From 87ae723b527bd8958cf45b47b23f42b28cc48b3d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Sep 2016 09:50:49 -0700 Subject: [PATCH 001/289] For JSX text, construct a single literal node `"foo bar"` instead of `"foo" + " " + "bar"`. --- src/compiler/transformers/jsx.ts | 55 +++++++------------ .../reference/tsxReactEmitWhitespace.js | 6 +- .../reference/tsxReactEmitWhitespace.symbols | 2 +- .../reference/tsxReactEmitWhitespace.types | 2 +- .../jsx/tsxReactEmitWhitespace.tsx | 2 +- 5 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 9e6aa507cce..354c1bcad7d 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -151,28 +151,29 @@ namespace ts { } } - function visitJsxText(node: JsxText) { - const text = getTextOfNode(node, /*includeTrivia*/ true); - let parts: Expression[]; + function visitJsxText(node: JsxText): StringLiteral | undefined { + const fixed = fixupWhitespaceAndDecodeEntities(getTextOfNode(node, /*includeTrivia*/ true)); + return fixed !== undefined && createLiteral(fixed); + } + + /** + * JSX trims whitespace at the end and beginning of lines, except that the + * start/end of a tag is considered a start/end of a line only if that line is + * on the same line as the closing tag. See examples in + * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + */ + function fixupWhitespaceAndDecodeEntities(text: string): string | undefined { + let acc: string | undefined; let firstNonWhitespace = 0; let lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in - // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx for (let i = 0; i < text.length; i++) { const c = text.charCodeAt(i); if (isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - const part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - if (!parts) { - parts = []; - } - - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(createLiteral(decodeEntities(part))); + const part = decodeEntities(text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); + acc = acc === undefined ? part : acc + " " + part; } firstNonWhitespace = -1; @@ -186,28 +187,12 @@ namespace ts { } if (firstNonWhitespace !== -1) { - const part = text.substr(firstNonWhitespace); - if (!parts) { - parts = []; - } - - // We do not escape the string here as that is handled by the printer - // when it emits the literal. We do, however, need to decode JSX entities. - parts.push(createLiteral(decodeEntities(part))); + const lastPart = decodeEntities(text.substr(firstNonWhitespace)); + return acc ? acc + lastPart : lastPart; } - - if (parts) { - return reduceLeft(parts, aggregateJsxTextParts); + else { + return acc; } - - return undefined; - } - - /** - * Aggregates two expressions by interpolating them with a whitespace literal. - */ - function aggregateJsxTextParts(left: Expression, right: Expression) { - return createAdd(createAdd(left, createLiteral(" ")), right); } /** diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.js b/tests/baselines/reference/tsxReactEmitWhitespace.js index dd69091569f..1588b53d8f4 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace.js @@ -41,7 +41,7 @@ var p = 0;
; -// Emit "foo" + ' ' + "bar" +// Emit "foo bar"
foo @@ -75,5 +75,5 @@ React.createElement("div", null, " 3 "); React.createElement("div", null, "3"); // Emit no args React.createElement("div", null); -// Emit "foo" + ' ' + "bar" -React.createElement("div", null, "foo" + " " + "bar"); +// Emit "foo bar" +React.createElement("div", null, "foo bar"); diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.symbols b/tests/baselines/reference/tsxReactEmitWhitespace.symbols index a0d8266faa0..4639e828b52 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.symbols +++ b/tests/baselines/reference/tsxReactEmitWhitespace.symbols @@ -79,7 +79,7 @@ var p = 0;
; >div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) -// Emit "foo" + ' ' + "bar" +// Emit "foo bar"
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.types b/tests/baselines/reference/tsxReactEmitWhitespace.types index 824aa5cfdae..ce6911f9874 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.types +++ b/tests/baselines/reference/tsxReactEmitWhitespace.types @@ -88,7 +88,7 @@ var p = 0;
; >div : any -// Emit "foo" + ' ' + "bar" +// Emit "foo bar"
>
foo bar
: JSX.Element >div : any diff --git a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx index 34fd158eab1..9977803e395 100644 --- a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx +++ b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx @@ -42,7 +42,7 @@ var p = 0;
; -// Emit "foo" + ' ' + "bar" +// Emit "foo bar"
foo From 9ae98d6a378805661f802974f3794ce5481f1529 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Sep 2016 12:49:58 -0700 Subject: [PATCH 002/289] Fix bug: return `undefined`, not `false` --- src/compiler/transformers/jsx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 354c1bcad7d..2a18adeda0e 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -153,7 +153,7 @@ namespace ts { function visitJsxText(node: JsxText): StringLiteral | undefined { const fixed = fixupWhitespaceAndDecodeEntities(getTextOfNode(node, /*includeTrivia*/ true)); - return fixed !== undefined && createLiteral(fixed); + return fixed === undefined ? undefined : createLiteral(fixed); } /** From aa322ea18ae247e63eec6e6ae9d828e61525c1a5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 9 Sep 2016 06:32:45 -0700 Subject: [PATCH 003/289] Add test with backslash --- tests/baselines/reference/tsxReactEmitWhitespace.js | 9 +++++++++ .../baselines/reference/tsxReactEmitWhitespace.symbols | 9 +++++++++ tests/baselines/reference/tsxReactEmitWhitespace.types | 10 ++++++++++ tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx | 7 +++++++ 4 files changed, 35 insertions(+) diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.js b/tests/baselines/reference/tsxReactEmitWhitespace.js index 1588b53d8f4..f8bdead81d2 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace.js @@ -50,6 +50,13 @@ var p = 0;
; +// Emit "hello\\ world" +
+ + hello\ + +world +
; //// [file.js] @@ -77,3 +84,5 @@ React.createElement("div", null, "3"); React.createElement("div", null); // Emit "foo bar" React.createElement("div", null, "foo bar"); +// Emit "hello\\ world" +React.createElement("div", null, "hello\\ world"); diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.symbols b/tests/baselines/reference/tsxReactEmitWhitespace.symbols index 4639e828b52..bb04dbf04b9 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.symbols +++ b/tests/baselines/reference/tsxReactEmitWhitespace.symbols @@ -90,4 +90,13 @@ var p = 0;
; >div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) +// Emit "hello\\ world" +
+>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) + + hello\ + +world +
; +>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.types b/tests/baselines/reference/tsxReactEmitWhitespace.types index ce6911f9874..25aed60f647 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.types +++ b/tests/baselines/reference/tsxReactEmitWhitespace.types @@ -100,4 +100,14 @@ var p = 0; ; >div : any +// Emit "hello\\ world" +
+>
hello\world
: JSX.Element +>div : any + + hello\ + +world +
; +>div : any diff --git a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx index 9977803e395..4853a504744 100644 --- a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx +++ b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx @@ -51,3 +51,10 @@ var p = 0; ; +// Emit "hello\\ world" +
+ + hello\ + +world +
; From 31669504b9e94e452b053c22d6d37834fd13ed34 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 9 Sep 2016 07:56:01 -0700 Subject: [PATCH 004/289] Comment code and remember to add a space before the last part --- src/compiler/transformers/jsx.ts | 43 ++++++++++++++----- .../reference/tsxReactEmitWhitespace.js | 7 +++ .../reference/tsxReactEmitWhitespace.symbols | 8 ++++ .../reference/tsxReactEmitWhitespace.types | 9 ++++ .../jsx/tsxReactEmitWhitespace.tsx | 5 +++ 5 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 2a18adeda0e..556c26c37f0 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -162,23 +162,39 @@ namespace ts { * on the same line as the closing tag. See examples in * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model + * + * An equivalent algorithm would be: + * - If there is only one line, return it. + * - If there is only whitespace (but multiple lines), return `undefined`. + * - Split the text into lines. + * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines. + * - Decode entities on each line (individually). + * - Remove empty lines and join the rest with " ". */ function fixupWhitespaceAndDecodeEntities(text: string): string | undefined { let acc: string | undefined; + // First non-whitespace character on this line. let firstNonWhitespace = 0; + // Last non-whitespace character on this line. let lastNonWhitespace = -1; + // These initial values are special because the first line is: + // firstNonWhitespace = 0 to indicate that we want leading whitsepace, + // but lastNonWhitespace = -1 as a special flag to indicate that we *don't* include the line if it's all whitespace. for (let i = 0; i < text.length; i++) { const c = text.charCodeAt(i); if (isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - const part = decodeEntities(text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); - acc = acc === undefined ? part : acc + " " + part; + // If we've seen any non-whitespace characters on this line, add the 'trim' of the line. + // (lastNonWhitespace === -1 is a special flag to detect whether the first line is all whitespace.) + if (firstNonWhitespace !== -1 && lastNonWhitespace !== -1) { + acc = addLineOfJsxText(acc, text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); } + // Reset firstNonWhitespace for the next line. + // Don't bother to reset lastNonWhitespace because we ignore it if firstNonWhitespace = -1. firstNonWhitespace = -1; } - else if (!isWhiteSpace(c)) { + else if (!isWhiteSpaceSingleLine(c)) { lastNonWhitespace = i; if (firstNonWhitespace === -1) { firstNonWhitespace = i; @@ -186,13 +202,18 @@ namespace ts { } } - if (firstNonWhitespace !== -1) { - const lastPart = decodeEntities(text.substr(firstNonWhitespace)); - return acc ? acc + lastPart : lastPart; - } - else { - return acc; - } + return firstNonWhitespace !== -1 + // Last line had a non-whitespace character. Emit the 'trimLeft', meaning keep trailing whitespace. + ? addLineOfJsxText(acc, text.substr(firstNonWhitespace)) + // Last line was all whitespace, so ignore it + : acc; + } + + function addLineOfJsxText(acc: string | undefined, trimmedLine: string): string { + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + const decoded = decodeEntities(trimmedLine); + return acc === undefined ? decoded : acc + " " + decoded; } /** diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.js b/tests/baselines/reference/tsxReactEmitWhitespace.js index f8bdead81d2..54839412567 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace.js @@ -57,6 +57,11 @@ var p = 0; world ; + +// Emit " a b c d " +
a + b c + d
; //// [file.js] @@ -86,3 +91,5 @@ React.createElement("div", null); React.createElement("div", null, "foo bar"); // Emit "hello\\ world" React.createElement("div", null, "hello\\ world"); +// Emit " a b c d " +React.createElement("div", null, " a b c d "); diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.symbols b/tests/baselines/reference/tsxReactEmitWhitespace.symbols index bb04dbf04b9..baac01227b6 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.symbols +++ b/tests/baselines/reference/tsxReactEmitWhitespace.symbols @@ -100,3 +100,11 @@ world ; >div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) +// Emit " a b c d " +
a +>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) + + b c + d
; +>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22)) + diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.types b/tests/baselines/reference/tsxReactEmitWhitespace.types index 25aed60f647..46ce9f305b4 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.types +++ b/tests/baselines/reference/tsxReactEmitWhitespace.types @@ -111,3 +111,12 @@ world ; >div : any +// Emit " a b c d " +
a +>
a b c d
: JSX.Element +>div : any + + b c + d
; +>div : any + diff --git a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx index 4853a504744..be677b37ff8 100644 --- a/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx +++ b/tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx @@ -58,3 +58,8 @@ var p = 0; world ; + +// Emit " a b c d " +
a + b c + d
; From 898a70df9704858431ec4e9cafde6c65559387aa Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 17 Sep 2016 11:11:49 +0900 Subject: [PATCH 005/289] change error message for assigning from object --- src/compiler/checker.ts | 6 ++- src/compiler/diagnosticMessages.json | 4 ++ ...ssigningFromObjecToAnythingElse.errors.txt | 38 +++++++++++++++++++ .../assigningFromObjecToAnythingElse.js | 18 +++++++++ .../reference/intTypeCheck.errors.txt | 36 ++++++++++++------ ...embersOfObjectAssignmentCompat2.errors.txt | 28 ++++++++------ ...mbersOfFunctionAssignmentCompat.errors.txt | 12 ++++-- ...mbersOfFunctionAssignmentCompat.errors.txt | 12 ++++-- ...serAutomaticSemicolonInsertion1.errors.txt | 12 ++++-- .../typeParametersShouldNotBeEqual.errors.txt | 2 + ...typeParametersShouldNotBeEqual2.errors.txt | 2 + ...typeParametersShouldNotBeEqual3.errors.txt | 4 ++ .../assigningFromObjecToAnythingElse.ts | 8 ++++ 13 files changed, 144 insertions(+), 38 deletions(-) create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js create mode 100644 tests/cases/compiler/assigningFromObjecToAnythingElse.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5aae3beb415..a952f5a7c95 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19,7 +19,7 @@ namespace ts { export function getSymbolId(symbol: Symbol): number { if (!symbol.id) { - symbol.id = nextSymbolId; + symbol.id = nextSymbolId; nextSymbolId++; } @@ -6365,7 +6365,7 @@ namespace ts { } function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { - const sourceType = typeToString(source); + const sourceType = typeToString(source); const targetType = typeToString(target); if ((globalStringType === source && stringType === target) || @@ -6501,6 +6501,8 @@ namespace ts { if (reportErrors) { if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); + } else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { + reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); } reportRelationError(headMessage, source, target); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0f3e90405a6..be4ee2fa07d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1959,6 +1959,10 @@ "category": "Error", "code": 2695 }, + "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?": { + "category": "Error", + "code": 2696 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt new file mode 100644 index 00000000000..2188474d9c9 --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'exec' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'charAt' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. + Property 'charAt' is missing in type 'Number'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'name' is missing in type 'Object'. + + +==== tests/cases/compiler/assigningFromObjecToAnythingElse.ts (4 errors) ==== + var x: Object; + var y: RegExp; + y = x; + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'exec' is missing in type 'Object'. + + var a: String = Object.create(""); + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'String'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'charAt' is missing in type 'Object'. + var c: String = Object.create(1); + ~ +!!! error TS2322: Type 'Number' is not assignable to type 'String'. +!!! error TS2322: Property 'charAt' is missing in type 'Number'. + + var w: Error = new Object(); + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'Error'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'name' is missing in type 'Object'. + \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js new file mode 100644 index 00000000000..ec6dc0c789d --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.js @@ -0,0 +1,18 @@ +//// [assigningFromObjecToAnythingElse.ts] +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); + + +//// [assigningFromObjecToAnythingElse.js] +var x; +var y; +y = x; +var a = Object.create(""); +var c = Object.create(1); +var w = new Object(); diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 2214c685956..f8b4fef7310 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -2,7 +2,8 @@ tests/cases/compiler/intTypeCheck.ts(35,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required. tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Object' is not assignable to type 'i1'. - Property 'p' is missing in type 'Object'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'p' is missing in type 'Object'. tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not assignable to type 'i1'. Property 'p' is missing in type 'Base'. @@ -15,7 +16,8 @@ tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' wit tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. Type '{}' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'. - Type 'Object' provides no match for the signature '(): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'. Type 'Base' provides no match for the signature '(): any' @@ -26,7 +28,8 @@ tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' wit tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'. - Type 'Object' provides no match for the signature 'new (): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'. Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'. @@ -43,7 +46,8 @@ tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' wit tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{}' is not assignable to type 'i5'. Property 'p' is missing in type '{}'. tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Object' is not assignable to type 'i5'. - Property 'p' is missing in type 'Object'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'p' is missing in type 'Object'. tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not assignable to type 'i5'. Property 'p' is missing in type 'Base'. @@ -56,7 +60,8 @@ tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' wit tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. Type '{}' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'. - Type 'Object' provides no match for the signature '(): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): any' tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword. tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'. Type 'Base' provides no match for the signature '(): any' @@ -69,7 +74,8 @@ tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' wit tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. - Type 'Object' provides no match for the signature 'new (): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'. Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. @@ -193,7 +199,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj2: i1 = new Object(); ~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i1'. -!!! error TS2322: Property 'p' is missing in type 'Object'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'p' is missing in type 'Object'. var obj3: i1 = new obj0; ~~~~~~~~ !!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -229,7 +236,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj13: i2 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i2'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): any' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): any' var obj14: i2 = new obj11; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. @@ -262,7 +270,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj24: i3 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i3'. -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var obj25: i3 = new obj22; var obj26: i3 = new Base; ~~~~~ @@ -320,7 +329,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj46: i5 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i5'. -!!! error TS2322: Property 'p' is missing in type 'Object'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'p' is missing in type 'Object'. var obj47: i5 = new obj44; ~~~~~~~~~ !!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. @@ -356,7 +366,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj57: i6 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i6'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): any' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): any' var obj58: i6 = new obj55; ~~~~~~~~~ !!! error TS2350: Only a void function can be called with the 'new' keyword. @@ -392,7 +403,8 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj68: i7 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i7'. -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt index a88796b390e..3e27b22240e 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.errors.txt @@ -3,17 +3,19 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC Type '() => number' is not assignable to type '() => string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. - Types of property 'toString' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Types of property 'toString' are incompatible. + Type '() => string' is not assignable to type '() => number'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(14,1): error TS2322: Type 'C' is not assignable to type 'Object'. Types of property 'toString' are incompatible. Type '() => number' is not assignable to type '() => string'. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(15,1): error TS2322: Type 'Object' is not assignable to type 'C'. - Types of property 'toString' are incompatible. - Type '() => string' is not assignable to type '() => number'. - Type 'string' is not assignable to type 'number'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Types of property 'toString' are incompatible. + Type '() => string' is not assignable to type '() => number'. + Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentCompat2.ts(20,1): error TS2322: Type '{ toString: () => void; }' is not assignable to type 'Object'. Types of property 'toString' are incompatible. Type '() => void' is not assignable to type '() => string'. @@ -36,9 +38,10 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC i = o; // error ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => string' is not assignable to type '() => number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Types of property 'toString' are incompatible. +!!! error TS2322: Type '() => string' is not assignable to type '() => number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. class C { toString(): number { return 1; } @@ -53,9 +56,10 @@ tests/cases/conformance/types/members/objectTypeHidingMembersOfObjectAssignmentC c = o; // error ~ !!! error TS2322: Type 'Object' is not assignable to type 'C'. -!!! error TS2322: Types of property 'toString' are incompatible. -!!! error TS2322: Type '() => string' is not assignable to type '() => number'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Types of property 'toString' are incompatible. +!!! error TS2322: Type '() => string' is not assignable to type '() => number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var a = { toString: () => { } diff --git a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index e296f2113fb..caeca11edf8 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. - Type 'Object' provides no match for the signature '(): void' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): void' tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. - Type 'Object' provides no match for the signature '(): void' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): void' ==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -15,7 +17,8 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf i = f; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' var a: { (): void @@ -24,4 +27,5 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf a = f; ~ !!! error TS2322: Type 'Object' is not assignable to type '() => void'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file diff --git a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt index 227ccc99603..ad0e801e435 100644 --- a/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt +++ b/tests/baselines/reference/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. - Type 'Object' provides no match for the signature 'new (): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature 'new (): any' tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'. - Type 'Object' provides no match for the signature 'new (): any' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature 'new (): any' ==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ==== @@ -15,7 +17,8 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb i = f; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' var a: { new(): any @@ -24,4 +27,5 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb a = f; ~ !!! error TS2322: Type 'Object' is not assignable to type 'new () => any'. -!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' \ No newline at end of file +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any' \ No newline at end of file diff --git a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt index 9ffdc614ab1..a2bbb98fbf4 100644 --- a/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt +++ b/tests/baselines/reference/parserAutomaticSemicolonInsertion1.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'. - Type 'Object' provides no match for the signature '(): void' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): void' tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'. - Type 'Object' provides no match for the signature '(): void' + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Type 'Object' provides no match for the signature '(): void' ==== tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAutomaticSemicolonInsertion1.ts (2 errors) ==== @@ -15,7 +17,8 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut i = o; ~ !!! error TS2322: Type 'Object' is not assignable to type 'I'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' var a: { (): void @@ -24,5 +27,6 @@ tests/cases/conformance/parser/ecmascript5/AutomaticSemicolonInsertion/parserAut a = o; ~ !!! error TS2322: Type 'Object' is not assignable to type '() => void'. -!!! error TS2322: Type 'Object' provides no match for the signature '(): void' +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Type 'Object' provides no match for the signature '(): void' \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt index 6f5e2766c8c..b5c9fd60206 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual.ts (2 errors) ==== @@ -12,6 +13,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual.ts(5,5): error TS2322: Type x = z; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt index 27ac1e07eab..d452b997980 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual2.errors.txt @@ -7,6 +7,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(7,5): error TS2322: Type tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(8,5): error TS2322: Type 'U' is not assignable to type 'V'. Type 'Date' is not assignable to type 'V'. tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual2.ts (6 errors) ==== @@ -34,6 +35,7 @@ tests/cases/compiler/typeParametersShouldNotBeEqual2.ts(9,5): error TS2322: Type x = zz; // Error ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? zz = x; // Ok } \ No newline at end of file diff --git a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt index 0169f57c06f..816db440a4c 100644 --- a/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt +++ b/tests/baselines/reference/typeParametersShouldNotBeEqual3.errors.txt @@ -1,6 +1,8 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(4,5): error TS2322: Type 'U' is not assignable to type 'T'. Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'T'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? ==== tests/cases/compiler/typeParametersShouldNotBeEqual3.ts (2 errors) ==== @@ -11,9 +13,11 @@ tests/cases/compiler/typeParametersShouldNotBeEqual3.ts(5,5): error TS2322: Type ~ !!! error TS2322: Type 'U' is not assignable to type 'T'. !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? x = z; // Ok ~ !!! error TS2322: Type 'Object' is not assignable to type 'T'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? z = x; // Ok } \ No newline at end of file diff --git a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts new file mode 100644 index 00000000000..ebf1a0a8763 --- /dev/null +++ b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts @@ -0,0 +1,8 @@ +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); From e65cdc3953eaf766aa691655dafbe8e845a86c2d Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 24 Sep 2016 10:18:49 +0900 Subject: [PATCH 006/289] change error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../parserExportAssignment5.errors.txt | 4 ++-- .../parserExportAssignment9.errors.txt | 16 ++++++++++++++++ .../reference/parserExportAssignment9.js | 18 ++++++++++++++++++ .../parserExportAssignment9.ts | 7 +++++++ 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/parserExportAssignment9.errors.txt create mode 100644 tests/baselines/reference/parserExportAssignment9.js create mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 903d18e2331..74b9330c1b7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17650,7 +17650,7 @@ namespace ts { const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { - error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); return; } // Grammar checking diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index be4ee2fa07d..29bea6c3d33 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -195,7 +195,7 @@ "category": "Error", "code": 1062 }, - "An export assignment cannot be used in a namespace.": { + "A default export can only be used in an ECMAScript-style module.": { "category": "Error", "code": 1063 }, diff --git a/tests/baselines/reference/parserExportAssignment5.errors.txt b/tests/baselines/reference/parserExportAssignment5.errors.txt index 7b07e1d225f..adef4b88f38 100644 --- a/tests/baselines/reference/parserExportAssignment5.errors.txt +++ b/tests/baselines/reference/parserExportAssignment5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: An export assignment cannot be used in a namespace. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (1 errors) ==== module M { export = A; ~~~~~~~~~~~ -!!! error TS1063: An export assignment cannot be used in a namespace. +!!! error TS1063: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt new file mode 100644 index 00000000000..9fc978537a6 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1063: A default export can only be used in an ECMAScript-style module. + + +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== + namespace Foo { + export default foo; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1063: A default export can only be used in an ECMAScript-style module. + } + + module Bar { + export default bar; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1063: A default export can only be used in an ECMAScript-style module. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.js b/tests/baselines/reference/parserExportAssignment9.js new file mode 100644 index 00000000000..2600ae629e9 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment9.js @@ -0,0 +1,18 @@ +//// [parserExportAssignment9.ts] +namespace Foo { + export default foo; +} + +module Bar { + export default bar; +} + +//// [parserExportAssignment9.js] +var Foo; +(function (Foo) { + export default foo; +})(Foo || (Foo = {})); +var Bar; +(function (Bar) { + export default bar; +})(Bar || (Bar = {})); diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts new file mode 100644 index 00000000000..dc3aad85335 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts @@ -0,0 +1,7 @@ +namespace Foo { + export default foo; +} + +module Bar { + export default bar; +} \ No newline at end of file From 83acef7309bc862780ed5d47d9a5df5656c36621 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 24 Sep 2016 10:48:57 +0900 Subject: [PATCH 007/289] fix linting error --- src/compiler/checker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 74b9330c1b7..2872f728fd5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19,7 +19,7 @@ namespace ts { export function getSymbolId(symbol: Symbol): number { if (!symbol.id) { - symbol.id = nextSymbolId; + symbol.id = nextSymbolId; nextSymbolId++; } @@ -6367,7 +6367,7 @@ namespace ts { } function tryElaborateErrorsForPrimitivesAndObjects(source: Type, target: Type) { - const sourceType = typeToString(source); + const sourceType = typeToString(source); const targetType = typeToString(target); if ((globalStringType === source && stringType === target) || @@ -6503,7 +6503,8 @@ namespace ts { if (reportErrors) { if (source.flags & TypeFlags.ObjectType && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); - } else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { + } + else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); } else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { From 723ffab8df671a7960bf05e2711f43f9de2398a6 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 28 Sep 2016 21:50:33 +0100 Subject: [PATCH 008/289] Improve Array.prototype.slice typing --- src/lib/es5.d.ts | 3 ++- tests/baselines/reference/arraySlice.js | 8 ++++++++ tests/baselines/reference/arraySlice.symbols | 9 +++++++++ tests/baselines/reference/arraySlice.types | 12 +++++++++++ tests/baselines/reference/invalidSplice.types | 4 ++-- ...ymousTypeNotReferencingTypeParameter.types | 20 +++++++++---------- tests/cases/compiler/arraySlice.ts | 2 ++ 7 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 tests/baselines/reference/arraySlice.js create mode 100644 tests/baselines/reference/arraySlice.symbols create mode 100644 tests/baselines/reference/arraySlice.types create mode 100644 tests/cases/compiler/arraySlice.ts diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index ce719668acf..8a9eeaba57c 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1156,8 +1156,9 @@ interface Array { /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. */ - splice(start: number): T[]; + splice(start: number, deleteCount?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. diff --git a/tests/baselines/reference/arraySlice.js b/tests/baselines/reference/arraySlice.js new file mode 100644 index 00000000000..a5e4ba1546e --- /dev/null +++ b/tests/baselines/reference/arraySlice.js @@ -0,0 +1,8 @@ +//// [arraySlice.ts] +var arr: string[] | number[]; +arr.splice(1, 1); + + +//// [arraySlice.js] +var arr; +arr.splice(1, 1); diff --git a/tests/baselines/reference/arraySlice.symbols b/tests/baselines/reference/arraySlice.symbols new file mode 100644 index 00000000000..3b6545f9349 --- /dev/null +++ b/tests/baselines/reference/arraySlice.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/arraySlice.ts === +var arr: string[] | number[]; +>arr : Symbol(arr, Decl(arraySlice.ts, 0, 3)) + +arr.splice(1, 1); +>arr.splice : Symbol(splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>arr : Symbol(arr, Decl(arraySlice.ts, 0, 3)) +>splice : Symbol(splice, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/arraySlice.types b/tests/baselines/reference/arraySlice.types new file mode 100644 index 00000000000..d1ee482ccaa --- /dev/null +++ b/tests/baselines/reference/arraySlice.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/arraySlice.ts === +var arr: string[] | number[]; +>arr : string[] | number[] + +arr.splice(1, 1); +>arr.splice(1, 1) : string[] | number[] +>arr.splice : { (start: number, deleteCount?: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; } +>arr : string[] | number[] +>splice : { (start: number, deleteCount?: number): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; } | { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; } +>1 : 1 +>1 : 1 + diff --git a/tests/baselines/reference/invalidSplice.types b/tests/baselines/reference/invalidSplice.types index 876846d3da9..9ff59021725 100644 --- a/tests/baselines/reference/invalidSplice.types +++ b/tests/baselines/reference/invalidSplice.types @@ -2,9 +2,9 @@ var arr = [].splice(0,3,4,5); >arr : any[] >[].splice(0,3,4,5) : any[] ->[].splice : { (start: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } +>[].splice : { (start: number, deleteCount?: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } >[] : undefined[] ->splice : { (start: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } +>splice : { (start: number, deleteCount?: number): any[]; (start: number, deleteCount: number, ...items: any[]): any[]; } >0 : 0 >3 : 3 >4 : 4 diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types index f2bd83674cd..127a8d930c5 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -364,9 +364,9 @@ class ListWrapper { >value : T >T : T >list.splice(index, 0, value) : T[] ->list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list.splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >list : T[] ->splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >index : number >0 : 0 >value : T @@ -389,9 +389,9 @@ class ListWrapper { list.splice(index, 1); >list.splice(index, 1) : T[] ->list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list.splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >list : T[] ->splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >index : number >1 : 1 @@ -431,9 +431,9 @@ class ListWrapper { list.splice(index, 1); >list.splice(index, 1) : T[] ->list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list.splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >list : T[] ->splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >index : number >1 : 1 } @@ -464,9 +464,9 @@ class ListWrapper { list.splice(index, 1); >list.splice(index, 1) : T[] ->list.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>list.splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >list : T[] ->splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >index : number >1 : 1 @@ -603,9 +603,9 @@ class ListWrapper { >length : number >T : T >l.splice(from, length) : T[] ->l.splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>l.splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >l : T[] ->splice : { (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } +>splice : { (start: number, deleteCount?: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; } >from : number >length : number diff --git a/tests/cases/compiler/arraySlice.ts b/tests/cases/compiler/arraySlice.ts new file mode 100644 index 00000000000..d2c5c974a23 --- /dev/null +++ b/tests/cases/compiler/arraySlice.ts @@ -0,0 +1,2 @@ +var arr: string[] | number[]; +arr.splice(1, 1); From 1438f9a015b4451d289cc9bee2a44d1192b24804 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 11 Oct 2016 14:09:21 -0700 Subject: [PATCH 009/289] Codefixes for implement interface and change extends to implements. --- .../codefixes/changeExtendsToImplementsFix.ts | 33 +++ src/services/codefixes/fixes.ts | 4 +- src/services/codefixes/interfaceFixes.ts | 268 ++++++++++++++++++ .../fourslash/changeExtendsToImplementsFS1.ts | 6 + .../fourslash/changeExtendsToImplementsFS2.ts | 6 + .../fourslash/unImplementedInterface1.ts | 18 ++ .../fourslash/unImplementedInterface10.ts | 18 ++ .../fourslash/unImplementedInterface11.ts | 19 ++ .../fourslash/unImplementedInterface12.ts | 19 ++ .../fourslash/unImplementedInterface13.ts | 19 ++ .../fourslash/unImplementedInterface14.ts | 16 ++ .../fourslash/unImplementedInterface15.ts | 15 + .../fourslash/unImplementedInterface16.ts | 12 + .../fourslash/unImplementedInterface17.ts | 11 + .../fourslash/unImplementedInterface18.ts | 12 + .../fourslash/unImplementedInterface19.ts | 13 + .../fourslash/unImplementedInterface2.ts | 16 ++ .../fourslash/unImplementedInterface20.ts | 14 + .../fourslash/unImplementedInterface21.ts | 14 + .../fourslash/unImplementedInterface22.ts | 12 + .../fourslash/unImplementedInterface23.ts | 14 + .../fourslash/unImplementedInterface24.ts | 12 + .../fourslash/unImplementedInterface25.ts | 14 + .../fourslash/unImplementedInterface26.ts | 14 + .../fourslash/unImplementedInterface27.ts | 16 ++ .../fourslash/unImplementedInterface28.ts | 21 ++ .../fourslash/unImplementedInterface29.ts | 14 + .../fourslash/unImplementedInterface3.ts | 16 ++ .../fourslash/unImplementedInterface30.ts | 18 ++ .../fourslash/unImplementedInterface31.ts | 18 ++ .../fourslash/unImplementedInterface32.ts | 18 ++ .../fourslash/unImplementedInterface33.ts | 18 ++ .../fourslash/unImplementedInterface34.ts | 14 + .../fourslash/unImplementedInterface35.ts | 16 ++ .../fourslash/unImplementedInterface36.ts | 20 ++ .../fourslash/unImplementedInterface37.ts | 20 ++ .../fourslash/unImplementedInterface38.ts | 11 + .../fourslash/unImplementedInterface39.ts | 18 ++ .../fourslash/unImplementedInterface4.ts | 18 ++ .../fourslash/unImplementedInterface5.ts | 18 ++ .../fourslash/unImplementedInterface6.ts | 15 + .../fourslash/unImplementedInterface7.ts | 15 + .../fourslash/unImplementedInterface8.ts | 15 + .../fourslash/unImplementedInterface9.ts | 17 ++ 44 files changed, 934 insertions(+), 1 deletion(-) create mode 100644 src/services/codefixes/changeExtendsToImplementsFix.ts create mode 100644 src/services/codefixes/interfaceFixes.ts create mode 100644 tests/cases/fourslash/changeExtendsToImplementsFS1.ts create mode 100644 tests/cases/fourslash/changeExtendsToImplementsFS2.ts create mode 100644 tests/cases/fourslash/unImplementedInterface1.ts create mode 100644 tests/cases/fourslash/unImplementedInterface10.ts create mode 100644 tests/cases/fourslash/unImplementedInterface11.ts create mode 100644 tests/cases/fourslash/unImplementedInterface12.ts create mode 100644 tests/cases/fourslash/unImplementedInterface13.ts create mode 100644 tests/cases/fourslash/unImplementedInterface14.ts create mode 100644 tests/cases/fourslash/unImplementedInterface15.ts create mode 100644 tests/cases/fourslash/unImplementedInterface16.ts create mode 100644 tests/cases/fourslash/unImplementedInterface17.ts create mode 100644 tests/cases/fourslash/unImplementedInterface18.ts create mode 100644 tests/cases/fourslash/unImplementedInterface19.ts create mode 100644 tests/cases/fourslash/unImplementedInterface2.ts create mode 100644 tests/cases/fourslash/unImplementedInterface20.ts create mode 100644 tests/cases/fourslash/unImplementedInterface21.ts create mode 100644 tests/cases/fourslash/unImplementedInterface22.ts create mode 100644 tests/cases/fourslash/unImplementedInterface23.ts create mode 100644 tests/cases/fourslash/unImplementedInterface24.ts create mode 100644 tests/cases/fourslash/unImplementedInterface25.ts create mode 100644 tests/cases/fourslash/unImplementedInterface26.ts create mode 100644 tests/cases/fourslash/unImplementedInterface27.ts create mode 100644 tests/cases/fourslash/unImplementedInterface28.ts create mode 100644 tests/cases/fourslash/unImplementedInterface29.ts create mode 100644 tests/cases/fourslash/unImplementedInterface3.ts create mode 100644 tests/cases/fourslash/unImplementedInterface30.ts create mode 100644 tests/cases/fourslash/unImplementedInterface31.ts create mode 100644 tests/cases/fourslash/unImplementedInterface32.ts create mode 100644 tests/cases/fourslash/unImplementedInterface33.ts create mode 100644 tests/cases/fourslash/unImplementedInterface34.ts create mode 100644 tests/cases/fourslash/unImplementedInterface35.ts create mode 100644 tests/cases/fourslash/unImplementedInterface36.ts create mode 100644 tests/cases/fourslash/unImplementedInterface37.ts create mode 100644 tests/cases/fourslash/unImplementedInterface38.ts create mode 100644 tests/cases/fourslash/unImplementedInterface39.ts create mode 100644 tests/cases/fourslash/unImplementedInterface4.ts create mode 100644 tests/cases/fourslash/unImplementedInterface5.ts create mode 100644 tests/cases/fourslash/unImplementedInterface6.ts create mode 100644 tests/cases/fourslash/unImplementedInterface7.ts create mode 100644 tests/cases/fourslash/unImplementedInterface8.ts create mode 100644 tests/cases/fourslash/unImplementedInterface9.ts diff --git a/src/services/codefixes/changeExtendsToImplementsFix.ts b/src/services/codefixes/changeExtendsToImplementsFix.ts new file mode 100644 index 00000000000..fd91ba1c8be --- /dev/null +++ b/src/services/codefixes/changeExtendsToImplementsFix.ts @@ -0,0 +1,33 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const textChanges: TextChange[] = []; + + if (token.kind === SyntaxKind.Identifier && token.parent.parent.kind === SyntaxKind.HeritageClause) { + const children = (token.parent.parent).getChildren(); + ts.forEach(children, child => { + if (child.kind === SyntaxKind.ExtendsKeyword) { + textChanges.push({ newText: " implements", span: { start: child.pos, length: child.end - child.pos } }); + } + }); + } + + if (textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + + return undefined; + } + }); +} diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index d64a99ca1b9..b1fdb9d43da 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -1 +1,3 @@ -/// +/// +/// +/// diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts new file mode 100644 index 00000000000..49d69497333 --- /dev/null +++ b/src/services/codefixes/interfaceFixes.ts @@ -0,0 +1,268 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Type_0_is_not_assignable_to_type_1.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); + let textChanges: TextChange[] = []; + + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.VariableDeclaration) { + const variableDeclaration = token.parent; + const membersAndStartPosObject = getMembersAndStartPosFromReference(variableDeclaration); + const variableMembers = membersAndStartPosObject.members; + const trackingAddedMembers: string[] = []; + const startPos: number = membersAndStartPosObject.startPos; + + if (variableDeclaration.type.kind === SyntaxKind.TypeReference) { + textChanges = textChanges.concat(getChanges(variableDeclaration.type, variableMembers, startPos, checker, /*reference*/ true, trackingAddedMembers, context.newLineCharacter)); + } + else if (variableDeclaration.type.kind === SyntaxKind.UnionType) { + const types = (variableDeclaration.type).types; + ts.forEach(types, t => { + textChanges = textChanges.concat(getChanges(t, variableMembers, startPos, checker, /*reference*/ true, trackingAddedMembers, context.newLineCharacter)); + }); + } + } + + if (textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_reference), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + + return undefined; + } + }); + + registerCodeFix({ + errorCodes: [Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); + + let textChanges: TextChange[] = []; + + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.ClassDeclaration) { + const classDeclaration = token.parent; + const startPos: number = classDeclaration.members.pos; + const classMembers = getClassMembers(classDeclaration); + const trackingAddedMembers: string[] = []; + const interfaceClauses = ts.getClassImplementsHeritageClauseElements(classDeclaration); + + for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { + textChanges = textChanges.concat(getChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); + } + } + + if (textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + + return undefined; + } + }); + + registerCodeFix({ + errorCodes: [Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); + + let textChanges: TextChange[] = []; + + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.ClassDeclaration) { + const classDeclaration = token.parent; + const startPos = classDeclaration.members.pos; + const classMembers = getClassMembers(classDeclaration); + const trackingAddedMembers: string[] = []; + const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); + textChanges = textChanges.concat(getChanges(extendsClause, classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); + } + + if (textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + + return undefined; + } + }); + + function getChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { + const type = checker.getTypeAtLocation(interfaceClause); + const changesArray: TextChange[] = []; + + if (type && type.symbol && type.symbol.declarations) { + const interfaceMembers = getMembers(type.symbol.declarations[0], checker); + for (let j = 0; interfaceMembers && j < interfaceMembers.length; j++) { + if (interfaceMembers[j].name && existingMembers.indexOf(interfaceMembers[j].name.getText()) === -1) { + if (interfaceMembers[j].kind === SyntaxKind.PropertySignature) { + const interfaceProperty = interfaceMembers[j]; + if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { + let propertyText = ""; + if (reference) { + propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; + } + else { + propertyText = interfaceProperty.getText(); + const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; + propertyText += stringToAdd; + } + changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceProperty.name.getText()); + } + } + else if (interfaceMembers[j].kind === SyntaxKind.MethodSignature || interfaceMembers[j].kind === SyntaxKind.MethodDeclaration) { + const interfaceMethod = interfaceMembers[j]; + handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); + } + } + } + } + + if (reference && existingMembers.length === 0 && changesArray.length > 0) { + let lastValue = changesArray[changesArray.length - 1].newText; + lastValue = `${lastValue.substr(0, lastValue.length - (newLineCharacter.length + 1))} ${newLineCharacter}`; + changesArray[changesArray.length - 1].newText = lastValue; + } + + return changesArray; + } + + function getMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { + const clauses = getInterfaceBaseTypeNodes(declaration); + let result: TypeElement[] = []; + for (let i = 0; clauses && i < clauses.length; i++) { + const type = checker.getTypeAtLocation(clauses[i]); + if (type && type.symbol && type.symbol.declarations) { + result = result.concat(getMembers(type.symbol.declarations[0], checker)); + } + } + + if (declaration.members) { + result = result.concat(declaration.members); + } + + return result; + } + + function getClassMembers(classDeclaration: ClassDeclaration): string[] { + const classMembers: string[] = []; + for (let i = 0; classDeclaration.members && i < classDeclaration.members.length; i++) { + if (classDeclaration.members[i].name) { + classMembers.push(classDeclaration.members[i].name.getText()); + } + } + return classMembers; + } + + function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { + const children = variableDeclaration.getChildren(); + const variableMembers: string[] = []; + let startPos = 0; + + ts.forEach(children, child => { + if (child.kind === SyntaxKind.ObjectLiteralExpression) { + const properties = (child).properties; + if (properties) { + startPos = properties.pos; + } + for (let j = 0; properties && j < properties.length; j++) { + if (properties[j].name) { + variableMembers.push(properties[j].name.getText()); + } + } + } + }); + + return { startPos: startPos, members: variableMembers }; + } + + function getDefaultValue(kind: SyntaxKind): string { + switch (kind) { + case SyntaxKind.StringKeyword: + return '""'; + case SyntaxKind.BooleanKeyword: + return "false"; + case SyntaxKind.NumberKeyword: + return "0"; + default: + return "null"; + } + } + + function handleMethods(interfaceMethod: MethodSignature, startPos: number, isReference: boolean, trackingAddedMembers: string[], textChanges: TextChange[], newLineCharacter: string) { + const methodBody = "throw new Error('Method not Implemented');"; + + if (trackingAddedMembers.indexOf(interfaceMethod.name.getText())) { + const methodName = interfaceMethod.name.getText(); + const typeParameterArray: string[] = []; + + for (let i = 0; interfaceMethod.typeParameters && i < interfaceMethod.typeParameters.length; i++) { + typeParameterArray.push(interfaceMethod.typeParameters[i].getText()); + } + + const parameterArray: string[] = []; + for (let j = 0; interfaceMethod.parameters && j < interfaceMethod.parameters.length; j++) { + parameterArray.push(interfaceMethod.parameters[j].getText()); + } + + let methodText = methodName; + if (typeParameterArray.length > 0) { + methodText += "<"; + } + + for (let k = 0; k < typeParameterArray.length; k++) { + methodText += typeParameterArray[k]; + if (k !== typeParameterArray.length - 1) { + methodText += ","; + } + } + + if (typeParameterArray.length > 0) { + methodText += ">"; + } + + methodText += "("; + for (let k = 0; k < parameterArray.length; k++) { + methodText += parameterArray[k]; + if (k !== parameterArray.length - 1) { + methodText += ","; + } + } + + methodText += `)`; + if (interfaceMethod.type) { + methodText += ":" + interfaceMethod.type.getText(); + } + + methodText += `{${newLineCharacter}${methodBody}${newLineCharacter}`; + methodText = isReference ? methodText.concat(`},${newLineCharacter}`) : methodText.concat(`}${newLineCharacter}`); + + textChanges.push({ newText: methodText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceMethod.name.getText()); + } + } +} diff --git a/tests/cases/fourslash/changeExtendsToImplementsFS1.ts b/tests/cases/fourslash/changeExtendsToImplementsFS1.ts new file mode 100644 index 00000000000..a5b9a6375b6 --- /dev/null +++ b/tests/cases/fourslash/changeExtendsToImplementsFS1.ts @@ -0,0 +1,6 @@ +/// + +//// interface I1 {} +//// [|class c1 extends I1|]{} + +verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/changeExtendsToImplementsFS2.ts b/tests/cases/fourslash/changeExtendsToImplementsFS2.ts new file mode 100644 index 00000000000..b63ab3032eb --- /dev/null +++ b/tests/cases/fourslash/changeExtendsToImplementsFS2.ts @@ -0,0 +1,6 @@ +/// + +////interface I1 {} +////[|class c1 extends I1|]{} + +verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface1.ts b/tests/cases/fourslash/unImplementedInterface1.ts new file mode 100644 index 00000000000..b07db08f12a --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface1.ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1(); +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface10.ts b/tests/cases/fourslash/unImplementedInterface10.ts new file mode 100644 index 00000000000..aa61cbc1836 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface10.ts @@ -0,0 +1,18 @@ +/// + +//// interface I1 { +//// f1() +//// } +//// +//// interface I2 extends I1 { +//// +//// } +//// +//// +//// class C1 implements I2 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface11.ts b/tests/cases/fourslash/unImplementedInterface11.ts new file mode 100644 index 00000000000..3c819f6b56e --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface11.ts @@ -0,0 +1,19 @@ +/// + +//// interface I1 { +//// +//// } +//// +//// interface I2 extends I1 { +//// f1(); +//// } +//// +//// interface I3 extends I2 {} +//// +//// class C1 implements I3 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface12.ts b/tests/cases/fourslash/unImplementedInterface12.ts new file mode 100644 index 00000000000..4e9e428fd6d --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface12.ts @@ -0,0 +1,19 @@ +/// + +//// interface I1 { +//// +//// } +//// +//// interface I2 { +//// f1(); +//// } +//// +//// interface I3 extends I2, I1 {} +//// +//// class C1 implements I3 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface13.ts b/tests/cases/fourslash/unImplementedInterface13.ts new file mode 100644 index 00000000000..fdb0fa1230c --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface13.ts @@ -0,0 +1,19 @@ +/// + +//// interface I1 { +//// f1(); +//// } +//// +//// interface I2 { +//// f1(); +//// } +//// +//// interface I3 extends I2, I1 {} +//// +//// class C1 implements I3 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface14.ts b/tests/cases/fourslash/unImplementedInterface14.ts new file mode 100644 index 00000000000..ad55fef3cce --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface14.ts @@ -0,0 +1,16 @@ +/// + +//// interface I1 { +//// f1(); +//// f2(); +//// } +//// +//// +//// var x: I1 ={[| +//// |]f2() {} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +}, +`); diff --git a/tests/cases/fourslash/unImplementedInterface15.ts b/tests/cases/fourslash/unImplementedInterface15.ts new file mode 100644 index 00000000000..e68f7171ee5 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface15.ts @@ -0,0 +1,15 @@ +/// + +//// interface I1 { +//// f1(); +//// } +//// +//// var x: I1 = {[| +//// +//// |]} + +verify.codeFixAtPosition(` +f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface16.ts b/tests/cases/fourslash/unImplementedInterface16.ts new file mode 100644 index 00000000000..ca992b1eb1e --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface16.ts @@ -0,0 +1,12 @@ +/// + +//// interface I1 { +//// x:string; +//// } +//// +//// +//// var x: I1 ={[| +//// |]} + +verify.codeFixAtPosition(`x : "" +`); diff --git a/tests/cases/fourslash/unImplementedInterface17.ts b/tests/cases/fourslash/unImplementedInterface17.ts new file mode 100644 index 00000000000..e909b60f588 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface17.ts @@ -0,0 +1,11 @@ +/// + +//// interface I1 { +//// x:number; +//// } +//// +//// var x: I1 ={[| +//// |]} + +verify.codeFixAtPosition(`x : 0 +`); diff --git a/tests/cases/fourslash/unImplementedInterface18.ts b/tests/cases/fourslash/unImplementedInterface18.ts new file mode 100644 index 00000000000..9e0f9888bf3 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface18.ts @@ -0,0 +1,12 @@ +/// + +//// interface I1 { +//// x:boolean; +//// } +//// +//// var x: I1 ={[| +//// +//// |]} + +verify.codeFixAtPosition(`x : false +`); diff --git a/tests/cases/fourslash/unImplementedInterface19.ts b/tests/cases/fourslash/unImplementedInterface19.ts new file mode 100644 index 00000000000..de484c282d8 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface19.ts @@ -0,0 +1,13 @@ +/// + +//// interface I1 { +//// x:string; +//// f1(); +//// } +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : "", +`); diff --git a/tests/cases/fourslash/unImplementedInterface2.ts b/tests/cases/fourslash/unImplementedInterface2.ts new file mode 100644 index 00000000000..394c54d4687 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface2.ts @@ -0,0 +1,16 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// x: number; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`x: number; +`); diff --git a/tests/cases/fourslash/unImplementedInterface20.ts b/tests/cases/fourslash/unImplementedInterface20.ts new file mode 100644 index 00000000000..56a707d21ba --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface20.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x:number; +//// f1(); +//// } +//// +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : 0, +`); diff --git a/tests/cases/fourslash/unImplementedInterface21.ts b/tests/cases/fourslash/unImplementedInterface21.ts new file mode 100644 index 00000000000..867c697e595 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface21.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x:boolean; +//// f1(); +//// } +//// +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : false, +`); diff --git a/tests/cases/fourslash/unImplementedInterface22.ts b/tests/cases/fourslash/unImplementedInterface22.ts new file mode 100644 index 00000000000..8a51577261f --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface22.ts @@ -0,0 +1,12 @@ +/// + +//// interface I1 { +//// x:[string]; +//// } +//// +//// +//// var x: I1 ={[| +//// |]} + +verify.codeFixAtPosition(`x : null +`); diff --git a/tests/cases/fourslash/unImplementedInterface23.ts b/tests/cases/fourslash/unImplementedInterface23.ts new file mode 100644 index 00000000000..8d00689a446 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface23.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x:[string]; +//// f1(); +//// } +//// +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : null, +`); diff --git a/tests/cases/fourslash/unImplementedInterface24.ts b/tests/cases/fourslash/unImplementedInterface24.ts new file mode 100644 index 00000000000..c206789b7f2 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface24.ts @@ -0,0 +1,12 @@ +/// + +//// interface I1 { +//// x:Array; +//// } +//// +//// +//// var x: I1 ={[| +//// |]} + +verify.codeFixAtPosition(`x : null +`); diff --git a/tests/cases/fourslash/unImplementedInterface25.ts b/tests/cases/fourslash/unImplementedInterface25.ts new file mode 100644 index 00000000000..6b2b809efaa --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface25.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x:Array; +//// f1(); +//// } +//// +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : null, +`); diff --git a/tests/cases/fourslash/unImplementedInterface26.ts b/tests/cases/fourslash/unImplementedInterface26.ts new file mode 100644 index 00000000000..a7136f0e70f --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface26.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x:T; +//// } +//// +//// class T {} +//// +//// +//// var x: I1 ={[| +//// |]} + +verify.codeFixAtPosition(`x : null +`); diff --git a/tests/cases/fourslash/unImplementedInterface27.ts b/tests/cases/fourslash/unImplementedInterface27.ts new file mode 100644 index 00000000000..fc12cb57377 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface27.ts @@ -0,0 +1,16 @@ +/// + +//// interface I1 { +//// x:T; +//// f1(); +//// } +//// +//// class T {} +//// +//// +//// var x: I1 ={[| +//// |]f1(){} +//// } + +verify.codeFixAtPosition(`x : null, +`); diff --git a/tests/cases/fourslash/unImplementedInterface28.ts b/tests/cases/fourslash/unImplementedInterface28.ts new file mode 100644 index 00000000000..16cbe47b26c --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface28.ts @@ -0,0 +1,21 @@ +/// + +//// interface I1 { +//// f1(); +//// } +//// +//// interface I2 { +//// f2(); +//// } +//// +//// var x: I1|I2 ={[| +//// +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +f2(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface29.ts b/tests/cases/fourslash/unImplementedInterface29.ts new file mode 100644 index 00000000000..c2719c2e7f9 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface29.ts @@ -0,0 +1,14 @@ +/// + +//// abstract class C1 { +//// f1(){} +//// } +//// +//// class C2 implements C1 {[| +//// |]f2(){} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface3.ts b/tests/cases/fourslash/unImplementedInterface3.ts new file mode 100644 index 00000000000..19354ce1c94 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface3.ts @@ -0,0 +1,16 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// x: number +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`x: number; +`); diff --git a/tests/cases/fourslash/unImplementedInterface30.ts b/tests/cases/fourslash/unImplementedInterface30.ts new file mode 100644 index 00000000000..71addef195b --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface30.ts @@ -0,0 +1,18 @@ +/// + +//// abstract class C1 { +//// f1(){} +//// } +//// +//// abstract class C2 extends C1 { +//// +//// } +//// +//// class C3 implements C2 {[| +//// |]f2(){} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface31.ts b/tests/cases/fourslash/unImplementedInterface31.ts new file mode 100644 index 00000000000..d56e44911b5 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface31.ts @@ -0,0 +1,18 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// abstract class C2 extends C1 { +//// +//// } +//// +//// class C3 implements C2 {[| +//// |]f2(){} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface32.ts b/tests/cases/fourslash/unImplementedInterface32.ts new file mode 100644 index 00000000000..825224f448b --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface32.ts @@ -0,0 +1,18 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// abstract class C2 extends C1 { +//// +//// } +//// +//// class C3 implements C2 {[| +//// |]f2(){} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface33.ts b/tests/cases/fourslash/unImplementedInterface33.ts new file mode 100644 index 00000000000..7c3a647ce40 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface33.ts @@ -0,0 +1,18 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// abstract class C2 extends C1 { +//// +//// } +//// +//// class C3 implements C2 {[| +//// |]f2(){} +//// } + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface34.ts b/tests/cases/fourslash/unImplementedInterface34.ts new file mode 100644 index 00000000000..ab7a4f30bea --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface34.ts @@ -0,0 +1,14 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// class C2 extends C1 {[| +//// +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface35.ts b/tests/cases/fourslash/unImplementedInterface35.ts new file mode 100644 index 00000000000..66d47491c41 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface35.ts @@ -0,0 +1,16 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// interface I1 extends C1 {} +//// +//// class C2 implements I1 {[| +//// +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface36.ts b/tests/cases/fourslash/unImplementedInterface36.ts new file mode 100644 index 00000000000..3871414428e --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface36.ts @@ -0,0 +1,20 @@ +/// + +//// abstract class C1 { +//// +//// } +//// +//// abstract class C2 { +//// abstract f1(); +//// } +//// +//// interface I1 extends C1, C2 {} +//// +//// class C3 implements I1 {[| +//// +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface37.ts b/tests/cases/fourslash/unImplementedInterface37.ts new file mode 100644 index 00000000000..2032f2d3461 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface37.ts @@ -0,0 +1,20 @@ +/// + +//// abstract class C1 { +//// abstract f1(); +//// } +//// +//// abstract class C2 extends C1{ +//// +//// } +//// +//// interface I1 extends C2 {} +//// +//// class C3 implements I1 {[| +//// +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface38.ts b/tests/cases/fourslash/unImplementedInterface38.ts new file mode 100644 index 00000000000..c60b9922ef8 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface38.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class C2 { +//// abstract f1(); +//// } +//// +//// var x: C2 = {[| |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +}`); diff --git a/tests/cases/fourslash/unImplementedInterface39.ts b/tests/cases/fourslash/unImplementedInterface39.ts new file mode 100644 index 00000000000..ae85d02b8a3 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface39.ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1():string{ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface4.ts b/tests/cases/fourslash/unImplementedInterface4.ts new file mode 100644 index 00000000000..6e4e64c18d1 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface4.ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1() +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface5.ts b/tests/cases/fourslash/unImplementedInterface5.ts new file mode 100644 index 00000000000..59b3ba85199 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface5.ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1(x: number, y: string) +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(x: number,y: string){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface6.ts b/tests/cases/fourslash/unImplementedInterface6.ts new file mode 100644 index 00000000000..2310e05fbb0 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface6.ts @@ -0,0 +1,15 @@ +/// + +//// interface I1 { +//// f1(x: number, y: T); +//// } +//// +//// class T {} +//// +//// class C1 implements I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(x: number,y: T){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface7.ts b/tests/cases/fourslash/unImplementedInterface7.ts new file mode 100644 index 00000000000..125f3e1ffeb --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface7.ts @@ -0,0 +1,15 @@ +/// + +//// interface I1 { +//// f1(x: number, y: C2); +//// } +//// +//// class C2 {} +//// +//// class C1 implements I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(x: number,y: C2){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface8.ts b/tests/cases/fourslash/unImplementedInterface8.ts new file mode 100644 index 00000000000..2df93c6d7d9 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface8.ts @@ -0,0 +1,15 @@ +/// + +//// interface I1 { +//// f1(x: number, y: C2); +//// } +//// +//// class C2 {} +//// +//// class C1 implements I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(x: number,y: C2){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/unImplementedInterface9.ts b/tests/cases/fourslash/unImplementedInterface9.ts new file mode 100644 index 00000000000..5c869996773 --- /dev/null +++ b/tests/cases/fourslash/unImplementedInterface9.ts @@ -0,0 +1,17 @@ +/// + +//// interface I1 { +//// +//// } +//// +//// interface I2 extends I1 { +//// f1(); +//// } +//// +//// class C1 implements I2 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); From 536d703d9ec3f208809a23b20b6058ebf38eae20 Mon Sep 17 00:00:00 2001 From: zhengbli Date: Wed, 12 Oct 2016 18:05:01 -0700 Subject: [PATCH 010/289] Set maxNodeModuleJsDepth for inferred projects --- .../unittests/tsserverProjectSystem.ts | 22 +++++++++++++++++++ src/server/project.ts | 7 ++++++ 2 files changed, 29 insertions(+) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 08e4bac7b2c..3e34b796955 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2387,4 +2387,26 @@ namespace ts.projectSystem { assert.isTrue(errorResult.length === 0); }); }); + + describe("maxNodeModuleJsDepth for inferred projects", () => { + it("should be set by default", () => { + const file1: FileOrFolder = { + path: "/a/b/file1.js", + content: `var t = require("test"); t.` + }; + const moduleFile: FileOrFolder = { + path: "/a/b/node_modules/test/index.js", + content: `var v = 10; module.exports = v;` + }; + + const host = createServerHost([file1, moduleFile]); + const projectService = createProjectService(host); + projectService.openClientFile(file1.path); + + const project = projectService.inferredProjects[0]; + const sourceFile = project.getSourceFile(file1.path); + assert.isTrue("test" in sourceFile.resolvedModules); + assert.equal((sourceFile.resolvedModules["test"]).resolvedFileName, moduleFile.path); + }); + }); } \ No newline at end of file diff --git a/src/server/project.ts b/src/server/project.ts index a355d75f942..91e898bb568 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -126,6 +126,13 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } + if (this.projectKind === ProjectKind.Inferred) { + // Add default compiler options for inferred projects here + if (this.compilerOptions.maxNodeModuleJsDepth === undefined) { + this.compilerOptions.maxNodeModuleJsDepth = 2; + } + } + if (languageServiceEnabled) { this.enableLanguageService(); } From 0faf32b27949e06739f6a41ad64922af1bc949e7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 09:27:20 -0700 Subject: [PATCH 011/289] Add spread syntax to JsxExpression. This allows you to specify that a JsxExpression should be a list that will be flattened by the JSX consumer. --- src/compiler/checker.ts | 6 +++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/emitter.ts | 3 +++ src/compiler/factory.ts | 7 ++++--- src/compiler/parser.ts | 4 +++- src/compiler/types.ts | 1 + 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a1a8ae0da5c..db318e4eb17 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10904,7 +10904,11 @@ namespace ts { function checkJsxExpression(node: JsxExpression) { if (node.expression) { - return checkExpression(node.expression); + const type = checkExpression(node.expression); + if (node.dotDotDotToken && !isArrayType(type)) { + error(node, Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1b8c995ea05..f0ccc7f33e2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1787,6 +1787,10 @@ "category": "Error", "code": 2608 }, + "JSX spread child must be an array type.": { + "category": "Error", + "code": 2609 + }, "Cannot emit namespaced JSX elements in React": { "category": "Error", "code": 2650 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 270fb0ca624..dae75e2516c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1969,6 +1969,9 @@ const _super = (function (geti, seti) { function emitJsxExpression(node: JsxExpression) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 97a36f46b13..d050739470f 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1318,15 +1318,16 @@ namespace ts { return node; } - export function createJsxExpression(expression: Expression, location?: TextRange) { + export function createJsxExpression(expression: Expression, dotDotDotToken: Token, location?: TextRange) { const node = createNode(SyntaxKind.JsxExpression, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } export function updateJsxExpression(node: JsxExpression, expression: Expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } @@ -2910,4 +2911,4 @@ namespace ts { function tryGetModuleNameFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions) { return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); } -} \ No newline at end of file +} diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 62ae61e4cb4..1133a5bafd6 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -362,7 +362,8 @@ namespace ts { case SyntaxKind.JsxSpreadAttribute: return visitNode(cbNode, (node).expression); case SyntaxKind.JsxExpression: - return visitNode(cbNode, (node).expression); + return visitNode(cbNode, (node as JsxExpression).dotDotDotToken) || + visitNode(cbNode, (node as JsxExpression).expression); case SyntaxKind.JsxClosingElement: return visitNode(cbNode, (node).tagName); @@ -3821,6 +3822,7 @@ namespace ts { parseExpected(SyntaxKind.OpenBraceToken); if (token() !== SyntaxKind.CloseBraceToken) { + node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 638504e613f..e54157ba986 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1396,6 +1396,7 @@ namespace ts { export interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + dotDotDotToken?: Token; expression?: Expression; } From d29c78e7189fcbcc13bd54f88d52948ddf65ff9f Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 09:28:39 -0700 Subject: [PATCH 012/289] Add spread syntax tests for JsxExpressions And baselines --- .../baselines/reference/tsxSpreadChildren.js | 41 ++++++++ .../reference/tsxSpreadChildren.symbols | 86 +++++++++++++++++ .../reference/tsxSpreadChildren.types | 94 +++++++++++++++++++ .../tsxSpreadChildrenInvalidType.errors.txt | 32 +++++++ .../reference/tsxSpreadChildrenInvalidType.js | 46 +++++++++ .../conformance/jsx/tsxSpreadChildren.tsx | 27 ++++++ .../jsx/tsxSpreadChildrenInvalidType.tsx | 26 +++++ 7 files changed, 352 insertions(+) create mode 100644 tests/baselines/reference/tsxSpreadChildren.js create mode 100644 tests/baselines/reference/tsxSpreadChildren.symbols create mode 100644 tests/baselines/reference/tsxSpreadChildren.types create mode 100644 tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt create mode 100644 tests/baselines/reference/tsxSpreadChildrenInvalidType.js create mode 100644 tests/cases/conformance/jsx/tsxSpreadChildren.tsx create mode 100644 tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx diff --git a/tests/baselines/reference/tsxSpreadChildren.js b/tests/baselines/reference/tsxSpreadChildren.js new file mode 100644 index 00000000000..bcc62de0566 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.js @@ -0,0 +1,41 @@ +//// [tsxSpreadChildren.tsx] + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...todos.map(todo => )} +
; +} +let x: TodoListProps; + + + +//// [tsxSpreadChildren.jsx] +function Todo(prop) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList(_a) { + var todos = _a.todos; + return
+ {...todos.map(function (todo) { return ; })} +
; +} +var x; +; diff --git a/tests/baselines/reference/tsxSpreadChildren.symbols b/tests/baselines/reference/tsxSpreadChildren.symbols new file mode 100644 index 00000000000..6e726e93217 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.symbols @@ -0,0 +1,86 @@ +=== tests/cases/conformance/jsx/tsxSpreadChildren.tsx === + +declare module JSX { +>JSX : Symbol(JSX, Decl(tsxSpreadChildren.tsx, 0, 0)) + + interface Element { } +>Element : Symbol(Element, Decl(tsxSpreadChildren.tsx, 1, 20)) + + interface IntrinsicElements { +>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) + + [s: string]: any; +>s : Symbol(s, Decl(tsxSpreadChildren.tsx, 4, 3)) + } +} +declare var React: any; +>React : Symbol(React, Decl(tsxSpreadChildren.tsx, 7, 11)) + +interface TodoProp { +>TodoProp : Symbol(TodoProp, Decl(tsxSpreadChildren.tsx, 7, 23)) + + id: number; +>id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) + + todo: string; +>todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) +} +interface TodoListProps { +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + todos: TodoProp[]; +>todos : Symbol(TodoListProps.todos, Decl(tsxSpreadChildren.tsx, 13, 25)) +>TodoProp : Symbol(TodoProp, Decl(tsxSpreadChildren.tsx, 7, 23)) +} +function Todo(prop: { key: number, todo: string }) { +>Todo : Symbol(Todo, Decl(tsxSpreadChildren.tsx, 15, 1)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) + + return
{prop.key.toString() + prop.todo}
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +>prop.key.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>prop.key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>prop.todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>prop : Symbol(prop, Decl(tsxSpreadChildren.tsx, 16, 14)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +} +function TodoList({ todos }: TodoListProps) { +>TodoList : Symbol(TodoList, Decl(tsxSpreadChildren.tsx, 18, 1)) +>todos : Symbol(todos, Decl(tsxSpreadChildren.tsx, 19, 19)) +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + return
+>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) + + {...todos.map(todo => )} +>todos.map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>todos : Symbol(todos, Decl(tsxSpreadChildren.tsx, 19, 19)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>Todo : Symbol(Todo, Decl(tsxSpreadChildren.tsx, 15, 1)) +>key : Symbol(key, Decl(tsxSpreadChildren.tsx, 16, 21)) +>todo.id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>id : Symbol(TodoProp.id, Decl(tsxSpreadChildren.tsx, 9, 20)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 16, 34)) +>todo.todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) +>todo : Symbol(todo, Decl(tsxSpreadChildren.tsx, 21, 22)) +>todo : Symbol(TodoProp.todo, Decl(tsxSpreadChildren.tsx, 10, 15)) + +
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxSpreadChildren.tsx, 2, 22)) +} +let x: TodoListProps; +>x : Symbol(x, Decl(tsxSpreadChildren.tsx, 24, 3)) +>TodoListProps : Symbol(TodoListProps, Decl(tsxSpreadChildren.tsx, 12, 1)) + + +>TodoList : Symbol(TodoList, Decl(tsxSpreadChildren.tsx, 18, 1)) +>x : Symbol(x, Decl(tsxSpreadChildren.tsx, 24, 3)) + diff --git a/tests/baselines/reference/tsxSpreadChildren.types b/tests/baselines/reference/tsxSpreadChildren.types new file mode 100644 index 00000000000..fbf76d0679d --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildren.types @@ -0,0 +1,94 @@ +=== tests/cases/conformance/jsx/tsxSpreadChildren.tsx === + +declare module JSX { +>JSX : any + + interface Element { } +>Element : Element + + interface IntrinsicElements { +>IntrinsicElements : IntrinsicElements + + [s: string]: any; +>s : string + } +} +declare var React: any; +>React : any + +interface TodoProp { +>TodoProp : TodoProp + + id: number; +>id : number + + todo: string; +>todo : string +} +interface TodoListProps { +>TodoListProps : TodoListProps + + todos: TodoProp[]; +>todos : TodoProp[] +>TodoProp : TodoProp +} +function Todo(prop: { key: number, todo: string }) { +>Todo : (prop: { key: number; todo: string; }) => JSX.Element +>prop : { key: number; todo: string; } +>key : number +>todo : string + + return
{prop.key.toString() + prop.todo}
; +>
{prop.key.toString() + prop.todo}
: JSX.Element +>div : any +>prop.key.toString() + prop.todo : string +>prop.key.toString() : string +>prop.key.toString : (radix?: number) => string +>prop.key : number +>prop : { key: number; todo: string; } +>key : number +>toString : (radix?: number) => string +>prop.todo : string +>prop : { key: number; todo: string; } +>todo : string +>div : any +} +function TodoList({ todos }: TodoListProps) { +>TodoList : ({todos}: TodoListProps) => JSX.Element +>todos : TodoProp[] +>TodoListProps : TodoListProps + + return
+>
{...todos.map(todo => )}
: JSX.Element +>div : any + + {...todos.map(todo => )} +>todos.map(todo => ) : JSX.Element[] +>todos.map : { (this: [TodoProp, TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U]; (this: [TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): U[]; } +>todos : TodoProp[] +>map : { (this: [TodoProp, TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U, U]; (this: [TodoProp, TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U, U]; (this: [TodoProp, TodoProp], callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: TodoProp, index: number, array: TodoProp[]) => U, thisArg?: any): U[]; } +>todo => : (todo: TodoProp) => JSX.Element +>todo : TodoProp +> : JSX.Element +>Todo : (prop: { key: number; todo: string; }) => JSX.Element +>key : any +>todo.id : number +>todo : TodoProp +>id : number +>todo : any +>todo.todo : string +>todo : TodoProp +>todo : string + +
; +>div : any +} +let x: TodoListProps; +>x : TodoListProps +>TodoListProps : TodoListProps + + +> : JSX.Element +>TodoList : ({todos}: TodoListProps) => JSX.Element +>x : TodoListProps + diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt new file mode 100644 index 00000000000..d0526541673 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609: JSX spread child must be an array type. + + +==== tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx (1 errors) ==== + declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } + } + declare var React: any; + + interface TodoProp { + id: number; + todo: string; + } + interface TodoListProps { + todos: TodoProp[]; + } + function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; + } + function TodoList({ todos }: TodoListProps) { + return
+ {...} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2609: JSX spread child must be an array type. +
; + } + let x: TodoListProps; + + \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js new file mode 100644 index 00000000000..507b36665d5 --- /dev/null +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js @@ -0,0 +1,46 @@ +//// [tsxSpreadChildrenInvalidType.tsx] +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...} +
; +} +let x: TodoListProps; + + + +//// [tsxSpreadChildrenInvalidType.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +function Todo(prop) { + return React.createElement("div", null, prop.key.toString() + prop.todo); +} +function TodoList(_a) { + var todos = _a.todos; + return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); +} +var x; +React.createElement(TodoList, __assign({}, x)); diff --git a/tests/cases/conformance/jsx/tsxSpreadChildren.tsx b/tests/cases/conformance/jsx/tsxSpreadChildren.tsx new file mode 100644 index 00000000000..3be0b3b99e4 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSpreadChildren.tsx @@ -0,0 +1,27 @@ +//@jsx: preserve + +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...todos.map(todo => )} +
; +} +let x: TodoListProps; + diff --git a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx new file mode 100644 index 00000000000..20f7d4fae87 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx @@ -0,0 +1,26 @@ +// @jsx: react +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +interface TodoProp { + id: number; + todo: string; +} +interface TodoListProps { + todos: TodoProp[]; +} +function Todo(prop: { key: number, todo: string }) { + return
{prop.key.toString() + prop.todo}
; +} +function TodoList({ todos }: TodoListProps) { + return
+ {...} +
; +} +let x: TodoListProps; + From 7eb39cc80ce7725afacb1b75763fd7fcd505d964 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Thu, 13 Oct 2016 10:17:01 -0700 Subject: [PATCH 013/289] Allow any type for spreads in JsxExpression --- src/compiler/checker.ts | 2 +- .../reference/tsxSpreadChildrenInvalidType.errors.txt | 6 ++++++ .../reference/tsxSpreadChildrenInvalidType.js | 11 +++++++++++ .../conformance/jsx/tsxSpreadChildrenInvalidType.tsx | 6 ++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index db318e4eb17..78481c17d1f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10905,7 +10905,7 @@ namespace ts { function checkJsxExpression(node: JsxExpression) { if (node.expression) { const type = checkExpression(node.expression); - if (node.dotDotDotToken && !isArrayType(type)) { + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { error(node, Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); } return type; diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt index d0526541673..d1524c6bf3a 100644 --- a/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.errors.txt @@ -27,6 +27,12 @@ tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx(21,9): error TS2609 !!! error TS2609: JSX spread child must be an array type. ; } + function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; + } let x: TodoListProps; \ No newline at end of file diff --git a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js index 507b36665d5..e9873bfb233 100644 --- a/tests/baselines/reference/tsxSpreadChildrenInvalidType.js +++ b/tests/baselines/reference/tsxSpreadChildrenInvalidType.js @@ -22,6 +22,12 @@ function TodoList({ todos }: TodoListProps) { {...} ; } +function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; +} let x: TodoListProps; @@ -42,5 +48,10 @@ function TodoList(_a) { var todos = _a.todos; return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); } +function TodoListNoError(_a) { + var todos = _a.todos; + // any is not checked + return React.createElement("div", null, React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo })); +} var x; React.createElement(TodoList, __assign({}, x)); diff --git a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx index 20f7d4fae87..41181618ce0 100644 --- a/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx +++ b/tests/cases/conformance/jsx/tsxSpreadChildrenInvalidType.tsx @@ -22,5 +22,11 @@ function TodoList({ todos }: TodoListProps) { {...} ; } +function TodoListNoError({ todos }: TodoListProps) { + // any is not checked + return
+ {...( as any)} +
; +} let x: TodoListProps; From 6b4f6b58640111a3078f4868e352cb58904e1fdf Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 25 Oct 2016 13:58:32 -0700 Subject: [PATCH 014/289] Remove Type Assignability QuickFix --- scripts/buildProtocol.js | 135 ++++++++++++++++++ src/services/codefixes/interfaceFixes.ts | 41 ------ .../fourslash/unImplementedInterface14.ts | 9 +- .../fourslash/unImplementedInterface15.ts | 11 +- .../fourslash/unImplementedInterface16.ts | 5 +- .../fourslash/unImplementedInterface17.ts | 5 +- .../fourslash/unImplementedInterface18.ts | 5 +- .../fourslash/unImplementedInterface19.ts | 5 +- .../fourslash/unImplementedInterface20.ts | 5 +- .../fourslash/unImplementedInterface21.ts | 5 +- .../fourslash/unImplementedInterface22.ts | 5 +- .../fourslash/unImplementedInterface23.ts | 5 +- .../fourslash/unImplementedInterface24.ts | 5 +- .../fourslash/unImplementedInterface25.ts | 5 +- .../fourslash/unImplementedInterface26.ts | 5 +- .../fourslash/unImplementedInterface27.ts | 5 +- .../fourslash/unImplementedInterface28.ts | 15 +- .../fourslash/unImplementedInterface38.ts | 7 +- 18 files changed, 194 insertions(+), 84 deletions(-) create mode 100644 scripts/buildProtocol.js diff --git a/scripts/buildProtocol.js b/scripts/buildProtocol.js new file mode 100644 index 00000000000..db080839309 --- /dev/null +++ b/scripts/buildProtocol.js @@ -0,0 +1,135 @@ +/// +"use strict"; +var ts = require("../lib/typescript"); +var path = require("path"); +function endsWith(s, suffix) { + return s.lastIndexOf(suffix, s.length - suffix.length) !== -1; +} +var DeclarationsWalker = (function () { + function DeclarationsWalker(typeChecker, protocolFile) { + this.typeChecker = typeChecker; + this.protocolFile = protocolFile; + this.visitedTypes = []; + this.text = ""; + } + DeclarationsWalker.getExtraDeclarations = function (typeChecker, protocolFile) { + var text = "declare namespace ts.server.protocol {\n"; + var walker = new DeclarationsWalker(typeChecker, protocolFile); + walker.visitTypeNodes(protocolFile); + return walker.text + ? "declare namespace ts.server.protocol {\n" + walker.text + "}" + : ""; + }; + DeclarationsWalker.prototype.processType = function (type) { + if (this.visitedTypes.indexOf(type) >= 0) { + return; + } + this.visitedTypes.push(type); + var s = type.aliasSymbol || type.getSymbol(); + if (!s) { + return; + } + if (s.name === "Array") { + // we should process type argument instead + return this.processType(type.typeArguments[0]); + } + else { + for (var _i = 0, _a = s.getDeclarations(); _i < _a.length; _i++) { + var decl = _a[_i]; + var sourceFile = decl.getSourceFile(); + if (sourceFile === this.protocolFile || path.basename(sourceFile.fileName) === "lib.d.ts") { + return; + } + // splice declaration in final d.ts file + var text = decl.getFullText(); + this.text += text + "\n"; + // recursively pull all dependencies into result dts file + this.visitTypeNodes(decl); + } + } + }; + DeclarationsWalker.prototype.visitTypeNodes = function (node) { + var _this = this; + if (node.parent) { + switch (node.parent.kind) { + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.PropertySignature: + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.IndexSignature: + if ((node.parent.type) === node) { + var type = this.typeChecker.getTypeAtLocation(node); + if (type && !(type.flags & ts.TypeFlags.TypeParameter)) { + this.processType(type); + } + } + break; + } + } + ts.forEachChild(node, function (n) { return _this.visitTypeNodes(n); }); + }; + return DeclarationsWalker; +}()); +function generateProtocolFile(protocolTs, typeScriptServicesDts) { + var options = { target: ts.ScriptTarget.ES5, declaration: true, noResolve: true, types: [], stripInternal: true }; + /** + * 1st pass - generate a program from protocol.ts and typescriptservices.d.ts and emit core version of protocol.d.ts with all internal members stripped + * @return text of protocol.d.t.s + */ + function getInitialDtsFileForProtocol() { + var program = ts.createProgram([protocolTs, typeScriptServicesDts], options); + var protocolDts; + program.emit(program.getSourceFile(protocolTs), function (file, content) { + if (endsWith(file, ".d.ts")) { + protocolDts = content; + } + }); + if (protocolDts === undefined) { + throw new Error("Declaration file for protocol.ts is not generated"); + } + return protocolDts; + } + var protocolFileName = "protocol.d.ts"; + /** + * Second pass - generate a program from protocol.d.ts and typescriptservices.d.ts, then augment core protocol.d.ts with extra types from typescriptservices.d.ts + */ + function getProgramWithProtocolText(protocolDts, includeTypeScriptServices) { + var host = ts.createCompilerHost(options); + var originalGetSourceFile = host.getSourceFile; + host.getSourceFile = function (fileName) { + if (fileName === protocolFileName) { + return ts.createSourceFile(fileName, protocolDts, options.target); + } + return originalGetSourceFile.apply(host, [fileName]); + }; + var rootFiles = includeTypeScriptServices ? [protocolFileName, typeScriptServicesDts] : [protocolFileName]; + return ts.createProgram(rootFiles, options, host); + } + var protocolDts = getInitialDtsFileForProtocol(); + var program = getProgramWithProtocolText(protocolDts, /*includeTypeScriptServices*/ true); + var protocolFile = program.getSourceFile("protocol.d.ts"); + var extraDeclarations = DeclarationsWalker.getExtraDeclarations(program.getTypeChecker(), protocolFile); + if (extraDeclarations) { + protocolDts += extraDeclarations; + } + // do sanity check and try to compile generated text as standalone program + var sanityCheckProgram = getProgramWithProtocolText(protocolDts, /*includeTypeScriptServices*/ false); + var diagnostics = program.getSyntacticDiagnostics().concat(program.getSemanticDiagnostics(), program.getGlobalDiagnostics()); + if (diagnostics.length) { + var flattenedDiagnostics = diagnostics.map(function (d) { return ts.flattenDiagnosticMessageText(d.messageText, "\n"); }).join("\n"); + throw new Error("Unexpected errors during sanity check: " + flattenedDiagnostics); + } + return protocolDts; +} +if (process.argv.length < 5) { + console.log("Expected 3 arguments: path to 'protocol.ts', path to 'typescriptservices.d.ts' and path to output file"); + process.exit(1); +} +var protocolTs = process.argv[2]; +var typeScriptServicesDts = process.argv[3]; +var outputFile = process.argv[4]; +var generatedProtocolDts = generateProtocolFile(protocolTs, typeScriptServicesDts); +ts.sys.writeFile(outputFile, generatedProtocolDts); +//# sourceMappingURL=file:///C:/repo/TypeScript/scripts/buildProtocol.js.map \ No newline at end of file diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts index 49d69497333..dc507360db1 100644 --- a/src/services/codefixes/interfaceFixes.ts +++ b/src/services/codefixes/interfaceFixes.ts @@ -1,46 +1,5 @@ /* @internal */ namespace ts.codefix { - registerCodeFix({ - errorCodes: [Diagnostics.Type_0_is_not_assignable_to_type_1.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - const checker = context.program.getTypeChecker(); - let textChanges: TextChange[] = []; - - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.VariableDeclaration) { - const variableDeclaration = token.parent; - const membersAndStartPosObject = getMembersAndStartPosFromReference(variableDeclaration); - const variableMembers = membersAndStartPosObject.members; - const trackingAddedMembers: string[] = []; - const startPos: number = membersAndStartPosObject.startPos; - - if (variableDeclaration.type.kind === SyntaxKind.TypeReference) { - textChanges = textChanges.concat(getChanges(variableDeclaration.type, variableMembers, startPos, checker, /*reference*/ true, trackingAddedMembers, context.newLineCharacter)); - } - else if (variableDeclaration.type.kind === SyntaxKind.UnionType) { - const types = (variableDeclaration.type).types; - ts.forEach(types, t => { - textChanges = textChanges.concat(getChanges(t, variableMembers, startPos, checker, /*reference*/ true, trackingAddedMembers, context.newLineCharacter)); - }); - } - } - - if (textChanges.length > 0) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_reference), - changes: [{ - fileName: sourceFile.fileName, - textChanges: textChanges - }] - }]; - } - - return undefined; - } - }); - registerCodeFix({ errorCodes: [Diagnostics.Class_0_incorrectly_implements_interface_1.code], getCodeActions: (context: CodeFixContext) => { diff --git a/tests/cases/fourslash/unImplementedInterface14.ts b/tests/cases/fourslash/unImplementedInterface14.ts index ad55fef3cce..d5da3231b7b 100644 --- a/tests/cases/fourslash/unImplementedInterface14.ts +++ b/tests/cases/fourslash/unImplementedInterface14.ts @@ -10,7 +10,8 @@ //// |]f2() {} //// } -verify.codeFixAtPosition(`f1(){ - throw new Error('Method not Implemented'); -}, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`f1(){ +// throw new Error('Method not Implemented'); +// }, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface15.ts b/tests/cases/fourslash/unImplementedInterface15.ts index e68f7171ee5..005ece4ea50 100644 --- a/tests/cases/fourslash/unImplementedInterface15.ts +++ b/tests/cases/fourslash/unImplementedInterface15.ts @@ -8,8 +8,9 @@ //// //// |]} -verify.codeFixAtPosition(` -f1(){ - throw new Error('Method not Implemented'); -} -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(` +// f1(){ +// throw new Error('Method not Implemented'); +// } +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface16.ts b/tests/cases/fourslash/unImplementedInterface16.ts index ca992b1eb1e..091174b47c4 100644 --- a/tests/cases/fourslash/unImplementedInterface16.ts +++ b/tests/cases/fourslash/unImplementedInterface16.ts @@ -8,5 +8,6 @@ //// var x: I1 ={[| //// |]} -verify.codeFixAtPosition(`x : "" -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : "" +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface17.ts b/tests/cases/fourslash/unImplementedInterface17.ts index e909b60f588..7fa3cc61be3 100644 --- a/tests/cases/fourslash/unImplementedInterface17.ts +++ b/tests/cases/fourslash/unImplementedInterface17.ts @@ -7,5 +7,6 @@ //// var x: I1 ={[| //// |]} -verify.codeFixAtPosition(`x : 0 -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : 0 +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface18.ts b/tests/cases/fourslash/unImplementedInterface18.ts index 9e0f9888bf3..0fa0eaefa56 100644 --- a/tests/cases/fourslash/unImplementedInterface18.ts +++ b/tests/cases/fourslash/unImplementedInterface18.ts @@ -8,5 +8,6 @@ //// //// |]} -verify.codeFixAtPosition(`x : false -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : false +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface19.ts b/tests/cases/fourslash/unImplementedInterface19.ts index de484c282d8..d037a8611b3 100644 --- a/tests/cases/fourslash/unImplementedInterface19.ts +++ b/tests/cases/fourslash/unImplementedInterface19.ts @@ -9,5 +9,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : "", -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : "", +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface20.ts b/tests/cases/fourslash/unImplementedInterface20.ts index 56a707d21ba..ffd3c8914b8 100644 --- a/tests/cases/fourslash/unImplementedInterface20.ts +++ b/tests/cases/fourslash/unImplementedInterface20.ts @@ -10,5 +10,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : 0, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : 0, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface21.ts b/tests/cases/fourslash/unImplementedInterface21.ts index 867c697e595..39e9aaf0e96 100644 --- a/tests/cases/fourslash/unImplementedInterface21.ts +++ b/tests/cases/fourslash/unImplementedInterface21.ts @@ -10,5 +10,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : false, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : false, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface22.ts b/tests/cases/fourslash/unImplementedInterface22.ts index 8a51577261f..8caeb26eb45 100644 --- a/tests/cases/fourslash/unImplementedInterface22.ts +++ b/tests/cases/fourslash/unImplementedInterface22.ts @@ -8,5 +8,6 @@ //// var x: I1 ={[| //// |]} -verify.codeFixAtPosition(`x : null -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface23.ts b/tests/cases/fourslash/unImplementedInterface23.ts index 8d00689a446..70e3db4f57d 100644 --- a/tests/cases/fourslash/unImplementedInterface23.ts +++ b/tests/cases/fourslash/unImplementedInterface23.ts @@ -10,5 +10,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : null, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface24.ts b/tests/cases/fourslash/unImplementedInterface24.ts index c206789b7f2..dead538d04d 100644 --- a/tests/cases/fourslash/unImplementedInterface24.ts +++ b/tests/cases/fourslash/unImplementedInterface24.ts @@ -8,5 +8,6 @@ //// var x: I1 ={[| //// |]} -verify.codeFixAtPosition(`x : null -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface25.ts b/tests/cases/fourslash/unImplementedInterface25.ts index 6b2b809efaa..84a018edc16 100644 --- a/tests/cases/fourslash/unImplementedInterface25.ts +++ b/tests/cases/fourslash/unImplementedInterface25.ts @@ -10,5 +10,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : null, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface26.ts b/tests/cases/fourslash/unImplementedInterface26.ts index a7136f0e70f..b75eac7184e 100644 --- a/tests/cases/fourslash/unImplementedInterface26.ts +++ b/tests/cases/fourslash/unImplementedInterface26.ts @@ -10,5 +10,6 @@ //// var x: I1 ={[| //// |]} -verify.codeFixAtPosition(`x : null -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface27.ts b/tests/cases/fourslash/unImplementedInterface27.ts index fc12cb57377..10460158694 100644 --- a/tests/cases/fourslash/unImplementedInterface27.ts +++ b/tests/cases/fourslash/unImplementedInterface27.ts @@ -12,5 +12,6 @@ //// |]f1(){} //// } -verify.codeFixAtPosition(`x : null, -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`x : null, +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface28.ts b/tests/cases/fourslash/unImplementedInterface28.ts index 16cbe47b26c..0e3aa3e95fb 100644 --- a/tests/cases/fourslash/unImplementedInterface28.ts +++ b/tests/cases/fourslash/unImplementedInterface28.ts @@ -12,10 +12,11 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ - throw new Error('Method not Implemented'); -} -f2(){ - throw new Error('Method not Implemented'); -} -`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`f1(){ +// throw new Error('Method not Implemented'); +// } +// f2(){ +// throw new Error('Method not Implemented'); +// } +// `); \ No newline at end of file diff --git a/tests/cases/fourslash/unImplementedInterface38.ts b/tests/cases/fourslash/unImplementedInterface38.ts index c60b9922ef8..8d1e06c4c47 100644 --- a/tests/cases/fourslash/unImplementedInterface38.ts +++ b/tests/cases/fourslash/unImplementedInterface38.ts @@ -6,6 +6,7 @@ //// //// var x: C2 = {[| |]} -verify.codeFixAtPosition(`f1(){ - throw new Error('Method not Implemented'); -}`); +verify.not.codeFixAvailable(); +// verify.codeFixAtPosition(`f1(){ +// throw new Error('Method not Implemented'); +// }`); \ No newline at end of file From 151f940100c40de5fa412b7e622e963438b1afe0 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 25 Oct 2016 13:38:55 -0700 Subject: [PATCH 015/289] Refactor classDeclarations --- src/services/codefixes/interfaceFixes.ts | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts index dc507360db1..a9588fa806b 100644 --- a/src/services/codefixes/interfaceFixes.ts +++ b/src/services/codefixes/interfaceFixes.ts @@ -8,28 +8,29 @@ namespace ts.codefix { const token = getTokenAtPosition(sourceFile, start); const checker = context.program.getTypeChecker(); - let textChanges: TextChange[] = []; - - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.ClassDeclaration) { + if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos: number = classDeclaration.members.pos; - const classMembers = getClassMembers(classDeclaration); + const classMembers = ts.map(getNamedClassMemberDeclarations(classDeclaration), member => member.name.getText()); const trackingAddedMembers: string[] = []; const interfaceClauses = ts.getClassImplementsHeritageClauseElements(classDeclaration); - for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { - textChanges = textChanges.concat(getChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); - } - } + let textChanges: TextChange[] = undefined; - if (textChanges.length > 0) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), - changes: [{ - fileName: sourceFile.fileName, - textChanges: textChanges - }] - }]; + for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { + let newChanges = getChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; + } + + if (textChanges && textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } } return undefined; @@ -46,13 +47,13 @@ namespace ts.codefix { let textChanges: TextChange[] = []; - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.ClassDeclaration) { + if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos = classDeclaration.members.pos; - const classMembers = getClassMembers(classDeclaration); + const abstractClassMembers = ts.map(getNamedClassAbstractMemberDeclarations(classDeclaration), member => member.name.getText()); const trackingAddedMembers: string[] = []; const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); - textChanges = textChanges.concat(getChanges(extendsClause, classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); + textChanges = textChanges.concat(getChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); } if (textChanges.length > 0) { @@ -127,14 +128,12 @@ namespace ts.codefix { return result; } - function getClassMembers(classDeclaration: ClassDeclaration): string[] { - const classMembers: string[] = []; - for (let i = 0; classDeclaration.members && i < classDeclaration.members.length; i++) { - if (classDeclaration.members[i].name) { - classMembers.push(classDeclaration.members[i].name.getText()); - } - } - return classMembers; + function getNamedClassMemberDeclarations(classDeclaration: ClassDeclaration): ClassElement[] { + return classDeclaration.members.filter(member => member.name); + } + + function getNamedClassAbstractMemberDeclarations(classDeclaration: ClassDeclaration): ClassElement[] { + return getNamedClassMemberDeclarations(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); } function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { From d1cea7361be1eaf1b0c25c8ffac8ebaef5366b9d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 25 Oct 2016 14:17:10 -0700 Subject: [PATCH 016/289] Refactor Loop --- src/services/codefixes/interfaceFixes.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts index a9588fa806b..e4de977a77c 100644 --- a/src/services/codefixes/interfaceFixes.ts +++ b/src/services/codefixes/interfaceFixes.ts @@ -76,10 +76,10 @@ namespace ts.codefix { if (type && type.symbol && type.symbol.declarations) { const interfaceMembers = getMembers(type.symbol.declarations[0], checker); - for (let j = 0; interfaceMembers && j < interfaceMembers.length; j++) { - if (interfaceMembers[j].name && existingMembers.indexOf(interfaceMembers[j].name.getText()) === -1) { - if (interfaceMembers[j].kind === SyntaxKind.PropertySignature) { - const interfaceProperty = interfaceMembers[j]; + for(let interfaceMember of interfaceMembers){ + if (interfaceMember.name && existingMembers.indexOf(interfaceMember.name.getText()) === -1) { + if (interfaceMember.kind === SyntaxKind.PropertySignature) { + const interfaceProperty = interfaceMember; if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { let propertyText = ""; if (reference) { @@ -94,8 +94,8 @@ namespace ts.codefix { trackingAddedMembers.push(interfaceProperty.name.getText()); } } - else if (interfaceMembers[j].kind === SyntaxKind.MethodSignature || interfaceMembers[j].kind === SyntaxKind.MethodDeclaration) { - const interfaceMethod = interfaceMembers[j]; + else if (interfaceMember.kind === SyntaxKind.MethodSignature || interfaceMember.kind === SyntaxKind.MethodDeclaration) { + const interfaceMethod = interfaceMember; handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); } } From c2feab6bde9f74123b9e149647aebb260561f1f2 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 25 Oct 2016 14:55:45 -0700 Subject: [PATCH 017/289] Rename Tests --- ...{unImplementedInterface1.ts => fixUnImplementedInterface01.ts} | 0 ...{unImplementedInterface2.ts => fixUnImplementedInterface02.ts} | 0 ...{unImplementedInterface3.ts => fixUnImplementedInterface03.ts} | 0 ...{unImplementedInterface4.ts => fixUnImplementedInterface04.ts} | 0 ...{unImplementedInterface5.ts => fixUnImplementedInterface05.ts} | 0 ...{unImplementedInterface6.ts => fixUnImplementedInterface06.ts} | 0 ...{unImplementedInterface7.ts => fixUnImplementedInterface07.ts} | 0 ...{unImplementedInterface8.ts => fixUnImplementedInterface08.ts} | 0 ...{unImplementedInterface9.ts => fixUnImplementedInterface09.ts} | 0 ...unImplementedInterface10.ts => fixUnImplementedInterface10.ts} | 0 ...unImplementedInterface11.ts => fixUnImplementedInterface11.ts} | 0 ...unImplementedInterface12.ts => fixUnImplementedInterface12.ts} | 0 ...unImplementedInterface13.ts => fixUnImplementedInterface13.ts} | 0 ...unImplementedInterface14.ts => fixUnImplementedInterface14.ts} | 0 ...unImplementedInterface15.ts => fixUnImplementedInterface15.ts} | 0 ...unImplementedInterface16.ts => fixUnImplementedInterface16.ts} | 0 ...unImplementedInterface17.ts => fixUnImplementedInterface17.ts} | 0 ...unImplementedInterface18.ts => fixUnImplementedInterface18.ts} | 0 ...unImplementedInterface19.ts => fixUnImplementedInterface19.ts} | 0 ...unImplementedInterface20.ts => fixUnImplementedInterface20.ts} | 0 ...unImplementedInterface21.ts => fixUnImplementedInterface21.ts} | 0 ...unImplementedInterface22.ts => fixUnImplementedInterface22.ts} | 0 ...unImplementedInterface23.ts => fixUnImplementedInterface23.ts} | 0 ...unImplementedInterface24.ts => fixUnImplementedInterface24.ts} | 0 ...unImplementedInterface25.ts => fixUnImplementedInterface25.ts} | 0 ...unImplementedInterface26.ts => fixUnImplementedInterface26.ts} | 0 ...unImplementedInterface27.ts => fixUnImplementedInterface27.ts} | 0 ...unImplementedInterface28.ts => fixUnImplementedInterface28.ts} | 0 ...unImplementedInterface29.ts => fixUnImplementedInterface29.ts} | 0 ...unImplementedInterface30.ts => fixUnImplementedInterface30.ts} | 0 ...unImplementedInterface31.ts => fixUnImplementedInterface31.ts} | 0 ...unImplementedInterface32.ts => fixUnImplementedInterface32.ts} | 0 ...unImplementedInterface33.ts => fixUnImplementedInterface33.ts} | 0 ...unImplementedInterface34.ts => fixUnImplementedInterface34.ts} | 0 ...unImplementedInterface35.ts => fixUnImplementedInterface35.ts} | 0 ...unImplementedInterface36.ts => fixUnImplementedInterface36.ts} | 0 ...unImplementedInterface37.ts => fixUnImplementedInterface37.ts} | 0 ...unImplementedInterface38.ts => fixUnImplementedInterface38.ts} | 0 ...unImplementedInterface39.ts => fixUnImplementedInterface39.ts} | 0 39 files changed, 0 insertions(+), 0 deletions(-) rename tests/cases/fourslash/{unImplementedInterface1.ts => fixUnImplementedInterface01.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface2.ts => fixUnImplementedInterface02.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface3.ts => fixUnImplementedInterface03.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface4.ts => fixUnImplementedInterface04.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface5.ts => fixUnImplementedInterface05.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface6.ts => fixUnImplementedInterface06.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface7.ts => fixUnImplementedInterface07.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface8.ts => fixUnImplementedInterface08.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface9.ts => fixUnImplementedInterface09.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface10.ts => fixUnImplementedInterface10.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface11.ts => fixUnImplementedInterface11.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface12.ts => fixUnImplementedInterface12.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface13.ts => fixUnImplementedInterface13.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface14.ts => fixUnImplementedInterface14.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface15.ts => fixUnImplementedInterface15.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface16.ts => fixUnImplementedInterface16.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface17.ts => fixUnImplementedInterface17.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface18.ts => fixUnImplementedInterface18.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface19.ts => fixUnImplementedInterface19.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface20.ts => fixUnImplementedInterface20.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface21.ts => fixUnImplementedInterface21.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface22.ts => fixUnImplementedInterface22.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface23.ts => fixUnImplementedInterface23.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface24.ts => fixUnImplementedInterface24.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface25.ts => fixUnImplementedInterface25.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface26.ts => fixUnImplementedInterface26.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface27.ts => fixUnImplementedInterface27.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface28.ts => fixUnImplementedInterface28.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface29.ts => fixUnImplementedInterface29.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface30.ts => fixUnImplementedInterface30.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface31.ts => fixUnImplementedInterface31.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface32.ts => fixUnImplementedInterface32.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface33.ts => fixUnImplementedInterface33.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface34.ts => fixUnImplementedInterface34.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface35.ts => fixUnImplementedInterface35.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface36.ts => fixUnImplementedInterface36.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface37.ts => fixUnImplementedInterface37.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface38.ts => fixUnImplementedInterface38.ts} (100%) rename tests/cases/fourslash/{unImplementedInterface39.ts => fixUnImplementedInterface39.ts} (100%) diff --git a/tests/cases/fourslash/unImplementedInterface1.ts b/tests/cases/fourslash/fixUnImplementedInterface01.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface1.ts rename to tests/cases/fourslash/fixUnImplementedInterface01.ts diff --git a/tests/cases/fourslash/unImplementedInterface2.ts b/tests/cases/fourslash/fixUnImplementedInterface02.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface2.ts rename to tests/cases/fourslash/fixUnImplementedInterface02.ts diff --git a/tests/cases/fourslash/unImplementedInterface3.ts b/tests/cases/fourslash/fixUnImplementedInterface03.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface3.ts rename to tests/cases/fourslash/fixUnImplementedInterface03.ts diff --git a/tests/cases/fourslash/unImplementedInterface4.ts b/tests/cases/fourslash/fixUnImplementedInterface04.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface4.ts rename to tests/cases/fourslash/fixUnImplementedInterface04.ts diff --git a/tests/cases/fourslash/unImplementedInterface5.ts b/tests/cases/fourslash/fixUnImplementedInterface05.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface5.ts rename to tests/cases/fourslash/fixUnImplementedInterface05.ts diff --git a/tests/cases/fourslash/unImplementedInterface6.ts b/tests/cases/fourslash/fixUnImplementedInterface06.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface6.ts rename to tests/cases/fourslash/fixUnImplementedInterface06.ts diff --git a/tests/cases/fourslash/unImplementedInterface7.ts b/tests/cases/fourslash/fixUnImplementedInterface07.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface7.ts rename to tests/cases/fourslash/fixUnImplementedInterface07.ts diff --git a/tests/cases/fourslash/unImplementedInterface8.ts b/tests/cases/fourslash/fixUnImplementedInterface08.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface8.ts rename to tests/cases/fourslash/fixUnImplementedInterface08.ts diff --git a/tests/cases/fourslash/unImplementedInterface9.ts b/tests/cases/fourslash/fixUnImplementedInterface09.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface9.ts rename to tests/cases/fourslash/fixUnImplementedInterface09.ts diff --git a/tests/cases/fourslash/unImplementedInterface10.ts b/tests/cases/fourslash/fixUnImplementedInterface10.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface10.ts rename to tests/cases/fourslash/fixUnImplementedInterface10.ts diff --git a/tests/cases/fourslash/unImplementedInterface11.ts b/tests/cases/fourslash/fixUnImplementedInterface11.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface11.ts rename to tests/cases/fourslash/fixUnImplementedInterface11.ts diff --git a/tests/cases/fourslash/unImplementedInterface12.ts b/tests/cases/fourslash/fixUnImplementedInterface12.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface12.ts rename to tests/cases/fourslash/fixUnImplementedInterface12.ts diff --git a/tests/cases/fourslash/unImplementedInterface13.ts b/tests/cases/fourslash/fixUnImplementedInterface13.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface13.ts rename to tests/cases/fourslash/fixUnImplementedInterface13.ts diff --git a/tests/cases/fourslash/unImplementedInterface14.ts b/tests/cases/fourslash/fixUnImplementedInterface14.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface14.ts rename to tests/cases/fourslash/fixUnImplementedInterface14.ts diff --git a/tests/cases/fourslash/unImplementedInterface15.ts b/tests/cases/fourslash/fixUnImplementedInterface15.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface15.ts rename to tests/cases/fourslash/fixUnImplementedInterface15.ts diff --git a/tests/cases/fourslash/unImplementedInterface16.ts b/tests/cases/fourslash/fixUnImplementedInterface16.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface16.ts rename to tests/cases/fourslash/fixUnImplementedInterface16.ts diff --git a/tests/cases/fourslash/unImplementedInterface17.ts b/tests/cases/fourslash/fixUnImplementedInterface17.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface17.ts rename to tests/cases/fourslash/fixUnImplementedInterface17.ts diff --git a/tests/cases/fourslash/unImplementedInterface18.ts b/tests/cases/fourslash/fixUnImplementedInterface18.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface18.ts rename to tests/cases/fourslash/fixUnImplementedInterface18.ts diff --git a/tests/cases/fourslash/unImplementedInterface19.ts b/tests/cases/fourslash/fixUnImplementedInterface19.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface19.ts rename to tests/cases/fourslash/fixUnImplementedInterface19.ts diff --git a/tests/cases/fourslash/unImplementedInterface20.ts b/tests/cases/fourslash/fixUnImplementedInterface20.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface20.ts rename to tests/cases/fourslash/fixUnImplementedInterface20.ts diff --git a/tests/cases/fourslash/unImplementedInterface21.ts b/tests/cases/fourslash/fixUnImplementedInterface21.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface21.ts rename to tests/cases/fourslash/fixUnImplementedInterface21.ts diff --git a/tests/cases/fourslash/unImplementedInterface22.ts b/tests/cases/fourslash/fixUnImplementedInterface22.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface22.ts rename to tests/cases/fourslash/fixUnImplementedInterface22.ts diff --git a/tests/cases/fourslash/unImplementedInterface23.ts b/tests/cases/fourslash/fixUnImplementedInterface23.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface23.ts rename to tests/cases/fourslash/fixUnImplementedInterface23.ts diff --git a/tests/cases/fourslash/unImplementedInterface24.ts b/tests/cases/fourslash/fixUnImplementedInterface24.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface24.ts rename to tests/cases/fourslash/fixUnImplementedInterface24.ts diff --git a/tests/cases/fourslash/unImplementedInterface25.ts b/tests/cases/fourslash/fixUnImplementedInterface25.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface25.ts rename to tests/cases/fourslash/fixUnImplementedInterface25.ts diff --git a/tests/cases/fourslash/unImplementedInterface26.ts b/tests/cases/fourslash/fixUnImplementedInterface26.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface26.ts rename to tests/cases/fourslash/fixUnImplementedInterface26.ts diff --git a/tests/cases/fourslash/unImplementedInterface27.ts b/tests/cases/fourslash/fixUnImplementedInterface27.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface27.ts rename to tests/cases/fourslash/fixUnImplementedInterface27.ts diff --git a/tests/cases/fourslash/unImplementedInterface28.ts b/tests/cases/fourslash/fixUnImplementedInterface28.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface28.ts rename to tests/cases/fourslash/fixUnImplementedInterface28.ts diff --git a/tests/cases/fourslash/unImplementedInterface29.ts b/tests/cases/fourslash/fixUnImplementedInterface29.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface29.ts rename to tests/cases/fourslash/fixUnImplementedInterface29.ts diff --git a/tests/cases/fourslash/unImplementedInterface30.ts b/tests/cases/fourslash/fixUnImplementedInterface30.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface30.ts rename to tests/cases/fourslash/fixUnImplementedInterface30.ts diff --git a/tests/cases/fourslash/unImplementedInterface31.ts b/tests/cases/fourslash/fixUnImplementedInterface31.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface31.ts rename to tests/cases/fourslash/fixUnImplementedInterface31.ts diff --git a/tests/cases/fourslash/unImplementedInterface32.ts b/tests/cases/fourslash/fixUnImplementedInterface32.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface32.ts rename to tests/cases/fourslash/fixUnImplementedInterface32.ts diff --git a/tests/cases/fourslash/unImplementedInterface33.ts b/tests/cases/fourslash/fixUnImplementedInterface33.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface33.ts rename to tests/cases/fourslash/fixUnImplementedInterface33.ts diff --git a/tests/cases/fourslash/unImplementedInterface34.ts b/tests/cases/fourslash/fixUnImplementedInterface34.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface34.ts rename to tests/cases/fourslash/fixUnImplementedInterface34.ts diff --git a/tests/cases/fourslash/unImplementedInterface35.ts b/tests/cases/fourslash/fixUnImplementedInterface35.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface35.ts rename to tests/cases/fourslash/fixUnImplementedInterface35.ts diff --git a/tests/cases/fourslash/unImplementedInterface36.ts b/tests/cases/fourslash/fixUnImplementedInterface36.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface36.ts rename to tests/cases/fourslash/fixUnImplementedInterface36.ts diff --git a/tests/cases/fourslash/unImplementedInterface37.ts b/tests/cases/fourslash/fixUnImplementedInterface37.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface37.ts rename to tests/cases/fourslash/fixUnImplementedInterface37.ts diff --git a/tests/cases/fourslash/unImplementedInterface38.ts b/tests/cases/fourslash/fixUnImplementedInterface38.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface38.ts rename to tests/cases/fourslash/fixUnImplementedInterface38.ts diff --git a/tests/cases/fourslash/unImplementedInterface39.ts b/tests/cases/fourslash/fixUnImplementedInterface39.ts similarity index 100% rename from tests/cases/fourslash/unImplementedInterface39.ts rename to tests/cases/fourslash/fixUnImplementedInterface39.ts From f74872dd69a47f50d2a9d55f65984338c3944c89 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 26 Oct 2016 11:30:52 -0700 Subject: [PATCH 018/289] temp --- src/compiler/checker.ts | 4 +++- .../codefixes/changeExtendsToImplementsFix.ts | 6 ++++++ tests/cases/fourslash/fixInterfaceInExtendsClause.ts | 11 +++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/fixInterfaceInExtendsClause.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 40332674567..893eb4365bd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1291,7 +1291,9 @@ namespace ts { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } - // Resolves a qualified name and any involved aliases + /** + * Resolves a qualified name and any involved aliases. + */ function resolveEntityName(name: EntityNameOrEntityNameExpression, meaning: SymbolFlags, ignoreErrors?: boolean, dontResolveAlias?: boolean, location?: Node): Symbol | undefined { if (nodeIsMissing(name)) { return undefined; diff --git a/src/services/codefixes/changeExtendsToImplementsFix.ts b/src/services/codefixes/changeExtendsToImplementsFix.ts index fd91ba1c8be..9dea26200ef 100644 --- a/src/services/codefixes/changeExtendsToImplementsFix.ts +++ b/src/services/codefixes/changeExtendsToImplementsFix.ts @@ -10,8 +10,14 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && token.parent.parent.kind === SyntaxKind.HeritageClause) { const children = (token.parent.parent).getChildren(); + + var hasImplements: boolean = ts.forEach(children, child => child.kind === SyntaxKind.ImplementsKeyword); + + var childInterfaces = children.filter(child => child.kind === SyntaxKind.InterfaceDeclaration) + ts.forEach(children, child => { if (child.kind === SyntaxKind.ExtendsKeyword) { + // TODO: (arozga) why is there a space before implements textChanges.push({ newText: " implements", span: { start: child.pos, length: child.end - child.pos } }); } }); diff --git a/tests/cases/fourslash/fixInterfaceInExtendsClause.ts b/tests/cases/fourslash/fixInterfaceInExtendsClause.ts new file mode 100644 index 00000000000..e9a20143acc --- /dev/null +++ b/tests/cases/fourslash/fixInterfaceInExtendsClause.ts @@ -0,0 +1,11 @@ +/// + +//// interface I { } +//// +//// class C extends I {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +`); From 132b7461d5a821f6b84ea4e3c430c0b99185284d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 26 Oct 2016 14:27:26 -0700 Subject: [PATCH 019/289] Covnert to Doc Comment --- src/compiler/checker.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 05ec69cf300..27e75843485 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3624,11 +3624,13 @@ namespace ts { return signatures; } - // The base constructor of a class can resolve to - // undefinedType if the class has no extends clause, - // unknownType if an error occurred during resolution of the extends expression, - // nullType if the extends expression is the null value, or - // an object type with at least one construct signature. + /** + * The base constructor of a class can resolve to + * * undefinedType if the class has no extends clause, + * * unknownType if an error occurred during resolution of the extends expression, + * * nullType if the extends expression is the null value, or + * * an object type with at least one construct signature. + */ function getBaseConstructorTypeOfClass(type: InterfaceType): Type { if (!type.resolvedBaseConstructorType) { const baseTypeNode = getBaseTypeNodeOfClass(type); From ecc029fd1c66886e31226bf126eadd9ef1e9d30e Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 26 Oct 2016 14:27:51 -0700 Subject: [PATCH 020/289] more temp --- src/services/codefixes/changeExtendsToImplementsFix.ts | 10 +++++++--- src/services/codefixes/interfaceFixes.ts | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/services/codefixes/changeExtendsToImplementsFix.ts b/src/services/codefixes/changeExtendsToImplementsFix.ts index 9dea26200ef..ebe277eb41c 100644 --- a/src/services/codefixes/changeExtendsToImplementsFix.ts +++ b/src/services/codefixes/changeExtendsToImplementsFix.ts @@ -11,9 +11,13 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && token.parent.parent.kind === SyntaxKind.HeritageClause) { const children = (token.parent.parent).getChildren(); - var hasImplements: boolean = ts.forEach(children, child => child.kind === SyntaxKind.ImplementsKeyword); - - var childInterfaces = children.filter(child => child.kind === SyntaxKind.InterfaceDeclaration) + // If there is already an implements keyword, we currently have incorrect behavior. + // For now, we suppress the quickfix altogether. + /* + if(ts.forEach(children, child => child.kind === SyntaxKind.ImplementsKeyword)) { + return undefined; + } + */ ts.forEach(children, child => { if (child.kind === SyntaxKind.ExtendsKeyword) { diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts index e4de977a77c..c379884ab5b 100644 --- a/src/services/codefixes/interfaceFixes.ts +++ b/src/services/codefixes/interfaceFixes.ts @@ -136,6 +136,7 @@ namespace ts.codefix { return getNamedClassMemberDeclarations(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); } + /* function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { const children = variableDeclaration.getChildren(); const variableMembers: string[] = []; @@ -157,6 +158,7 @@ namespace ts.codefix { return { startPos: startPos, members: variableMembers }; } + */ function getDefaultValue(kind: SyntaxKind): string { switch (kind) { From a66b0ae54ca22cce3eb08da0410aebbe4da3dd5c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 26 Oct 2016 16:57:43 -0700 Subject: [PATCH 021/289] Split CodeFixes in Separate Files --- Jakefile.js | 11 +- ...sDoesntImplementInheritedAbstractMember.ts | 34 +++ .../fixClassIncorrectlyImplementsInterface.ts | 39 +++ ... => fixClassSuperMustPrecedeThisAccess.ts} | 23 -- .../fixConstructorForDerivedNeedSuperCall.ts | 20 ++ ...> fixExtendsInterfaceBecomesImplements.ts} | 0 src/services/codefixes/fixes.ts | 8 +- src/services/codefixes/interfaceFixes.ts | 228 ------------------ src/services/tsconfig.json | 7 +- src/services/utilities.ts | 161 +++++++++++++ 10 files changed, 275 insertions(+), 256 deletions(-) create mode 100644 src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts create mode 100644 src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts rename src/services/codefixes/{superFixes.ts => fixClassSuperMustPrecedeThisAccess.ts} (68%) create mode 100644 src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts rename src/services/codefixes/{changeExtendsToImplementsFix.ts => fixExtendsInterfaceBecomesImplements.ts} (100%) delete mode 100644 src/services/codefixes/interfaceFixes.ts diff --git a/Jakefile.js b/Jakefile.js index cda7e2ca882..fcb5a482acd 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -149,6 +149,7 @@ var servicesSources = [ "signatureHelp.ts", "symbolDisplay.ts", "transpile.ts", + // Formatting "formatting/formatting.ts", "formatting/formattingContext.ts", "formatting/formattingRequestKind.ts", @@ -164,7 +165,15 @@ var servicesSources = [ "formatting/rulesMap.ts", "formatting/rulesProvider.ts", "formatting/smartIndenter.ts", - "formatting/tokenRange.ts" + "formatting/tokenRange.ts", + // CodeFixes + "codeFixes/codeFixProvider.ts", + "codeFixes/fixes.ts", + "codeFixes/fixExtendsInterfaceBecomesImplements.ts", + "codeFixes/fixClassIncorrectlyImplementsInterface.ts", + "codeFixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codeFixes/fixClassSuperMustPrecedeThisAccess.ts", + "codeFixes/fixConstructorForDerivedNeedSuperCall.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts new file mode 100644 index 00000000000..ce7eb04d2cd --- /dev/null +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -0,0 +1,34 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); + + if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { + const classDeclaration = token.parent; + const startPos = classDeclaration.members.pos; + // TODO: (arozga) actually get abstract members + const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); + const trackingAddedMembers: string[] = []; + const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); + let textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + + if (textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + } + + return undefined; + } + }); +} \ No newline at end of file diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts new file mode 100644 index 00000000000..9ff3a554c23 --- /dev/null +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -0,0 +1,39 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); + + if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { + const classDeclaration = token.parent; + const startPos: number = classDeclaration.members.pos; + const classMembers = ts.map(getNamedClassMembers(classDeclaration), member => member.name.getText()); + const trackingAddedMembers: string[] = []; + const interfaceClauses = ts.getClassImplementsHeritageClauseElements(classDeclaration); + + let textChanges: TextChange[] = undefined; + + for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { + let newChanges = getCodeFixChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; + } + + if (textChanges && textChanges.length > 0) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + } + } + + return undefined; + } + }); +} \ No newline at end of file diff --git a/src/services/codefixes/superFixes.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts similarity index 68% rename from src/services/codefixes/superFixes.ts rename to src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index f117799f3e1..4528c48774d 100644 --- a/src/services/codefixes/superFixes.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -1,28 +1,5 @@ /* @internal */ namespace ts.codefix { - function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile) { - // First token is the open curly, this is where we want to put the 'super' call. - return constructor.body.getFirstToken(sourceFile).getEnd(); - } - - registerCodeFix({ - errorCodes: [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const token = getTokenAtPosition(sourceFile, context.span.start); - - if (token.kind !== SyntaxKind.ConstructorKeyword) { - return undefined; - } - - const newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: getLocaleSpecificMessage(Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] - }]; - } - }); - registerCodeFix({ errorCodes: [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: (context: CodeFixContext) => { diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts new file mode 100644 index 00000000000..0dede87cf28 --- /dev/null +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -0,0 +1,20 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const token = getTokenAtPosition(sourceFile, context.span.start); + + if (token.kind !== SyntaxKind.ConstructorKeyword) { + return undefined; + } + + const newPosition = getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: getLocaleSpecificMessage(Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); +} \ No newline at end of file diff --git a/src/services/codefixes/changeExtendsToImplementsFix.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts similarity index 100% rename from src/services/codefixes/changeExtendsToImplementsFix.ts rename to src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index b1fdb9d43da..7df58b03f81 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -1,3 +1,5 @@ -/// -/// -/// +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/src/services/codefixes/interfaceFixes.ts b/src/services/codefixes/interfaceFixes.ts deleted file mode 100644 index c379884ab5b..00000000000 --- a/src/services/codefixes/interfaceFixes.ts +++ /dev/null @@ -1,228 +0,0 @@ -/* @internal */ -namespace ts.codefix { - registerCodeFix({ - errorCodes: [Diagnostics.Class_0_incorrectly_implements_interface_1.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - const checker = context.program.getTypeChecker(); - - if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { - const classDeclaration = token.parent; - const startPos: number = classDeclaration.members.pos; - const classMembers = ts.map(getNamedClassMemberDeclarations(classDeclaration), member => member.name.getText()); - const trackingAddedMembers: string[] = []; - const interfaceClauses = ts.getClassImplementsHeritageClauseElements(classDeclaration); - - let textChanges: TextChange[] = undefined; - - for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { - let newChanges = getChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); - textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; - } - - if (textChanges && textChanges.length > 0) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), - changes: [{ - fileName: sourceFile.fileName, - textChanges: textChanges - }] - }]; - } - } - - return undefined; - } - }); - - registerCodeFix({ - errorCodes: [Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - const checker = context.program.getTypeChecker(); - - let textChanges: TextChange[] = []; - - if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { - const classDeclaration = token.parent; - const startPos = classDeclaration.members.pos; - const abstractClassMembers = ts.map(getNamedClassAbstractMemberDeclarations(classDeclaration), member => member.name.getText()); - const trackingAddedMembers: string[] = []; - const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); - textChanges = textChanges.concat(getChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter)); - } - - if (textChanges.length > 0) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), - changes: [{ - fileName: sourceFile.fileName, - textChanges: textChanges - }] - }]; - } - - return undefined; - } - }); - - function getChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { - const type = checker.getTypeAtLocation(interfaceClause); - const changesArray: TextChange[] = []; - - if (type && type.symbol && type.symbol.declarations) { - const interfaceMembers = getMembers(type.symbol.declarations[0], checker); - for(let interfaceMember of interfaceMembers){ - if (interfaceMember.name && existingMembers.indexOf(interfaceMember.name.getText()) === -1) { - if (interfaceMember.kind === SyntaxKind.PropertySignature) { - const interfaceProperty = interfaceMember; - if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { - let propertyText = ""; - if (reference) { - propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; - } - else { - propertyText = interfaceProperty.getText(); - const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; - propertyText += stringToAdd; - } - changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceProperty.name.getText()); - } - } - else if (interfaceMember.kind === SyntaxKind.MethodSignature || interfaceMember.kind === SyntaxKind.MethodDeclaration) { - const interfaceMethod = interfaceMember; - handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); - } - } - } - } - - if (reference && existingMembers.length === 0 && changesArray.length > 0) { - let lastValue = changesArray[changesArray.length - 1].newText; - lastValue = `${lastValue.substr(0, lastValue.length - (newLineCharacter.length + 1))} ${newLineCharacter}`; - changesArray[changesArray.length - 1].newText = lastValue; - } - - return changesArray; - } - - function getMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { - const clauses = getInterfaceBaseTypeNodes(declaration); - let result: TypeElement[] = []; - for (let i = 0; clauses && i < clauses.length; i++) { - const type = checker.getTypeAtLocation(clauses[i]); - if (type && type.symbol && type.symbol.declarations) { - result = result.concat(getMembers(type.symbol.declarations[0], checker)); - } - } - - if (declaration.members) { - result = result.concat(declaration.members); - } - - return result; - } - - function getNamedClassMemberDeclarations(classDeclaration: ClassDeclaration): ClassElement[] { - return classDeclaration.members.filter(member => member.name); - } - - function getNamedClassAbstractMemberDeclarations(classDeclaration: ClassDeclaration): ClassElement[] { - return getNamedClassMemberDeclarations(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); - } - - /* - function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { - const children = variableDeclaration.getChildren(); - const variableMembers: string[] = []; - let startPos = 0; - - ts.forEach(children, child => { - if (child.kind === SyntaxKind.ObjectLiteralExpression) { - const properties = (child).properties; - if (properties) { - startPos = properties.pos; - } - for (let j = 0; properties && j < properties.length; j++) { - if (properties[j].name) { - variableMembers.push(properties[j].name.getText()); - } - } - } - }); - - return { startPos: startPos, members: variableMembers }; - } - */ - - function getDefaultValue(kind: SyntaxKind): string { - switch (kind) { - case SyntaxKind.StringKeyword: - return '""'; - case SyntaxKind.BooleanKeyword: - return "false"; - case SyntaxKind.NumberKeyword: - return "0"; - default: - return "null"; - } - } - - function handleMethods(interfaceMethod: MethodSignature, startPos: number, isReference: boolean, trackingAddedMembers: string[], textChanges: TextChange[], newLineCharacter: string) { - const methodBody = "throw new Error('Method not Implemented');"; - - if (trackingAddedMembers.indexOf(interfaceMethod.name.getText())) { - const methodName = interfaceMethod.name.getText(); - const typeParameterArray: string[] = []; - - for (let i = 0; interfaceMethod.typeParameters && i < interfaceMethod.typeParameters.length; i++) { - typeParameterArray.push(interfaceMethod.typeParameters[i].getText()); - } - - const parameterArray: string[] = []; - for (let j = 0; interfaceMethod.parameters && j < interfaceMethod.parameters.length; j++) { - parameterArray.push(interfaceMethod.parameters[j].getText()); - } - - let methodText = methodName; - if (typeParameterArray.length > 0) { - methodText += "<"; - } - - for (let k = 0; k < typeParameterArray.length; k++) { - methodText += typeParameterArray[k]; - if (k !== typeParameterArray.length - 1) { - methodText += ","; - } - } - - if (typeParameterArray.length > 0) { - methodText += ">"; - } - - methodText += "("; - for (let k = 0; k < parameterArray.length; k++) { - methodText += parameterArray[k]; - if (k !== parameterArray.length - 1) { - methodText += ","; - } - } - - methodText += `)`; - if (interfaceMethod.type) { - methodText += ":" + interfaceMethod.type.getText(); - } - - methodText += `{${newLineCharacter}${methodBody}${newLineCharacter}`; - methodText = isReference ? methodText.concat(`},${newLineCharacter}`) : methodText.concat(`}${newLineCharacter}`); - - textChanges.push({ newText: methodText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceMethod.name.getText()); - } - } -} diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index e81db68325c..b890e27f01e 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -85,6 +85,11 @@ "formatting/smartIndenter.ts", "formatting/tokenRange.ts", "codeFixes/codeFixProvider.ts", - "codeFixes/fixes.ts" + "codeFixes/fixes.ts", + "codeFixes/fixExtendsInterfaceBecomesImplements.ts", + "codeFixes/fixClassIncorrectlyImplementsInterface.ts", + "codeFixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codeFixes/fixClassSuperMustPrecedeThisAccess.ts", + "codeFixes/fixConstructorForDerivedNeedSuperCall.ts" ] } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 8fd5f510be0..ee8f348d15d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1358,4 +1358,165 @@ namespace ts { diagnostics: error ? concatenate(diagnostics, [error]) : diagnostics }; } + + export function getCodeFixChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { + const type = checker.getTypeAtLocation(interfaceClause); + const changesArray: TextChange[] = []; + + if (type && type.symbol && type.symbol.declarations) { + const interfaceMembers = getInterfaceMembers(type.symbol.declarations[0], checker); + for(let interfaceMember of interfaceMembers){ + if (interfaceMember.name && existingMembers.indexOf(interfaceMember.name.getText()) === -1) { + if (interfaceMember.kind === SyntaxKind.PropertySignature) { + const interfaceProperty = interfaceMember; + if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { + let propertyText = ""; + if (reference) { + propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; + } + else { + propertyText = interfaceProperty.getText(); + const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; + propertyText += stringToAdd; + } + changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceProperty.name.getText()); + } + } + else if (interfaceMember.kind === SyntaxKind.MethodSignature || interfaceMember.kind === SyntaxKind.MethodDeclaration) { + const interfaceMethod = interfaceMember; + handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); + } + } + } + } + + if (reference && existingMembers.length === 0 && changesArray.length > 0) { + let lastValue = changesArray[changesArray.length - 1].newText; + lastValue = `${lastValue.substr(0, lastValue.length - (newLineCharacter.length + 1))} ${newLineCharacter}`; + changesArray[changesArray.length - 1].newText = lastValue; + } + + return changesArray; + } + + function getInterfaceMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { + const clauses = getInterfaceBaseTypeNodes(declaration); + let result: TypeElement[] = []; + for (let i = 0; clauses && i < clauses.length; i++) { + const type = checker.getTypeAtLocation(clauses[i]); + if (type && type.symbol && type.symbol.declarations) { + result = result.concat(getInterfaceMembers(type.symbol.declarations[0], checker)); + } + } + + if (declaration.members) { + result = result.concat(declaration.members); + } + + return result; + } + + export function getNamedClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { + return classDeclaration.members.filter(member => member.name); + } + + export function getNamedAbstractClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { + return getNamedClassMembers(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); + } + + /* + function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { + const children = variableDeclaration.getChildren(); + const variableMembers: string[] = []; + let startPos = 0; + + ts.forEach(children, child => { + if (child.kind === SyntaxKind.ObjectLiteralExpression) { + const properties = (child).properties; + if (properties) { + startPos = properties.pos; + } + for (let j = 0; properties && j < properties.length; j++) { + if (properties[j].name) { + variableMembers.push(properties[j].name.getText()); + } + } + } + }); + + return { startPos: startPos, members: variableMembers }; + } + */ + + function getDefaultValue(kind: SyntaxKind): string { + switch (kind) { + case SyntaxKind.StringKeyword: + return '""'; + case SyntaxKind.BooleanKeyword: + return "false"; + case SyntaxKind.NumberKeyword: + return "0"; + default: + return "null"; + } + } + + function handleMethods(interfaceMethod: MethodSignature, startPos: number, isReference: boolean, trackingAddedMembers: string[], textChanges: TextChange[], newLineCharacter: string) { + const methodBody = "throw new Error('Method not Implemented');"; + + if (trackingAddedMembers.indexOf(interfaceMethod.name.getText())) { + const methodName = interfaceMethod.name.getText(); + const typeParameterArray: string[] = []; + + for (let i = 0; interfaceMethod.typeParameters && i < interfaceMethod.typeParameters.length; i++) { + typeParameterArray.push(interfaceMethod.typeParameters[i].getText()); + } + + const parameterArray: string[] = []; + for (let j = 0; interfaceMethod.parameters && j < interfaceMethod.parameters.length; j++) { + parameterArray.push(interfaceMethod.parameters[j].getText()); + } + + let methodText = methodName; + if (typeParameterArray.length > 0) { + methodText += "<"; + } + + for (let k = 0; k < typeParameterArray.length; k++) { + methodText += typeParameterArray[k]; + if (k !== typeParameterArray.length - 1) { + methodText += ","; + } + } + + if (typeParameterArray.length > 0) { + methodText += ">"; + } + + methodText += "("; + for (let k = 0; k < parameterArray.length; k++) { + methodText += parameterArray[k]; + if (k !== parameterArray.length - 1) { + methodText += ","; + } + } + + methodText += `)`; + if (interfaceMethod.type) { + methodText += ":" + interfaceMethod.type.getText(); + } + + methodText += `{${newLineCharacter}${methodBody}${newLineCharacter}`; + methodText = isReference ? methodText.concat(`},${newLineCharacter}`) : methodText.concat(`}${newLineCharacter}`); + + textChanges.push({ newText: methodText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceMethod.name.getText()); + } + } + + export function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile).getEnd(); + } } From 5d9a4e30541c27e757febb8a54df3db61776bdc0 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 26 Oct 2016 17:02:09 -0700 Subject: [PATCH 022/289] Move codeFixProvider.ts --- Jakefile.js | 2 +- src/services/{codefixes => }/codeFixProvider.ts | 0 src/services/services.ts | 2 +- src/services/tsconfig.json | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/services/{codefixes => }/codeFixProvider.ts (100%) diff --git a/Jakefile.js b/Jakefile.js index fcb5a482acd..763a204dc9c 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -167,7 +167,7 @@ var servicesSources = [ "formatting/smartIndenter.ts", "formatting/tokenRange.ts", // CodeFixes - "codeFixes/codeFixProvider.ts", + "codeFixProvider.ts", "codeFixes/fixes.ts", "codeFixes/fixExtendsInterfaceBecomesImplements.ts", "codeFixes/fixClassIncorrectlyImplementsInterface.ts", diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codeFixProvider.ts similarity index 100% rename from src/services/codefixes/codeFixProvider.ts rename to src/services/codeFixProvider.ts diff --git a/src/services/services.ts b/src/services/services.ts index 5669134d37e..6f9967f3cae 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -24,7 +24,7 @@ /// /// /// -/// +/// /// namespace ts { diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index b890e27f01e..b350380369c 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -84,7 +84,7 @@ "formatting/rulesProvider.ts", "formatting/smartIndenter.ts", "formatting/tokenRange.ts", - "codeFixes/codeFixProvider.ts", + "codeFixProvider.ts", "codeFixes/fixes.ts", "codeFixes/fixExtendsInterfaceBecomesImplements.ts", "codeFixes/fixClassIncorrectlyImplementsInterface.ts", From 3ac9ffa75ef3d954b42b8e34a5cb3974d63f5018 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 27 Oct 2016 16:33:33 -0700 Subject: [PATCH 023/289] Nerf Extends to implements For Now --- .../codefixes/fixExtendsInterfaceBecomesImplements.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index ebe277eb41c..a354b608915 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -13,20 +13,22 @@ namespace ts.codefix { // If there is already an implements keyword, we currently have incorrect behavior. // For now, we suppress the quickfix altogether. - /* + // TODO: (arozga) Fix this. if(ts.forEach(children, child => child.kind === SyntaxKind.ImplementsKeyword)) { return undefined; } - */ ts.forEach(children, child => { if (child.kind === SyntaxKind.ExtendsKeyword) { - // TODO: (arozga) why is there a space before implements + // Note: child.pos points to the space *before* `extends`. textChanges.push({ newText: " implements", span: { start: child.pos, length: child.end - child.pos } }); } }); } + // TODO: (arozga) Get Separate messages for + // 1) Change extends to implements + // 2) Move interface to extends clause if (textChanges.length > 0) { return [{ description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), From d24236b9332a573c6e448ba11e5a3c9c794de945 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 27 Oct 2016 16:39:47 -0700 Subject: [PATCH 024/289] Simplify getCodeFixChanges --- src/services/utilities.ts | 55 +++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index ee8f348d15d..57370cd45d1 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1363,32 +1363,33 @@ namespace ts { const type = checker.getTypeAtLocation(interfaceClause); const changesArray: TextChange[] = []; - if (type && type.symbol && type.symbol.declarations) { - const interfaceMembers = getInterfaceMembers(type.symbol.declarations[0], checker); - for(let interfaceMember of interfaceMembers){ - if (interfaceMember.name && existingMembers.indexOf(interfaceMember.name.getText()) === -1) { - if (interfaceMember.kind === SyntaxKind.PropertySignature) { - const interfaceProperty = interfaceMember; - if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { - let propertyText = ""; - if (reference) { - propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; - } - else { - propertyText = interfaceProperty.getText(); - const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; - propertyText += stringToAdd; - } - changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceProperty.name.getText()); - } + if (!(type && type.symbol && type.symbol.declarations && type.symbol.declarations.length > 0)) { + return []; + } + + const missingMembers = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); + + for (let member of missingMembers) { + if (member.kind === SyntaxKind.PropertySignature) { + const interfaceProperty = member; + if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { + let propertyText = ""; + if (reference) { + propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; } - else if (interfaceMember.kind === SyntaxKind.MethodSignature || interfaceMember.kind === SyntaxKind.MethodDeclaration) { - const interfaceMethod = interfaceMember; - handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); + else { + propertyText = interfaceProperty.getText(); + const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; + propertyText += stringToAdd; } + changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceProperty.name.getText()); } } + else if (member.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.MethodDeclaration) { + const interfaceMethod = member; + handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); + } } if (reference && existingMembers.length === 0 && changesArray.length > 0) { @@ -1400,6 +1401,9 @@ namespace ts { return changesArray; } + /** + * Gets members in an interface and all its base types. + */ function getInterfaceMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { const clauses = getInterfaceBaseTypeNodes(declaration); let result: TypeElement[] = []; @@ -1417,6 +1421,13 @@ namespace ts { return result; } + function getMissingInterfaceMembers(declaration: InterfaceDeclaration, existingMembers: string[], checker: TypeChecker): TypeElement[] { + let interfaceMembers = getInterfaceMembers(declaration, checker); + + return ts.filter(interfaceMembers, member => !member.name || existingMembers.indexOf(member.name.getText()) === -1); + + } + export function getNamedClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { return classDeclaration.members.filter(member => member.name); } From 7758e6dc9d8b1d7b284395ce09fda87a0b31a185 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 27 Oct 2016 18:39:49 -0700 Subject: [PATCH 025/289] Rename Most Tests --- .../codefix.ts => codeFixAddSuperCall.ts} | 0 .../codeFixClassExtendsAbstractPrivateNumber.ts | 16 ++++++++++++++++ ...codeFixObjectInterfaceMissingArrayNumber.ts} | 1 - ...odeFixObjectInterfaceMissingArrayNumber2.ts} | 0 ...codeFixObjectInterfaceMissingArrayString.ts} | 0 ...odeFixObjectInterfaceMissingArrayString2.ts} | 0 ... => codeFixObjectInterfaceMissingBoolean.ts} | 0 ...=> codeFixObjectInterfaceMissingBoolean2.ts} | 0 ...s => codeFixObjectInterfaceMissingClassT.ts} | 1 - ...> codeFixObjectInterfaceMissingFromUnion.ts} | 0 ...> codeFixObjectInterfaceMissingFunction1.ts} | 0 ...> codeFixObjectInterfaceMissingFunction2.ts} | 0 ...s => codeFixObjectInterfaceMissingNumber.ts} | 0 ... => codeFixObjectInterfaceMissingNumber2.ts} | 0 ... => codeFixObjectInterfaceMissingString1.ts} | 0 ... => codeFixObjectInterfaceMissingString2.ts} | 0 .../{superFix2.ts => codeFixReOrderSuper.ts} | 0 ...perFix3.ts => codeFixThisUsedInSuperCall.ts} | 0 ...36.ts => codeFixUnImplementedInterface36.ts} | 0 ...37.ts => codeFixUnImplementedInterface37.ts} | 0 ...38.ts => codeFixUnImplementedInterface38.ts} | 0 ...39.ts => codeFixUnImplementedInterface39.ts} | 0 ...bstractFunctionGenericParamExtendsNumber.ts} | 0 ...nericParamExtendsNumberViaHeritageClause.ts} | 0 ...ericParamExtendsNumberViaHeritageClause2.ts} | 0 ...actFunctionGenericParamViaHeritageClause.ts} | 0 ...MissingAbstractFunctionViaHeritageClause.ts} | 0 ...FixUnImplementedInterfaceMissingFunction.ts} | 0 ...mentedInterfaceMissingFunctionAndExtends.ts} | 0 ...ntedInterfaceMissingFunctionFromAbstract.ts} | 0 ...nctionFromAbstractClassViaHeritageClause.ts} | 0 ...erfaceMissingFunctionFromHeritageClause1.ts} | 1 - ...erfaceMissingFunctionFromHeritageClause2.ts} | 0 ...erfaceMissingFunctionFromHeritageClause3.ts} | 0 ...erfaceMissingFunctionFromHeritageClause4.ts} | 0 ...MissingFunctionGenericParamExtendsString.ts} | 0 ...tedInterfaceMissingFunctionGenericParams.ts} | 0 ...entedInterfaceMissingFunctionNoSemicolon.ts} | 0 ...mentedInterfaceMissingFunctionWithParams.ts} | 0 ...dInterfaceMissingFunctionWithParamsClass.ts} | 0 ...deFixUnImplementedInterfaceMissingNumber.ts} | 0 ...ementedInterfaceMissingNumberNoSemicolon.ts} | 0 .../fourslash/fixInterfaceInExtendsClause.ts | 11 ----------- .../fourslash/fixUnImplementedInterface27.ts | 17 ----------------- .../codeFixAddSuperCall.ts} | 0 45 files changed, 16 insertions(+), 31 deletions(-) rename tests/cases/fourslash/{server/codefix.ts => codeFixAddSuperCall.ts} (100%) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts rename tests/cases/fourslash/{fixUnImplementedInterface24.ts => codeFixObjectInterfaceMissingArrayNumber.ts} (92%) rename tests/cases/fourslash/{fixUnImplementedInterface25.ts => codeFixObjectInterfaceMissingArrayNumber2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface22.ts => codeFixObjectInterfaceMissingArrayString.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface23.ts => codeFixObjectInterfaceMissingArrayString2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface18.ts => codeFixObjectInterfaceMissingBoolean.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface21.ts => codeFixObjectInterfaceMissingBoolean2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface26.ts => codeFixObjectInterfaceMissingClassT.ts} (91%) rename tests/cases/fourslash/{fixUnImplementedInterface28.ts => codeFixObjectInterfaceMissingFromUnion.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface15.ts => codeFixObjectInterfaceMissingFunction1.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface14.ts => codeFixObjectInterfaceMissingFunction2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface17.ts => codeFixObjectInterfaceMissingNumber.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface20.ts => codeFixObjectInterfaceMissingNumber2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface16.ts => codeFixObjectInterfaceMissingString1.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface19.ts => codeFixObjectInterfaceMissingString2.ts} (100%) rename tests/cases/fourslash/{superFix2.ts => codeFixReOrderSuper.ts} (100%) rename tests/cases/fourslash/{superFix3.ts => codeFixThisUsedInSuperCall.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface36.ts => codeFixUnImplementedInterface36.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface37.ts => codeFixUnImplementedInterface37.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface38.ts => codeFixUnImplementedInterface38.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface39.ts => codeFixUnImplementedInterface39.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface34.ts => codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface33.ts => codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface35.ts => codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface32.ts => codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface31.ts => codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface01.ts => codeFixUnImplementedInterfaceMissingFunction.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface09.ts => codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface29.ts => codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface30.ts => codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface10.ts => codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts} (91%) rename tests/cases/fourslash/{fixUnImplementedInterface11.ts => codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface12.ts => codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface13.ts => codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface08.ts => codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface07.ts => codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface04.ts => codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface05.ts => codeFixUnImplementedInterfaceMissingFunctionWithParams.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface06.ts => codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface02.ts => codeFixUnImplementedInterfaceMissingNumber.ts} (100%) rename tests/cases/fourslash/{fixUnImplementedInterface03.ts => codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts} (100%) delete mode 100644 tests/cases/fourslash/fixInterfaceInExtendsClause.ts delete mode 100644 tests/cases/fourslash/fixUnImplementedInterface27.ts rename tests/cases/fourslash/{superFix1.ts => server/codeFixAddSuperCall.ts} (100%) diff --git a/tests/cases/fourslash/server/codefix.ts b/tests/cases/fourslash/codeFixAddSuperCall.ts similarity index 100% rename from tests/cases/fourslash/server/codefix.ts rename to tests/cases/fourslash/codeFixAddSuperCall.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts new file mode 100644 index 00000000000..a7218ec8fd5 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts @@ -0,0 +1,16 @@ +/// + +//// abstract class A { +//// private abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +// We don't know how to fix this problem. We can: +// 1) Make x protected, and then insert. +// 2) Make x private, and then insert. +// 3) Make x not abstract. +// So we offer no fixes for now. +// TODO: (arozga) change this behavior. +verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/fixUnImplementedInterface24.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts similarity index 92% rename from tests/cases/fourslash/fixUnImplementedInterface24.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts index dead538d04d..530a651315e 100644 --- a/tests/cases/fourslash/fixUnImplementedInterface24.ts +++ b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts @@ -4,7 +4,6 @@ //// x:Array; //// } //// -//// //// var x: I1 ={[| //// |]} diff --git a/tests/cases/fourslash/fixUnImplementedInterface25.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface25.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface22.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface22.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface23.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface23.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface18.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface18.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface21.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface21.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface26.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts similarity index 91% rename from tests/cases/fourslash/fixUnImplementedInterface26.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts index b75eac7184e..7343aeaf971 100644 --- a/tests/cases/fourslash/fixUnImplementedInterface26.ts +++ b/tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts @@ -6,7 +6,6 @@ //// //// class T {} //// -//// //// var x: I1 ={[| //// |]} diff --git a/tests/cases/fourslash/fixUnImplementedInterface28.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface28.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface15.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface15.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface14.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface14.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface17.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface17.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface20.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface20.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface16.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface16.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface19.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface19.ts rename to tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts diff --git a/tests/cases/fourslash/superFix2.ts b/tests/cases/fourslash/codeFixReOrderSuper.ts similarity index 100% rename from tests/cases/fourslash/superFix2.ts rename to tests/cases/fourslash/codeFixReOrderSuper.ts diff --git a/tests/cases/fourslash/superFix3.ts b/tests/cases/fourslash/codeFixThisUsedInSuperCall.ts similarity index 100% rename from tests/cases/fourslash/superFix3.ts rename to tests/cases/fourslash/codeFixThisUsedInSuperCall.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface36.ts rename to tests/cases/fourslash/codeFixUnImplementedInterface36.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface37.ts b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface37.ts rename to tests/cases/fourslash/codeFixUnImplementedInterface37.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface38.ts b/tests/cases/fourslash/codeFixUnImplementedInterface38.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface38.ts rename to tests/cases/fourslash/codeFixUnImplementedInterface38.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface39.ts rename to tests/cases/fourslash/codeFixUnImplementedInterface39.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface34.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface34.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface33.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface33.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface35.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface35.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface32.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface32.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface31.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface31.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface01.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface01.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface09.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface09.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface29.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface29.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface30.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface30.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface10.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts similarity index 91% rename from tests/cases/fourslash/fixUnImplementedInterface10.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts index aa61cbc1836..c6c2998ac9a 100644 --- a/tests/cases/fourslash/fixUnImplementedInterface10.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts @@ -8,7 +8,6 @@ //// //// } //// -//// //// class C1 implements I2 {[| //// |]} diff --git a/tests/cases/fourslash/fixUnImplementedInterface11.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface11.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface12.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface12.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface13.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface13.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface08.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface08.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface07.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface07.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface04.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface04.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface05.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface05.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface06.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface06.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface02.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface02.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts diff --git a/tests/cases/fourslash/fixUnImplementedInterface03.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts similarity index 100% rename from tests/cases/fourslash/fixUnImplementedInterface03.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts diff --git a/tests/cases/fourslash/fixInterfaceInExtendsClause.ts b/tests/cases/fourslash/fixInterfaceInExtendsClause.ts deleted file mode 100644 index e9a20143acc..00000000000 --- a/tests/cases/fourslash/fixInterfaceInExtendsClause.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -//// interface I { } -//// -//// class C extends I {[| -//// |]} - -verify.codeFixAtPosition(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/fixUnImplementedInterface27.ts b/tests/cases/fourslash/fixUnImplementedInterface27.ts deleted file mode 100644 index 10460158694..00000000000 --- a/tests/cases/fourslash/fixUnImplementedInterface27.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -//// interface I1 { -//// x:T; -//// f1(); -//// } -//// -//// class T {} -//// -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/superFix1.ts b/tests/cases/fourslash/server/codeFixAddSuperCall.ts similarity index 100% rename from tests/cases/fourslash/superFix1.ts rename to tests/cases/fourslash/server/codeFixAddSuperCall.ts From 72728337e00a0e8cec2b9bb1fe145bfdeb82afad Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 28 Oct 2016 11:48:01 -0700 Subject: [PATCH 026/289] Rename and Add a Test --- ...sFS1.ts => codeFixChangeExtendsToImplementsFS1.ts} | 0 ...sFS2.ts => codeFixChangeExtendsToImplementsFS2.ts} | 0 .../fourslash/codeFixClassExtendsAbstractNumber.ts | 11 +++++++++++ 3 files changed, 11 insertions(+) rename tests/cases/fourslash/{changeExtendsToImplementsFS1.ts => codeFixChangeExtendsToImplementsFS1.ts} (100%) rename tests/cases/fourslash/{changeExtendsToImplementsFS2.ts => codeFixChangeExtendsToImplementsFS2.ts} (100%) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts diff --git a/tests/cases/fourslash/changeExtendsToImplementsFS1.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts similarity index 100% rename from tests/cases/fourslash/changeExtendsToImplementsFS1.ts rename to tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts diff --git a/tests/cases/fourslash/changeExtendsToImplementsFS2.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts similarity index 100% rename from tests/cases/fourslash/changeExtendsToImplementsFS2.ts rename to tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts new file mode 100644 index 00000000000..134c1979dce --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`x: number; +`); From 834245cd8f0db5560ee511c7483c852236151c1c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 28 Oct 2016 11:57:30 -0700 Subject: [PATCH 027/289] Add Failing Tests --- .../codeFixClassExtendsAbstractFunction.ts | 13 ++++ ...eFixClassExtendsAbstractProtectedNumber.ts | 11 ++++ ...codeFixClassExtendsAbstractPublicNumber.ts | 11 ++++ .../codeFixInterfaceInExtendsClause.ts | 12 ++++ ...mentedInterfaceMissingMultipleFunctions.ts | 22 +++++++ ...MissingMultipleFunctionsDeepInheritance.ts | 62 +++++++++++++++++++ 6 files changed, 131 insertions(+) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts create mode 100644 tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts new file mode 100644 index 00000000000..6bed7a3fe0f --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts @@ -0,0 +1,13 @@ +/// + +//// abstract class A { +//// abstract f(); +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`f(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts new file mode 100644 index 00000000000..7f525632fc5 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// protected abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`protected x: number; +`); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts new file mode 100644 index 00000000000..82cafbd86ad --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// public abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`public x: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts new file mode 100644 index 00000000000..c08cdc30952 --- /dev/null +++ b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts @@ -0,0 +1,12 @@ +/// + +//// interface I { +//// f1(); +//// } +//// +//// class /*0*/C/*1*/ /*2*/extend/*3*/s/*4*/ /*5*/I/*6*/ {/*7*/} + +for (let i = 0; i < 8; ++i) { + goTo.marker("" + i); + verify.codeFixAtPosition(""); +} \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts new file mode 100644 index 00000000000..02415491191 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts @@ -0,0 +1,22 @@ +/// + +//// class C1 { +//// f1(); +//// } +//// +//// class C2 { +//// f2(); +//// } +//// +//// interface I1 extends C1, C2 {} +//// +//// class C3 implements I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +f2(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts new file mode 100644 index 00000000000..729df3a91c8 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts @@ -0,0 +1,62 @@ +/// + + +//// // Referenced throughout the inheritance chain. +//// interface I0 { a: number } +//// +//// class C1 implements I0 { a: number } +//// interface I1 { b: number } +//// interface I2 extends C1, I1 {} +//// +//// class C2 { c: number } +//// interface I3 {d: number} +//// class C3 extends C2 implements I0, I2, I3 { +//// a: number; +//// b: number; +//// d: number; +//// } +//// +//// interface I4 { e: number } +//// interface I5 { f: number } +//// class C4 extends C3 implements I0, I4, I5 { +//// e: number; +//// f: number; +//// } +//// +//// interface I6 extends C4 {} +//// class C5 implements I6 {[| +//// |]} + + +/** + * We want to check whether the search for member to replace actually searches through + * the various possible paths of the inheritance chain correctly, and that We + * don't issue duplicates for the same member. + * + * Our class DAG: + * + * C5 + * |-I6 + * |-C4 + * |-I4 + * |-I5 + * |------------------------ I0 + * |-C3 + * |-I2 + * |-I1 + * |-C1 + * |-------------------I0 + * |-I3 + * |-----------------------I0 + * |-C2 + */ + + +verify.codeFixAtPosition( +`a: number; +b: number; +c: number; +d: number; +e: number: +f: number; +`); From c89b97b56a9f91977bdf6e4a8499644edf395d99 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 28 Oct 2016 18:38:03 -0700 Subject: [PATCH 028/289] Add removeAbstractModifier Fix Still need to add localization strings --- Jakefile.js | 3 +- ...emoveAbstractModifierInNonAbstractClass.ts | 42 +++++++++++++++++++ src/services/codefixes/fixes.ts | 3 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts diff --git a/Jakefile.js b/Jakefile.js index 763a204dc9c..37227ced4b5 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -173,7 +173,8 @@ var servicesSources = [ "codeFixes/fixClassIncorrectlyImplementsInterface.ts", "codeFixes/fixClassDoesntImplementInheritedAbstractMember.ts", "codeFixes/fixClassSuperMustPrecedeThisAccess.ts", - "codeFixes/fixConstructorForDerivedNeedSuperCall.ts" + "codeFixes/fixConstructorForDerivedNeedSuperCall.ts", + "codeFixes/fixRemoveAbstractModifierInNonAbstractClass.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); diff --git a/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts b/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts new file mode 100644 index 00000000000..4fdd58c31a5 --- /dev/null +++ b/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts @@ -0,0 +1,42 @@ +/* @internal */ +namespace ts.codefix { + registerCodeFix({ + errorCodes: [Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class.code], + getCodeActions: (context: CodeFixContext) => { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + + Debug.assert(token.kind === SyntaxKind.AbstractKeyword); + + const propertyDeclaration = token.parent; + const classDeclaration = propertyDeclaration.parent; + const classKeywordStart = classDeclaration.getChildren()[0].getStart(); + + let codeFix: CodeAction[] = [ + { + description: `Remove abstract modifier from ${propertyDeclaration.name.getText()}.`, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: {start: start, length: context.span.length + /*space*/ 1}, + newText: "" + }] + }] + }, + { + description: `Make class ${classDeclaration.name.getText()} abstract.`, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: classKeywordStart, length: 0 }, + newText: "abstract " + }] + }] + } + ]; + + return codeFix; + } + }); +} diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index 7df58b03f81..982b6abc84b 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -2,4 +2,5 @@ /// /// /// -/// \ No newline at end of file +/// +/// \ No newline at end of file From 16dc834d2de8fa3c0f2cf6669a9d86039d66edf2 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 28 Oct 2016 18:39:17 -0700 Subject: [PATCH 029/289] extends->implements w/ implements keyword present --- .../fixExtendsInterfaceBecomesImplements.ts | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index a354b608915..f9d3bbcf57a 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -6,40 +6,43 @@ namespace ts.codefix { const sourceFile = context.sourceFile; const start = context.span.start; const token = getTokenAtPosition(sourceFile, start); + + if (!(token.kind === SyntaxKind.Identifier && token.parent.parent.parent.kind === SyntaxKind.ClassDeclaration)) { + return undefined; + } + const textChanges: TextChange[] = []; - if (token.kind === SyntaxKind.Identifier && token.parent.parent.kind === SyntaxKind.HeritageClause) { - const children = (token.parent.parent).getChildren(); + const heritageNodes = (token.parent.parent).getChildren(); - // If there is already an implements keyword, we currently have incorrect behavior. - // For now, we suppress the quickfix altogether. - // TODO: (arozga) Fix this. - if(ts.forEach(children, child => child.kind === SyntaxKind.ImplementsKeyword)) { - return undefined; - } + // This should never fail + Debug.assert(heritageNodes.length > 0); + const extendsIndex = 0; + const extendsNode = heritageNodes[0]; - ts.forEach(children, child => { - if (child.kind === SyntaxKind.ExtendsKeyword) { - // Note: child.pos points to the space *before* `extends`. - textChanges.push({ newText: " implements", span: { start: child.pos, length: child.end - child.pos } }); - } - }); + Debug.assert(extendsIndex === 0); + + // We change the extends keyword to implements. + textChanges.push({ newText: " implements", span: { start: extendsNode.pos, length: extendsNode.end - extendsNode.pos } }); + + try { + // If the implements keyword exists, we replace it with a comma. + const implementsToken = token.parent.parent.parent.getChildren()[2].getChildren()[1]; + Debug.assert(implementsToken.token === SyntaxKind.ImplementsKeyword); + const implementsNode = implementsToken.getChildren()[0]; + textChanges.push({ newText: ",", span: { start: implementsNode.pos, length: implementsNode.end - implementsToken.pos } }); } + catch (e) {} - // TODO: (arozga) Get Separate messages for - // 1) Change extends to implements - // 2) Move interface to extends clause - if (textChanges.length > 0) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), - changes: [{ - fileName: sourceFile.fileName, - textChanges: textChanges - }] - }]; - } - - return undefined; + return [{ + // TODO: (arozga) Move the locale-specific conversion further up the stack, since all + // the codefixes will need to call this? + description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; } }); } From cbaea9996ccfbeb1326f4aba454138d66706b89d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 31 Oct 2016 14:47:02 -0700 Subject: [PATCH 030/289] Cleanup Extends -> Interface Change --- .../fixExtendsInterfaceBecomesImplements.ts | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index f9d3bbcf57a..4841bc43db4 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -11,38 +11,36 @@ namespace ts.codefix { return undefined; } - const textChanges: TextChange[] = []; + const extendsNode = (token.parent.parent as HeritageClause).getChildren()[0]; - const heritageNodes = (token.parent.parent).getChildren(); - - // This should never fail - Debug.assert(heritageNodes.length > 0); - const extendsIndex = 0; - const extendsNode = heritageNodes[0]; - - Debug.assert(extendsIndex === 0); - - // We change the extends keyword to implements. - textChanges.push({ newText: " implements", span: { start: extendsNode.pos, length: extendsNode.end - extendsNode.pos } }); - - try { - // If the implements keyword exists, we replace it with a comma. - const implementsToken = token.parent.parent.parent.getChildren()[2].getChildren()[1]; - Debug.assert(implementsToken.token === SyntaxKind.ImplementsKeyword); - const implementsNode = implementsToken.getChildren()[0]; - textChanges.push({ newText: ",", span: { start: implementsNode.pos, length: implementsNode.end - implementsToken.pos } }); - } - catch (e) {} - - return [{ - // TODO: (arozga) Move the locale-specific conversion further up the stack, since all - // the codefixes will need to call this? + let result = [{ description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), changes: [{ fileName: sourceFile.fileName, - textChanges: textChanges + textChanges: [{ newText: " implements", span: { start: extendsNode.pos, length: extendsNode.end - extendsNode.pos } }] }] }]; + + // We check if the implements keyword is present and replace it with a comma if so. + const classDeclChildren = (token.parent.parent.parent as ClassDeclaration).getChildren(); + if (classDeclChildren.length < 3) { + return result; + } + + let classSyntaxListChildren: Node[]; + if (classDeclChildren[2].kind !== SyntaxKind.SyntaxList || (classSyntaxListChildren = classDeclChildren[2].getChildren()).length < 2) { + return result; + } + + let implementsTokenChildren: Node[]; + if ((classSyntaxListChildren[1] as HeritageClause).token !== SyntaxKind.ImplementsKeyword || (implementsTokenChildren = classSyntaxListChildren[1].getChildren()).length === 0) { + return result; + } + + const implementsNode = implementsTokenChildren[0]; + result[0].changes[0].textChanges.push({ newText: ",", span: { start: implementsNode.pos, length: implementsNode.end - implementsNode.pos } }); + + return result; } }); } From bc2134681de541b58ecea295c36b2d23f43f883c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 1 Nov 2016 15:38:07 -0700 Subject: [PATCH 031/289] Refactor fourslash testing for codeFixes --- src/harness/fourslash.ts | 157 ++++++++++++++++++++++------- tests/cases/fourslash/fourslash.ts | 5 + 2 files changed, 127 insertions(+), 35 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index e9fa5d6be2e..f469a50fdd0 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -44,6 +44,14 @@ namespace FourSlash { markers: Marker[]; + /** + * Inserted in source files by surrounding desired text + * in a range with `[|` and `|]`. For example, + * + * [|text in range|] + * + * is a range with `text in range` "selected". + */ ranges: Range[]; } @@ -84,6 +92,15 @@ namespace FourSlash { end: number; } + export interface ErrorIdentifier { + code: number; + /** + * In a file where there is more than one error with code `code`, `count` refers + * to which 0-indexed error, sorted by order of occurence, to consider. + */ + count: number; + } + export import IndentStyle = ts.IndentStyle; const entityMap = ts.createMap({ @@ -1575,11 +1592,11 @@ namespace FourSlash { let runningOffset = 0; edits = edits.sort((a, b) => a.span.start - b.span.start); // Get a snapshot of the content of the file so we can make sure any formatting edits didn't destroy non-whitespace characters - const oldContent = this.getFileContent(this.activeFile.fileName); - for (let j = 0; j < edits.length; j++) { - this.languageServiceAdapterHost.editScript(fileName, edits[j].span.start + runningOffset, ts.textSpanEnd(edits[j].span) + runningOffset, edits[j].newText); - this.updateMarkersForEdit(fileName, edits[j].span.start + runningOffset, ts.textSpanEnd(edits[j].span) + runningOffset, edits[j].newText); - const change = (edits[j].span.start - ts.textSpanEnd(edits[j].span)) + edits[j].newText.length; + const oldContent = this.getFileContent(fileName); + for (const edit of edits) { + this.languageServiceAdapterHost.editScript(fileName, edit.span.start + runningOffset, ts.textSpanEnd(edit.span) + runningOffset, edit.newText); + this.updateMarkersForEdit(fileName, edit.span.start + runningOffset, ts.textSpanEnd(edit.span) + runningOffset, edit.newText); + const change = (edit.span.start - ts.textSpanEnd(edit.span)) + edit.newText.length; runningOffset += change; // TODO: Consider doing this at least some of the time for higher fidelity. Currently causes a failure (bug 707150) // this.languageService.getScriptLexicalStructure(fileName); @@ -1595,6 +1612,12 @@ namespace FourSlash { return runningOffset; } + private applyCodeAction(action: ts.CodeAction): void { + for (const filechange of action.changes) { + this.applyEdits(filechange.fileName, filechange.textChanges, /*isFormattingEdit*/ false); + } + } + public copyFormatOptions(): ts.FormatCodeSettings { return ts.clone(this.formatCodeSettings); } @@ -2019,40 +2042,33 @@ namespace FourSlash { } } - private getCodeFixes(errorCode?: number) { - const fileName = this.activeFile.fileName; - const diagnostics = this.getDiagnostics(fileName); - - if (diagnostics.length === 0) { - this.raiseError("Errors expected."); - } - - if (diagnostics.length > 1 && errorCode !== undefined) { - this.raiseError("When there's more than one error, you must specify the errror to fix."); - } - - const diagnostic = !errorCode ? diagnostics[0] : ts.find(diagnostics, d => d.code == errorCode); - - return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]); - } - + /** + * Compares expected text to the text that would be in the sole range + * (ie: [|...|]) in the file after applying the codefix corresponding + * to the error with errorCode, or of the sole error in the source file. + * + * Because codefixes are only applied on the working file, it is unsafe + * to apply this more than once (consider a refactoring across files). + */ public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) { const ranges = this.getRanges(); - if (ranges.length == 0) { - this.raiseError("At least one range should be specified in the testfile."); + if (ranges.length !== 1) { + this.raiseError("Exactly one range should be specified in the testfile."); } - const actual = this.getCodeFixes(errorCode); + const fileName = this.activeFile.fileName; + const codeFix: ts.CodeAction = this.getCodeFix(fileName, errorCode ? { code: errorCode, count: 0 } : undefined); - if (!actual || actual.length == 0) { - this.raiseError("No codefixes returned."); + if (!codeFix) { + this.raiseError("Should find exactly one codefix."); } - if (actual.length > 1) { - this.raiseError("More than 1 codefix returned."); + const fileChange = ts.find(codeFix.changes, change => change.fileName === fileName); + if (!fileChange) { + this.raiseError("CodeFix found doesn't provide any changes in this file."); } - this.applyEdits(actual[0].changes[0].fileName, actual[0].changes[0].textChanges, /*isFormattingEdit*/ false); + this.applyEdits(fileChange.fileName, fileChange.textChanges, /*isFormattingEdit*/ false); const actualText = this.rangeText(ranges[0]); if (this.removeWhitespace(actualText) !== this.removeWhitespace(expectedText)) { @@ -2060,6 +2076,73 @@ namespace FourSlash { } } + /** + * Applies fixes for the errors in fileName and compares the results to + * expectedContents after all fixes have been applied. + * + * Note: applying one codefix may generate another (eg: remove duplicate implements + * may generate an extends -> interface conversion fix). + * @param expectedContents The contents of the file after the fixes are applied. + * @param fileName The file to check. If not supplied, the current open file is used. + * @param errorsToFix An array of errors for which quickfixes will be applied. If not + * supplied, all codefixes in the file are applied until none are left, starting from + * the first available codefix. + * + */ + public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]) { + fileName = fileName ? fileName : this.activeFile.fileName; + + if (errorsToFix) { + for (const error of errorsToFix) { + const fix = this.getCodeFix(fileName, error); + if (fix === undefined) { + this.raiseError(`Couldn't find the ${error.count}'th error with code ${error.code}.`); + } + this.applyCodeAction(fix); + } + } + else { + let fix: ts.CodeAction; + while (fix = this.getCodeFix(fileName)) { + this.applyCodeAction(fix); + } + } + + const actualContents: string = this.getFileContent(fileName); + if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { + this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n${expectedContents}`); + } + } + + /** + * Rerieves a codefix satisfying the parameters, or undefined if no such codefix is found. + * @param fileName Path to file where error should be retrieved from. + * @param error We get the `error.count`'th codefix with code `error.code`. + * + * If undefined, we get the first codefix available. + */ + private getCodeFix(fileName: string, error?: ErrorIdentifier): ts.CodeAction | undefined { + const diagnostics: ts.Diagnostic[] = this.getDiagnostics(fileName); + const errorCount = error ? error.count : 0; + + let countSeen = 0; + for (const diagnostic of diagnostics) { + if (error && error.code !== diagnostic.code) { + continue; + } + const action = this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]); + if (action) { + if (action.length > errorCount - countSeen) { + return action[errorCount - countSeen]; + } + else { + countSeen += action.length; + } + } + } + return undefined; + } + public verifyDocCommentTemplate(expected?: ts.TextInsertion) { const name = "verifyDocCommentTemplate"; const actual = this.languageService.getDocCommentTemplateAtPosition(this.activeFile.fileName, this.currentCaretPosition); @@ -2344,14 +2427,14 @@ namespace FourSlash { } public verifyCodeFixAvailable(negative: boolean, errorCode?: number) { - const fixes = this.getCodeFixes(errorCode); + const codeFix = this.getCodeFix(this.activeFile.fileName, errorCode ? { code: errorCode, count: 0 } : undefined); - if (negative && fixes && fixes.length > 0) { - this.raiseError(`verifyCodeFixAvailable failed - expected no fixes, actual: ${fixes.length}`); + if (negative && codeFix) { + this.raiseError(`verifyCodeFixAvailable failed - expected no fixes but found one.`); } - if (!negative && (fixes === undefined || fixes.length === 0)) { - this.raiseError(`verifyCodeFixAvailable failed - expected code fixes, actual: 0`); + if (!(negative || codeFix)) { + this.raiseError(`verifyCodeFixAvailable failed - expected code fixes but none found.`); } } @@ -3329,6 +3412,10 @@ namespace FourSlashInterface { this.state.verifyCodeFixAtPosition(expectedText, errorCode); } + public fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: FourSlash.ErrorIdentifier[]): void { + this.state.verifyFileAfterCodeFix(expectedContents, fileName, errorsToFix); + } + public navigationBar(json: any) { this.state.verifyNavigationBar(json); } diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 0a72d295295..3b5c0c1e897 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -98,6 +98,10 @@ declare namespace FourSlashInterface { start: number; end: number; } + interface ErrorIdentifier { + code: number; + count: number + } class test_ { markers(): Marker[]; markerNames(): string[]; @@ -210,6 +214,7 @@ declare namespace FourSlashInterface { DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; codeFixAtPosition(expectedText: string, errorCode?: number): void; + fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]): void; navigationBar(json: any): void; navigationTree(json: any): void; From 99ae5d9a999cb1e30dfabf391f5abf5bcac1f156 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 1 Nov 2016 15:38:35 -0700 Subject: [PATCH 032/289] Remove unused tests --- .../codeFixInterfaceInExtendsClause.ts | 20 +++++++++-------- ...odeFixObjectInterfaceMissingArrayNumber.ts | 12 ---------- ...deFixObjectInterfaceMissingArrayNumber2.ts | 15 ------------- ...odeFixObjectInterfaceMissingArrayString.ts | 13 ----------- ...deFixObjectInterfaceMissingArrayString2.ts | 15 ------------- .../codeFixObjectInterfaceMissingBoolean.ts | 13 ----------- .../codeFixObjectInterfaceMissingBoolean2.ts | 15 ------------- .../codeFixObjectInterfaceMissingClassT.ts | 14 ------------ .../codeFixObjectInterfaceMissingFromUnion.ts | 22 ------------------- .../codeFixObjectInterfaceMissingFunction1.ts | 16 -------------- .../codeFixObjectInterfaceMissingFunction2.ts | 17 -------------- .../codeFixObjectInterfaceMissingNumber.ts | 12 ---------- .../codeFixObjectInterfaceMissingNumber2.ts | 15 ------------- .../codeFixObjectInterfaceMissingString1.ts | 13 ----------- .../codeFixObjectInterfaceMissingString2.ts | 14 ------------ .../codeFixUnImplementedInterface38.ts | 12 ---------- 16 files changed, 11 insertions(+), 227 deletions(-) delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts delete mode 100644 tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface38.ts diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts index c08cdc30952..82debc0109a 100644 --- a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts +++ b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts @@ -1,12 +1,14 @@ /// -//// interface I { -//// f1(); -//// } -//// -//// class /*0*/C/*1*/ /*2*/extend/*3*/s/*4*/ /*5*/I/*6*/ {/*7*/} +//// interface I1 { } +//// class C1 extends I1 { } +//// interface I2 { } +//// class C2 extends I2 { } -for (let i = 0; i < 8; ++i) { - goTo.marker("" + i); - verify.codeFixAtPosition(""); -} \ No newline at end of file +// verify.codeFixAvailable(); +verify.fileAfterCodeFixes(` +interface I1 { } +class C1 implements I1 { } +interface I2 { } +class C2 implements I2 { } +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts deleted file mode 100644 index 530a651315e..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -//// interface I1 { -//// x:Array; -//// } -//// -//// var x: I1 ={[| -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts deleted file mode 100644 index 84a018edc16..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayNumber2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// x:Array; -//// f1(); -//// } -//// -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts deleted file mode 100644 index 8caeb26eb45..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -//// interface I1 { -//// x:[string]; -//// } -//// -//// -//// var x: I1 ={[| -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts deleted file mode 100644 index 70e3db4f57d..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingArrayString2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// x:[string]; -//// f1(); -//// } -//// -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts deleted file mode 100644 index 0fa0eaefa56..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -//// interface I1 { -//// x:boolean; -//// } -//// -//// var x: I1 ={[| -//// -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : false -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts deleted file mode 100644 index 39e9aaf0e96..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingBoolean2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// x:boolean; -//// f1(); -//// } -//// -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : false, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts deleted file mode 100644 index 7343aeaf971..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingClassT.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -//// interface I1 { -//// x:T; -//// } -//// -//// class T {} -//// -//// var x: I1 ={[| -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : null -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts deleted file mode 100644 index 0e3aa3e95fb..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingFromUnion.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -//// interface I1 { -//// f1(); -//// } -//// -//// interface I2 { -//// f2(); -//// } -//// -//// var x: I1|I2 ={[| -//// -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`f1(){ -// throw new Error('Method not Implemented'); -// } -// f2(){ -// throw new Error('Method not Implemented'); -// } -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts deleted file mode 100644 index 005ece4ea50..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction1.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -//// interface I1 { -//// f1(); -//// } -//// -//// var x: I1 = {[| -//// -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(` -// f1(){ -// throw new Error('Method not Implemented'); -// } -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts deleted file mode 100644 index d5da3231b7b..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingFunction2.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -//// interface I1 { -//// f1(); -//// f2(); -//// } -//// -//// -//// var x: I1 ={[| -//// |]f2() {} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`f1(){ -// throw new Error('Method not Implemented'); -// }, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts deleted file mode 100644 index 7fa3cc61be3..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -//// interface I1 { -//// x:number; -//// } -//// -//// var x: I1 ={[| -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : 0 -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts deleted file mode 100644 index ffd3c8914b8..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingNumber2.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// x:number; -//// f1(); -//// } -//// -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : 0, -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts deleted file mode 100644 index 091174b47c4..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingString1.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -//// interface I1 { -//// x:string; -//// } -//// -//// -//// var x: I1 ={[| -//// |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : "" -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts b/tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts deleted file mode 100644 index d037a8611b3..00000000000 --- a/tests/cases/fourslash/codeFixObjectInterfaceMissingString2.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -//// interface I1 { -//// x:string; -//// f1(); -//// } -//// -//// var x: I1 ={[| -//// |]f1(){} -//// } - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`x : "", -// `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface38.ts b/tests/cases/fourslash/codeFixUnImplementedInterface38.ts deleted file mode 100644 index 8d1e06c4c47..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface38.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -//// abstract class C2 { -//// abstract f1(); -//// } -//// -//// var x: C2 = {[| |]} - -verify.not.codeFixAvailable(); -// verify.codeFixAtPosition(`f1(){ -// throw new Error('Method not Implemented'); -// }`); \ No newline at end of file From aa6ecd4154fbb7e1e74804b46e035d6a1a0eae7d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 1 Nov 2016 15:39:01 -0700 Subject: [PATCH 033/289] Fix linting errors --- .../fixClassDoesntImplementInheritedAbstractMember.ts | 3 +-- .../codefixes/fixClassIncorrectlyImplementsInterface.ts | 2 +- .../codefixes/fixExtendsInterfaceBecomesImplements.ts | 2 +- .../fixRemoveAbstractModifierInNonAbstractClass.ts | 6 ++---- src/services/utilities.ts | 6 +++--- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index ce7eb04d2cd..3a209fbc27d 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -11,11 +11,10 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos = classDeclaration.members.pos; - // TODO: (arozga) actually get abstract members const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); const trackingAddedMembers: string[] = []; const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); - let textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); if (textChanges.length > 0) { return [{ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 9ff3a554c23..c8c84715a3d 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -18,7 +18,7 @@ namespace ts.codefix { let textChanges: TextChange[] = undefined; for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { - let newChanges = getCodeFixChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + const newChanges = getCodeFixChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; } diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 4841bc43db4..e462d7416f7 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -13,7 +13,7 @@ namespace ts.codefix { const extendsNode = (token.parent.parent as HeritageClause).getChildren()[0]; - let result = [{ + const result = [{ description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), changes: [{ fileName: sourceFile.fileName, diff --git a/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts b/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts index 4fdd58c31a5..93b1513b149 100644 --- a/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts +++ b/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts @@ -13,13 +13,13 @@ namespace ts.codefix { const classDeclaration = propertyDeclaration.parent; const classKeywordStart = classDeclaration.getChildren()[0].getStart(); - let codeFix: CodeAction[] = [ + return [ { description: `Remove abstract modifier from ${propertyDeclaration.name.getText()}.`, changes: [{ fileName: sourceFile.fileName, textChanges: [{ - span: {start: start, length: context.span.length + /*space*/ 1}, + span: { start: start, length: context.span.length + /*space*/ 1 }, newText: "" }] }] @@ -35,8 +35,6 @@ namespace ts.codefix { }] } ]; - - return codeFix; } }); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 57370cd45d1..5f4465f490e 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1368,8 +1368,8 @@ namespace ts { } const missingMembers = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); - - for (let member of missingMembers) { + + for (const member of missingMembers) { if (member.kind === SyntaxKind.PropertySignature) { const interfaceProperty = member; if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { @@ -1422,7 +1422,7 @@ namespace ts { } function getMissingInterfaceMembers(declaration: InterfaceDeclaration, existingMembers: string[], checker: TypeChecker): TypeElement[] { - let interfaceMembers = getInterfaceMembers(declaration, checker); + const interfaceMembers = getInterfaceMembers(declaration, checker); return ts.filter(interfaceMembers, member => !member.name || existingMembers.indexOf(member.name.getText()) === -1); From 0380f3f38ed51de742176f3a0efe1300d13ccfbb Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 1 Nov 2016 17:19:06 -0700 Subject: [PATCH 034/289] Recognize modifiers --- src/compiler/checker.ts | 2 +- src/services/utilities.ts | 21 +++++++++---------- .../codeFixClassExtendsAbstractNumber.ts | 3 ++- ...eFixClassExtendsAbstractProtectedNumber.ts | 3 ++- ...codeFixClassExtendsAbstractPublicNumber.ts | 3 ++- ...MissingMultipleFunctionsDeepInheritance.ts | 11 +++++----- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2ca169cb140..48a5933a59a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1308,7 +1308,7 @@ namespace ts { /** * Resolves a qualified name and any involved aliases. - */ + */ function resolveEntityName(name: EntityNameOrEntityNameExpression, meaning: SymbolFlags, ignoreErrors?: boolean, dontResolveAlias?: boolean, location?: Node): Symbol | undefined { if (nodeIsMissing(name)) { return undefined; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5f4465f490e..736b8d11a01 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1370,7 +1370,7 @@ namespace ts { const missingMembers = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); for (const member of missingMembers) { - if (member.kind === SyntaxKind.PropertySignature) { + if (member.kind === SyntaxKind.PropertySignature || member.kind === SyntaxKind.PropertyDeclaration) { const interfaceProperty = member; if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { let propertyText = ""; @@ -1405,25 +1405,24 @@ namespace ts { * Gets members in an interface and all its base types. */ function getInterfaceMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { + let result: TypeElement[] = declaration.members + ? declaration.members.filter(member => !(getModifierFlags(member) & ModifierFlags.Private)) + : []; const clauses = getInterfaceBaseTypeNodes(declaration); - let result: TypeElement[] = []; - for (let i = 0; clauses && i < clauses.length; i++) { - const type = checker.getTypeAtLocation(clauses[i]); - if (type && type.symbol && type.symbol.declarations) { - result = result.concat(getInterfaceMembers(type.symbol.declarations[0], checker)); + if (clauses) { + for (const clause of clauses) { + const type = checker.getTypeAtLocation(clause); + if (type && type.symbol && type.symbol.declarations) { + result = result.concat(getInterfaceMembers(type.symbol.declarations[0], checker)); + } } } - if (declaration.members) { - result = result.concat(declaration.members); - } - return result; } function getMissingInterfaceMembers(declaration: InterfaceDeclaration, existingMembers: string[], checker: TypeChecker): TypeElement[] { const interfaceMembers = getInterfaceMembers(declaration, checker); - return ts.filter(interfaceMembers, member => !member.name || existingMembers.indexOf(member.name.getText()) === -1); } diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts index 134c1979dce..f57017693cd 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts @@ -7,5 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(`x: number; +verify.codeFixAtPosition(` +abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts index 7f525632fc5..2f1a0f4b64e 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts @@ -7,5 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(`protected x: number; +verify.codeFixAtPosition(` +protected abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts index 82cafbd86ad..380f23f6c58 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts @@ -7,5 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(`public x: number; +verify.codeFixAtPosition(` +public abstract x: number; `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts index 729df3a91c8..fcb990ac27f 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts @@ -53,10 +53,11 @@ verify.codeFixAtPosition( -`a: number; -b: number; -c: number; -d: number; -e: number: +` +e: number; f: number; +a: number; +b: number; +d: number; +c: number; `); From 1b60a97bedbe69c2eaab7c0fbe7f443302baa576 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 2 Nov 2016 10:40:10 -0700 Subject: [PATCH 035/289] Remove unused --- src/services/utilities.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 736b8d11a01..baeabe52e23 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1435,30 +1435,6 @@ namespace ts { return getNamedClassMembers(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); } - /* - function getMembersAndStartPosFromReference(variableDeclaration: VariableDeclaration): { startPos: number, members: string[] } { - const children = variableDeclaration.getChildren(); - const variableMembers: string[] = []; - let startPos = 0; - - ts.forEach(children, child => { - if (child.kind === SyntaxKind.ObjectLiteralExpression) { - const properties = (child).properties; - if (properties) { - startPos = properties.pos; - } - for (let j = 0; properties && j < properties.length; j++) { - if (properties[j].name) { - variableMembers.push(properties[j].name.getText()); - } - } - } - }); - - return { startPos: startPos, members: variableMembers }; - } - */ - function getDefaultValue(kind: SyntaxKind): string { switch (kind) { case SyntaxKind.StringKeyword: From e5279fd828fbc7f88ddc9c1f4d44e1cfc7221200 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 2 Nov 2016 12:38:33 -0700 Subject: [PATCH 036/289] Rename and simplify fourslash interface --- src/harness/fourslash.ts | 52 ++++++++++--------- tests/cases/fourslash/codeFixAddSuperCall.ts | 2 +- .../codeFixChangeExtendsToImplementsFS1.ts | 2 +- .../codeFixChangeExtendsToImplementsFS2.ts | 2 +- .../codeFixClassExtendsAbstractFunction.ts | 2 +- .../codeFixClassExtendsAbstractNumber.ts | 2 +- ...eFixClassExtendsAbstractProtectedNumber.ts | 2 +- ...codeFixClassExtendsAbstractPublicNumber.ts | 2 +- .../codeFixInterfaceInExtendsClause.ts | 15 ++---- tests/cases/fourslash/codeFixReOrderSuper.ts | 2 +- .../codeFixUnImplementedInterface36.ts | 2 +- .../codeFixUnImplementedInterface37.ts | 2 +- .../codeFixUnImplementedInterface39.ts | 2 +- ...stractFunctionGenericParamExtendsNumber.ts | 2 +- ...ericParamExtendsNumberViaHeritageClause.ts | 2 +- ...ricParamExtendsNumberViaHeritageClause2.ts | 2 +- ...ctFunctionGenericParamViaHeritageClause.ts | 2 +- ...issingAbstractFunctionViaHeritageClause.ts | 2 +- ...ixUnImplementedInterfaceMissingFunction.ts | 2 +- ...entedInterfaceMissingFunctionAndExtends.ts | 2 +- ...tedInterfaceMissingFunctionFromAbstract.ts | 2 +- ...ctionFromAbstractClassViaHeritageClause.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause1.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause2.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause3.ts | 2 +- ...rfaceMissingFunctionFromHeritageClause4.ts | 2 +- ...issingFunctionGenericParamExtendsString.ts | 2 +- ...edInterfaceMissingFunctionGenericParams.ts | 2 +- ...ntedInterfaceMissingFunctionNoSemicolon.ts | 2 +- ...entedInterfaceMissingFunctionWithParams.ts | 2 +- ...InterfaceMissingFunctionWithParamsClass.ts | 2 +- ...eFixUnImplementedInterfaceMissingNumber.ts | 2 +- ...mentedInterfaceMissingNumberNoSemicolon.ts | 2 +- ...mentedInterfaceMissingMultipleFunctions.ts | 2 +- ...MissingMultipleFunctionsDeepInheritance.ts | 2 +- tests/cases/fourslash/fourslash.ts | 6 +-- .../fourslash/server/codeFixAddSuperCall.ts | 10 ---- 37 files changed, 68 insertions(+), 81 deletions(-) delete mode 100644 tests/cases/fourslash/server/codeFixAddSuperCall.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c2f9dee0e7c..e8e5c8e9597 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -92,11 +92,14 @@ namespace FourSlash { end: number; } - export interface ErrorIdentifier { + export interface CodeFixIdentifier { + /** + * Error code to search over for codefix. + */ code: number; /** * In a file where there is more than one error with code `code`, `count` refers - * to which 0-indexed error, sorted by order of occurence, to consider. + * to which 0-indexed codefix, sorted by order of occurence, to consider. */ count: number; } @@ -2022,14 +2025,14 @@ namespace FourSlash { * Because codefixes are only applied on the working file, it is unsafe * to apply this more than once (consider a refactoring across files). */ - public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) { + public verifyRangeAfterCodeFix(expectedText: string, codeFixIdentifier?: CodeFixIdentifier) { const ranges = this.getRanges(); if (ranges.length !== 1) { this.raiseError("Exactly one range should be specified in the testfile."); } const fileName = this.activeFile.fileName; - const codeFix: ts.CodeAction = this.getCodeFix(fileName, errorCode ? { code: errorCode, count: 0 } : undefined); + const codeFix: ts.CodeAction = this.getCodeFix(fileName, codeFixIdentifier); if (!codeFix) { this.raiseError("Should find exactly one codefix."); @@ -2052,6 +2055,8 @@ namespace FourSlash { * Applies fixes for the errors in fileName and compares the results to * expectedContents after all fixes have been applied. * + * It is safe to apply this multiple times in a single test. + * * Note: applying one codefix may generate another (eg: remove duplicate implements * may generate an extends -> interface conversion fix). * @param expectedContents The contents of the file after the fixes are applied. @@ -2059,30 +2064,27 @@ namespace FourSlash { * @param errorsToFix An array of errors for which quickfixes will be applied. If not * supplied, all codefixes in the file are applied until none are left, starting from * the first available codefix. - * + * */ - public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]) { + public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, codeFixIdentifier?: CodeFixIdentifier) { fileName = fileName ? fileName : this.activeFile.fileName; - if (errorsToFix) { - for (const error of errorsToFix) { - const fix = this.getCodeFix(fileName, error); - if (fix === undefined) { - this.raiseError(`Couldn't find the ${error.count}'th error with code ${error.code}.`); - } - this.applyCodeAction(fix); - } - } - else { - let fix: ts.CodeAction; - while (fix = this.getCodeFix(fileName)) { - this.applyCodeAction(fix); + const codeFix = this.getCodeFix(fileName, codeFixIdentifier); + + if (codeFix === undefined) { + if (codeFixIdentifier) { + this.raiseError(`Couldn't find the ${codeFixIdentifier.count}'th error with code ${codeFixIdentifier.code}.`); + } + else { + this.raiseError("No code fix could be found."); } } + this.applyCodeAction(codeFix); + const actualContents: string = this.getFileContent(fileName); if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { - this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n${expectedContents}`); + this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n\n${expectedContents}`); } } @@ -2093,7 +2095,7 @@ namespace FourSlash { * * If undefined, we get the first codefix available. */ - private getCodeFix(fileName: string, error?: ErrorIdentifier): ts.CodeAction | undefined { + private getCodeFix(fileName: string, error?: CodeFixIdentifier): ts.CodeAction | undefined { const diagnostics: ts.Diagnostic[] = this.getDiagnostics(fileName); const errorCount = error ? error.count : 0; @@ -3364,12 +3366,12 @@ namespace FourSlashInterface { this.DocCommentTemplate(/*expectedText*/ undefined, /*expectedOffset*/ undefined, /*empty*/ true); } - public codeFixAtPosition(expectedText: string, errorCode?: number): void { - this.state.verifyCodeFixAtPosition(expectedText, errorCode); + public rangeAfterCodeFix(expectedText: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { + this.state.verifyRangeAfterCodeFix(expectedText, codeFixidentifier); } - public fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: FourSlash.ErrorIdentifier[]): void { - this.state.verifyFileAfterCodeFix(expectedContents, fileName, errorsToFix); + public fileAfterCodeFix(expectedContents: string, fileName?: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { + this.state.verifyFileAfterCodeFix(expectedContents, fileName, codeFixidentifier); } public navigationBar(json: any) { diff --git a/tests/cases/fourslash/codeFixAddSuperCall.ts b/tests/cases/fourslash/codeFixAddSuperCall.ts index 7fbe2cb4fd7..0f5117cb487 100644 --- a/tests/cases/fourslash/codeFixAddSuperCall.ts +++ b/tests/cases/fourslash/codeFixAddSuperCall.ts @@ -7,4 +7,4 @@ //// } ////} -verify.codeFixAtPosition('super();'); +verify.rangeAfterCodeFix('super();'); diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts index a5b9a6375b6..6721eda7367 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts @@ -3,4 +3,4 @@ //// interface I1 {} //// [|class c1 extends I1|]{} -verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file +verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts index b63ab3032eb..973795732ad 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts @@ -3,4 +3,4 @@ ////interface I1 {} ////[|class c1 extends I1|]{} -verify.codeFixAtPosition("class c1 implements I1"); \ No newline at end of file +verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts index 6bed7a3fe0f..a946d6386a0 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts @@ -7,7 +7,7 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(`f(){ +verify.rangeAfterCodeFix(`f(){ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts index f57017693cd..0fa6dd3dc51 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts index 2f1a0f4b64e..dae05f58ac2 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` protected abstract x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts index 380f23f6c58..2862c329235 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts @@ -7,6 +7,6 @@ //// class C extends A {[| //// |]} -verify.codeFixAtPosition(` +verify.rangeAfterCodeFix(` public abstract x: number; `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts index 82debc0109a..15b6833d899 100644 --- a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts +++ b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts @@ -1,14 +1,9 @@ /// -//// interface I1 { } -//// class C1 extends I1 { } -//// interface I2 { } -//// class C2 extends I2 { } +//// interface I { } +//// class C extends I { } -// verify.codeFixAvailable(); -verify.fileAfterCodeFixes(` -interface I1 { } -class C1 implements I1 { } -interface I2 { } -class C2 implements I2 { } +verify.fileAfterCodeFix(` +interface I { } +class C implements I { } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixReOrderSuper.ts b/tests/cases/fourslash/codeFixReOrderSuper.ts index 880b5d43167..2bff98ceca0 100644 --- a/tests/cases/fourslash/codeFixReOrderSuper.ts +++ b/tests/cases/fourslash/codeFixReOrderSuper.ts @@ -10,4 +10,4 @@ //// } ////} -verify.codeFixAtPosition("super(); this.a = 12;"); \ No newline at end of file +verify.rangeAfterCodeFix("super(); this.a = 12;"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts index 3871414428e..17f889b56bf 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts @@ -14,7 +14,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts index 2032f2d3461..3ff689d455e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts @@ -14,7 +14,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts index ae85d02b8a3..fcc43ba6259 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1():string{ +verify.rangeAfterCodeFix(`f1():string{ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts index ab7a4f30bea..5a644dfb993 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts @@ -8,7 +8,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts index 7c3a647ce40..083f4301a11 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts index 66d47491c41..aaa00cc791a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts @@ -10,7 +10,7 @@ //// //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts index 825224f448b..24c9048015e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts index d56e44911b5..b7b7271badd 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts index b07db08f12a..0459b90c99c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts index 5c869996773..36f1c11dc82 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts @@ -11,7 +11,7 @@ //// class C1 implements I2 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts index c2719c2e7f9..4b17f315534 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts @@ -8,7 +8,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts index 71addef195b..7cbc606539b 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts index c6c2998ac9a..a6f7c5cdba7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts @@ -11,7 +11,7 @@ //// class C1 implements I2 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts index 3c819f6b56e..01da0838679 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts index 4e9e428fd6d..ff91223f63a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts index fdb0fa1230c..390a249f7c8 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts @@ -13,7 +13,7 @@ //// class C1 implements I3 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts index 2df93c6d7d9..abf5848668e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: C2){ +verify.rangeAfterCodeFix(`f1(x: number,y: C2){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts index 125f3e1ffeb..51becc8c99c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: C2){ +verify.rangeAfterCodeFix(`f1(x: number,y: C2){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts index 6e4e64c18d1..5b5f177741c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts index 59b3ba85199..5a4537ff2d5 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: string){ +verify.rangeAfterCodeFix(`f1(x: number,y: string){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts index 2310e05fbb0..157c9bec04e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts @@ -9,7 +9,7 @@ //// class C1 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(x: number,y: T){ +verify.rangeAfterCodeFix(`f1(x: number,y: T){ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts index 394c54d4687..e8a30703638 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts @@ -12,5 +12,5 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`x: number; +verify.rangeAfterCodeFix(`x: number; `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts index 19354ce1c94..f9aeb194fd7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts @@ -12,5 +12,5 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.codeFixAtPosition(`x: number; +verify.rangeAfterCodeFix(`x: number; `); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts index 02415491191..165edc92584 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts @@ -13,7 +13,7 @@ //// class C3 implements I1 {[| //// |]} -verify.codeFixAtPosition(`f1(){ +verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } f2(){ diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts index fcb990ac27f..e8b199b21af 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts @@ -52,7 +52,7 @@ */ -verify.codeFixAtPosition( +verify.rangeAfterCodeFix( ` e: number; f: number; diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 3b5c0c1e897..356bc449c3b 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -98,7 +98,7 @@ declare namespace FourSlashInterface { start: number; end: number; } - interface ErrorIdentifier { + interface CodeFixIdentifier { code: number; count: number } @@ -213,8 +213,8 @@ declare namespace FourSlashInterface { noMatchingBracePositionInCurrentFile(bracePosition: number): void; DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; - codeFixAtPosition(expectedText: string, errorCode?: number): void; - fileAfterCodeFixes(expectedContents: string, fileName?: string, errorsToFix?: ErrorIdentifier[]): void; + rangeAfterCodeFix(expectedText: string, CodeFixIdentifier?: CodeFixIdentifier): void; + fileAfterCodeFix(expectedContents: string, fileName?: string, CodeFixIdentifier?: CodeFixIdentifier): void; navigationBar(json: any): void; navigationTree(json: any): void; diff --git a/tests/cases/fourslash/server/codeFixAddSuperCall.ts b/tests/cases/fourslash/server/codeFixAddSuperCall.ts deleted file mode 100644 index 7fbe2cb4fd7..00000000000 --- a/tests/cases/fourslash/server/codeFixAddSuperCall.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -////class Base{ -////} -////class C extends Base{ -//// constructor() {[| |] -//// } -////} - -verify.codeFixAtPosition('super();'); From 04968ab7cbfcfe5f7fc6ff65bf7d61948211cc25 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 2 Nov 2016 13:05:27 -0700 Subject: [PATCH 037/289] fix references to codefixes? --- src/harness/tsconfig.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 8bf3139b9de..1cb17e2a843 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -73,6 +73,13 @@ "../services/formatting/rulesProvider.ts", "../services/formatting/smartIndenter.ts", "../services/formatting/tokenRange.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixes.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts", "harness.ts", "sourceMapRecorder.ts", "harnessLanguageService.ts", From d02eb6c1f167e7b5ff18bfe11aae7370fd52fbe8 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 2 Nov 2016 14:33:31 -0700 Subject: [PATCH 038/289] fix jakefile1 --- Jakefile.js | 14 +++++++------- src/services/utilities.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Jakefile.js b/Jakefile.js index 33227915761..bc7142b1399 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -168,13 +168,13 @@ var servicesSources = [ "formatting/tokenRange.ts", // CodeFixes "codeFixProvider.ts", - "codeFixes/fixes.ts", - "codeFixes/fixExtendsInterfaceBecomesImplements.ts", - "codeFixes/fixClassIncorrectlyImplementsInterface.ts", - "codeFixes/fixClassDoesntImplementInheritedAbstractMember.ts", - "codeFixes/fixClassSuperMustPrecedeThisAccess.ts", - "codeFixes/fixConstructorForDerivedNeedSuperCall.ts", - "codeFixes/fixRemoveAbstractModifierInNonAbstractClass.ts" + "codefixes/fixes.ts", + "codefixes/fixExtendsInterfaceBecomesImplements.ts", + "codefixes/fixClassIncorrectlyImplementsInterface.ts", + "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index baeabe52e23..1f4f07e96ac 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1361,13 +1361,13 @@ namespace ts { export function getCodeFixChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { const type = checker.getTypeAtLocation(interfaceClause); - const changesArray: TextChange[] = []; if (!(type && type.symbol && type.symbol.declarations && type.symbol.declarations.length > 0)) { return []; } const missingMembers = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); + const changesArray: TextChange[] = []; for (const member of missingMembers) { if (member.kind === SyntaxKind.PropertySignature || member.kind === SyntaxKind.PropertyDeclaration) { From 2e8bbf0c9660330c42a2df41dd1fee7d403cfe52 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 2 Nov 2016 20:27:53 +0800 Subject: [PATCH 039/289] fix #11480, disallow delete operator on readonly property or index signature --- src/compiler/checker.ts | 3 +++ src/compiler/diagnosticMessages.json | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 006b87cb542..7b4fd5803e3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13550,6 +13550,9 @@ namespace ts { function checkDeleteExpression(node: DeleteExpression): Type { checkExpression(node.expression); + checkReferenceExpression(node.expression, + Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference, + Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); return booleanType; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5290782c156..187a3a60d16 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1983,6 +1983,14 @@ "category": "Error", "code": 2697 }, + "The operand of a delete operator must be a property reference": { + "category": "Error", + "code": 2698 + }, + "The operand of a delete operator cannot be a read-only property": { + "category": "Error", + "code": 2699 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", From 8ea8044f80f18417a9c1f09c0268ee0ecf7cd115 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 2 Nov 2016 20:47:46 +0800 Subject: [PATCH 040/289] add new tests and accept baselines --- .../await_unaryExpression_es2017_1.errors.txt | 29 +++++++ .../await_unaryExpression_es2017_2.errors.txt | 21 +++++ .../await_unaryExpression_es6_1.errors.txt | 29 +++++++ .../await_unaryExpression_es6_2.errors.txt | 21 +++++ .../deleteOperatorWithAnyOtherType.errors.txt | 44 +++++++++- .../deleteOperatorWithBooleanType.errors.txt | 65 ++++++++++++++ .../deleteOperatorWithEnumType.errors.txt | 64 ++++++++++++++ .../deleteOperatorWithNumberType.errors.txt | 84 ++++++++++++++++++ .../deleteOperatorWithStringType.errors.txt | 86 +++++++++++++++++++ .../reference/deleteReadonly.errors.txt | 28 ++++++ tests/baselines/reference/deleteReadonly.js | 30 +++++++ ...onentiationOperatorSyntaxError2.errors.txt | 26 +++++- ...idSimpleUnaryExpressionOperands.errors.txt | 28 +++++- .../reference/parserStrictMode16.errors.txt | 20 +++++ .../reference/symbolType3.errors.txt | 5 +- ...emplateStringInDeleteExpression.errors.txt | 7 ++ ...lateStringInDeleteExpressionES6.errors.txt | 7 ++ tests/cases/compiler/deleteReadonly.ts | 18 ++++ 18 files changed, 607 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es6_1.errors.txt create mode 100644 tests/baselines/reference/await_unaryExpression_es6_2.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithEnumType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithNumberType.errors.txt create mode 100644 tests/baselines/reference/deleteOperatorWithStringType.errors.txt create mode 100644 tests/baselines/reference/deleteReadonly.errors.txt create mode 100644 tests/baselines/reference/deleteReadonly.js create mode 100644 tests/baselines/reference/parserStrictMode16.errors.txt create mode 100644 tests/baselines/reference/templateStringInDeleteExpression.errors.txt create mode 100644 tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt create mode 100644 tests/cases/compiler/deleteReadonly.ts diff --git a/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt new file mode 100644 index 00000000000..60e786cbad1 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt new file mode 100644 index 00000000000..1c1072fd86c --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt new file mode 100644 index 00000000000..90bd23b7597 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt new file mode 100644 index 00000000000..9386d206eee --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 73ddab1a33c..d92f1ffb1e7 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,23 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,46): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (17 errors) ==== // delete operator on any type var ANY: any; @@ -31,13 +45,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean1 = delete ANY1; var ResultIsBoolean2 = delete ANY2; var ResultIsBoolean3 = delete A; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean4 = delete M; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean5 = delete obj; var ResultIsBoolean6 = delete obj1; // any type literal var ResultIsBoolean7 = delete undefined; + ~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean8 = delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // any type expressions var ResultIsBoolean9 = delete ANY2[0]; @@ -46,21 +68,41 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean12 = delete objA.a; var ResultIsBoolean13 = delete M.n; var ResultIsBoolean14 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean15 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean16 = delete (ANY + ANY1); + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsBoolean18 = delete (null + null); + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsBoolean19 = delete (undefined + undefined); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; + ~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean21 = delete delete delete (ANY + ANY1); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete ANY; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt new file mode 100644 index 00000000000..3f653671e2e --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (8 errors) ==== + // delete operator on boolean type + var BOOLEAN: boolean; + + function foo(): boolean { return true; } + + class A { + public a: boolean; + static foo() { return false; } + } + module M { + export var n: boolean; + } + + var objA = new A(); + + // boolean type var + var ResultIsBoolean1 = delete BOOLEAN; + + // boolean type literal + var ResultIsBoolean2 = delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean3 = delete { x: true, y: false }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // boolean type expressions + var ResultIsBoolean4 = delete objA.a; + var ResultIsBoolean5 = delete M.n; + var ResultIsBoolean6 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean7 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean8 = delete delete BOOLEAN; + ~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete BOOLEAN; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete true, false; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt new file mode 100644 index 00000000000..103070d15dc --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,45): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts (13 errors) ==== + // delete operator on enum type + + enum ENUM { }; + enum ENUM1 { A, B, "" }; + + // enum type var + var ResultIsBoolean1 = delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean2 = delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // enum type expressions + var ResultIsBoolean3 = delete ENUM1["A"]; + ~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operators + var ResultIsBoolean5 = delete delete ENUM; + ~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1.B; + ~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + delete ENUM, ENUM1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt new file mode 100644 index 00000000000..bb35f3338b9 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -0,0 +1,84 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (12 errors) ==== + // delete operator on number type + var NUMBER: number; + var NUMBER1: number[] = [1, 2]; + + function foo(): number { return 1; } + + class A { + public a: number; + static foo() { return 1; } + } + module M { + export var n: number; + } + + var objA = new A(); + + // number type var + var ResultIsBoolean1 = delete NUMBER; + var ResultIsBoolean2 = delete NUMBER1; + + // number type literal + var ResultIsBoolean3 = delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: 1, y: 2}; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // number type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete NUMBER1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean12 = delete delete NUMBER; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete NUMBER; + delete NUMBER1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; + delete objA.a, M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt new file mode 100644 index 00000000000..9ffde0a8f97 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -0,0 +1,86 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (13 errors) ==== + // delete operator on string type + var STRING: string; + var STRING1: string[] = ["", "abc"]; + + function foo(): string { return "abc"; } + + class A { + public a: string; + static foo() { return ""; } + } + module M { + export var n: string; + } + + var objA = new A(); + + // string type var + var ResultIsBoolean1 = delete STRING; + var ResultIsBoolean2 = delete STRING1; + + // string type literal + var ResultIsBoolean3 = delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: "", y: "" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // string type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete STRING1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean12 = delete STRING.charAt(0); + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean13 = delete delete STRING; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean14 = delete delete delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete STRING; + delete STRING1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a,M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt new file mode 100644 index 00000000000..c0fc3ee7dc3 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/deleteReadonly.ts(8,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a delete operator cannot be a read-only property + + +==== tests/cases/compiler/deleteReadonly.ts (2 errors) ==== + interface A { + readonly b + } + var a: A = { + b: 123 + }; + + delete a.b; + ~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + + interface B { + readonly [k: string]: string + } + + var b: B = { + 'test': 'test' + }; + + delete b['test']; + ~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.js b/tests/baselines/reference/deleteReadonly.js new file mode 100644 index 00000000000..fd16bf270f6 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.js @@ -0,0 +1,30 @@ +//// [deleteReadonly.ts] +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test']; + + +//// [deleteReadonly.js] +var a = { + b: 123 +}; +delete a.b; +var b = { + 'test': 'test' +}; +delete b['test']; diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt index 134a883540e..c08335f8598 100644 --- a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt @@ -1,19 +1,27 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -81,7 +89,7 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(68,1): error TS17007: A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (81 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (89 errors) ==== // Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without () var temp: any; @@ -91,21 +99,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete --temp ** 3; @@ -113,21 +129,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference typeof --temp ** 3; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt index f43cbd0042a..24145c81158 100644 --- a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt @@ -19,16 +19,24 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(25,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,14): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (28 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (36 errors) ==== var temp: any; // Error: incorrect type on left-hand side @@ -99,25 +107,41 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp++) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp++) ** 3; ~~~~~~~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode16.errors.txt b/tests/baselines/reference/parserStrictMode16.errors.txt new file mode 100644 index 00000000000..edcda2787e1 --- /dev/null +++ b/tests/baselines/reference/parserStrictMode16.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts (4 errors) ==== + "use strict"; + delete this; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete "a"; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt index 7cc9e82b3b3..bf7a5cf0438 100644 --- a/tests/baselines/reference/symbolType3.errors.txt +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -1,3 +1,4 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(2,8): error TS2699: The operand of a delete operator cannot be a read-only property tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. @@ -6,9 +7,11 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' o tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. -==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (7 errors) ==== var s = Symbol(); delete Symbol.iterator; + ~~~~~~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property void Symbol.toPrimitive; typeof Symbol.toStringTag; ++s; diff --git a/tests/baselines/reference/templateStringInDeleteExpression.errors.txt b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt new file mode 100644 index 00000000000..9218b93b650 --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt new file mode 100644 index 00000000000..9ea14c39f2b --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/cases/compiler/deleteReadonly.ts b/tests/cases/compiler/deleteReadonly.ts new file mode 100644 index 00000000000..b7d35b3261b --- /dev/null +++ b/tests/cases/compiler/deleteReadonly.ts @@ -0,0 +1,18 @@ +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test']; From 747f50f447a9f28b707c31607594a2e3ef13d058 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Thu, 3 Nov 2016 13:19:16 +0800 Subject: [PATCH 041/289] migrate checkDelete to new property checking --- src/compiler/checker.ts | 15 +++++++++++---- src/compiler/types.ts | 1 - src/compiler/utilities.ts | 14 +++++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7b4fd5803e3..b105721ba13 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5777,7 +5777,7 @@ namespace ts { getIndexInfoOfType(objectType, IndexKind.String) || undefined; if (indexInfo) { - if (accessExpression && isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) { error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -13550,9 +13550,16 @@ namespace ts { function checkDeleteExpression(node: DeleteExpression): Type { checkExpression(node.expression); - checkReferenceExpression(node.expression, - Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference, - Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + const expr = skipParentheses(node.expression); + if (expr.kind !== SyntaxKind.PropertyAccessExpression && expr.kind !== SyntaxKind.ElementAccessExpression) { + error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + const links = getNodeLinks(expr); + const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e4c92c502a4..9e1b35c60da 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2651,7 +2651,6 @@ namespace ts { resolvedType?: Type; // Cached type of type node resolvedSignature?: Signature; // Cached signature of signature node or call expression resolvedSymbol?: Symbol; // Cached name resolution result - resolvedIndexInfo?: IndexInfo; // Cached indexing info resolution result enumMemberValue?: number; // Constant value of enum member isVisible?: boolean; // Is this node visible hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 299f91be662..8e7b11ccf91 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /* @internal */ namespace ts { @@ -1666,6 +1666,18 @@ namespace ts { return getAssignmentTargetKind(node) !== AssignmentKind.None; } + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + export function isDeleteTarget(node: Node): boolean { + if (node.kind !== SyntaxKind.PropertyAccessExpression && node.kind !== SyntaxKind.ElementAccessExpression) { + return false; + } + node = node.parent; + while (node && node.kind === SyntaxKind.ParenthesizedExpression) { + node = node.parent; + } + return node && node.kind === SyntaxKind.DeleteExpression; + } + export function isNodeDescendantOf(node: Node, ancestor: Node): boolean { while (node) { if (node === ancestor) return true; From 023d5caf3b4e51871ae73849be2dc60961c2012d Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Thu, 3 Nov 2016 13:25:58 +0800 Subject: [PATCH 042/289] accept new baseline --- .../computedPropertyNames3_ES5.errors.txt | 5 +- .../computedPropertyNames3_ES6.errors.txt | 5 +- .../controlFlowDeleteOperator.errors.txt | 23 ++++++++ .../reference/deleteOperator1.errors.txt | 13 ++++- .../deleteOperatorInStrictMode.errors.txt | 7 ++- ...deleteOperatorInvalidOperations.errors.txt | 11 +++- .../deleteOperatorWithAnyOtherType.errors.txt | 52 ++++++++++++++----- .../deleteOperatorWithBooleanType.errors.txt | 11 +++- .../deleteOperatorWithEnumType.errors.txt | 8 +-- .../deleteOperatorWithNumberType.errors.txt | 25 +++++++-- .../deleteOperatorWithStringType.errors.txt | 25 +++++++-- .../reference/deleteReadonly.errors.txt | 11 ++-- tests/baselines/reference/deleteReadonly.js | 3 ++ .../reference/parserStrictMode15.errors.txt | 7 ++- tests/cases/compiler/deleteReadonly.ts | 2 + 15 files changed, 167 insertions(+), 41 deletions(-) create mode 100644 tests/baselines/reference/controlFlowDeleteOperator.errors.txt diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index fd6f8e8bdc1..86e363c9377 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (7 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (8 errors) ==== var id; class C { [0 + 1]() { } @@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt index 4299437777d..f287138661a 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,1 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (7 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (8 errors) ==== var id; class C { [0 + 1]() { } @@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1 !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ~~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference set [[0, 1]](v) { } ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. diff --git a/tests/baselines/reference/controlFlowDeleteOperator.errors.txt b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt new file mode 100644 index 00000000000..720b368219c --- /dev/null +++ b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts (1 errors) ==== + + function f() { + let x: { a?: number | string, b: number | string } = { b: 1 }; + x.a; + x.b; + x.a = 1; + x.b = 1; + x.a; + x.b; + delete x.a; + delete x.b; + x.a; + x.b; + x; + delete x; // No effect + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + x; + } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperator1.errors.txt b/tests/baselines/reference/deleteOperator1.errors.txt index 964bdec9ea2..5cf2a63925d 100644 --- a/tests/baselines/reference/deleteOperator1.errors.txt +++ b/tests/baselines/reference/deleteOperator1.errors.txt @@ -1,10 +1,19 @@ +tests/cases/compiler/deleteOperator1.ts(2,25): error TS2698: The operand of a delete operator must be a property reference +tests/cases/compiler/deleteOperator1.ts(3,21): error TS2698: The operand of a delete operator must be a property reference tests/cases/compiler/deleteOperator1.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/compiler/deleteOperator1.ts(4,24): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/compiler/deleteOperator1.ts (1 errors) ==== +==== tests/cases/compiler/deleteOperator1.ts (4 errors) ==== var a; var x: boolean = delete a; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var y: any = delete a; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var z: number = delete a; ~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2322: Type 'boolean' is not assignable to type 'number'. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt index 5952d8b8296..9d9e04d154c 100644 --- a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt +++ b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt @@ -1,9 +1,12 @@ tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/compiler/deleteOperatorInStrictMode.ts (1 errors) ==== +==== tests/cases/compiler/deleteOperatorInStrictMode.ts (2 errors) ==== "use strict" var a; delete a; ~ -!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. \ No newline at end of file +!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt index d50be713d0a..2ff0c764c51 100644 --- a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt @@ -1,10 +1,13 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,20): error TS1005: ',' expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,26): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,27): error TS1109: Expression expected. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,22): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,23): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (4 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (7 errors) ==== // Unary operator delete var ANY; @@ -12,11 +15,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var BOOLEAN1 = ANY delete ; //expect error ~~~~~~ !!! error TS1005: ',' expected. + +!!! error TS2698: The operand of a delete operator must be a property reference ~ !!! error TS1109: Expression expected. // miss an operand var BOOLEAN2 = delete ; + +!!! error TS2698: The operand of a delete operator must be a property reference ~ !!! error TS1109: Expression expected. @@ -26,5 +33,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator delete s; //expect error ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference } } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index d92f1ffb1e7..64f41c84a0d 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,23 +1,31 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(25,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(29,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,47): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(54,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(55,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (17 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (25 errors) ==== // delete operator on any type var ANY: any; @@ -43,7 +51,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // any type var var ResultIsBoolean1 = delete ANY1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete ANY2; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean3 = delete A; ~ !!! error TS2698: The operand of a delete operator must be a property reference @@ -51,7 +63,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean5 = delete obj; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean6 = delete obj1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // any type literal var ResultIsBoolean7 = delete undefined; @@ -74,41 +90,49 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean16 = delete (ANY + ANY1); - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); - ~~~~~~~~~~~~~~~~~~ -!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. - var ResultIsBoolean18 = delete (null + null); - ~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean18 = delete (null + null); ~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. - var ResultIsBoolean19 = delete (undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean19 = delete (undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operators var ResultIsBoolean20 = delete delete ANY; ~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean21 = delete delete delete (ANY + ANY1); ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~ + ~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete ANY; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ANY1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ANY2[0]; delete ANY, ANY1; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete obj1.x; delete obj1.y; delete objA.a; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt index 3f653671e2e..5d65f8f718a 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -1,14 +1,17 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(17,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,38): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(34,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (8 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (11 errors) ==== // delete operator on boolean type var BOOLEAN: boolean; @@ -26,6 +29,8 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // boolean type var var ResultIsBoolean1 = delete BOOLEAN; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // boolean type literal var ResultIsBoolean2 = delete true; @@ -49,12 +54,16 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean8 = delete delete BOOLEAN; ~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete true; ~~~~ !!! error TS2698: The operand of a delete operator must be a property reference delete BOOLEAN; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt index 103070d15dc..f515e3b7b70 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -1,12 +1,12 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2699: The operand of a delete operator cannot be a read-only property -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,45): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,46): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2699: The operand of a delete operator cannot be a read-only property @@ -32,7 +32,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~~~~ !!! error TS2699: The operand of a delete operator cannot be a read-only property var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operators @@ -46,7 +46,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt index bb35f3338b9..f908bee9686 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -1,18 +1,23 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(18,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(19,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,47): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(41,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (12 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (17 errors) ==== // delete operator on number type var NUMBER: number; var NUMBER1: number[] = [1, 2]; @@ -31,7 +36,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // number type var var ResultIsBoolean1 = delete NUMBER; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete NUMBER1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // number type literal var ResultIsBoolean3 = delete 1; @@ -55,19 +64,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean11 = delete (NUMBER + NUMBER); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // multiple delete operator var ResultIsBoolean12 = delete delete NUMBER; ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators @@ -75,7 +86,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~ !!! error TS2698: The operand of a delete operator must be a property reference delete NUMBER; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete NUMBER1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt index 9ffde0a8f97..c15e6b47433 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -1,19 +1,24 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(18,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(19,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,33): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2698: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,47): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(41,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (13 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (18 errors) ==== // delete operator on string type var STRING: string; var STRING1: string[] = ["", "abc"]; @@ -32,7 +37,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // string type var var ResultIsBoolean1 = delete STRING; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean2 = delete STRING1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // string type literal var ResultIsBoolean3 = delete ""; @@ -56,7 +65,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean11 = delete (STRING + STRING); - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean12 = delete STRING.charAt(0); ~~~~~~~~~~~~~~~~ @@ -65,13 +74,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator // multiple delete operator var ResultIsBoolean13 = delete delete STRING; ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean14 = delete delete delete (STRING + STRING); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference - ~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators @@ -79,7 +90,11 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~ !!! error TS2698: The operand of a delete operator must be a property reference delete STRING; + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete STRING1; + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete foo(); ~~~~~ !!! error TS2698: The operand of a delete operator must be a property reference diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt index c0fc3ee7dc3..1846f139d86 100644 --- a/tests/baselines/reference/deleteReadonly.errors.txt +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/deleteReadonly.ts(8,8): error TS2699: The operand of a delete operator cannot be a read-only property -tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(18,8): error TS2542: Index signature in type 'B' only permits reading. +tests/cases/compiler/deleteReadonly.ts(20,12): error TS2542: Index signature in type 'B' only permits reading. -==== tests/cases/compiler/deleteReadonly.ts (2 errors) ==== +==== tests/cases/compiler/deleteReadonly.ts (3 errors) ==== interface A { readonly b } @@ -24,5 +25,9 @@ tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a del delete b['test']; ~~~~~~~~~ -!!! error TS2699: The operand of a delete operator cannot be a read-only property +!!! error TS2542: Index signature in type 'B' only permits reading. + + delete ((((b['test'])))); + ~~~~~~~~~ +!!! error TS2542: Index signature in type 'B' only permits reading. \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.js b/tests/baselines/reference/deleteReadonly.js index fd16bf270f6..bdfdf155546 100644 --- a/tests/baselines/reference/deleteReadonly.js +++ b/tests/baselines/reference/deleteReadonly.js @@ -17,6 +17,8 @@ var b: B = { }; delete b['test']; + +delete ((((b['test'])))); //// [deleteReadonly.js] @@ -28,3 +30,4 @@ var b = { 'test': 'test' }; delete b['test']; +delete ((((b['test'])))); diff --git a/tests/baselines/reference/parserStrictMode15.errors.txt b/tests/baselines/reference/parserStrictMode15.errors.txt index 0bcaaf33786..82175901236 100644 --- a/tests/baselines/reference/parserStrictMode15.errors.txt +++ b/tests/baselines/reference/parserStrictMode15.errors.txt @@ -1,11 +1,14 @@ tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2304: Cannot find name 'a'. +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (3 errors) ==== "use strict"; delete a; ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. ~ -!!! error TS2304: Cannot find name 'a'. \ No newline at end of file +!!! error TS2304: Cannot find name 'a'. + ~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/cases/compiler/deleteReadonly.ts b/tests/cases/compiler/deleteReadonly.ts index b7d35b3261b..cdab3f2eb23 100644 --- a/tests/cases/compiler/deleteReadonly.ts +++ b/tests/cases/compiler/deleteReadonly.ts @@ -16,3 +16,5 @@ var b: B = { }; delete b['test']; + +delete ((((b['test'])))); From 3b0b696517d820c08b14c7884dbc47e93da9f5cc Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 3 Nov 2016 16:02:32 -0700 Subject: [PATCH 043/289] broken --- src/compiler/checker.ts | 11 +++-- src/compiler/types.ts | 1 + src/services/utilities.ts | 91 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 95 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 48a5933a59a..e12036322bd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -81,6 +81,7 @@ namespace ts { getIndexTypeOfType, getBaseTypes, getReturnTypeOfSignature, + resolveStructuredTypeMembers, getNonNullableType, getSymbolsInScope, getSymbolAtLocation, @@ -6586,10 +6587,12 @@ namespace ts { } } - // Compare two types and return - // Ternary.True if they are related with no assumptions, - // Ternary.Maybe if they are related with assumptions of other relationships, or - // Ternary.False if they are not related. + /** + * Compare two types and return + * * Ternary.True if they are related with no assumptions, + * * 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): Ternary { let result: Ternary; if (source.flags & TypeFlags.StringOrNumberLiteral && source.flags & TypeFlags.FreshLiteral) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index cefa3714017..ece3dab6ecc 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2251,6 +2251,7 @@ namespace ts { getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; + resolveStructuredTypeMembers(type: StructuredType): ResolvedType; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 1f4f07e96ac..3777d8b8ac3 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -372,7 +372,7 @@ namespace ts { export function isThis(node: Node): boolean { switch (node.kind) { case SyntaxKind.ThisKeyword: - // case SyntaxKind.ThisType: TODO: GH#9267 + // case SyntaxKind.ThisType: TODO: GH#9267 return true; case SyntaxKind.Identifier: // 'this' as a parameter @@ -1359,6 +1359,90 @@ namespace ts { }; } + /* + const classMembers: TypeElement[]; // TODO: this + const implementedInterfaceMembers: TypeElement[] = []; + const parentAbstractMembers: TypeElement[] = [] + const missingMembers: TypeElement[] = []; + // const typeWiththis = checker.getTypeWithThisArgument(classType); + // const staticType = checker.getTypeOfSymbol(symbol); + // const classType = checker.getTypeAtLocation(classDecl); + */ + + export function getUnimplementedMemberChanges(classDecl: ClassDeclaration, checker: TypeChecker): TextChange[] { + const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl); + + if (!baseTypeNode) + { + return []; + } + const classSymbol = checker.getSymbolAtLocation(classDecl); + const classType = checker.getDeclaredTypeOfSymbol(classSymbol); + + const baseTypes = checker.getBaseTypes(classType); + Debug.assert(baseTypes.length === 1); + const baseType = baseTypes[0]; + + const resolvedClassType = checker.resolveStructuredTypeMembers(classType); + const resolvedBaseType = checker.resolveStructuredTypeMembers(baseType); + + const missingMembers = filterMissingMembers(resolvedClassType.members, resolvedBaseType.members); + return insertionsForMembers(missingMembers); + } + + // TODO: (arozga) Get changes for interface as well. + // const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); + } + + function insertionsForMembers(symbols: Symbol[]): TextChange[] { + let changes: TextChange[] = []; + for (const symbol of symbols) { + const decl = getdeclaration + switch (member.kind) { + case SyntaxKind.PropertySignature: + case SyntaxKind.PropertyDeclaration: + break; + case SyntaxKind.MethodSignature: + case SyntaxKind.MethodDeclaration: + break; + default: + break; + } + } + return changes; + } + + // TODO: (arozga) simplify to quadratic time solution. + function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Symbol[] { + let missingMembers: Symbol[] = []; + const sortedSourceKeys = Object.keys(sourceSymbols).sort(); + const sortedTargetKeys = Object.keys(targetSymbols).sort(); + + let i = 0; + let j = 0; + while (i < sortedSourceKeys.length && j < sortedTargetKeys.length) { + // TODO: (arozga) convert switch to if else with inequalities (browser compat?) + switch (sortedSourceKeys[i].localeCompare(sortedSourceKeys[j])) { + case 0: + ++i; + ++j; + break; + case -1: + missingMembers.push(sourceSymbols[sortedSourceKeys[i]]); + ++i; + break; + case 1: + ++j; + default: + } + } + + return missingMembers; + } + + /** + * Generates codefix changes to insert + */ export function getCodeFixChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { const type = checker.getTypeAtLocation(interfaceClause); @@ -1366,7 +1450,7 @@ namespace ts { return []; } - const missingMembers = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); + const missingMembers: TypeElement[] = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); const changesArray: TextChange[] = []; for (const member of missingMembers) { @@ -1405,7 +1489,7 @@ namespace ts { * Gets members in an interface and all its base types. */ function getInterfaceMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { - let result: TypeElement[] = declaration.members + let result: TypeElement[] = declaration.members ? declaration.members.filter(member => !(getModifierFlags(member) & ModifierFlags.Private)) : []; const clauses = getInterfaceBaseTypeNodes(declaration); @@ -1424,7 +1508,6 @@ namespace ts { function getMissingInterfaceMembers(declaration: InterfaceDeclaration, existingMembers: string[], checker: TypeChecker): TypeElement[] { const interfaceMembers = getInterfaceMembers(declaration, checker); return ts.filter(interfaceMembers, member => !member.name || existingMembers.indexOf(member.name.getText()) === -1); - } export function getNamedClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { From 36c5befae9f74969fff170c7ab45012c61432b6b Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 4 Nov 2016 16:34:10 -0700 Subject: [PATCH 044/289] Add tests and simplify existing ones --- .../codeFixChangeExtendsToImplements.ts | 6 ++++ .../codeFixChangeExtendsToImplementsFS1.ts | 6 ---- .../codeFixChangeExtendsToImplementsFS2.ts | 6 ---- ...eFixChangeExtendsToImplementsTypeParams.ts | 6 ++++ ...s => codeFixClassExtendsAbstractMethod.ts} | 0 ...FixClassExtendsAbstractPrivateProperty.ts} | 0 ...=> codeFixClassExtendsAbstractProperty.ts} | 0 ...xClassExtendsAbstractProtectedProperty.ts} | 0 ...eFixClassExtendsAbstractPublicProperty.ts} | 0 .../codeFixInterfaceInExtendsClause.ts | 9 ------ ...OrderSuper.ts => codeFixSuperAfterThis.ts} | 0 ...uperCall.ts => codeFixSuperCallMissing.ts} | 0 ...l.ts => codeFixSuperCallWithThisInside.ts} | 0 ...ImplementedClassMissingAbstractProperty.ts | 11 ++++++++ ...odeFixUnImplementedClassMissingFunction.ts | 13 +++++++++ ...ementedClassMissingPropertyViaHeritage.ts} | 6 ++-- ...ixUnImplementedInterfaceDuplicateMember.ts | 15 ++++++++++ ...ericParamExtendsNumberViaHeritageClause.ts | 18 ------------ ...ricParamExtendsNumberViaHeritageClause2.ts | 16 ----------- ...ctFunctionGenericParamViaHeritageClause.ts | 18 ------------ ...issingAbstractFunctionViaHeritageClause.ts | 18 ------------ ...ixUnImplementedInterfaceMissingFunction.ts | 18 ------------ ...tedInterfaceMissingFunctionFromAbstract.ts | 14 ---------- ...rfaceMissingFunctionFromHeritageClause1.ts | 17 ----------- ...rfaceMissingFunctionFromHeritageClause2.ts | 19 ------------- ...rfaceMissingFunctionFromHeritageClause3.ts | 19 ------------- ...rfaceMissingFunctionFromHeritageClause4.ts | 19 ------------- ...issingFunctionGenericParamExtendsString.ts | 15 ---------- ...edInterfaceMissingFunctionGenericParams.ts | 15 ---------- ...ntedInterfaceMissingFunctionNoSemicolon.ts | 18 ------------ ...entedInterfaceMissingFunctionWithParams.ts | 18 ------------ ...InterfaceMissingFunctionWithParamsClass.ts | 15 ---------- ...FixUnImplementedInterfaceMissingMethod.ts} | 8 ++---- ...ementedInterfaceMissingMethodWithParams.ts | 14 ++++++++++ ...mentedInterfaceMissingNumberNoSemicolon.ts | 16 ----------- ...ixUnImplementedInterfaceMissingProperty.ts | 11 ++++++++ ...tedInterfaceMissingPropertyIntersection.ts | 12 ++++++++ ...nImplementedInterfaceNamespaceConflict.ts} | 3 +- ...plementedInterfaceSomePropertiesPresent.ts | 14 ++++++++++ ...mplementedInterfaceTypeParamOnProperty.ts} | 10 +++---- ...=> codeFixUnimplementedDeepInheritance.ts} | 0 ...mentedInterfaceMissingMultipleFunctions.ts | 22 --------------- ...entedInterfaceMissingMultipleImplements.ts | 16 +++++++++++ ...aceMissingMultipleMembersAndPunctuation.ts | 28 +++++++++++++++++++ ...ntedInterfaceTypeParamInstantiateDeeply.ts | 17 +++++++++++ ...entedInterfaceTypeParamInstantiateError.ts | 11 ++++++++ ...ntedInterfaceTypeParamInstantiateNumber.ts | 17 +++++++++++ ...plementedInterfaceTypeParamInstantiateT.ts | 17 +++++++++++ ...plementedInterfaceTypeParamInstantiateU.ts | 17 +++++++++++ ...dInterfaceTypeParamInstantiationMissing.ts | 9 ++++++ ...xUnimplementedInterfaceUndeclaredSymbol.ts | 16 +++++++++++ 51 files changed, 261 insertions(+), 332 deletions(-) create mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplements.ts delete mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts delete mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts create mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts rename tests/cases/fourslash/{codeFixClassExtendsAbstractFunction.ts => codeFixClassExtendsAbstractMethod.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractPrivateNumber.ts => codeFixClassExtendsAbstractPrivateProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractNumber.ts => codeFixClassExtendsAbstractProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractProtectedNumber.ts => codeFixClassExtendsAbstractProtectedProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractPublicNumber.ts => codeFixClassExtendsAbstractPublicProperty.ts} (100%) delete mode 100644 tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts rename tests/cases/fourslash/{codeFixReOrderSuper.ts => codeFixSuperAfterThis.ts} (100%) rename tests/cases/fourslash/{codeFixAddSuperCall.ts => codeFixSuperCallMissing.ts} (100%) rename tests/cases/fourslash/{codeFixThisUsedInSuperCall.ts => codeFixSuperCallWithThisInside.ts} (100%) create mode 100644 tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts => codeFixUnImplementedClassMissingPropertyViaHeritage.ts} (68%) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts => codeFixUnImplementedInterfaceMissingMethod.ts} (57%) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingNumber.ts => codeFixUnImplementedInterfaceNamespaceConflict.ts} (80%) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts => codeFixUnImplementedInterfaceTypeParamOnProperty.ts} (54%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts => codeFixUnimplementedDeepInheritance.ts} (100%) delete mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts new file mode 100644 index 00000000000..9d913c83f2d --- /dev/null +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts @@ -0,0 +1,6 @@ +/// + +//// interface I {} +//// [|class C extends I|]{} + +verify.rangeAfterCodeFix("class C implements I"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts deleted file mode 100644 index 6721eda7367..00000000000 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS1.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -//// interface I1 {} -//// [|class c1 extends I1|]{} - -verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts deleted file mode 100644 index 973795732ad..00000000000 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplementsFS2.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -////interface I1 {} -////[|class c1 extends I1|]{} - -verify.rangeAfterCodeFix("class c1 implements I1"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts new file mode 100644 index 00000000000..869bd1a5dc0 --- /dev/null +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsTypeParams.ts @@ -0,0 +1,6 @@ +/// + +////interface I { x: X} +////[|class C extends I|]{} + +verify.rangeAfterCodeFix("class C implements I"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractPrivateNumber.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractNumber.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts deleted file mode 100644 index 15b6833d899..00000000000 --- a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -//// interface I { } -//// class C extends I { } - -verify.fileAfterCodeFix(` -interface I { } -class C implements I { } -`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixReOrderSuper.ts b/tests/cases/fourslash/codeFixSuperAfterThis.ts similarity index 100% rename from tests/cases/fourslash/codeFixReOrderSuper.ts rename to tests/cases/fourslash/codeFixSuperAfterThis.ts diff --git a/tests/cases/fourslash/codeFixAddSuperCall.ts b/tests/cases/fourslash/codeFixSuperCallMissing.ts similarity index 100% rename from tests/cases/fourslash/codeFixAddSuperCall.ts rename to tests/cases/fourslash/codeFixSuperCallMissing.ts diff --git a/tests/cases/fourslash/codeFixThisUsedInSuperCall.ts b/tests/cases/fourslash/codeFixSuperCallWithThisInside.ts similarity index 100% rename from tests/cases/fourslash/codeFixThisUsedInSuperCall.ts rename to tests/cases/fourslash/codeFixSuperCallWithThisInside.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts new file mode 100644 index 00000000000..89060b0dfb7 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class C1 { +//// abstract x: number; +//// } +//// +//// class C3 implements C2 {[| |]} + +verify.rangeAfterCodeFix(` +x: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts new file mode 100644 index 00000000000..529db61fc71 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts @@ -0,0 +1,13 @@ +/// + +//// class A { +//// f() {} +//// } +//// +//// class B implements A {[| |]} + +verify.rangeAfterCodeFix(` +f(){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts similarity index 68% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts rename to tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts index 7cbc606539b..d794c7a60d6 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstractClassViaHeritageClause.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts @@ -1,10 +1,10 @@ /// -//// abstract class C1 { -//// f1(){} +//// class C1 { +//// f1(); //// } //// -//// abstract class C2 extends C1 { +//// class C2 extends C1 { //// //// } //// diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts new file mode 100644 index 00000000000..caf4d15df7e --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts @@ -0,0 +1,15 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// x: number; +//// } +//// +//// class C1 implements I1,I2 {[| +//// |]} + +verify.rangeAfterCodeFix(` +x: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts deleted file mode 100644 index 083f4301a11..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// abstract class C1 { -//// abstract f1(); -//// } -//// -//// abstract class C2 extends C1 { -//// -//// } -//// -//// class C3 implements C2 {[| -//// |]f2(){} -//// } - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts deleted file mode 100644 index aaa00cc791a..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumberViaHeritageClause2.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -//// abstract class C1 { -//// abstract f1(); -//// } -//// -//// interface I1 extends C1 {} -//// -//// class C2 implements I1 {[| -//// -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts deleted file mode 100644 index 24c9048015e..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamViaHeritageClause.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// abstract class C1 { -//// abstract f1(); -//// } -//// -//// abstract class C2 extends C1 { -//// -//// } -//// -//// class C3 implements C2 {[| -//// |]f2(){} -//// } - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts deleted file mode 100644 index b7b7271badd..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionViaHeritageClause.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// abstract class C1 { -//// abstract f1(); -//// } -//// -//// abstract class C2 extends C1 { -//// -//// } -//// -//// class C3 implements C2 {[| -//// |]f2(){} -//// } - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts deleted file mode 100644 index 0459b90c99c..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunction.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1(); -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts deleted file mode 100644 index 4b17f315534..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromAbstract.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -//// abstract class C1 { -//// f1(){} -//// } -//// -//// class C2 implements C1 {[| -//// |]f2(){} -//// } - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts deleted file mode 100644 index a6f7c5cdba7..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause1.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -//// interface I1 { -//// f1() -//// } -//// -//// interface I2 extends I1 { -//// -//// } -//// -//// class C1 implements I2 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts deleted file mode 100644 index 01da0838679..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause2.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -//// interface I1 { -//// -//// } -//// -//// interface I2 extends I1 { -//// f1(); -//// } -//// -//// interface I3 extends I2 {} -//// -//// class C1 implements I3 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts deleted file mode 100644 index ff91223f63a..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause3.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -//// interface I1 { -//// -//// } -//// -//// interface I2 { -//// f1(); -//// } -//// -//// interface I3 extends I2, I1 {} -//// -//// class C1 implements I3 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts deleted file mode 100644 index 390a249f7c8..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionFromHeritageClause4.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -//// interface I1 { -//// f1(); -//// } -//// -//// interface I2 { -//// f1(); -//// } -//// -//// interface I3 extends I2, I1 {} -//// -//// class C1 implements I3 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts deleted file mode 100644 index abf5848668e..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParamExtendsString.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// f1(x: number, y: C2); -//// } -//// -//// class C2 {} -//// -//// class C1 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(x: number,y: C2){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts deleted file mode 100644 index 51becc8c99c..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionGenericParams.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// f1(x: number, y: C2); -//// } -//// -//// class C2 {} -//// -//// class C1 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(x: number,y: C2){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts deleted file mode 100644 index 5b5f177741c..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionNoSemicolon.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1() -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts deleted file mode 100644 index 5a4537ff2d5..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParams.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1(x: number, y: string) -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(x: number,y: string){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts deleted file mode 100644 index 157c9bec04e..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionWithParamsClass.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// interface I1 { -//// f1(x: number, y: T); -//// } -//// -//// class T {} -//// -//// class C1 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(x: number,y: T){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts similarity index 57% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts index 36f1c11dc82..976c0dba56d 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingFunctionAndExtends.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts @@ -1,14 +1,10 @@ /// -//// interface I1 { -//// -//// } -//// -//// interface I2 extends I1 { +//// interface I { //// f1(); //// } //// -//// class C1 implements I2 {[| +//// class C implements I {[| //// |]} verify.rangeAfterCodeFix(`f1(){ diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts new file mode 100644 index 00000000000..a21c7074b50 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts @@ -0,0 +1,14 @@ +/// + +//// interface I { +//// f(x: number, y: string) +//// } +//// +//// class C implements I {[| +//// |]} + +verify.rangeAfterCodeFix(` +f(x: number,y: string){ + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts deleted file mode 100644 index f9aeb194fd7..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumberNoSemicolon.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// x: number -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`x: number; -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts new file mode 100644 index 00000000000..4e08a30cde4 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts @@ -0,0 +1,11 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// +//// class C1 implements I1 {[| +//// |]} + +verify.rangeAfterCodeFix(`x: number; +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts new file mode 100644 index 00000000000..9b10cf5d316 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts @@ -0,0 +1,12 @@ +/// + +//// interface I1 { +//// x: number & { __iBrand: any }; +//// } +//// +//// class C1 implements I1 {[| +//// |]} + +verify.rangeAfterCodeFix(` +x: number & { __iBrand: any } +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts similarity index 80% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts index e8a30703638..8e0a35c7fe7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts @@ -12,5 +12,6 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.rangeAfterCodeFix(`x: number; +verify.rangeAfterCodeFix(` +x: number; `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts new file mode 100644 index 00000000000..03c9e535d8d --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts @@ -0,0 +1,14 @@ +/// + +//// interface I { +//// x: number; +//// y: number; +//// } +//// +//// class C2 implements C {[| |] +//// x: number +//// } + +verify.rangeAfterCodeFix(` +y: number; +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts similarity index 54% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts index 5a644dfb993..8c32be6b7f4 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingAbstractFunctionGenericParamExtendsNumber.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts @@ -1,14 +1,12 @@ /// -//// abstract class C1 { -//// abstract f1(); +//// interface I { +//// f1(); //// } //// -//// class C2 extends C1 {[| -//// -//// |]} +//// class C implements I {[| |]} verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } -`); +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedDeepInheritance.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts rename to tests/cases/fourslash/codeFixUnimplementedDeepInheritance.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts deleted file mode 100644 index 165edc92584..00000000000 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -//// class C1 { -//// f1(); -//// } -//// -//// class C2 { -//// f2(); -//// } -//// -//// interface I1 extends C1, C2 {} -//// -//// class C3 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -f2(){ - throw new Error('Method not Implemented'); -} -`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts new file mode 100644 index 00000000000..5470258323e --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts @@ -0,0 +1,16 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// y: number; +//// } +//// +//// class C1 implements I1,I2 {[| +//// |]} + +verify.rangeAfterCodeFix(` +x: number; +y: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts new file mode 100644 index 00000000000..01f7789620a --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts @@ -0,0 +1,28 @@ +/// + +//// interface I1 { +//// x: number, +//// y: number +//// z: number; +//// f(), +//// g() +//// h(); +//// } +//// +//// class C1 implements I1 {[| +//// |]} + +verify.rangeAfterCodeFix(` +x: number; +y: number; +z: number; +f() { + throw new Error('Method not Implemented'); +} +g() { + throw new Error('Method not Implemented'); +} +h() { + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts new file mode 100644 index 00000000000..a5bd006ec06 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts @@ -0,0 +1,17 @@ +/// + +//// interface I { +//// x: { y: T, z: T[] }; +//// } +//// +//// class C implements I { } + +verify.fileAfterCodeFix(` +interface I { + x: { y: T, z: T[] }; +} + +class C implements I { + x: { y: number, z: number[] }; +} +`); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts new file mode 100644 index 00000000000..bc1c60d6dbe --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts @@ -0,0 +1,11 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +// Don't know how to instantiate in codeFix +// if instantiation is invalid. +verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts new file mode 100644 index 00000000000..932368a363c --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts @@ -0,0 +1,17 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +verify.fileAfterCodeFix(` +interface I { + x: T; +} + +class C implements I { + x: number; +} +`); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts new file mode 100644 index 00000000000..0ec1c067445 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts @@ -0,0 +1,17 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +verify.fileAfterCodeFix(` +interface I { + x: T; +} + +class C implements I { + x: T; +} +`); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts new file mode 100644 index 00000000000..9608ac14cf4 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts @@ -0,0 +1,17 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +verify.fileAfterCodeFix(` +interface I { + x: T; +} + +class C implements I { + x: U; +} +`); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts new file mode 100644 index 00000000000..226aee47833 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts @@ -0,0 +1,9 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts new file mode 100644 index 00000000000..448986163f7 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts @@ -0,0 +1,16 @@ +/// + +//// interface I { +//// x: T; +//// } +//// +//// class C implements I { } + +// T is not a declared symbol. There are a couple fixes: +// 1) Declare T. +// 2) Rename T to an existing symbol. +// 3) Make T a type parameter to I. +// +// In the latter two cases, it is premature to copy `x:T` into C. +// Since we can't guess the programmer's intent here, we do nothing. +verify.not.codeFixAvailable(); \ No newline at end of file From 1b8486df89ceec07ac47d0d9e9f66fbd4e622195 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 4 Nov 2016 16:35:51 -0700 Subject: [PATCH 045/289] Still re-writing missing member grabber --- src/compiler/checker.ts | 5 + src/compiler/types.ts | 23 ++- ...sDoesntImplementInheritedAbstractMember.ts | 17 +- .../fixClassIncorrectlyImplementsInterface.ts | 1 + src/services/utilities.ts | 189 +++++++++++++----- 5 files changed, 165 insertions(+), 70 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e12036322bd..25fa0b3e8f4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -74,6 +74,7 @@ namespace ts { getGlobalDiagnostics, getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration, + getTypeOfSymbol, getDeclaredTypeOfSymbol, getPropertiesOfType, getPropertyOfType, @@ -84,6 +85,7 @@ namespace ts { resolveStructuredTypeMembers, getNonNullableType, getSymbolsInScope, + getSymbolOfNode, getSymbolAtLocation, getShorthandAssignmentValueSymbol, getExportSpecifierLocalTargetSymbol, @@ -4352,6 +4354,9 @@ namespace ts { setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } + /** + * Converts an AnonymousType to a ResolvedType. + */ function resolveAnonymousTypeMembers(type: AnonymousType) { const symbol = type.symbol; if (type.target) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ece3dab6ecc..5bf20b1c0bf 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2245,6 +2245,7 @@ namespace ts { export interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getTypeOfSymbol(symbol: Symbol): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; @@ -2256,6 +2257,7 @@ namespace ts { getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolOfNode(node: Node): Symbol; getSymbolAtLocation(node: Node): Symbol; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; @@ -2760,7 +2762,7 @@ namespace ts { objectFlags: ObjectFlags; } - // Class and interface types (TypeFlags.Class and TypeFlags.Interface) + /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ export interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none) @@ -2780,14 +2782,16 @@ namespace ts { declaredNumberIndexInfo: IndexInfo; // Declared numeric indexing info } - // Type references (TypeFlags.Reference). When a class or interface has type parameters or - // a "this" type, references to the class or interface are made using type references. The - // typeArguments property specifies the types to substitute for the type parameters of the - // class or interface and optionally includes an extra element that specifies the type to - // substitute for "this" in the resulting instantiation. When no extra argument is present, - // the type reference itself is substituted for "this". The typeArguments property is undefined - // if the class or interface has no type parameters and the reference isn't specifying an - // explicit "this" argument. + /** + * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * a "this" type, references to the class or interface are made using type references. The + * typeArguments property specifies the types to substitute for the type parameters of the + * class or interface and optionally includes an extra element that specifies the type to + * substitute for "this" in the resulting instantiation. When no extra argument is present, + * the type reference itself is substituted for "this". The typeArguments property is undefined + * if the class or interface has no type parameters and the reference isn't specifying an + * explicit "this" argument. + */ export interface TypeReference extends ObjectType { target: GenericType; // Type reference target typeArguments: Type[]; // Type reference type arguments (undefined if none) @@ -2825,7 +2829,6 @@ namespace ts { finalArrayType?: Type; // Final array type of evolving array type } - /* @internal */ // Resolved object, union, or intersection type export interface ResolvedType extends ObjectType, UnionOrIntersectionType { members: SymbolTable; // Properties by name diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 3a209fbc27d..23b10fc91ba 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -11,17 +11,20 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos = classDeclaration.members.pos; - const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); - const trackingAddedMembers: string[] = []; - const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); - const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); - - if (textChanges.length > 0) { + // const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); + // const trackingAddedMembers: string[] = []; + // const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); + // const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + const insertion = getMissingAbstractMemberInsertion(classDeclaration, checker, context.newLineCharacter); + if (insertion.length > 0) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), changes: [{ fileName: sourceFile.fileName, - textChanges: textChanges + textChanges: [{ + span: {start: startPos, length: 0}, + newText: insertion + }] }] }]; } diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index c8c84715a3d..3244cc0afb9 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -19,6 +19,7 @@ namespace ts.codefix { for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { const newChanges = getCodeFixChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + // getMissingAbstractMemberChanges(classDeclaration, checker, context.newLineCharacter); textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 3777d8b8ac3..4d732c06c6d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,60 +1359,139 @@ namespace ts { }; } - /* - const classMembers: TypeElement[]; // TODO: this - const implementedInterfaceMembers: TypeElement[] = []; - const parentAbstractMembers: TypeElement[] = [] - const missingMembers: TypeElement[] = []; - // const typeWiththis = checker.getTypeWithThisArgument(classType); - // const staticType = checker.getTypeOfSymbol(symbol); - // const classType = checker.getTypeAtLocation(classDecl); - */ + /* + const classMembers: TypeElement[]; // TODO: this + const implementedInterfaceMembers: TypeElement[] = []; + const parentAbstractMembers: TypeElement[] = [] + const missingMembers: TypeElement[] = []; + // const typeWiththis = checker.getTypeWithThisArgument(classType); + // const staticType = checker.getTypeOfSymbol(symbol); + // const classType = checker.getTypeAtLocation(classDecl); + */ - export function getUnimplementedMemberChanges(classDecl: ClassDeclaration, checker: TypeChecker): TextChange[] { + // TODO: (arozga) Get changes for interface as well. + // const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); + export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl); - if (!baseTypeNode) - { - return []; + if (!baseTypeNode) { + return ""; // TODO: (arozga) undefined? } - const classSymbol = checker.getSymbolAtLocation(classDecl); - const classType = checker.getDeclaredTypeOfSymbol(classSymbol); - - const baseTypes = checker.getBaseTypes(classType); - Debug.assert(baseTypes.length === 1); - const baseType = baseTypes[0]; + const classSymbol = checker.getSymbolOfNode(classDecl); + // TODO: (arozga) Should this be getTypeOfSymbol? + // We want the once that gets the members. I think that's the instance, so we want typeofsymbol. + const classType = checker.getTypeOfSymbol(classSymbol); - const resolvedClassType = checker.resolveStructuredTypeMembers(classType); - const resolvedBaseType = checker.resolveStructuredTypeMembers(baseType); + const baseTypes = checker.getBaseTypes(classType); + Debug.assert(baseTypes.length === 1); + const baseType = baseTypes[0]; - const missingMembers = filterMissingMembers(resolvedClassType.members, resolvedBaseType.members); - return insertionsForMembers(missingMembers); - } + // TODO: (arozga) Does this give us the correct instantiations for generics? + // TODO: (arozga) If not, how do we get them? + const resolvedClassType = checker.resolveStructuredTypeMembers(classType); + const resolvedBaseType = checker.resolveStructuredTypeMembers(baseType); - // TODO: (arozga) Get changes for interface as well. - // const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); + // TODO: (arozga) handle private members as well. + const missingMembers = filterMissingMembers(filterAbstract(resolvedBaseType.members), resolvedClassType.members); + + return insertionsForMembers(missingMembers, newlineChar); } - function insertionsForMembers(symbols: Symbol[]): TextChange[] { - let changes: TextChange[] = []; - for (const symbol of symbols) { - const decl = getdeclaration - switch (member.kind) { - case SyntaxKind.PropertySignature: - case SyntaxKind.PropertyDeclaration: - break; - case SyntaxKind.MethodSignature: - case SyntaxKind.MethodDeclaration: - break; - default: - break; + function filterSymbolMapByDecl(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { + let result = createMap(); + for (const key in symbolMap) { + const decl = symbolMap[key].getDeclarations(); + Debug.assert(!!(decl && decl.length)); + if (pred(decl[0])) { + result[key] = symbolMap[key]; } } - return changes; + return result; } - // TODO: (arozga) simplify to quadratic time solution. + function filterAbstract(symbolMap: Map) { + return filterSymbolMapByDecl(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); + } + + function filterNonPrivate(symbolMap: Map) { + return filterSymbolMapByDecl(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); + } + + function insertionsForMembers(symbols: Symbol[], newlineChar: string): string { + let insertion = ""; + for (const symbol of symbols) { + const decls = symbol.getDeclarations(); + if(!(decls && decls.length)) { + return ""; + } + insertion = insertion.concat(getInsertion(decls[0], newlineChar)); + } + return insertion; + } + + const stubMethodBody = "{\nthrow new Error('Method not Implemented');\n}"; + const functionPrefix = "function "; + + // TODO: (arozga) needs a re-write that takes the symbol and type (with type parameter instantiations) + // and figures out how to print it. + function getInsertion(decl: Declaration, newlineChar: string): string { + let insertion = ""; + switch (decl.kind) { + case SyntaxKind.PropertySignature: + case SyntaxKind.PropertyDeclaration: + insertion = decl.getText(); + + // TODO: (arozga) need to remove trailing comma + if (insertion.length && insertion.charAt(insertion.length - 1) !== ";") { + insertion += ";"; + } + return insertion; + case SyntaxKind.MethodSignature: + case SyntaxKind.MethodDeclaration: + const method = decl as MethodSignature | MethodDeclaration; + // TODO: (arozga) figure out how to do proper instantiation of generic values based on heritage clause. + const typeParameters = method.typeParameters && method.typeParameters.length > 0 ? + getCommaSeparatedString(method.typeParameters.map(param => param.getText()), "<", ">") : ""; + const parameters = getCommaSeparatedString(method.parameters.map(param => param.getText()), "(", ")"); + insertion += functionPrefix + method.name + typeParameters + parameters + stubMethodBody; + break; + default: + break; + } + + return insertion += newlineChar; + + /** + * Flattens params into a comma-separated list, sandwiched by prefix + * and suffix on either end. + */ + function getCommaSeparatedString(params: string[], prefix: string, suffix: string) { + let result = prefix; + for(let i = 0; params && i < params.length; ++i) { + result += (i > 0 ? "," : "") + params[i]; + } + return result + suffix; + } + } + + /** + * Finds the symbols in source but not target. + */ + function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Symbol[] { + let result: Symbol[] = []; + outer: + for(const sourceName in sourceSymbols) { + for(const targetName in targetSymbols) { + if(sourceName === targetName) { + continue outer; + } + } + result.push(sourceSymbols[sourceName]); + } + return result; + } + + /* function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Symbol[] { let missingMembers: Symbol[] = []; const sortedSourceKeys = Object.keys(sourceSymbols).sort(); @@ -1439,6 +1518,7 @@ namespace ts { return missingMembers; } + */ /** * Generates codefix changes to insert @@ -1456,19 +1536,22 @@ namespace ts { for (const member of missingMembers) { if (member.kind === SyntaxKind.PropertySignature || member.kind === SyntaxKind.PropertyDeclaration) { const interfaceProperty = member; - if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) === -1) { - let propertyText = ""; - if (reference) { - propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; - } - else { - propertyText = interfaceProperty.getText(); - const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; - propertyText += stringToAdd; - } - changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceProperty.name.getText()); + if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) !== -1) { + continue; } + + let propertyText = ""; + if (reference) { + propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; + } + else { + propertyText = interfaceProperty.getText(); + const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; + propertyText += stringToAdd; + } + changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); + trackingAddedMembers.push(interfaceProperty.name.getText()); + } else if (member.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.MethodDeclaration) { const interfaceMethod = member; From b7b30aab460541ee2f34052b1148ba65f5b0d763 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 4 Nov 2016 16:36:28 -0700 Subject: [PATCH 046/289] Add straggling Test --- .../codeFixUnImplementedInterfaceTypeParamOnProperty.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts index 8c32be6b7f4..83299f10ecf 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts @@ -1,12 +1,12 @@ /// //// interface I { -//// f1(); +//// f(); //// } //// //// class C implements I {[| |]} -verify.rangeAfterCodeFix(`f1(){ +verify.rangeAfterCodeFix(`f(){ throw new Error('Method not Implemented'); } -`); \ No newline at end of file +`); \ No newline at end of file From 71d17445f7b7c7fb4b95a3ed2a2eb45912c30691 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 7 Nov 2016 19:00:27 -0800 Subject: [PATCH 047/289] Test Fixes * remove abstract modifier on insertion * use semi-colon to delimit object types * remove bad type param --- ...xtendsAbstractMethodGenericParamsInstantiated.ts | 13 +++++++++++++ .../codeFixClassExtendsAbstractProperty.ts | 2 +- .../codeFixClassExtendsAbstractProtectedProperty.ts | 2 +- .../codeFixClassExtendsAbstractPublicProperty.ts | 2 +- ...eFixUnImplementedClassMissingAbstractProperty.ts | 4 ++-- ...plementedInterfaceMissingMethodWithReturnType.ts | 13 +++++++++++++ ...plementedInterfaceMissingPropertyIntersection.ts | 2 +- ...ixUnImplementedInterfaceSomePropertiesPresent.ts | 7 ++++--- ...mplementedInterfaceTypeParamInstantiateDeeply.ts | 4 ++-- 9 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts new file mode 100644 index 00000000000..64f74262ba8 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts @@ -0,0 +1,13 @@ +/// + +//// abstract class A { +//// abstract f(); +//// } +//// +//// class C extends A {[| +//// |]} + +verify.rangeAfterCodeFix(`f(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts index 0fa6dd3dc51..46de88f7511 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts @@ -8,5 +8,5 @@ //// |]} verify.rangeAfterCodeFix(` -abstract x: number; +x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts index dae05f58ac2..6d0571fce6b 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts @@ -8,5 +8,5 @@ //// |]} verify.rangeAfterCodeFix(` -protected abstract x: number; +protected x: number; `); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts index 2862c329235..917f75051f1 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts @@ -8,5 +8,5 @@ //// |]} verify.rangeAfterCodeFix(` -public abstract x: number; +public x: number; `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts index 89060b0dfb7..25edca0964e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts @@ -1,10 +1,10 @@ /// -//// abstract class C1 { +//// abstract class A { //// abstract x: number; //// } //// -//// class C3 implements C2 {[| |]} +//// class C implements A {[| |]} verify.rangeAfterCodeFix(` x: number; diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts new file mode 100644 index 00000000000..89ee457a521 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts @@ -0,0 +1,13 @@ +/// + +//// interface I { +//// f1(): string; +//// } +//// +//// class C implements I {[| +//// |]} + +verify.rangeAfterCodeFix(`f1(): string { + throw new Error('Method not Implemented'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts index 9b10cf5d316..5221810bc40 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts @@ -8,5 +8,5 @@ //// |]} verify.rangeAfterCodeFix(` -x: number & { __iBrand: any } +x: number & { __iBrand: any; }; `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts index 03c9e535d8d..5a932941e07 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts @@ -5,10 +5,11 @@ //// y: number; //// } //// -//// class C2 implements C {[| |] -//// x: number -//// } +//// class C2 implements I {[| +//// x: number; +//// |]} verify.rangeAfterCodeFix(` y: number; +x: number; `); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts index a5bd006ec06..dacbdc7eb51 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts @@ -11,7 +11,7 @@ interface I { x: { y: T, z: T[] }; } -class C implements I { - x: { y: number, z: number[] }; +class C implements I { + x: { y: number; z: number[]; }; } `); From 8c35185b3748a5eb79b8e084f8b77b87521855e4 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 7 Nov 2016 19:03:05 -0800 Subject: [PATCH 048/289] Expose More TypeChecker * getUnionType * getIntersectionType * getTypeFromTypeReference --- src/compiler/checker.ts | 5 ++++- src/compiler/types.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 25fa0b3e8f4..248df02cfb9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -81,6 +81,9 @@ namespace ts { getSignaturesOfType, getIndexTypeOfType, getBaseTypes, + getUnionType, + getIntersectionType, + getTypeFromTypeReference, getReturnTypeOfSignature, resolveStructuredTypeMembers, getNonNullableType, @@ -2037,7 +2040,7 @@ namespace ts { return result || types; } - function visibilityToString(flags: ModifierFlags) { + function visibilityToString(flags: ModifierFlags): string | undefined { if (flags === ModifierFlags.Private) { return "private"; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5bf20b1c0bf..afebe57aeed 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2255,6 +2255,8 @@ namespace ts { resolveStructuredTypeMembers(type: StructuredType): ResolvedType; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; + getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; + getUnionType(types: Type[], subtypeReduction?: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolOfNode(node: Node): Symbol; @@ -2264,6 +2266,7 @@ namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; From bc1bb0e7f16c6cccc6ca1e1952bbe5e1d557726e Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 7 Nov 2016 19:03:25 -0800 Subject: [PATCH 049/289] Make test failure more readable --- src/harness/fourslash.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index e8e5c8e9597..b7ecf957cb1 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2047,7 +2047,7 @@ namespace FourSlash { const actualText = this.rangeText(ranges[0]); if (this.removeWhitespace(actualText) !== this.removeWhitespace(expectedText)) { - this.raiseError(`Actual text doesn't match expected text. Actual: '${actualText}' Expected: '${expectedText}'`); + this.raiseError(`Actual text doesn't match expected text. Actual:\n'${actualText}'\nExpected:\n'${expectedText}'`); } } @@ -2084,7 +2084,7 @@ namespace FourSlash { const actualContents: string = this.getFileContent(fileName); if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { - this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n\n${expectedContents}`); + this.raiseError(`Actual text doesn't match expected text. Actual:\n${actualContents}\n\nExpected:\n${expectedContents}`); } } From 0ce53f0230e9d248a1157319a612a9416a06249d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 10:43:36 -0800 Subject: [PATCH 050/289] rename tests --- ...stractMethodTypeParamsInstantiateNumber.ts | 13 ++++++++++ ...dsAbstractMethodTypeParamsInstantiateU.ts} | 0 ...assExtendsAbstractSomePropertiesPresent.ts | 16 +++++++++++++ ...mentedClassMissingFunctionVoidInferred.ts} | 2 +- ...plementedClassMissingMethodViaHeritage.ts} | 4 ++-- .../codeFixUnImplementedInterface39.ts | 2 +- ...mentedInterfaceMissingMethodTypeParams.ts} | 0 ...plementedInterfaceSomePropertiesPresent.ts | 11 +++++---- ...ceMissingMultipleImplementsIntersection.ts | 24 +++++++++++++++++++ 9 files changed, 63 insertions(+), 9 deletions(-) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts rename tests/cases/fourslash/{codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts => codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts} (100%) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts rename tests/cases/fourslash/{codeFixUnImplementedClassMissingFunction.ts => codeFixUnImplementedClassMissingFunctionVoidInferred.ts} (89%) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingPropertyViaHeritage.ts => codeFixUnImplementedClassMissingMethodViaHeritage.ts} (75%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceTypeParamOnProperty.ts => codeFixUnImplementedInterfaceMissingMethodTypeParams.ts} (100%) create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts new file mode 100644 index 00000000000..cf8747d482e --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts @@ -0,0 +1,13 @@ +/// + +//// abstract class A { +//// abstract f(); +//// } +//// +//// class C extends A {[| +//// |]} + +verify.rangeAfterCodeFix(`f(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractMethodGenericParamsInstantiated.ts rename to tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts new file mode 100644 index 00000000000..60adfb5d319 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts @@ -0,0 +1,16 @@ +/// + +//// abstract class A { +//// abstract x: number; +//// abstract y: number; +//// abstract z: number; +//// } +//// +//// class C extends A {[| |] +//// constructor(public x: number) { } +//// y: number; +//// } + +verify.rangeAfterCodeFix(` +z: number; +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts similarity index 89% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts rename to tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts index 529db61fc71..e78bf00f854 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunction.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts @@ -7,7 +7,7 @@ //// class B implements A {[| |]} verify.rangeAfterCodeFix(` -f(){ +f(): void{ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts similarity index 75% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts rename to tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts index d794c7a60d6..af20c19561d 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyViaHeritage.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts @@ -1,7 +1,7 @@ /// //// class C1 { -//// f1(); +//// f1() {} //// } //// //// class C2 extends C1 { @@ -12,7 +12,7 @@ //// |]f2(){} //// } -verify.rangeAfterCodeFix(`f1(){ +verify.rangeAfterCodeFix(`f1(): void{ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts index fcc43ba6259..42dfae91e3e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts @@ -12,7 +12,7 @@ //// class C1 implements N1.I1 {[| //// |]} -verify.rangeAfterCodeFix(`f1():string{ +verify.rangeAfterCodeFix(`f1(): string{ throw new Error('Method not Implemented'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodTypeParams.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamOnProperty.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodTypeParams.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts index 5a932941e07..6fea1a38d1b 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts @@ -3,13 +3,14 @@ //// interface I { //// x: number; //// y: number; +//// z: number; //// } //// -//// class C2 implements I {[| -//// x: number; -//// |]} +//// class C implements I {[| |] +//// constructor(public x: number) { } +//// y: number; +//// } verify.rangeAfterCodeFix(` -y: number; -x: number; +z: number; `); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts new file mode 100644 index 00000000000..0cd15a2ff16 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts @@ -0,0 +1,24 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// x: string; +//// } +//// +//// class C1 implements I1,I2 {[| +//// |]} + +verify.fileAfterCodeFix(` +interface I1 { + x: number; + } + interface I2 { + x: string; + } + + class C1 implements I1,I2 { + x: number & string; +} +`); From b26ba83db3287362cf06eb5ad0e4abb9c6989bb6 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 13:14:30 -0800 Subject: [PATCH 051/289] Expose signatureToString, addSupressAnyReturn Flag --- src/compiler/checker.ts | 9 +++++++-- src/compiler/types.ts | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 248df02cfb9..5ed3136e64d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -94,6 +94,7 @@ namespace ts { getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment, + signatureToString, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -2674,6 +2675,11 @@ namespace ts { } function buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + const returnType = getReturnTypeOfSignature(signature); + if (flags & TypeFormatFlags.supressAnyReturnType && isTypeAny(returnType)) { + return; + } + if (flags & TypeFormatFlags.WriteArrowStyleSignature) { writeSpace(writer); writePunctuation(writer, SyntaxKind.EqualsGreaterThanToken); @@ -2687,7 +2693,6 @@ namespace ts { buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - const returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -4136,7 +4141,7 @@ namespace ts { return type; } - function getTypeWithThisArgument(type: Type, thisArgument?: Type) { + function getTypeWithThisArgument(type: Type, thisArgument?: Type): Type { if (getObjectFlags(type) & ObjectFlags.Reference) { return createTypeReference((type).target, concatenate((type).typeArguments, [thisArgument || (type).target.thisType])); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index afebe57aeed..085895f3387 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2257,7 +2257,7 @@ namespace ts { getNonNullableType(type: Type): Type; getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; getUnionType(types: Type[], subtypeReduction?: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; - + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolOfNode(node: Node): Symbol; getSymbolAtLocation(node: Node): Symbol; @@ -2267,6 +2267,7 @@ namespace ts { getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -2348,6 +2349,7 @@ namespace ts { InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type InTypeAlias = 0x00000200, // Writing type in type alias declaration UseTypeAliasValue = 0x00000400, // Serialize the type instead of using type-alias. This is needed when we emit declaration file. + supressAnyReturnType = 0x00000800, // If the return type is any-like, don't offer a return type. } export const enum SymbolFormatFlags { From 11cea6a771be997d3ca8975697d77fc71f6e195d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 13:14:54 -0800 Subject: [PATCH 052/289] Use TypeChecker to Get Types, Print --- src/services/utilities.ts | 350 +++++++++++--------------------------- 1 file changed, 98 insertions(+), 252 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 4d732c06c6d..7e5a8c78c98 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,42 +1359,68 @@ namespace ts { }; } - /* - const classMembers: TypeElement[]; // TODO: this - const implementedInterfaceMembers: TypeElement[] = []; - const parentAbstractMembers: TypeElement[] = [] - const missingMembers: TypeElement[] = []; - // const typeWiththis = checker.getTypeWithThisArgument(classType); - // const staticType = checker.getTypeOfSymbol(symbol); - // const classType = checker.getTypeAtLocation(classDecl); - */ - - // TODO: (arozga) Get changes for interface as well. - // const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl); - if (!baseTypeNode) { - return ""; // TODO: (arozga) undefined? + return ""; } + const classSymbol = checker.getSymbolOfNode(classDecl); - // TODO: (arozga) Should this be getTypeOfSymbol? - // We want the once that gets the members. I think that's the instance, so we want typeofsymbol. + + const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); + const resolvedExtendsType = checker.resolveStructuredTypeMembers(InstantiatedExtendsType); + + // TODO: (arozga) Should we use the above or this to get the type of the extended class? + /* const classType = checker.getTypeOfSymbol(classSymbol); - - const baseTypes = checker.getBaseTypes(classType); - Debug.assert(baseTypes.length === 1); - const baseType = baseTypes[0]; - - // TODO: (arozga) Does this give us the correct instantiations for generics? - // TODO: (arozga) If not, how do we get them? - const resolvedClassType = checker.resolveStructuredTypeMembers(classType); + let baseType = checker.getBaseTypes(classType)[0]; const resolvedBaseType = checker.resolveStructuredTypeMembers(baseType); + if (baseType.objectFlags & ObjectFlags.Reference) { + baseType = checker.getTypeFromTypeReference(baseType); + } + */ - // TODO: (arozga) handle private members as well. - const missingMembers = filterMissingMembers(filterAbstract(resolvedBaseType.members), resolvedClassType.members); + const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedExtendsType.members)), classSymbol.members); - return insertionsForMembers(missingMembers, newlineChar); + return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); + } + + export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { + const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); + if (!implementedTypeNodes || implementedTypeNodes.length === 0) { + return ""; + } + + const classSymbol = checker.getSymbolOfNode(classDecl); + + let implementsIntersectionType: IntersectionType | InterfaceType; + if(implementedTypeNodes.length > 1) { + implementsIntersectionType = checker.getIntersectionType(implementedTypeNodes.map(checker.getTypeFromTypeReference)); + } + else { + implementsIntersectionType = checker.getTypeFromTypeReference(implementedTypeNodes[0]); + } + + const structuredType = checker.resolveStructuredTypeMembers(implementsIntersectionType); + const missingMembers = filterMissingMembers(filterNonPrivate(structuredType.members), classSymbol.members); + return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); + } + + /** + * Finds the symbols in source but not target, generating a new map with the differences. + */ + function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Map { + let result: Map = createMap(); + outer: + for(const sourceName in sourceSymbols) { + for(const targetName in targetSymbols) { + if(sourceName === targetName) { + continue outer; + } + } + result[sourceName] = sourceSymbols[sourceName]; + } + return result; } function filterSymbolMapByDecl(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { @@ -1410,6 +1436,8 @@ namespace ts { } function filterAbstract(symbolMap: Map) { + // TODO: (arozga) use first or second? + // return mapObject(symbolMap, (key, val) => getModifierFlags(val.getDeclarations()[0]) & ModifierFlags.Abstract ? [key, val]: [undefined, undefined] ); return filterSymbolMapByDecl(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); } @@ -1417,254 +1445,72 @@ namespace ts { return filterSymbolMapByDecl(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); } - function insertionsForMembers(symbols: Symbol[], newlineChar: string): string { + function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { let insertion = ""; - for (const symbol of symbols) { - const decls = symbol.getDeclarations(); - if(!(decls && decls.length)) { - return ""; - } - insertion = insertion.concat(getInsertion(decls[0], newlineChar)); + + for (const symbolName in symbolMap) { + insertion = insertion.concat(getInsertionForMemberSymbol(symbolMap[symbolName], enclosingDeclaration, checker, newlineChar)); } return insertion; } - const stubMethodBody = "{\nthrow new Error('Method not Implemented');\n}"; - const functionPrefix = "function "; - - // TODO: (arozga) needs a re-write that takes the symbol and type (with type parameter instantiations) - // and figures out how to print it. - function getInsertion(decl: Declaration, newlineChar: string): string { - let insertion = ""; - switch (decl.kind) { + function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { + const name = symbol.getName(); + const type = checker.getTypeOfSymbol(symbol); + + const decls = symbol.getDeclarations(); + if (!(decls && decls.length)) { + return ""; + } + const node = decls[0]; + const visibility = getVisibilityPrefix(getModifierFlags(node)); + switch (node.kind) { case SyntaxKind.PropertySignature: case SyntaxKind.PropertyDeclaration: - insertion = decl.getText(); - - // TODO: (arozga) need to remove trailing comma - if (insertion.length && insertion.charAt(insertion.length - 1) !== ";") { - insertion += ";"; - } - return insertion; + const typeString = checker.typeToString(type, enclosingDeclaration, TypeFormatFlags.None); + return `${visibility}${name}: ${typeString};${newlineChar}`; + case SyntaxKind.MethodSignature: case SyntaxKind.MethodDeclaration: - const method = decl as MethodSignature | MethodDeclaration; - // TODO: (arozga) figure out how to do proper instantiation of generic values based on heritage clause. - const typeParameters = method.typeParameters && method.typeParameters.length > 0 ? - getCommaSeparatedString(method.typeParameters.map(param => param.getText()), "<", ">") : ""; - const parameters = getCommaSeparatedString(method.parameters.map(param => param.getText()), "(", ")"); - insertion += functionPrefix + method.name + typeParameters + parameters + stubMethodBody; - break; + const sigs = checker.getSignaturesOfType(type, SignatureKind.Call); + if(!(sigs && sigs.length > 0)) { + return ""; + } + // TODO: (arozga) Deal with multiple signatures. + const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); + + return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; default: - break; + return ""; } + } - return insertion += newlineChar; - - /** - * Flattens params into a comma-separated list, sandwiched by prefix - * and suffix on either end. - */ - function getCommaSeparatedString(params: string[], prefix: string, suffix: string) { - let result = prefix; - for(let i = 0; params && i < params.length; ++i) { - result += (i > 0 ? "," : "") + params[i]; - } - return result + suffix; - } + function getMethodBodyStub(newLineChar: string) { + return `{${newLineChar}throw new Error('Method not Implemented');${newLineChar}}${newLineChar}`; } /** - * Finds the symbols in source but not target. + * Flattens params into a comma-separated list, sandwiched by prefix + * and suffix on either end. */ - function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Symbol[] { - let result: Symbol[] = []; - outer: - for(const sourceName in sourceSymbols) { - for(const targetName in targetSymbols) { - if(sourceName === targetName) { - continue outer; - } - } - result.push(sourceSymbols[sourceName]); - } - return result; - } - /* - function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Symbol[] { - let missingMembers: Symbol[] = []; - const sortedSourceKeys = Object.keys(sourceSymbols).sort(); - const sortedTargetKeys = Object.keys(targetSymbols).sort(); - - let i = 0; - let j = 0; - while (i < sortedSourceKeys.length && j < sortedTargetKeys.length) { - // TODO: (arozga) convert switch to if else with inequalities (browser compat?) - switch (sortedSourceKeys[i].localeCompare(sortedSourceKeys[j])) { - case 0: - ++i; - ++j; - break; - case -1: - missingMembers.push(sourceSymbols[sortedSourceKeys[i]]); - ++i; - break; - case 1: - ++j; - default: - } + function getCommaSeparatedString(params: string[], prefix: string, suffix: string) { + let result = prefix; + for (let i = 0; params && i < params.length; ++i) { + result += (i > 0 ? "," : "") + params[i]; } - - return missingMembers; + return result + suffix; } */ - /** - * Generates codefix changes to insert - */ - export function getCodeFixChanges(interfaceClause: Node, existingMembers: string[], startPos: number, checker: TypeChecker, reference: boolean, trackingAddedMembers: string[], newLineCharacter: string): TextChange[] { - const type = checker.getTypeAtLocation(interfaceClause); - - if (!(type && type.symbol && type.symbol.declarations && type.symbol.declarations.length > 0)) { - return []; + function getVisibilityPrefix(flags: ModifierFlags): string { + if (flags & ModifierFlags.Public) { + return "public "; } - - const missingMembers: TypeElement[] = getMissingInterfaceMembers(type.symbol.declarations[0], existingMembers, checker); - const changesArray: TextChange[] = []; - - for (const member of missingMembers) { - if (member.kind === SyntaxKind.PropertySignature || member.kind === SyntaxKind.PropertyDeclaration) { - const interfaceProperty = member; - if (trackingAddedMembers.indexOf(interfaceProperty.name.getText()) !== -1) { - continue; - } - - let propertyText = ""; - if (reference) { - propertyText = `${interfaceProperty.name.getText()} : ${getDefaultValue(interfaceProperty.type.kind)},${newLineCharacter}`; - } - else { - propertyText = interfaceProperty.getText(); - const stringToAdd = !(propertyText.match(/;$/)) ? `;${newLineCharacter}` : newLineCharacter; - propertyText += stringToAdd; - } - changesArray.push({ newText: propertyText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceProperty.name.getText()); - - } - else if (member.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.MethodDeclaration) { - const interfaceMethod = member; - handleMethods(interfaceMethod, startPos, reference, trackingAddedMembers, changesArray, newLineCharacter); - } - } - - if (reference && existingMembers.length === 0 && changesArray.length > 0) { - let lastValue = changesArray[changesArray.length - 1].newText; - lastValue = `${lastValue.substr(0, lastValue.length - (newLineCharacter.length + 1))} ${newLineCharacter}`; - changesArray[changesArray.length - 1].newText = lastValue; - } - - return changesArray; - } - - /** - * Gets members in an interface and all its base types. - */ - function getInterfaceMembers(declaration: InterfaceDeclaration, checker: TypeChecker): TypeElement[] { - let result: TypeElement[] = declaration.members - ? declaration.members.filter(member => !(getModifierFlags(member) & ModifierFlags.Private)) - : []; - const clauses = getInterfaceBaseTypeNodes(declaration); - if (clauses) { - for (const clause of clauses) { - const type = checker.getTypeAtLocation(clause); - if (type && type.symbol && type.symbol.declarations) { - result = result.concat(getInterfaceMembers(type.symbol.declarations[0], checker)); - } - } - } - - return result; - } - - function getMissingInterfaceMembers(declaration: InterfaceDeclaration, existingMembers: string[], checker: TypeChecker): TypeElement[] { - const interfaceMembers = getInterfaceMembers(declaration, checker); - return ts.filter(interfaceMembers, member => !member.name || existingMembers.indexOf(member.name.getText()) === -1); - } - - export function getNamedClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { - return classDeclaration.members.filter(member => member.name); - } - - export function getNamedAbstractClassMembers(classDeclaration: ClassDeclaration): ClassElement[] { - return getNamedClassMembers(classDeclaration).filter(member => getModifierFlags(member) & ModifierFlags.Abstract); - } - - function getDefaultValue(kind: SyntaxKind): string { - switch (kind) { - case SyntaxKind.StringKeyword: - return '""'; - case SyntaxKind.BooleanKeyword: - return "false"; - case SyntaxKind.NumberKeyword: - return "0"; - default: - return "null"; - } - } - - function handleMethods(interfaceMethod: MethodSignature, startPos: number, isReference: boolean, trackingAddedMembers: string[], textChanges: TextChange[], newLineCharacter: string) { - const methodBody = "throw new Error('Method not Implemented');"; - - if (trackingAddedMembers.indexOf(interfaceMethod.name.getText())) { - const methodName = interfaceMethod.name.getText(); - const typeParameterArray: string[] = []; - - for (let i = 0; interfaceMethod.typeParameters && i < interfaceMethod.typeParameters.length; i++) { - typeParameterArray.push(interfaceMethod.typeParameters[i].getText()); - } - - const parameterArray: string[] = []; - for (let j = 0; interfaceMethod.parameters && j < interfaceMethod.parameters.length; j++) { - parameterArray.push(interfaceMethod.parameters[j].getText()); - } - - let methodText = methodName; - if (typeParameterArray.length > 0) { - methodText += "<"; - } - - for (let k = 0; k < typeParameterArray.length; k++) { - methodText += typeParameterArray[k]; - if (k !== typeParameterArray.length - 1) { - methodText += ","; - } - } - - if (typeParameterArray.length > 0) { - methodText += ">"; - } - - methodText += "("; - for (let k = 0; k < parameterArray.length; k++) { - methodText += parameterArray[k]; - if (k !== parameterArray.length - 1) { - methodText += ","; - } - } - - methodText += `)`; - if (interfaceMethod.type) { - methodText += ":" + interfaceMethod.type.getText(); - } - - methodText += `{${newLineCharacter}${methodBody}${newLineCharacter}`; - methodText = isReference ? methodText.concat(`},${newLineCharacter}`) : methodText.concat(`}${newLineCharacter}`); - - textChanges.push({ newText: methodText, span: { start: startPos, length: 0 } }); - trackingAddedMembers.push(interfaceMethod.name.getText()); + else if (flags & ModifierFlags.Protected) { + return "protected "; } + return ""; } export function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile) { From 7141a2a7146b145aa8e5728347d0e30394eb872a Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 13:15:09 -0800 Subject: [PATCH 053/289] Better error message in fourslash --- src/harness/fourslash.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b7ecf957cb1..768894ae528 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2035,7 +2035,7 @@ namespace FourSlash { const codeFix: ts.CodeAction = this.getCodeFix(fileName, codeFixIdentifier); if (!codeFix) { - this.raiseError("Should find exactly one codefix."); + this.raiseError("Should find exactly one codefix, but none found."); } const fileChange = ts.find(codeFix.changes, change => change.fileName === fileName); From 55bf3e3ff01d5eeaedc206715be04b26fc305cb6 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 13:15:58 -0800 Subject: [PATCH 054/289] Use new engine for interface fixes --- .../fixClassIncorrectlyImplementsInterface.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 3244cc0afb9..940452b687f 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -11,24 +11,18 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos: number = classDeclaration.members.pos; - const classMembers = ts.map(getNamedClassMembers(classDeclaration), member => member.name.getText()); - const trackingAddedMembers: string[] = []; - const interfaceClauses = ts.getClassImplementsHeritageClauseElements(classDeclaration); - let textChanges: TextChange[] = undefined; + const insertion = getMissingInterfaceMembersInsertion(classDeclaration, checker, context.newLineCharacter); - for (let i = 0; interfaceClauses && i < interfaceClauses.length; i++) { - const newChanges = getCodeFixChanges(interfaceClauses[i], classMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); - // getMissingAbstractMemberChanges(classDeclaration, checker, context.newLineCharacter); - textChanges = textChanges ? textChanges.concat(newChanges) : newChanges; - } - - if (textChanges && textChanges.length > 0) { + if(insertion && insertion.length) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), changes: [{ fileName: sourceFile.fileName, - textChanges: textChanges + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] }] }]; } From 4441380e6fdb3314d8a874b0bf6ffe0d727d99b0 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 13:20:56 -0800 Subject: [PATCH 055/289] tests: edit expected type params --- ...ixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts | 4 ++-- ...codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts | 4 ++-- ...ams.ts => codeFixUnImplementedInterfaceTypeParamMethod.ts} | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingMethodTypeParams.ts => codeFixUnImplementedInterfaceTypeParamMethod.ts} (61%) diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts index cf8747d482e..d434f282884 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts @@ -1,13 +1,13 @@ /// //// abstract class A { -//// abstract f(); +//// abstract f(x: T); //// } //// //// class C extends A {[| //// |]} -verify.rangeAfterCodeFix(`f(){ +verify.rangeAfterCodeFix(`f(x: number){ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts index 64f74262ba8..7d6b8e1e815 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts @@ -1,13 +1,13 @@ /// //// abstract class A { -//// abstract f(); +//// abstract f(x: T); //// } //// //// class C extends A {[| //// |]} -verify.rangeAfterCodeFix(`f(){ +verify.rangeAfterCodeFix(`f(x: U){ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodTypeParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts similarity index 61% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodTypeParams.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts index 83299f10ecf..bd221ceb8cb 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodTypeParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts @@ -1,12 +1,12 @@ /// //// interface I { -//// f(); +//// f(x: T); //// } //// //// class C implements I {[| |]} -verify.rangeAfterCodeFix(`f(){ +verify.rangeAfterCodeFix(`f(x: T){ throw new Error('Method not Implemented'); } `); \ No newline at end of file From 1ec234af3266c9e005bee2bea6d7c2d1010504e0 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 14:13:25 -0800 Subject: [PATCH 056/289] Edit error handling tests --- .../codeFixUnImplementedInterface37.ts | 20 ------------------- ...ixUnImplementedInterfaceDuplicateMember.ts | 7 ++++++- ...entedInterfaceMissingMultipleImplements.ts | 7 ++++++- ...ceMissingMultipleImplementsIntersection.ts | 5 +++++ ...entedInterfaceTypeParamInstantiateError.ts | 6 ++++-- ...xUnimplementedInterfaceUndeclaredSymbol.ts | 5 ++++- 6 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface37.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts b/tests/cases/fourslash/codeFixUnImplementedInterface37.ts deleted file mode 100644 index 3ff689d455e..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface37.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// - -//// abstract class C1 { -//// abstract f1(); -//// } -//// -//// abstract class C2 extends C1{ -//// -//// } -//// -//// interface I1 extends C2 {} -//// -//// class C3 implements I1 {[| -//// -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts index caf4d15df7e..07a31e1cc6a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts @@ -10,6 +10,11 @@ //// class C1 implements I1,I2 {[| //// |]} +verify.not.codeFixAvailable(); + +// TODO: (arozga) Get members from multiple interfaces. +/* verify.rangeAfterCodeFix(` x: number; -`); \ No newline at end of file +`); +*/ \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts index 5470258323e..114eac38cc2 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts @@ -10,7 +10,12 @@ //// class C1 implements I1,I2 {[| //// |]} +verify.not.codeFixAvailable(); + +// TODO: (arozga) Get members from multiple interfaces. +/* verify.rangeAfterCodeFix(` x: number; y: number; -`); \ No newline at end of file +`); +*/ \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts index 0cd15a2ff16..4a115eb5a84 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts @@ -10,6 +10,10 @@ //// class C1 implements I1,I2 {[| //// |]} +verify.not.codeFixAvailable(); + +// TODO: (arozga) Get members from multiple interfaces. +/* verify.fileAfterCodeFix(` interface I1 { x: number; @@ -22,3 +26,4 @@ interface I1 { x: number & string; } `); +*/ diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts index bc1c60d6dbe..f4e433e9c0d 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts @@ -6,6 +6,8 @@ //// //// class C implements I { } -// Don't know how to instantiate in codeFix +verify.codeFixAvailable(); + +// TODO: (arozga) Don't know how to instantiate in codeFix // if instantiation is invalid. -verify.not.codeFixAvailable(); \ No newline at end of file +// verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts index 448986163f7..0acf60645c9 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts @@ -13,4 +13,7 @@ // // In the latter two cases, it is premature to copy `x:T` into C. // Since we can't guess the programmer's intent here, we do nothing. -verify.not.codeFixAvailable(); \ No newline at end of file + +verify.codeFixAvailable(); +// TODO: (aozgaa) Acknowledge other errors on class/implemented interface/extended abstract class. +// verify.not.codeFixAvailable(); \ No newline at end of file From 6bd35fb066112b287a5ec294f422a4eb8cb043c7 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 14:26:10 -0800 Subject: [PATCH 057/289] Fix Type Param method Tests --- ...assExtendsAbstractMethodTypeParamsInstantiateNumber.ts | 4 ++-- ...FixClassExtendsAbstractMethodTypeParamsInstantiateU.ts | 6 +++--- tests/cases/fourslash/codeFixUnImplementedInterface36.ts | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts index d434f282884..1faa572b5bc 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts @@ -1,13 +1,13 @@ /// //// abstract class A { -//// abstract f(x: T); +//// abstract f(x: T): T; //// } //// //// class C extends A {[| //// |]} -verify.rangeAfterCodeFix(`f(x: number){ +verify.rangeAfterCodeFix(`f(x: number): number{ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts index 7d6b8e1e815..abb8b6fd2a7 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts @@ -1,13 +1,13 @@ /// //// abstract class A { -//// abstract f(x: T); +//// abstract f(x: T): T; //// } //// //// class C extends A {[| -//// |]} +//// |]} -verify.rangeAfterCodeFix(`f(x: U){ +verify.rangeAfterCodeFix(`f(x: U): U{ throw new Error('Method not Implemented'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts index 17f889b56bf..6200b2ac467 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts @@ -14,7 +14,15 @@ //// //// |]} +verify.rangeAfterCodeFix(`f1(){ + throw new Error('Method not Implemented'); +} +`); + +// TODO: (arozga) Include type qualifiers. +/* verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } `); +*/ From 4973852722c5203194df1dc5e699c7498763e603 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 14:37:46 -0800 Subject: [PATCH 058/289] fix linter errors --- src/compiler/types.ts | 2 +- ...sDoesntImplementInheritedAbstractMember.ts | 8 +-- .../fixClassIncorrectlyImplementsInterface.ts | 2 +- src/services/utilities.ts | 54 +++++-------------- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 085895f3387..887c77d5131 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2257,7 +2257,7 @@ namespace ts { getNonNullableType(type: Type): Type; getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; getUnionType(types: Type[], subtypeReduction?: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; - + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolOfNode(node: Node): Symbol; getSymbolAtLocation(node: Node): Symbol; diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 23b10fc91ba..3e501ccbcff 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -8,7 +8,7 @@ namespace ts.codefix { const token = getTokenAtPosition(sourceFile, start); const checker = context.program.getTypeChecker(); - if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { + if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos = classDeclaration.members.pos; // const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); @@ -22,9 +22,9 @@ namespace ts.codefix { changes: [{ fileName: sourceFile.fileName, textChanges: [{ - span: {start: startPos, length: 0}, - newText: insertion - }] + span: { start: startPos, length: 0 }, + newText: insertion + }] }] }]; } diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 940452b687f..e935dd55607 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -14,7 +14,7 @@ namespace ts.codefix { const insertion = getMissingInterfaceMembersInsertion(classDeclaration, checker, context.newLineCharacter); - if(insertion && insertion.length) { + if (insertion && insertion.length) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), changes: [{ diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 7e5a8c78c98..95794e3aaee 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1364,22 +1364,12 @@ namespace ts { if (!baseTypeNode) { return ""; } - + const classSymbol = checker.getSymbolOfNode(classDecl); const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); const resolvedExtendsType = checker.resolveStructuredTypeMembers(InstantiatedExtendsType); - // TODO: (arozga) Should we use the above or this to get the type of the extended class? - /* - const classType = checker.getTypeOfSymbol(classSymbol); - let baseType = checker.getBaseTypes(classType)[0]; - const resolvedBaseType = checker.resolveStructuredTypeMembers(baseType); - if (baseType.objectFlags & ObjectFlags.Reference) { - baseType = checker.getTypeFromTypeReference(baseType); - } - */ - const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedExtendsType.members)), classSymbol.members); return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); @@ -1394,14 +1384,14 @@ namespace ts { const classSymbol = checker.getSymbolOfNode(classDecl); let implementsIntersectionType: IntersectionType | InterfaceType; - if(implementedTypeNodes.length > 1) { + if (implementedTypeNodes.length > 1) { implementsIntersectionType = checker.getIntersectionType(implementedTypeNodes.map(checker.getTypeFromTypeReference)); } else { implementsIntersectionType = checker.getTypeFromTypeReference(implementedTypeNodes[0]); } - const structuredType = checker.resolveStructuredTypeMembers(implementsIntersectionType); + const structuredType = checker.resolveStructuredTypeMembers(implementsIntersectionType); const missingMembers = filterMissingMembers(filterNonPrivate(structuredType.members), classSymbol.members); return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); } @@ -1410,11 +1400,11 @@ namespace ts { * Finds the symbols in source but not target, generating a new map with the differences. */ function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Map { - let result: Map = createMap(); + const result: Map = createMap(); outer: - for(const sourceName in sourceSymbols) { - for(const targetName in targetSymbols) { - if(sourceName === targetName) { + for (const sourceName in sourceSymbols) { + for (const targetName in targetSymbols) { + if (sourceName === targetName) { continue outer; } } @@ -1424,7 +1414,7 @@ namespace ts { } function filterSymbolMapByDecl(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { - let result = createMap(); + const result = createMap(); for (const key in symbolMap) { const decl = symbolMap[key].getDeclarations(); Debug.assert(!!(decl && decl.length)); @@ -1436,8 +1426,6 @@ namespace ts { } function filterAbstract(symbolMap: Map) { - // TODO: (arozga) use first or second? - // return mapObject(symbolMap, (key, val) => getModifierFlags(val.getDeclarations()[0]) & ModifierFlags.Abstract ? [key, val]: [undefined, undefined] ); return filterSymbolMapByDecl(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); } @@ -1447,7 +1435,7 @@ namespace ts { function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { let insertion = ""; - + for (const symbolName in symbolMap) { insertion = insertion.concat(getInsertionForMemberSymbol(symbolMap[symbolName], enclosingDeclaration, checker, newlineChar)); } @@ -1455,9 +1443,9 @@ namespace ts { } function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { - const name = symbol.getName(); - const type = checker.getTypeOfSymbol(symbol); - + const name = symbol.getName(); + const type = checker.getTypeOfSymbol(symbol); + const decls = symbol.getDeclarations(); if (!(decls && decls.length)) { return ""; @@ -1473,7 +1461,7 @@ namespace ts { case SyntaxKind.MethodSignature: case SyntaxKind.MethodDeclaration: const sigs = checker.getSignaturesOfType(type, SignatureKind.Call); - if(!(sigs && sigs.length > 0)) { + if (!(sigs && sigs.length > 0)) { return ""; } // TODO: (arozga) Deal with multiple signatures. @@ -1489,20 +1477,6 @@ namespace ts { return `{${newLineChar}throw new Error('Method not Implemented');${newLineChar}}${newLineChar}`; } - /** - * Flattens params into a comma-separated list, sandwiched by prefix - * and suffix on either end. - */ - /* - function getCommaSeparatedString(params: string[], prefix: string, suffix: string) { - let result = prefix; - for (let i = 0; params && i < params.length; ++i) { - result += (i > 0 ? "," : "") + params[i]; - } - return result + suffix; - } - */ - function getVisibilityPrefix(flags: ModifierFlags): string { if (flags & ModifierFlags.Public) { return "public "; @@ -1517,4 +1491,4 @@ namespace ts { // First token is the open curly, this is where we want to put the 'super' call. return constructor.body.getFirstToken(sourceFile).getEnd(); } -} +} \ No newline at end of file From 1d6ef6aedd15a84098d767e5563c17fc257d358f Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 8 Nov 2016 16:48:54 -0800 Subject: [PATCH 059/289] cleanup --- ...ixClassDoesntImplementInheritedAbstractMember.ts | 6 ++---- .../fixClassIncorrectlyImplementsInterface.ts | 1 - src/services/utilities.ts | 13 ++----------- .../codeFixClassExtendsAbstractPrivateProperty.ts | 3 +-- .../fourslash/codeFixUnImplementedInterface36.ts | 10 +--------- 5 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 3e501ccbcff..5c8532b5436 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -11,11 +11,9 @@ namespace ts.codefix { if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { const classDeclaration = token.parent; const startPos = classDeclaration.members.pos; - // const abstractClassMembers = ts.map(getNamedAbstractClassMembers(classDeclaration), member => member.name.getText()); - // const trackingAddedMembers: string[] = []; - // const extendsClause = ts.getClassExtendsHeritageClauseElement(classDeclaration); - // const textChanges = getCodeFixChanges(extendsClause, abstractClassMembers, startPos, checker, /*reference*/ false, trackingAddedMembers, context.newLineCharacter); + const insertion = getMissingAbstractMemberInsertion(classDeclaration, checker, context.newLineCharacter); + if (insertion.length > 0) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index e935dd55607..17c716eadc6 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -27,7 +27,6 @@ namespace ts.codefix { }]; } } - return undefined; } }); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 95794e3aaee..a0994b691e9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -372,7 +372,7 @@ namespace ts { export function isThis(node: Node): boolean { switch (node.kind) { case SyntaxKind.ThisKeyword: - // case SyntaxKind.ThisType: TODO: GH#9267 + // case SyntaxKind.ThisType: TODO: GH#9267 return true; case SyntaxKind.Identifier: // 'this' as a parameter @@ -1360,11 +1360,6 @@ namespace ts { } export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { - const baseTypeNode: ExpressionWithTypeArguments = getClassExtendsHeritageClauseElement(classDecl); - if (!baseTypeNode) { - return ""; - } - const classSymbol = checker.getSymbolOfNode(classDecl); const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); @@ -1377,9 +1372,6 @@ namespace ts { export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - if (!implementedTypeNodes || implementedTypeNodes.length === 0) { - return ""; - } const classSymbol = checker.getSymbolOfNode(classDecl); @@ -1445,7 +1437,6 @@ namespace ts { function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const name = symbol.getName(); const type = checker.getTypeOfSymbol(symbol); - const decls = symbol.getDeclarations(); if (!(decls && decls.length)) { return ""; @@ -1465,7 +1456,7 @@ namespace ts { return ""; } // TODO: (arozga) Deal with multiple signatures. - const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.WriteTypeArgumentsOfSignature | TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); + const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; default: diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts index a7218ec8fd5..d395272b36f 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts @@ -11,6 +11,5 @@ // 1) Make x protected, and then insert. // 2) Make x private, and then insert. // 3) Make x not abstract. -// So we offer no fixes for now. -// TODO: (arozga) change this behavior. +// So we offer no fixes. verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts index 6200b2ac467..6c25b4b55cf 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts @@ -14,15 +14,7 @@ //// //// |]} -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); -} -`); - -// TODO: (arozga) Include type qualifiers. -/* verify.rangeAfterCodeFix(`f1(){ throw new Error('Method not Implemented'); } -`); -*/ +`); \ No newline at end of file From b1e97b370f2ba52fc347def309b94c772b00bcde Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 9 Nov 2016 16:04:56 -0800 Subject: [PATCH 060/289] Get one fix per interface --- ...sDoesntImplementInheritedAbstractMember.ts | 9 ++-- .../fixClassIncorrectlyImplementsInterface.ts | 47 +++++++++++++++---- src/services/utilities.ts | 29 ++++-------- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 5c8532b5436..8a9836afb54 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -9,10 +9,13 @@ namespace ts.codefix { const checker = context.program.getTypeChecker(); if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { - const classDeclaration = token.parent; - const startPos = classDeclaration.members.pos; + const classDecl = token.parent; + const startPos = classDecl.members.pos; - const insertion = getMissingAbstractMemberInsertion(classDeclaration, checker, context.newLineCharacter); + const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); + const resolvedExtendsType = checker.resolveStructuredTypeMembers(InstantiatedExtendsType); + + const insertion = getMissingAbstractMembersInsertion(classDecl, resolvedExtendsType, checker, context.newLineCharacter); if (insertion.length > 0) { return [{ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 17c716eadc6..bf15f4fcf38 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -8,15 +8,40 @@ namespace ts.codefix { const token = getTokenAtPosition(sourceFile, start); const checker = context.program.getTypeChecker(); - if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { - const classDeclaration = token.parent; - const startPos: number = classDeclaration.members.pos; + if (!(token.kind === SyntaxKind.Identifier && isClassLike(token.parent))) { + return undefined; + } + const classDecl = token.parent; + const startPos: number = classDecl.members.pos; - const insertion = getMissingInterfaceMembersInsertion(classDeclaration, checker, context.newLineCharacter); + const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); + const implementedTypes = implementedTypeNodes.map(checker.getTypeFromTypeReference); + const resolvedImplementedTypes = implementedTypes.map(checker.resolveStructuredTypeMembers); + let result: CodeAction[] | undefined = undefined; + + for (const resolvedType of resolvedImplementedTypes) { + const insertion = getMissingMembersInsertion(classDecl, resolvedType, checker, context.newLineCharacter); + result = pushAction(insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), result); + } + + // TODO: (arozga) Get this working and figure out how to test it reliably. + /* + // If there are multiple objects, we additionally try to generate a combined fix that simultaneously implements all types. + const intersectionType = checker.getIntersectionType(implementedTypes); + if(intersectionType.flags & TypeFlags.Intersection) { + const resolvedIntersectionType = checker.resolveStructuredTypeMembers(intersectionType) + const insertion = getMissingMembersInsertion(classDecl, resolvedIntersectionType, checker, context.newLineCharacter); + result = pushAction(insertion, "stubbed locale message", result) + } + */ + + return result; + + function pushAction(insertion: string, description: string, result?: CodeAction[]): CodeAction[] { if (insertion && insertion.length) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), + const newAction: CodeAction = { + description: description, changes: [{ fileName: sourceFile.fileName, textChanges: [{ @@ -24,10 +49,16 @@ namespace ts.codefix { newText: insertion }] }] - }]; + }; + if (result) { + result.push(newAction); + } + else { + result = [newAction]; + } } + return result; } - return undefined; } }); } \ No newline at end of file diff --git a/src/services/utilities.ts b/src/services/utilities.ts index a0994b691e9..8f3ce8ae413 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,32 +1359,19 @@ namespace ts { }; } - export function getMissingAbstractMemberInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { + export function getMissingAbstractMembersInsertion(classDecl: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { const classSymbol = checker.getSymbolOfNode(classDecl); - - const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); - const resolvedExtendsType = checker.resolveStructuredTypeMembers(InstantiatedExtendsType); - - const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedExtendsType.members)), classSymbol.members); - + const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classSymbol.members); return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); } - export function getMissingInterfaceMembersInsertion(classDecl: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { - const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + */ + export function getMissingMembersInsertion(classDecl: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { const classSymbol = checker.getSymbolOfNode(classDecl); - - let implementsIntersectionType: IntersectionType | InterfaceType; - if (implementedTypeNodes.length > 1) { - implementsIntersectionType = checker.getIntersectionType(implementedTypeNodes.map(checker.getTypeFromTypeReference)); - } - else { - implementsIntersectionType = checker.getTypeFromTypeReference(implementedTypeNodes[0]); - } - - const structuredType = checker.resolveStructuredTypeMembers(implementsIntersectionType); - const missingMembers = filterMissingMembers(filterNonPrivate(structuredType.members), classSymbol.members); + const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classSymbol.members); return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); } From c650c33bb543dabc9f2727f8d07dd672b33c2fe3 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 9 Nov 2016 16:37:48 -0800 Subject: [PATCH 061/289] Update tests --- ...ixUnImplementedInterfaceDuplicateMember.ts | 6 +----- ...tedInterfaceMissingMultipleImplements1.ts} | 10 ++++------ ...ntedInterfaceMissingMultipleImplements2.ts | 19 ++++++++++++++++++ ...ceMissingMultipleImplementsIntersection.ts | 20 ++++--------------- 4 files changed, 28 insertions(+), 27 deletions(-) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplements.ts => codeFixUnimplementedInterfaceMissingMultipleImplements1.ts} (66%) create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts index 07a31e1cc6a..5d0651b009d 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts @@ -10,11 +10,7 @@ //// class C1 implements I1,I2 {[| //// |]} -verify.not.codeFixAvailable(); - -// TODO: (arozga) Get members from multiple interfaces. -/* verify.rangeAfterCodeFix(` x: number; `); -*/ \ No newline at end of file +verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements1.ts similarity index 66% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements1.ts index 114eac38cc2..c8d61227c49 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements1.ts @@ -7,15 +7,13 @@ //// y: number; //// } //// -//// class C1 implements I1,I2 {[| +//// class C implements I1,I2 {[| +//// y: number; //// |]} -verify.not.codeFixAvailable(); - -// TODO: (arozga) Get members from multiple interfaces. -/* verify.rangeAfterCodeFix(` x: number; y: number; `); -*/ \ No newline at end of file + +verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts new file mode 100644 index 00000000000..d29b23998b8 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts @@ -0,0 +1,19 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// y: number; +//// } +//// +//// class C implements I1,I2 {[| +//// x: number; +//// |]} + +verify.rangeAfterCodeFix(` +y: number; +x: number; +`); + +verify.not.codeFixAvailable(); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts index 4a115eb5a84..1aa7ef7cdb5 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts @@ -7,23 +7,11 @@ //// x: string; //// } //// -//// class C1 implements I1,I2 {[| +//// class C implements I1,I2 {[| //// |]} -verify.not.codeFixAvailable(); - -// TODO: (arozga) Get members from multiple interfaces. -/* -verify.fileAfterCodeFix(` -interface I1 { +verify.rangeAfterCodeFix(` x: number; - } - interface I2 { - x: string; - } - - class C1 implements I1,I2 { - x: number & string; -} `); -*/ + +verify.not.codeFixAvailable(); \ No newline at end of file From 0591e1bd206cdf0a7718656779a6f4091ae60d0f Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 9 Nov 2016 17:47:52 -0800 Subject: [PATCH 062/289] Simplify Testing --- src/harness/fourslash.ts | 111 ++++++------------ ...assExtendsAbstractSomePropertiesPresent.ts | 2 +- ...xUnImplementedInterfaceDuplicateMember1.ts | 13 ++ ...UnImplementedInterfaceDuplicateMember2.ts} | 8 +- ...MissingMultipleImplementsIntersection1.ts} | 6 +- ...eMissingMultipleImplementsIntersection2.ts | 14 +++ tests/cases/fourslash/fourslash.ts | 8 +- 7 files changed, 68 insertions(+), 94 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceDuplicateMember.ts => codeFixUnImplementedInterfaceDuplicateMember2.ts} (62%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts => codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts} (65%) create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b832e12711b..542b0b765ab 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -92,18 +92,6 @@ namespace FourSlash { end: number; } - export interface CodeFixIdentifier { - /** - * Error code to search over for codefix. - */ - code: number; - /** - * In a file where there is more than one error with code `code`, `count` refers - * to which 0-indexed codefix, sorted by order of occurence, to consider. - */ - count: number; - } - export import IndentStyle = ts.IndentStyle; const entityMap = ts.createMap({ @@ -1609,12 +1597,6 @@ namespace FourSlash { return runningOffset; } - private applyCodeAction(action: ts.CodeAction): void { - for (const filechange of action.changes) { - this.applyEdits(filechange.fileName, filechange.textChanges, /*isFormattingEdit*/ false); - } - } - public copyFormatOptions(): ts.FormatCodeSettings { return ts.clone(this.formatCodeSettings); } @@ -2034,31 +2016,22 @@ namespace FourSlash { /** * Compares expected text to the text that would be in the sole range - * (ie: [|...|]) in the file after applying the codefix corresponding - * to the error with errorCode, or of the sole error in the source file. + * (ie: [|...|]) in the file after applying the codefix sole codefix + * in the source file. * * Because codefixes are only applied on the working file, it is unsafe * to apply this more than once (consider a refactoring across files). */ - public verifyRangeAfterCodeFix(expectedText: string, codeFixIdentifier?: CodeFixIdentifier) { + public verifyRangeAfterCodeFix(expectedText: string) { const ranges = this.getRanges(); if (ranges.length !== 1) { this.raiseError("Exactly one range should be specified in the testfile."); } const fileName = this.activeFile.fileName; - const codeFix: ts.CodeAction = this.getCodeFix(fileName, codeFixIdentifier); - if (!codeFix) { - this.raiseError("Should find exactly one codefix, but none found."); - } + this.applyCodeFixActions(fileName, this.getCodeFixActions(fileName)); - const fileChange = ts.find(codeFix.changes, change => change.fileName === fileName); - if (!fileChange) { - this.raiseError("CodeFix found doesn't provide any changes in this file."); - } - - this.applyEdits(fileChange.fileName, fileChange.textChanges, /*isFormattingEdit*/ false); const actualText = this.rangeText(ranges[0]); if (this.removeWhitespace(actualText) !== this.removeWhitespace(expectedText)) { @@ -2069,33 +2042,16 @@ namespace FourSlash { /** * Applies fixes for the errors in fileName and compares the results to * expectedContents after all fixes have been applied. - * - * It is safe to apply this multiple times in a single test. - * + * Note: applying one codefix may generate another (eg: remove duplicate implements * may generate an extends -> interface conversion fix). * @param expectedContents The contents of the file after the fixes are applied. * @param fileName The file to check. If not supplied, the current open file is used. - * @param errorsToFix An array of errors for which quickfixes will be applied. If not - * supplied, all codefixes in the file are applied until none are left, starting from - * the first available codefix. - * */ - public verifyFileAfterCodeFix(expectedContents: string, fileName?: string, codeFixIdentifier?: CodeFixIdentifier) { + public verifyFileAfterCodeFix(expectedContents: string, fileName?: string) { fileName = fileName ? fileName : this.activeFile.fileName; - const codeFix = this.getCodeFix(fileName, codeFixIdentifier); - - if (codeFix === undefined) { - if (codeFixIdentifier) { - this.raiseError(`Couldn't find the ${codeFixIdentifier.count}'th error with code ${codeFixIdentifier.code}.`); - } - else { - this.raiseError("No code fix could be found."); - } - } - - this.applyCodeAction(codeFix); + this.applyCodeFixActions(fileName, this.getCodeFixActions(fileName)); const actualContents: string = this.getFileContent(fileName); if (this.removeWhitespace(actualContents) !== this.removeWhitespace(expectedContents)) { @@ -2106,30 +2062,31 @@ namespace FourSlash { /** * Rerieves a codefix satisfying the parameters, or undefined if no such codefix is found. * @param fileName Path to file where error should be retrieved from. - * @param error We get the `error.count`'th codefix with code `error.code`. - * - * If undefined, we get the first codefix available. */ - private getCodeFix(fileName: string, error?: CodeFixIdentifier): ts.CodeAction | undefined { + private getCodeFixActions(fileName: string): ts.CodeAction[] { const diagnostics: ts.Diagnostic[] = this.getDiagnostics(fileName); - const errorCount = error ? error.count : 0; - let countSeen = 0; + let actions: ts.CodeAction[] = undefined; for (const diagnostic of diagnostics) { - if (error && error.code !== diagnostic.code) { - continue; - } - const action = this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]); - if (action) { - if (action.length > errorCount - countSeen) { - return action[errorCount - countSeen]; - } - else { - countSeen += action.length; - } + const newActions = this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]); + if (newActions && newActions.length) { + actions = actions ? actions.concat(newActions) : newActions; } } - return undefined; + return actions; + } + + private applyCodeFixActions(fileName: string, actions: ts.CodeAction[]): void { + if (!(actions && actions.length === 1)) { + this.raiseError(`Should find exactly one codefix, but ${actions ? actions.length : "none"} found.`); + } + + const fileChanges = ts.find(actions[0].changes, change => change.fileName === fileName); + if (!fileChanges) { + this.raiseError("The CodeFix found doesn't provide any changes in this file."); + } + + this.applyEdits(fileChanges.fileName, fileChanges.textChanges, /*isFormattingEdit*/ false); } public verifyDocCommentTemplate(expected?: ts.TextInsertion) { @@ -2404,8 +2361,8 @@ namespace FourSlash { } } - public verifyCodeFixAvailable(negative: boolean, errorCode?: number) { - const codeFix = this.getCodeFix(this.activeFile.fileName, errorCode ? { code: errorCode, count: 0 } : undefined); + public verifyCodeFixAvailable(negative: boolean) { + const codeFix = this.getCodeFixActions(this.activeFile.fileName); if (negative && codeFix) { this.raiseError(`verifyCodeFixAvailable failed - expected no fixes but found one.`); @@ -3199,8 +3156,8 @@ namespace FourSlashInterface { this.state.verifyBraceCompletionAtPosition(this.negative, openingBrace); } - public codeFixAvailable(errorCode?: number) { - this.state.verifyCodeFixAvailable(this.negative, errorCode); + public codeFixAvailable() { + this.state.verifyCodeFixAvailable(this.negative); } } @@ -3385,12 +3342,12 @@ namespace FourSlashInterface { this.DocCommentTemplate(/*expectedText*/ undefined, /*expectedOffset*/ undefined, /*empty*/ true); } - public rangeAfterCodeFix(expectedText: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { - this.state.verifyRangeAfterCodeFix(expectedText, codeFixidentifier); + public rangeAfterCodeFix(expectedText: string): void { + this.state.verifyRangeAfterCodeFix(expectedText); } - public fileAfterCodeFix(expectedContents: string, fileName?: string, codeFixidentifier?: FourSlash.CodeFixIdentifier): void { - this.state.verifyFileAfterCodeFix(expectedContents, fileName, codeFixidentifier); + public fileAfterCodeFix(expectedContents: string, fileName?: string): void { + this.state.verifyFileAfterCodeFix(expectedContents, fileName); } public navigationBar(json: any) { diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts index 60adfb5d319..b6dd679bb71 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts @@ -7,7 +7,7 @@ //// } //// //// class C extends A {[| |] -//// constructor(public x: number) { } +//// constructor(public x: number) { super(); } //// y: number; //// } diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts new file mode 100644 index 00000000000..a2154de567a --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts @@ -0,0 +1,13 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// x: number; +//// } +//// +//// class C implements I1,I2 {[| +//// |]} + +verify.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember2.ts similarity index 62% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember2.ts index 5d0651b009d..ac90d51b07c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember2.ts @@ -7,10 +7,8 @@ //// x: number; //// } //// -//// class C1 implements I1,I2 {[| -//// |]} +//// class C implements I1,I2 { +//// x: number; +//// } -verify.rangeAfterCodeFix(` -x: number; -`); verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts similarity index 65% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts index 1aa7ef7cdb5..321d41e4633 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts @@ -10,8 +10,4 @@ //// class C implements I1,I2 {[| //// |]} -verify.rangeAfterCodeFix(` - x: number; -`); - -verify.not.codeFixAvailable(); \ No newline at end of file +verify.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts new file mode 100644 index 00000000000..8f744e25cae --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts @@ -0,0 +1,14 @@ +/// + +//// interface I1 { +//// x: number; +//// } +//// interface I2 { +//// x: string; +//// } +//// +//// class C implements I1,I2 { +//// x: string; +//// } + +verify.not.codeFixAvailable(); \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index b663d2825b7..10f990fdb84 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -98,10 +98,6 @@ declare namespace FourSlashInterface { start: number; end: number; } - interface CodeFixIdentifier { - code: number; - count: number - } class test_ { markers(): Marker[]; markerNames(): string[]; @@ -214,8 +210,8 @@ declare namespace FourSlashInterface { noMatchingBracePositionInCurrentFile(bracePosition: number): void; DocCommentTemplate(expectedText: string, expectedOffset: number, empty?: boolean): void; noDocCommentTemplate(): void; - rangeAfterCodeFix(expectedText: string, CodeFixIdentifier?: CodeFixIdentifier): void; - fileAfterCodeFix(expectedContents: string, fileName?: string, CodeFixIdentifier?: CodeFixIdentifier): void; + rangeAfterCodeFix(expectedText: string): void; + fileAfterCodeFix(expectedContents: string, fileName?: string): void; navigationBar(json: any): void; navigationTree(json: any): void; From 263734f333e6cfa0ba9587102590ba4bff56fa87 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 13:53:59 -0800 Subject: [PATCH 063/289] Add a test --- ...ssingPropertyFromParentConstructorFunction.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts new file mode 100644 index 00000000000..2a4ca4df923 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts @@ -0,0 +1,16 @@ +/// + +//// class A { +//// constructor(public x: number) { } +//// } +//// +//// class B implements A {[| |]} + +verify.not.codeFixAvailable(); + +// TODO: (arozga) Get this working. +/* +verify.rangeAfterCodeFix(` +public x: number; +`); +*/ From 4b202abf2e935128963a0ce1a689ce73af6a9b74 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 13:59:06 -0800 Subject: [PATCH 064/289] Initialize result to empy array --- .../fixClassIncorrectlyImplementsInterface.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index bf15f4fcf38..38d5072d30a 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -18,11 +18,11 @@ namespace ts.codefix { const implementedTypes = implementedTypeNodes.map(checker.getTypeFromTypeReference); const resolvedImplementedTypes = implementedTypes.map(checker.resolveStructuredTypeMembers); - let result: CodeAction[] | undefined = undefined; + const result: CodeAction[] = []; for (const resolvedType of resolvedImplementedTypes) { const insertion = getMissingMembersInsertion(classDecl, resolvedType, checker, context.newLineCharacter); - result = pushAction(insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class), result); + pushAction(result, insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class)); } // TODO: (arozga) Get this working and figure out how to test it reliably. @@ -30,15 +30,15 @@ namespace ts.codefix { // If there are multiple objects, we additionally try to generate a combined fix that simultaneously implements all types. const intersectionType = checker.getIntersectionType(implementedTypes); if(intersectionType.flags & TypeFlags.Intersection) { - const resolvedIntersectionType = checker.resolveStructuredTypeMembers(intersectionType) + const resolvedIntersectionType = checker.resolveStructuredTypeMembers(intersectionType); const insertion = getMissingMembersInsertion(classDecl, resolvedIntersectionType, checker, context.newLineCharacter); - result = pushAction(insertion, "stubbed locale message", result) + pushAction(result, insertion, "stubbed locale message") } */ return result; - function pushAction(insertion: string, description: string, result?: CodeAction[]): CodeAction[] { + function pushAction(result: CodeAction[], insertion: string, description: string): void { if (insertion && insertion.length) { const newAction: CodeAction = { description: description, @@ -50,14 +50,8 @@ namespace ts.codefix { }] }] }; - if (result) { - result.push(newAction); - } - else { - result = [newAction]; - } + result.push(newAction); } - return result; } } }); From 357ed7ed7dc97e2ac6c6932e3d7fd981edfe184b Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 14:23:08 -0800 Subject: [PATCH 065/289] Remove Inner Loop --- src/services/utilities.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 8f3ce8ae413..dce9ce1497b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1380,14 +1380,10 @@ namespace ts { */ function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Map { const result: Map = createMap(); - outer: for (const sourceName in sourceSymbols) { - for (const targetName in targetSymbols) { - if (sourceName === targetName) { - continue outer; - } + if (!(sourceName in targetSymbols)) { + result[sourceName] = sourceSymbols[sourceName]; } - result[sourceName] = sourceSymbols[sourceName]; } return result; } From f6fc320c1f6560e4710648b3624a1d04904ba6c7 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 14:24:03 -0800 Subject: [PATCH 066/289] Get Ancestor instead of manual walk --- .../codefixes/fixExtendsInterfaceBecomesImplements.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index e462d7416f7..692eeedbdb6 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -22,7 +22,11 @@ namespace ts.codefix { }]; // We check if the implements keyword is present and replace it with a comma if so. - const classDeclChildren = (token.parent.parent.parent as ClassDeclaration).getChildren(); + const classDeclNode = getAncestor(token, SyntaxKind.ClassDeclaration); + if (!classDeclNode) { + return result; + } + const classDeclChildren = classDeclNode.getChildren(); if (classDeclChildren.length < 3) { return result; } From efd16c780ba830dd5cafe7dc8d76e9419a4211bb Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 14:32:40 -0800 Subject: [PATCH 067/289] Spell out names fully --- src/services/utilities.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index dce9ce1497b..f9610f81d07 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,20 +1359,20 @@ namespace ts { }; } - export function getMissingAbstractMembersInsertion(classDecl: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const classSymbol = checker.getSymbolOfNode(classDecl); + export function getMissingAbstractMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { + const classSymbol = checker.getSymbolOfNode(classDeclaration); const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classSymbol.members); - return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); + return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } /** * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. */ - export function getMissingMembersInsertion(classDecl: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const classSymbol = checker.getSymbolOfNode(classDecl); + export function getMissingMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { + const classSymbol = checker.getSymbolOfNode(classDeclaration); const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classSymbol.members); - return getInsertionsForMembers(missingMembers, classDecl, checker, newlineChar); + return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } /** @@ -1388,12 +1388,12 @@ namespace ts { return result; } - function filterSymbolMapByDecl(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { + function filterSymbolMapByDeclaration(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { const result = createMap(); for (const key in symbolMap) { - const decl = symbolMap[key].getDeclarations(); - Debug.assert(!!(decl && decl.length)); - if (pred(decl[0])) { + const declaration = symbolMap[key].getDeclarations(); + Debug.assert(!!(declaration && declaration.length)); + if (pred(declaration[0])) { result[key] = symbolMap[key]; } } @@ -1401,11 +1401,11 @@ namespace ts { } function filterAbstract(symbolMap: Map) { - return filterSymbolMapByDecl(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); + return filterSymbolMapByDeclaration(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); } function filterNonPrivate(symbolMap: Map) { - return filterSymbolMapByDecl(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); + return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); } function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { @@ -1420,11 +1420,11 @@ namespace ts { function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const name = symbol.getName(); const type = checker.getTypeOfSymbol(symbol); - const decls = symbol.getDeclarations(); - if (!(decls && decls.length)) { + const declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { return ""; } - const node = decls[0]; + const node = declarations[0]; const visibility = getVisibilityPrefix(getModifierFlags(node)); switch (node.kind) { case SyntaxKind.PropertySignature: @@ -1434,12 +1434,12 @@ namespace ts { case SyntaxKind.MethodSignature: case SyntaxKind.MethodDeclaration: - const sigs = checker.getSignaturesOfType(type, SignatureKind.Call); - if (!(sigs && sigs.length > 0)) { + const signatures = checker.getSignaturesOfType(type, SignatureKind.Call); + if (!(signatures && signatures.length > 0)) { return ""; } // TODO: (arozga) Deal with multiple signatures. - const sigString = checker.signatureToString(sigs[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); + const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; default: From bba96da128ed2b03647a4e34312d17ec0abdc8f2 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 14:33:29 -0800 Subject: [PATCH 068/289] remove multiple implements TODO --- .../fixClassIncorrectlyImplementsInterface.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 38d5072d30a..9bcf491ac5b 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -25,17 +25,6 @@ namespace ts.codefix { pushAction(result, insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class)); } - // TODO: (arozga) Get this working and figure out how to test it reliably. - /* - // If there are multiple objects, we additionally try to generate a combined fix that simultaneously implements all types. - const intersectionType = checker.getIntersectionType(implementedTypes); - if(intersectionType.flags & TypeFlags.Intersection) { - const resolvedIntersectionType = checker.resolveStructuredTypeMembers(intersectionType); - const insertion = getMissingMembersInsertion(classDecl, resolvedIntersectionType, checker, context.newLineCharacter); - pushAction(result, insertion, "stubbed locale message") - } - */ - return result; function pushAction(result: CodeAction[], insertion: string, description: string): void { From cfe50d1b92089d857f6ffaf58e2afb66f741c3a7 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 15:13:46 -0800 Subject: [PATCH 069/289] Fix extends -> implements for decorators/modifiers --- .../fixExtendsInterfaceBecomesImplements.ts | 41 ++++++++----------- ...angeExtendsToImplementsAbstractModifier.ts | 8 ++++ ...xChangeExtendsToImplementsWithDecorator.ts | 13 ++++++ 3 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts create mode 100644 tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 692eeedbdb6..307939785be 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -6,43 +6,36 @@ namespace ts.codefix { const sourceFile = context.sourceFile; const start = context.span.start; const token = getTokenAtPosition(sourceFile, start); - - if (!(token.kind === SyntaxKind.Identifier && token.parent.parent.parent.kind === SyntaxKind.ClassDeclaration)) { + const classDeclNode = getAncestor(token, SyntaxKind.ClassDeclaration) as ClassDeclaration; + if (!(token.kind === SyntaxKind.Identifier && classDeclNode && classDeclNode.kind === SyntaxKind.ClassDeclaration)) { return undefined; } - const extendsNode = (token.parent.parent as HeritageClause).getChildren()[0]; + const heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + + const extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === SyntaxKind.ExtendsKeyword)) { + return undefined; + } const result = [{ description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), changes: [{ fileName: sourceFile.fileName, - textChanges: [{ newText: " implements", span: { start: extendsNode.pos, length: extendsNode.end - extendsNode.pos } }] + textChanges: [{ newText: " implements", span: { start: extendsToken.pos, length: extendsToken.end - extendsToken.pos } }] }] }]; // We check if the implements keyword is present and replace it with a comma if so. - const classDeclNode = getAncestor(token, SyntaxKind.ClassDeclaration); - if (!classDeclNode) { - return result; + for (let i = 1; i < heritageClauses.length; i++) { + const keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + result[0].changes[0].textChanges.push({ newText: ",", span: { start: keywordToken.pos, length: keywordToken.end - keywordToken.pos } }); + } } - const classDeclChildren = classDeclNode.getChildren(); - if (classDeclChildren.length < 3) { - return result; - } - - let classSyntaxListChildren: Node[]; - if (classDeclChildren[2].kind !== SyntaxKind.SyntaxList || (classSyntaxListChildren = classDeclChildren[2].getChildren()).length < 2) { - return result; - } - - let implementsTokenChildren: Node[]; - if ((classSyntaxListChildren[1] as HeritageClause).token !== SyntaxKind.ImplementsKeyword || (implementsTokenChildren = classSyntaxListChildren[1].getChildren()).length === 0) { - return result; - } - - const implementsNode = implementsTokenChildren[0]; - result[0].changes[0].textChanges.push({ newText: ",", span: { start: implementsNode.pos, length: implementsNode.end - implementsNode.pos } }); return result; } diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts new file mode 100644 index 00000000000..5f5ca93c28f --- /dev/null +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsAbstractModifier.ts @@ -0,0 +1,8 @@ +/// + +//// interface I1 { } +//// interface I2 { } + +//// [|abstract class A extends I1 implements I2|] { } + +verify.rangeAfterCodeFix("abstract class A implements I1, I2"); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts new file mode 100644 index 00000000000..9671f41def3 --- /dev/null +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplementsWithDecorator.ts @@ -0,0 +1,13 @@ +/// + +//// interface I1 { } +//// interface I2 { } + +//// function sealed(constructor: Function) { +//// Object.seal(constructor); +//// Object.seal(constructor.prototype); +//// } + +//// @sealed +//// [|class A extends I1 implements I2 { }|] +verify.rangeAfterCodeFix("class A implements I1, I2 { }"); \ No newline at end of file From ad3035d8caf8694b2283e2db2884d136c79471b8 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 15:18:34 -0800 Subject: [PATCH 070/289] remove generated file from PR --- scripts/buildProtocol.js | 135 --------------------------------------- 1 file changed, 135 deletions(-) delete mode 100644 scripts/buildProtocol.js diff --git a/scripts/buildProtocol.js b/scripts/buildProtocol.js deleted file mode 100644 index db080839309..00000000000 --- a/scripts/buildProtocol.js +++ /dev/null @@ -1,135 +0,0 @@ -/// -"use strict"; -var ts = require("../lib/typescript"); -var path = require("path"); -function endsWith(s, suffix) { - return s.lastIndexOf(suffix, s.length - suffix.length) !== -1; -} -var DeclarationsWalker = (function () { - function DeclarationsWalker(typeChecker, protocolFile) { - this.typeChecker = typeChecker; - this.protocolFile = protocolFile; - this.visitedTypes = []; - this.text = ""; - } - DeclarationsWalker.getExtraDeclarations = function (typeChecker, protocolFile) { - var text = "declare namespace ts.server.protocol {\n"; - var walker = new DeclarationsWalker(typeChecker, protocolFile); - walker.visitTypeNodes(protocolFile); - return walker.text - ? "declare namespace ts.server.protocol {\n" + walker.text + "}" - : ""; - }; - DeclarationsWalker.prototype.processType = function (type) { - if (this.visitedTypes.indexOf(type) >= 0) { - return; - } - this.visitedTypes.push(type); - var s = type.aliasSymbol || type.getSymbol(); - if (!s) { - return; - } - if (s.name === "Array") { - // we should process type argument instead - return this.processType(type.typeArguments[0]); - } - else { - for (var _i = 0, _a = s.getDeclarations(); _i < _a.length; _i++) { - var decl = _a[_i]; - var sourceFile = decl.getSourceFile(); - if (sourceFile === this.protocolFile || path.basename(sourceFile.fileName) === "lib.d.ts") { - return; - } - // splice declaration in final d.ts file - var text = decl.getFullText(); - this.text += text + "\n"; - // recursively pull all dependencies into result dts file - this.visitTypeNodes(decl); - } - } - }; - DeclarationsWalker.prototype.visitTypeNodes = function (node) { - var _this = this; - if (node.parent) { - switch (node.parent.kind) { - case ts.SyntaxKind.VariableDeclaration: - case ts.SyntaxKind.MethodDeclaration: - case ts.SyntaxKind.MethodSignature: - case ts.SyntaxKind.PropertyDeclaration: - case ts.SyntaxKind.PropertySignature: - case ts.SyntaxKind.Parameter: - case ts.SyntaxKind.IndexSignature: - if ((node.parent.type) === node) { - var type = this.typeChecker.getTypeAtLocation(node); - if (type && !(type.flags & ts.TypeFlags.TypeParameter)) { - this.processType(type); - } - } - break; - } - } - ts.forEachChild(node, function (n) { return _this.visitTypeNodes(n); }); - }; - return DeclarationsWalker; -}()); -function generateProtocolFile(protocolTs, typeScriptServicesDts) { - var options = { target: ts.ScriptTarget.ES5, declaration: true, noResolve: true, types: [], stripInternal: true }; - /** - * 1st pass - generate a program from protocol.ts and typescriptservices.d.ts and emit core version of protocol.d.ts with all internal members stripped - * @return text of protocol.d.t.s - */ - function getInitialDtsFileForProtocol() { - var program = ts.createProgram([protocolTs, typeScriptServicesDts], options); - var protocolDts; - program.emit(program.getSourceFile(protocolTs), function (file, content) { - if (endsWith(file, ".d.ts")) { - protocolDts = content; - } - }); - if (protocolDts === undefined) { - throw new Error("Declaration file for protocol.ts is not generated"); - } - return protocolDts; - } - var protocolFileName = "protocol.d.ts"; - /** - * Second pass - generate a program from protocol.d.ts and typescriptservices.d.ts, then augment core protocol.d.ts with extra types from typescriptservices.d.ts - */ - function getProgramWithProtocolText(protocolDts, includeTypeScriptServices) { - var host = ts.createCompilerHost(options); - var originalGetSourceFile = host.getSourceFile; - host.getSourceFile = function (fileName) { - if (fileName === protocolFileName) { - return ts.createSourceFile(fileName, protocolDts, options.target); - } - return originalGetSourceFile.apply(host, [fileName]); - }; - var rootFiles = includeTypeScriptServices ? [protocolFileName, typeScriptServicesDts] : [protocolFileName]; - return ts.createProgram(rootFiles, options, host); - } - var protocolDts = getInitialDtsFileForProtocol(); - var program = getProgramWithProtocolText(protocolDts, /*includeTypeScriptServices*/ true); - var protocolFile = program.getSourceFile("protocol.d.ts"); - var extraDeclarations = DeclarationsWalker.getExtraDeclarations(program.getTypeChecker(), protocolFile); - if (extraDeclarations) { - protocolDts += extraDeclarations; - } - // do sanity check and try to compile generated text as standalone program - var sanityCheckProgram = getProgramWithProtocolText(protocolDts, /*includeTypeScriptServices*/ false); - var diagnostics = program.getSyntacticDiagnostics().concat(program.getSemanticDiagnostics(), program.getGlobalDiagnostics()); - if (diagnostics.length) { - var flattenedDiagnostics = diagnostics.map(function (d) { return ts.flattenDiagnosticMessageText(d.messageText, "\n"); }).join("\n"); - throw new Error("Unexpected errors during sanity check: " + flattenedDiagnostics); - } - return protocolDts; -} -if (process.argv.length < 5) { - console.log("Expected 3 arguments: path to 'protocol.ts', path to 'typescriptservices.d.ts' and path to output file"); - process.exit(1); -} -var protocolTs = process.argv[2]; -var typeScriptServicesDts = process.argv[3]; -var outputFile = process.argv[4]; -var generatedProtocolDts = generateProtocolFile(protocolTs, typeScriptServicesDts); -ts.sys.writeFile(outputFile, generatedProtocolDts); -//# sourceMappingURL=file:///C:/repo/TypeScript/scripts/buildProtocol.js.map \ No newline at end of file From d8b359f67b9aed538f42461191a5cae399282298 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 15:22:52 -0800 Subject: [PATCH 071/289] Fix typo and capitalization --- src/compiler/checker.ts | 2 +- src/compiler/types.ts | 2 +- src/services/utilities.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fa57345cbb2..46f1c353dd7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2682,7 +2682,7 @@ namespace ts { function buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { const returnType = getReturnTypeOfSignature(signature); - if (flags & TypeFormatFlags.supressAnyReturnType && isTypeAny(returnType)) { + if (flags & TypeFormatFlags.SuppressAnyReturnType && isTypeAny(returnType)) { return; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7e2b31b794a..7bd2db13ba2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2364,7 +2364,7 @@ namespace ts { InFirstTypeArgument = 0x00000100, // Writing first type argument of the instantiated type InTypeAlias = 0x00000200, // Writing type in type alias declaration UseTypeAliasValue = 0x00000400, // Serialize the type instead of using type-alias. This is needed when we emit declaration file. - supressAnyReturnType = 0x00000800, // If the return type is any-like, don't offer a return type. + SuppressAnyReturnType = 0x00000800, // If the return type is any-like, don't offer a return type. } export const enum SymbolFormatFlags { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index f9610f81d07..98cf5e0adb8 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1439,7 +1439,7 @@ namespace ts { return ""; } // TODO: (arozga) Deal with multiple signatures. - const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.supressAnyReturnType, SignatureKind.Call); + const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; default: From 6400d53394def163795e77bf35ea0ce87d2db53d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 14 Nov 2016 15:43:24 -0800 Subject: [PATCH 072/289] Fix handling of default class --- src/compiler/utilities.ts | 2 +- .../codefixes/fixClassIncorrectlyImplementsInterface.ts | 5 +++-- .../cases/fourslash/codeFixUnImplementedDefaultClass.ts | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 299f91be662..eafac479807 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1801,7 +1801,7 @@ namespace ts { } } - export function getAncestor(node: Node, kind: SyntaxKind): Node { + export function getAncestor(node: Node | undefined, kind: SyntaxKind): Node { while (node) { if (node.kind === kind) { return node; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 9bcf491ac5b..f8da7ae2218 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -8,10 +8,11 @@ namespace ts.codefix { const token = getTokenAtPosition(sourceFile, start); const checker = context.program.getTypeChecker(); - if (!(token.kind === SyntaxKind.Identifier && isClassLike(token.parent))) { + const classDecl = getAncestor(token, SyntaxKind.ClassDeclaration) as ClassDeclaration; + if (!(classDecl && isClassLike(classDecl))) { return undefined; } - const classDecl = token.parent; + const startPos: number = classDecl.members.pos; const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); diff --git a/tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts b/tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts new file mode 100644 index 00000000000..9f507c3dc60 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts @@ -0,0 +1,9 @@ +/// + +//// interface I { x: number; } +//// +//// export default class implements I {[| |]} + +verify.rangeAfterCodeFix(` +x: number; +`); \ No newline at end of file From c010a0e974f8a9a96002f2a34438f9a3dc885189 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 10:57:48 -0800 Subject: [PATCH 073/289] Use getTypeOfSymbolAtLocation --- src/compiler/checker.ts | 1 - src/compiler/types.ts | 1 - src/services/utilities.ts | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 46f1c353dd7..7462e381f23 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -74,7 +74,6 @@ namespace ts { getGlobalDiagnostics, getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration, - getTypeOfSymbol, getDeclaredTypeOfSymbol, getPropertiesOfType, getPropertyOfType, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7bd2db13ba2..2db59acbaae 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2258,7 +2258,6 @@ namespace ts { export interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; - getTypeOfSymbol(symbol: Symbol): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 98cf5e0adb8..a727d271022 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1419,7 +1419,7 @@ namespace ts { function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { const name = symbol.getName(); - const type = checker.getTypeOfSymbol(symbol); + const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); const declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { return ""; From 395d73684360f9ea940737a7bd60180171a8820a Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 11:24:37 -0800 Subject: [PATCH 074/289] Remove getSymbolOfNode from TypeChecker interface --- src/compiler/checker.ts | 1 - src/compiler/types.ts | 1 - src/services/utilities.ts | 6 ++---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7462e381f23..d96db21dc37 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -87,7 +87,6 @@ namespace ts { resolveStructuredTypeMembers, getNonNullableType, getSymbolsInScope, - getSymbolOfNode, getSymbolAtLocation, getShorthandAssignmentValueSymbol, getExportSpecifierLocalTargetSymbol, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2db59acbaae..f983b8d60bf 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2271,7 +2271,6 @@ namespace ts { getUnionType(types: Type[], subtypeReduction?: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; - getSymbolOfNode(node: Node): Symbol; getSymbolAtLocation(node: Node): Symbol; getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index a727d271022..f56a191e585 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1360,8 +1360,7 @@ namespace ts { } export function getMissingAbstractMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const classSymbol = checker.getSymbolOfNode(classDeclaration); - const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classSymbol.members); + const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classDeclaration.symbol.members); return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } @@ -1370,8 +1369,7 @@ namespace ts { * and generates source code for the missing members. */ export function getMissingMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const classSymbol = checker.getSymbolOfNode(classDeclaration); - const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classSymbol.members); + const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classDeclaration.symbol.members); return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } From d7d4bf6b04ba7bd3544fd4b282947858364f39e1 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 11:41:23 -0800 Subject: [PATCH 075/289] Handle class expressions --- .../fixClassIncorrectlyImplementsInterface.ts | 4 ++-- .../codefixes/fixExtendsInterfaceBecomesImplements.ts | 4 ++-- src/services/utilities.ts | 8 ++++---- .../codeFixUnImplementedInterfaceClassExpression.ts | 10 ++++++++++ 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index f8da7ae2218..af39da7b2d0 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -8,8 +8,8 @@ namespace ts.codefix { const token = getTokenAtPosition(sourceFile, start); const checker = context.program.getTypeChecker(); - const classDecl = getAncestor(token, SyntaxKind.ClassDeclaration) as ClassDeclaration; - if (!(classDecl && isClassLike(classDecl))) { + const classDecl = getContainingClass(token); + if (!classDecl) { return undefined; } diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 307939785be..f29beb7b547 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -6,8 +6,8 @@ namespace ts.codefix { const sourceFile = context.sourceFile; const start = context.span.start; const token = getTokenAtPosition(sourceFile, start); - const classDeclNode = getAncestor(token, SyntaxKind.ClassDeclaration) as ClassDeclaration; - if (!(token.kind === SyntaxKind.Identifier && classDeclNode && classDeclNode.kind === SyntaxKind.ClassDeclaration)) { + const classDeclNode = getContainingClass(token); + if (!(token.kind === SyntaxKind.Identifier && isClassLike(classDeclNode))) { return undefined; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index f56a191e585..ec1a6320e3e 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,7 +1359,7 @@ namespace ts { }; } - export function getMissingAbstractMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { + export function getMissingAbstractMembersInsertion(classDeclaration: ClassLikeDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classDeclaration.symbol.members); return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } @@ -1368,7 +1368,7 @@ namespace ts { * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. */ - export function getMissingMembersInsertion(classDeclaration: ClassDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { + export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classDeclaration.symbol.members); return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } @@ -1406,7 +1406,7 @@ namespace ts { return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); } - function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { + function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { let insertion = ""; for (const symbolName in symbolMap) { @@ -1415,7 +1415,7 @@ namespace ts { return insertion; } - function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassDeclaration, checker: TypeChecker, newlineChar: string): string { + function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { const name = symbol.getName(); const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); const declarations = symbol.getDeclarations(); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts new file mode 100644 index 00000000000..5b07a582c6c --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts @@ -0,0 +1,10 @@ +/// + + +//// interface I { x: number; } +//// +//// new class implements I {[| |]}; + +verify.rangeAfterCodeFix(` +x: number; +`); \ No newline at end of file From a94d955d9da20599194c80207cb280fd51cd9074 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 12:40:46 -0800 Subject: [PATCH 076/289] Aggregate changes before building result --- .../fixExtendsInterfaceBecomesImplements.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index f29beb7b547..b7ec5d0b8ca 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -21,22 +21,24 @@ namespace ts.codefix { return undefined; } + const textChanges: TextChange[] = [{ newText: " implements", span: { start: extendsToken.pos, length: extendsToken.end - extendsToken.pos } }]; + + // We replace existing keywords with commas. + for (let i = 1; i < heritageClauses.length; i++) { + const keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + textChanges.push({ newText: ",", span: { start: keywordToken.pos, length: keywordToken.end - keywordToken.pos } }); + } + } + const result = [{ description: getLocaleSpecificMessage(Diagnostics.Change_extends_to_implements), changes: [{ fileName: sourceFile.fileName, - textChanges: [{ newText: " implements", span: { start: extendsToken.pos, length: extendsToken.end - extendsToken.pos } }] + textChanges: textChanges }] }]; - // We check if the implements keyword is present and replace it with a comma if so. - for (let i = 1; i < heritageClauses.length; i++) { - const keywordToken = heritageClauses[i].getFirstToken(); - if (keywordToken) { - result[0].changes[0].textChanges.push({ newText: ",", span: { start: keywordToken.pos, length: keywordToken.end - keywordToken.pos } }); - } - } - return result; } }); From 43afb806de70177e6b018223eb3f99b5f0cd9e58 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 12:49:38 -0800 Subject: [PATCH 077/289] remove fix * fixRemoveAbstractModifierInNonAbstractClass.ts --- Jakefile.js | 1 - src/harness/tsconfig.json | 1 - ...emoveAbstractModifierInNonAbstractClass.ts | 40 ------------------- src/services/codefixes/fixes.ts | 3 +- 4 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts diff --git a/Jakefile.js b/Jakefile.js index fdb064334c3..d6671aceb9c 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -174,7 +174,6 @@ var servicesSources = [ "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", "codefixes/fixClassSuperMustPrecedeThisAccess.ts", "codefixes/fixConstructorForDerivedNeedSuperCall.ts", - "codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 1cb17e2a843..5c248dbdfc5 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -79,7 +79,6 @@ "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", "../services/codefixes/fixes.ts", "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", - "../services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts", "harness.ts", "sourceMapRecorder.ts", "harnessLanguageService.ts", diff --git a/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts b/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts deleted file mode 100644 index 93b1513b149..00000000000 --- a/src/services/codefixes/fixRemoveAbstractModifierInNonAbstractClass.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* @internal */ -namespace ts.codefix { - registerCodeFix({ - errorCodes: [Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - - Debug.assert(token.kind === SyntaxKind.AbstractKeyword); - - const propertyDeclaration = token.parent; - const classDeclaration = propertyDeclaration.parent; - const classKeywordStart = classDeclaration.getChildren()[0].getStart(); - - return [ - { - description: `Remove abstract modifier from ${propertyDeclaration.name.getText()}.`, - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ - span: { start: start, length: context.span.length + /*space*/ 1 }, - newText: "" - }] - }] - }, - { - description: `Make class ${classDeclaration.name.getText()} abstract.`, - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ - span: { start: classKeywordStart, length: 0 }, - newText: "abstract " - }] - }] - } - ]; - } - }); -} diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index 982b6abc84b..7df58b03f81 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -2,5 +2,4 @@ /// /// /// -/// -/// \ No newline at end of file +/// \ No newline at end of file From 6ed8d1803b56f0f2c3fe3acb312f525808050b2b Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 15 Nov 2016 13:56:42 -0800 Subject: [PATCH 078/289] unexpose resolveStructuredTypeMembers --- src/compiler/checker.ts | 1 - src/compiler/types.ts | 2 +- ...lassDoesntImplementInheritedAbstractMember.ts | 9 +++++++-- .../fixClassIncorrectlyImplementsInterface.ts | 10 +++++++--- src/services/utilities.ts | 16 ++++++---------- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d96db21dc37..4a4194b1097 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -84,7 +84,6 @@ namespace ts { getIntersectionType, getTypeFromTypeReference, getReturnTypeOfSignature, - resolveStructuredTypeMembers, getNonNullableType, getSymbolsInScope, getSymbolAtLocation, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f983b8d60bf..7e788600d6f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2264,7 +2264,6 @@ namespace ts { getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; - resolveStructuredTypeMembers(type: StructuredType): ResolvedType; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; @@ -2849,6 +2848,7 @@ namespace ts { finalArrayType?: Type; // Final array type of evolving array type } + /* @internal */ // Resolved object, union, or intersection type export interface ResolvedType extends ObjectType, UnionOrIntersectionType { members: SymbolTable; // Properties by name diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 8a9836afb54..65a6d4aba05 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -13,9 +13,14 @@ namespace ts.codefix { const startPos = classDecl.members.pos; const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); - const resolvedExtendsType = checker.resolveStructuredTypeMembers(InstantiatedExtendsType); + const extendsSymbols = checker.getPropertiesOfType(InstantiatedExtendsType); + let extendsAbstractSymbolsMap = createMap(); + for (const symbol of extendsSymbols) { + extendsAbstractSymbolsMap[symbol.getName()] = symbol; + } + extendsAbstractSymbolsMap = filterAbstractAndNonPrivate(extendsAbstractSymbolsMap); - const insertion = getMissingAbstractMembersInsertion(classDecl, resolvedExtendsType, checker, context.newLineCharacter); + const insertion = getMissingMembersInsertion(classDecl, extendsAbstractSymbolsMap, checker, context.newLineCharacter); if (insertion.length > 0) { return [{ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index af39da7b2d0..902ccf96b62 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -17,12 +17,16 @@ namespace ts.codefix { const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); const implementedTypes = implementedTypeNodes.map(checker.getTypeFromTypeReference); - const resolvedImplementedTypes = implementedTypes.map(checker.resolveStructuredTypeMembers); + const implementedTypeSymbols = implementedTypes.map(checker.getPropertiesOfType); const result: CodeAction[] = []; - for (const resolvedType of resolvedImplementedTypes) { - const insertion = getMissingMembersInsertion(classDecl, resolvedType, checker, context.newLineCharacter); + for (const symbols of implementedTypeSymbols) { + const symbolMap = createMap(); + for (const symbol of symbols) { + symbolMap[symbol.getName()] = symbol; + } + const insertion = getMissingMembersInsertion(classDecl, filterNonPrivate(symbolMap), checker, context.newLineCharacter); pushAction(result, insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class)); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index ec1a6320e3e..bd7ab363f9d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,17 +1359,13 @@ namespace ts { }; } - export function getMissingAbstractMembersInsertion(classDeclaration: ClassLikeDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const missingMembers = filterMissingMembers(filterAbstract(filterNonPrivate(resolvedType.members)), classDeclaration.symbol.members); - return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); - } - /** * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter. */ - export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, resolvedType: ResolvedType, checker: TypeChecker, newlineChar: string): string { - const missingMembers = filterMissingMembers(filterNonPrivate(resolvedType.members), classDeclaration.symbol.members); + export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Map, checker: TypeChecker, newlineChar: string): string { + const missingMembers = filterMissingMembers(possiblyMissingSymbols, classDeclaration.symbol.members); return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); } @@ -1398,11 +1394,11 @@ namespace ts { return result; } - function filterAbstract(symbolMap: Map) { - return filterSymbolMapByDeclaration(symbolMap, decl => !!(getModifierFlags(decl) & ModifierFlags.Abstract)); + export function filterAbstractAndNonPrivate(symbolMap: Map) { + return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private) && !!(getModifierFlags(decl) & ModifierFlags.Abstract)); } - function filterNonPrivate(symbolMap: Map) { + export function filterNonPrivate(symbolMap: Map) { return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); } From 94c78961ef3e340c617334597bf2c1b04d25f87f Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 19 Nov 2016 16:18:20 +0900 Subject: [PATCH 079/289] modify error message --- src/compiler/checker.ts | 10 ++++++---- src/compiler/diagnosticMessages.json | 6 +++++- .../parserExportAssignment10.errors.txt | 11 +++++++++++ .../reference/parserExportAssignment10.js | 16 ++++++++++++++++ .../reference/parserExportAssignment5.errors.txt | 4 ++-- .../reference/parserExportAssignment9.errors.txt | 8 ++++---- .../parserExportAssignment10.ts | 5 +++++ 7 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/parserExportAssignment10.errors.txt create mode 100644 tests/baselines/reference/parserExportAssignment10.js create mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 824ce784909..cb10e8fbf13 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7293,9 +7293,6 @@ namespace ts { if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Primitive) { tryElaborateErrorsForPrimitivesAndObjects(source, target); } - else if (source.symbol && source.flags & TypeFlags.ObjectType && globalObjectType === source) { - reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); - } else if (source.symbol && source.flags & TypeFlags.Object && globalObjectType === source) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); } @@ -18764,7 +18761,12 @@ namespace ts { const container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { - error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + if (node.isExportEquals) { + error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } else { + error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + return; } // Grammar checking diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 03f1e5e8388..03be26ff954 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -195,7 +195,7 @@ "category": "Error", "code": 1062 }, - "A default export can only be used in an ECMAScript-style module.": { + "An export assignment cannot be used in a namespace.": { "category": "Error", "code": 1063 }, @@ -851,6 +851,10 @@ "category": "Error", "code": 1317 }, + "A default export can only be used in an ECMAScript-style module.": { + "category": "Error", + "code": 1318 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 diff --git a/tests/baselines/reference/parserExportAssignment10.errors.txt b/tests/baselines/reference/parserExportAssignment10.errors.txt new file mode 100644 index 00000000000..db00da3e8b0 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment10.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts(4,3): error TS1128: Declaration or statement expected. + + +==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts (1 errors) ==== + export default "123"; + namespace Foo { + var foo; + export foo; + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment10.js b/tests/baselines/reference/parserExportAssignment10.js new file mode 100644 index 00000000000..58bd2c82a9e --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment10.js @@ -0,0 +1,16 @@ +//// [parserExportAssignment10.ts] +export default "123"; +namespace Foo { + var foo; + export foo; +} + +//// [parserExportAssignment10.js] +"use strict"; +exports.__esModule = true; +exports["default"] = "123"; +var Foo; +(function (Foo) { + var foo; + foo; +})(Foo || (Foo = {})); diff --git a/tests/baselines/reference/parserExportAssignment5.errors.txt b/tests/baselines/reference/parserExportAssignment5.errors.txt index adef4b88f38..7b07e1d225f 100644 --- a/tests/baselines/reference/parserExportAssignment5.errors.txt +++ b/tests/baselines/reference/parserExportAssignment5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts(2,5): error TS1063: An export assignment cannot be used in a namespace. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment5.ts (1 errors) ==== module M { export = A; ~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1063: An export assignment cannot be used in a namespace. } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt index 9fc978537a6..5d84ee9836c 100644 --- a/tests/baselines/reference/parserExportAssignment9.errors.txt +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1063: A default export can only be used in an ECMAScript-style module. -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1063: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1318: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1318: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== namespace Foo { export default foo; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1318: A default export can only be used in an ECMAScript-style module. } module Bar { export default bar; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1063: A default export can only be used in an ECMAScript-style module. +!!! error TS1318: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts new file mode 100644 index 00000000000..a5bf22dd854 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts @@ -0,0 +1,5 @@ +export default "123"; +namespace Foo { + var foo; + export foo; +} \ No newline at end of file From 13f52c9148e8e302551cf4671e6861608435d03d Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Fri, 25 Nov 2016 00:40:50 +0900 Subject: [PATCH 080/289] fix linting error --- src/compiler/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b30250fabd6..11085532794 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18756,10 +18756,11 @@ namespace ts { if (container.kind === SyntaxKind.ModuleDeclaration && !isAmbientModule(container)) { if (node.isExportEquals) { error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); - } else { + } + else { error(node, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } - + return; } // Grammar checking From 40252248e0d2d55c21fc216cae7047b0c1b0d9de Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Fri, 25 Nov 2016 07:10:05 +0900 Subject: [PATCH 081/289] remove extra tests --- .../parserExportAssignment10.errors.txt | 11 ----------- .../reference/parserExportAssignment10.js | 16 ---------------- .../parserExportAssignment10.ts | 5 ----- 3 files changed, 32 deletions(-) delete mode 100644 tests/baselines/reference/parserExportAssignment10.errors.txt delete mode 100644 tests/baselines/reference/parserExportAssignment10.js delete mode 100644 tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts diff --git a/tests/baselines/reference/parserExportAssignment10.errors.txt b/tests/baselines/reference/parserExportAssignment10.errors.txt deleted file mode 100644 index db00da3e8b0..00000000000 --- a/tests/baselines/reference/parserExportAssignment10.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts(4,3): error TS1128: Declaration or statement expected. - - -==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts (1 errors) ==== - export default "123"; - namespace Foo { - var foo; - export foo; - ~~~~~~ -!!! error TS1128: Declaration or statement expected. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserExportAssignment10.js b/tests/baselines/reference/parserExportAssignment10.js deleted file mode 100644 index 58bd2c82a9e..00000000000 --- a/tests/baselines/reference/parserExportAssignment10.js +++ /dev/null @@ -1,16 +0,0 @@ -//// [parserExportAssignment10.ts] -export default "123"; -namespace Foo { - var foo; - export foo; -} - -//// [parserExportAssignment10.js] -"use strict"; -exports.__esModule = true; -exports["default"] = "123"; -var Foo; -(function (Foo) { - var foo; - foo; -})(Foo || (Foo = {})); diff --git a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts b/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts deleted file mode 100644 index a5bf22dd854..00000000000 --- a/tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment10.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default "123"; -namespace Foo { - var foo; - export foo; -} \ No newline at end of file From b293257640e608c09055e033e8b3b7b8dda342cb Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 01:19:41 +0900 Subject: [PATCH 082/289] remove extra files --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ------------------ .../assigningFromObjecToAnythingElse.js | 18 --------- .../compiler/asiPublicPrivateProtected.ts | 39 ------------------- 3 files changed, 95 deletions(-) delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js delete mode 100644 tests/cases/compiler/asiPublicPrivateProtected.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt deleted file mode 100644 index 2188474d9c9..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'exec' is missing in type 'Object'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'charAt' is missing in type 'Object'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. - Property 'charAt' is missing in type 'Number'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'name' is missing in type 'Object'. - - -==== tests/cases/compiler/assigningFromObjecToAnythingElse.ts (4 errors) ==== - var x: Object; - var y: RegExp; - y = x; - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'exec' is missing in type 'Object'. - - var a: String = Object.create(""); - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'String'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'charAt' is missing in type 'Object'. - var c: String = Object.create(1); - ~ -!!! error TS2322: Type 'Number' is not assignable to type 'String'. -!!! error TS2322: Property 'charAt' is missing in type 'Number'. - - var w: Error = new Object(); - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'Error'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'name' is missing in type 'Object'. - \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js deleted file mode 100644 index ec6dc0c789d..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [assigningFromObjecToAnythingElse.ts] -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); - - -//// [assigningFromObjecToAnythingElse.js] -var x; -var y; -y = x; -var a = Object.create(""); -var c = Object.create(1); -var w = new Object(); diff --git a/tests/cases/compiler/asiPublicPrivateProtected.ts b/tests/cases/compiler/asiPublicPrivateProtected.ts deleted file mode 100644 index 4ccd4c1c01b..00000000000 --- a/tests/cases/compiler/asiPublicPrivateProtected.ts +++ /dev/null @@ -1,39 +0,0 @@ -public -class NonPublicClass { - public s() { - } -} - -class NonPublicClass2 { - public - private nonPublicFunction() { - } -} -private -class NonPrivateClass { - private s() { - } -} - -class NonPrivateClass2 { - private - public nonPrivateFunction() { - } -} -protected -class NonProtectedClass { - protected s() { - } -} - -class NonProtectedClass2 { - protected - public nonProtectedFunction() { - } -} - -class ClassWithThreeMembers { - public - private - protected -} From e18901a61ef165fa5c1d73047c32a84403d53c55 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 08:03:42 +0900 Subject: [PATCH 083/289] Revert "remove extra files" This reverts commit b293257640e608c09055e033e8b3b7b8dda342cb. --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ++++++++++++++++++ .../assigningFromObjecToAnythingElse.js | 18 +++++++++ .../compiler/asiPublicPrivateProtected.ts | 39 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt create mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js create mode 100644 tests/cases/compiler/asiPublicPrivateProtected.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt new file mode 100644 index 00000000000..2188474d9c9 --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'exec' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'charAt' is missing in type 'Object'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. + Property 'charAt' is missing in type 'Number'. +tests/cases/compiler/assigningFromObjecToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. + The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? + Property 'name' is missing in type 'Object'. + + +==== tests/cases/compiler/assigningFromObjecToAnythingElse.ts (4 errors) ==== + var x: Object; + var y: RegExp; + y = x; + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'exec' is missing in type 'Object'. + + var a: String = Object.create(""); + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'String'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'charAt' is missing in type 'Object'. + var c: String = Object.create(1); + ~ +!!! error TS2322: Type 'Number' is not assignable to type 'String'. +!!! error TS2322: Property 'charAt' is missing in type 'Number'. + + var w: Error = new Object(); + ~ +!!! error TS2322: Type 'Object' is not assignable to type 'Error'. +!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? +!!! error TS2322: Property 'name' is missing in type 'Object'. + \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js new file mode 100644 index 00000000000..ec6dc0c789d --- /dev/null +++ b/tests/baselines/reference/assigningFromObjecToAnythingElse.js @@ -0,0 +1,18 @@ +//// [assigningFromObjecToAnythingElse.ts] +var x: Object; +var y: RegExp; +y = x; + +var a: String = Object.create(""); +var c: String = Object.create(1); + +var w: Error = new Object(); + + +//// [assigningFromObjecToAnythingElse.js] +var x; +var y; +y = x; +var a = Object.create(""); +var c = Object.create(1); +var w = new Object(); diff --git a/tests/cases/compiler/asiPublicPrivateProtected.ts b/tests/cases/compiler/asiPublicPrivateProtected.ts new file mode 100644 index 00000000000..4ccd4c1c01b --- /dev/null +++ b/tests/cases/compiler/asiPublicPrivateProtected.ts @@ -0,0 +1,39 @@ +public +class NonPublicClass { + public s() { + } +} + +class NonPublicClass2 { + public + private nonPublicFunction() { + } +} +private +class NonPrivateClass { + private s() { + } +} + +class NonPrivateClass2 { + private + public nonPrivateFunction() { + } +} +protected +class NonProtectedClass { + protected s() { + } +} + +class NonProtectedClass2 { + protected + public nonProtectedFunction() { + } +} + +class ClassWithThreeMembers { + public + private + protected +} From 67b621eae4a8b7fdaafb8e13fa5c6b20b94c0f01 Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Sat, 26 Nov 2016 08:06:44 +0900 Subject: [PATCH 084/289] remove extra files --- ...ssigningFromObjecToAnythingElse.errors.txt | 38 ------------------- .../assigningFromObjecToAnythingElse.js | 18 --------- .../assigningFromObjecToAnythingElse.ts | 8 ---- 3 files changed, 64 deletions(-) delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt delete mode 100644 tests/baselines/reference/assigningFromObjecToAnythingElse.js delete mode 100644 tests/cases/compiler/assigningFromObjecToAnythingElse.ts diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt b/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt deleted file mode 100644 index 2188474d9c9..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(3,1): error TS2322: Type 'Object' is not assignable to type 'RegExp'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'exec' is missing in type 'Object'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(5,5): error TS2322: Type 'Object' is not assignable to type 'String'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'charAt' is missing in type 'Object'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(6,5): error TS2322: Type 'Number' is not assignable to type 'String'. - Property 'charAt' is missing in type 'Number'. -tests/cases/compiler/assigningFromObjecToAnythingElse.ts(8,5): error TS2322: Type 'Object' is not assignable to type 'Error'. - The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? - Property 'name' is missing in type 'Object'. - - -==== tests/cases/compiler/assigningFromObjecToAnythingElse.ts (4 errors) ==== - var x: Object; - var y: RegExp; - y = x; - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'RegExp'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'exec' is missing in type 'Object'. - - var a: String = Object.create(""); - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'String'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'charAt' is missing in type 'Object'. - var c: String = Object.create(1); - ~ -!!! error TS2322: Type 'Number' is not assignable to type 'String'. -!!! error TS2322: Property 'charAt' is missing in type 'Number'. - - var w: Error = new Object(); - ~ -!!! error TS2322: Type 'Object' is not assignable to type 'Error'. -!!! error TS2322: The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? -!!! error TS2322: Property 'name' is missing in type 'Object'. - \ No newline at end of file diff --git a/tests/baselines/reference/assigningFromObjecToAnythingElse.js b/tests/baselines/reference/assigningFromObjecToAnythingElse.js deleted file mode 100644 index ec6dc0c789d..00000000000 --- a/tests/baselines/reference/assigningFromObjecToAnythingElse.js +++ /dev/null @@ -1,18 +0,0 @@ -//// [assigningFromObjecToAnythingElse.ts] -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); - - -//// [assigningFromObjecToAnythingElse.js] -var x; -var y; -y = x; -var a = Object.create(""); -var c = Object.create(1); -var w = new Object(); diff --git a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts b/tests/cases/compiler/assigningFromObjecToAnythingElse.ts deleted file mode 100644 index ebf1a0a8763..00000000000 --- a/tests/cases/compiler/assigningFromObjecToAnythingElse.ts +++ /dev/null @@ -1,8 +0,0 @@ -var x: Object; -var y: RegExp; -y = x; - -var a: String = Object.create(""); -var c: String = Object.create(1); - -var w: Error = new Object(); From 680af0f7827e92c9382b21043c39e4833e7546d6 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 28 Nov 2016 14:42:55 -0600 Subject: [PATCH 085/289] use getStart() --- .../codefixes/fixExtendsInterfaceBecomesImplements.ts | 8 ++++++-- tests/cases/fourslash/codeFixChangeExtendsToImplements.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index b7ec5d0b8ca..1e72700ec01 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -21,13 +21,17 @@ namespace ts.codefix { return undefined; } - const textChanges: TextChange[] = [{ newText: " implements", span: { start: extendsToken.pos, length: extendsToken.end - extendsToken.pos } }]; + let changeStart = extendsToken.getStart(sourceFile); + let changeEnd = extendsToken.getEnd(); + const textChanges: TextChange[] = [{ newText: " implements", span: { start: changeStart, length: changeEnd - changeStart } }]; // We replace existing keywords with commas. for (let i = 1; i < heritageClauses.length; i++) { const keywordToken = heritageClauses[i].getFirstToken(); if (keywordToken) { - textChanges.push({ newText: ",", span: { start: keywordToken.pos, length: keywordToken.end - keywordToken.pos } }); + changeStart = keywordToken.getStart(sourceFile); + changeEnd = keywordToken.getEnd(); + textChanges.push({ newText: ",", span: { start: changeStart, length: changeEnd - changeStart } }); } } diff --git a/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts index 9d913c83f2d..bfaedf2818a 100644 --- a/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts +++ b/tests/cases/fourslash/codeFixChangeExtendsToImplements.ts @@ -1,6 +1,6 @@ /// //// interface I {} -//// [|class C extends I|]{} +//// [|/* */ class /* */ C /* */ extends /* */ I|]{} -verify.rangeAfterCodeFix("class C implements I"); \ No newline at end of file +verify.rangeAfterCodeFix("/* */ class /* */ C /* */ implements /* */ I"); \ No newline at end of file From 16b146f882cf8a16c3b3217b0641a7011e702229 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 28 Nov 2016 15:26:55 -0600 Subject: [PATCH 086/289] Use array instead of map --- ...sDoesntImplementInheritedAbstractMember.ts | 17 ++++--- .../fixClassIncorrectlyImplementsInterface.ts | 22 +++++---- src/services/codefixes/fixes.ts | 4 +- src/services/utilities.ts | 47 +++---------------- 4 files changed, 33 insertions(+), 57 deletions(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 65a6d4aba05..e91507a6140 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -13,14 +13,12 @@ namespace ts.codefix { const startPos = classDecl.members.pos; const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. const extendsSymbols = checker.getPropertiesOfType(InstantiatedExtendsType); - let extendsAbstractSymbolsMap = createMap(); - for (const symbol of extendsSymbols) { - extendsAbstractSymbolsMap[symbol.getName()] = symbol; - } - extendsAbstractSymbolsMap = filterAbstractAndNonPrivate(extendsAbstractSymbolsMap); + const abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); - const insertion = getMissingMembersInsertion(classDecl, extendsAbstractSymbolsMap, checker, context.newLineCharacter); + const insertion = getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); if (insertion.length > 0) { return [{ @@ -37,6 +35,13 @@ namespace ts.codefix { } return undefined; + + function symbolPointsToNonPrivateAndAbstractMember(symbol: Symbol): boolean { + const decls = symbol.getDeclarations(); + Debug.assert(!!(decls && decls.length > 0)); + const flags = getModifierFlags(decls[0]); + return !(flags & ModifierFlags.Private) && !!(flags & ModifierFlags.Abstract); + } } }); } \ No newline at end of file diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 902ccf96b62..605e362cae8 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -16,22 +16,28 @@ namespace ts.codefix { const startPos: number = classDecl.members.pos; const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - const implementedTypes = implementedTypeNodes.map(checker.getTypeFromTypeReference); - const implementedTypeSymbols = implementedTypes.map(checker.getPropertiesOfType); const result: CodeAction[] = []; - for (const symbols of implementedTypeSymbols) { - const symbolMap = createMap(); - for (const symbol of symbols) { - symbolMap[symbol.getName()] = symbol; - } - const insertion = getMissingMembersInsertion(classDecl, filterNonPrivate(symbolMap), checker, context.newLineCharacter); + for (const implementedTypeNode of implementedTypeNodes) { + const implementedType = checker.getTypeFromTypeReference(implementedTypeNode); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); + + const insertion = getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); pushAction(result, insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class)); } return result; + function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { + const decls = symbol.getDeclarations(); + Debug.assert(!!(decls && decls.length > 0)); + return !(getModifierFlags(decls[0]) & ModifierFlags.Private); + } + function pushAction(result: CodeAction[], insertion: string, description: string): void { if (insertion && insertion.length) { const newAction: CodeAction = { diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index c04ff83f6fa..da6dcde16c3 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -3,6 +3,6 @@ /// /// /// -/// -/// +/// +/// diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 58fc82d1d7f..863baeb5045 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1362,51 +1362,16 @@ namespace ts { /** * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. - * @param possiblyMissingSymbols The collection of symbols to filter. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. */ - export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Map, checker: TypeChecker, newlineChar: string): string { - const missingMembers = filterMissingMembers(possiblyMissingSymbols, classDeclaration.symbol.members); - return getInsertionsForMembers(missingMembers, classDeclaration, checker, newlineChar); - } + export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string { + const classMembers = classDeclaration.symbol.members; + const missingMembers = possiblyMissingSymbols.filter(symbol => !(symbol.getName() in classMembers)); - /** - * Finds the symbols in source but not target, generating a new map with the differences. - */ - function filterMissingMembers(sourceSymbols: Map, targetSymbols: Map): Map { - const result: Map = createMap(); - for (const sourceName in sourceSymbols) { - if (!(sourceName in targetSymbols)) { - result[sourceName] = sourceSymbols[sourceName]; - } - } - return result; - } - - function filterSymbolMapByDeclaration(symbolMap: Map, pred: (decl: Declaration) => boolean): Map { - const result = createMap(); - for (const key in symbolMap) { - const declaration = symbolMap[key].getDeclarations(); - Debug.assert(!!(declaration && declaration.length)); - if (pred(declaration[0])) { - result[key] = symbolMap[key]; - } - } - return result; - } - - export function filterAbstractAndNonPrivate(symbolMap: Map) { - return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private) && !!(getModifierFlags(decl) & ModifierFlags.Abstract)); - } - - export function filterNonPrivate(symbolMap: Map) { - return filterSymbolMapByDeclaration(symbolMap, decl => !(getModifierFlags(decl) & ModifierFlags.Private)); - } - - function getInsertionsForMembers(symbolMap: MapLike, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { let insertion = ""; - for (const symbolName in symbolMap) { - insertion = insertion.concat(getInsertionForMemberSymbol(symbolMap[symbolName], enclosingDeclaration, checker, newlineChar)); + for (const symbol of missingMembers) { + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); } return insertion; } From 8df1c7ed13aebc71173f160a70adfa92775f1c81 Mon Sep 17 00:00:00 2001 From: Iwata Hidetaka Date: Mon, 28 Nov 2016 23:27:29 +0900 Subject: [PATCH 087/289] add test for #12536 --- .../fourslash/completionForStringLiteral5.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/cases/fourslash/completionForStringLiteral5.ts diff --git a/tests/cases/fourslash/completionForStringLiteral5.ts b/tests/cases/fourslash/completionForStringLiteral5.ts new file mode 100644 index 00000000000..3752734d913 --- /dev/null +++ b/tests/cases/fourslash/completionForStringLiteral5.ts @@ -0,0 +1,15 @@ +/// + +////interface Foo { +//// foo: string; +//// bar: string; +////} +//// +////function f(a: K) { }; +////f("/*1*/ + +goTo.marker('1'); +verify.completionListContains("foo"); +verify.completionListContains("bar"); +verify.memberListCount(2); + From f37640a43ef5ecd530ef2c985feffdbed8e3374c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 28 Nov 2016 16:47:26 -0600 Subject: [PATCH 088/289] Add args to diagnostic message --- src/compiler/core.ts | 2 +- src/compiler/diagnosticMessages.json | 8 +++--- ...sDoesntImplementInheritedAbstractMember.ts | 2 +- .../fixClassIncorrectlyImplementsInterface.ts | 27 ++++++++++--------- src/services/utilities.ts | 3 ++- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 89057dd2939..f0dff5122cc 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1078,7 +1078,7 @@ namespace ts { } } - function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string { + export function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string { baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5a22d7d40d5..9070f01338d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3171,11 +3171,11 @@ "category": "Message", "code": 90002 }, - "Change 'extends' to 'implements'": { + "Change 'extends' to 'implements'.": { "category": "Message", "code": 90003 }, - "Remove unused identifiers": { + "Remove unused identifiers.": { "category": "Message", "code": 90004 }, @@ -3183,11 +3183,11 @@ "category": "Message", "code": 90005 }, - "Implement interface on class": { + "Implement interface '{0}'.": { "category": "Message", "code": 90006 }, - "Implement inherited abstract class": { + "Implement inherited abstract class.": { "category": "Message", "code": 90007 }, diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index e91507a6140..2ce45a64bc3 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -20,7 +20,7 @@ namespace ts.codefix { const insertion = getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); - if (insertion.length > 0) { + if (insertion) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), changes: [{ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 605e362cae8..2cec3adb8f5 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -27,7 +27,10 @@ namespace ts.codefix { const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); const insertion = getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); - pushAction(result, insertion, getLocaleSpecificMessage(Diagnostics.Implement_interface_on_class)); + const message = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); + } } return result; @@ -39,19 +42,17 @@ namespace ts.codefix { } function pushAction(result: CodeAction[], insertion: string, description: string): void { - if (insertion && insertion.length) { - const newAction: CodeAction = { - description: description, - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ - span: { start: startPos, length: 0 }, - newText: insertion - }] + const newAction: CodeAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion }] - }; - result.push(newAction); - } + }] + }; + result.push(newAction); } } }); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 863baeb5045..947222cba3c 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1363,6 +1363,7 @@ namespace ts { * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns undefined iff there is no insertion available. */ export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string { const classMembers = classDeclaration.symbol.members; @@ -1373,7 +1374,7 @@ namespace ts { for (const symbol of missingMembers) { insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); } - return insertion; + return insertion.length > 0 ? insertion : undefined; } function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { From 5d6a714a041b09cc34fa27146c8f39492ece5750 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 28 Nov 2016 17:40:59 -0600 Subject: [PATCH 089/289] move helpers under codefix dir --- Jakefile.js | 3 ++ src/harness/tsconfig.json | 15 ++++--- src/services/codefixes/fixes.ts | 1 + src/services/codefixes/helpers.ts | 65 +++++++++++++++++++++++++++++++ src/services/tsconfig.json | 17 ++++---- src/services/utilities.ts | 62 ----------------------------- 6 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 src/services/codefixes/helpers.ts diff --git a/Jakefile.js b/Jakefile.js index 95027e07ed3..0ed65abf263 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -176,6 +176,9 @@ var servicesSources = [ "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", "codefixes/fixClassSuperMustPrecedeThisAccess.ts", "codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "codefixes/helpers.ts", + "codefixes/importFixes.ts", + "codefixes/unusedIdentifierFixes.ts" ].map(function (f) { return path.join(servicesDirectory, f); })); diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 41167058578..6b83cf249a7 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -74,13 +74,18 @@ "../services/formatting/rulesProvider.ts", "../services/formatting/smartIndenter.ts", "../services/formatting/tokenRange.ts", - "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", - "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", - "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", - "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codeFixProvider.ts", "../services/codefixes/fixes.ts", "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", - "harness.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/importFixes.ts", + "../services/codefixes/unusedIdentifierFixes.ts", + "../services/harness.ts", + "sourceMapRecorder.ts", "harnessLanguageService.ts", "fourslash.ts", diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index da6dcde16c3..10d6fa50158 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -5,4 +5,5 @@ /// /// /// +/// diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts new file mode 100644 index 00000000000..5ad99e7b389 --- /dev/null +++ b/src/services/codefixes/helpers.ts @@ -0,0 +1,65 @@ +/* @internal */ +namespace ts.codefix { + + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns undefined iff there is no insertion available. + */ + export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string { + const classMembers = classDeclaration.symbol.members; + const missingMembers = possiblyMissingSymbols.filter(symbol => !(symbol.getName() in classMembers)); + + let insertion = ""; + + for (const symbol of missingMembers) { + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); + } + return insertion.length > 0 ? insertion : undefined; + } + + function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { + const name = symbol.getName(); + const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); + const declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return ""; + } + const node = declarations[0]; + const visibility = getVisibilityPrefix(getModifierFlags(node)); + switch (node.kind) { + case SyntaxKind.PropertySignature: + case SyntaxKind.PropertyDeclaration: + const typeString = checker.typeToString(type, enclosingDeclaration, TypeFormatFlags.None); + return `${visibility}${name}: ${typeString};${newlineChar}`; + + case SyntaxKind.MethodSignature: + case SyntaxKind.MethodDeclaration: + const signatures = checker.getSignaturesOfType(type, SignatureKind.Call); + if (!(signatures && signatures.length > 0)) { + return ""; + } + // TODO: (arozga) Deal with multiple signatures. + const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); + + return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + default: + return ""; + } + } + + function getMethodBodyStub(newLineChar: string) { + return `{${newLineChar}throw new Error('Method not Implemented');${newLineChar}}${newLineChar}`; + } + + function getVisibilityPrefix(flags: ModifierFlags): string { + if (flags & ModifierFlags.Public) { + return "public "; + } + else if (flags & ModifierFlags.Protected) { + return "protected "; + } + return ""; + } +} \ No newline at end of file diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 9966c83f4cd..921ee7762f8 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -88,11 +88,14 @@ "formatting/smartIndenter.ts", "formatting/tokenRange.ts", "codeFixProvider.ts", - "codeFixes/fixes.ts", - "codeFixes/fixExtendsInterfaceBecomesImplements.ts", - "codeFixes/fixClassIncorrectlyImplementsInterface.ts", - "codeFixes/fixClassDoesntImplementInheritedAbstractMember.ts", - "codeFixes/fixClassSuperMustPrecedeThisAccess.ts", - "codeFixes/fixConstructorForDerivedNeedSuperCall.ts" + "codefixes/fixExtendsInterfaceBecomesImplements.ts", + "codefixes/fixClassIncorrectlyImplementsInterface.ts", + "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "codefixes/fixes.ts", + "codefixes/helpers.ts", + "codefixes/importFixes.ts", + "codefixes/unusedIdentifierFixes.ts" ] -} +} \ No newline at end of file diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 947222cba3c..7542fd86dac 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1359,68 +1359,6 @@ namespace ts { }; } - /** - * Finds members of the resolved type that are missing in the class pointed to by class decl - * and generates source code for the missing members. - * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. - * @returns undefined iff there is no insertion available. - */ - export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string { - const classMembers = classDeclaration.symbol.members; - const missingMembers = possiblyMissingSymbols.filter(symbol => !(symbol.getName() in classMembers)); - - let insertion = ""; - - for (const symbol of missingMembers) { - insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); - } - return insertion.length > 0 ? insertion : undefined; - } - - function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { - const name = symbol.getName(); - const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); - const declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return ""; - } - const node = declarations[0]; - const visibility = getVisibilityPrefix(getModifierFlags(node)); - switch (node.kind) { - case SyntaxKind.PropertySignature: - case SyntaxKind.PropertyDeclaration: - const typeString = checker.typeToString(type, enclosingDeclaration, TypeFormatFlags.None); - return `${visibility}${name}: ${typeString};${newlineChar}`; - - case SyntaxKind.MethodSignature: - case SyntaxKind.MethodDeclaration: - const signatures = checker.getSignaturesOfType(type, SignatureKind.Call); - if (!(signatures && signatures.length > 0)) { - return ""; - } - // TODO: (arozga) Deal with multiple signatures. - const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); - - return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; - default: - return ""; - } - } - - function getMethodBodyStub(newLineChar: string) { - return `{${newLineChar}throw new Error('Method not Implemented');${newLineChar}}${newLineChar}`; - } - - function getVisibilityPrefix(flags: ModifierFlags): string { - if (flags & ModifierFlags.Public) { - return "public "; - } - else if (flags & ModifierFlags.Protected) { - return "protected "; - } - return ""; - } - export function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile) { // First token is the open curly, this is where we want to put the 'super' call. return constructor.body.getFirstToken(sourceFile).getEnd(); From 5f073a63163f969a8f18786128310c8623cc48fc Mon Sep 17 00:00:00 2001 From: Iwata Hidetaka Date: Tue, 29 Nov 2016 10:32:52 +0900 Subject: [PATCH 090/289] expose getApparentType on TypeChecker interface --- src/compiler/checker.ts | 3 ++- src/compiler/types.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e016d493046..ec2070008f3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -112,7 +112,8 @@ namespace ts { // we deliberately exclude augmentations // since we are only interested in declarations of the module itself return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); - } + }, + getApparentType }; const tupleTypes: GenericType[] = []; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 219e7efa90a..b0fd1174930 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2379,6 +2379,7 @@ namespace ts { getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; /* @internal */ tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; From aaf87735cce8df134c4c515890f7fb82a13948ac Mon Sep 17 00:00:00 2001 From: Iwata Hidetaka Date: Mon, 28 Nov 2016 23:28:23 +0900 Subject: [PATCH 091/289] tsserver: get candidates from (fix #12536) --- src/services/completions.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/services/completions.ts b/src/services/completions.ts index b710aa8cd78..f0daa696474 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -244,6 +244,9 @@ namespace ts.Completions { } function addStringLiteralCompletionsFromType(type: Type, result: CompletionEntry[]): void { + if (type && type.flags & TypeFlags.TypeParameter) { + type = typeChecker.getApparentType(type); + } if (!type) { return; } From bf48564cc8bd49e9223353f636c6d9dd067fba22 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 29 Nov 2016 13:36:09 -0600 Subject: [PATCH 092/289] FIx typo in method stub. --- src/services/codefixes/helpers.ts | 2 +- tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts | 2 +- ...ClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts | 2 +- ...deFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts | 2 +- .../codeFixUnImplementedClassMissingFunctionVoidInferred.ts | 2 +- .../codeFixUnImplementedClassMissingMethodViaHeritage.ts | 2 +- tests/cases/fourslash/codeFixUnImplementedInterface36.ts | 2 +- tests/cases/fourslash/codeFixUnImplementedInterface39.ts | 2 +- .../fourslash/codeFixUnImplementedInterfaceMissingMethod.ts | 2 +- .../codeFixUnImplementedInterfaceMissingMethodWithParams.ts | 2 +- ...eFixUnImplementedInterfaceMissingMethodWithReturnType.ts | 2 +- .../codeFixUnImplementedInterfaceTypeParamMethod.ts | 2 +- ...lementedInterfaceMissingMultipleMembersAndPunctuation.ts | 6 +++--- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 5ad99e7b389..bcab7d59b37 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -50,7 +50,7 @@ namespace ts.codefix { } function getMethodBodyStub(newLineChar: string) { - return `{${newLineChar}throw new Error('Method not Implemented');${newLineChar}}${newLineChar}`; + return `{${newLineChar}throw new Error('Method not implemented.');${newLineChar}}${newLineChar}`; } function getVisibilityPrefix(flags: ModifierFlags): string { diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts index a946d6386a0..cf1322ff8b3 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts @@ -8,6 +8,6 @@ //// |]} verify.rangeAfterCodeFix(`f(){ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts index 1faa572b5bc..bdf198b89e3 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts @@ -8,6 +8,6 @@ //// |]} verify.rangeAfterCodeFix(`f(x: number): number{ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts index abb8b6fd2a7..647a533c1c5 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts @@ -8,6 +8,6 @@ //// |]} verify.rangeAfterCodeFix(`f(x: U): U{ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts index e78bf00f854..d9b9f57d4d2 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts @@ -8,6 +8,6 @@ verify.rangeAfterCodeFix(` f(): void{ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts index af20c19561d..4365a160531 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts @@ -13,6 +13,6 @@ //// } verify.rangeAfterCodeFix(`f1(): void{ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts index 6c25b4b55cf..f9fc48991fc 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface36.ts @@ -15,6 +15,6 @@ //// |]} verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts index 42dfae91e3e..f81dea49782 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39.ts @@ -13,6 +13,6 @@ //// |]} verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts index 976c0dba56d..b5ba2e20697 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts @@ -8,6 +8,6 @@ //// |]} verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts index a21c7074b50..f0b1e669b46 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts @@ -9,6 +9,6 @@ verify.rangeAfterCodeFix(` f(x: number,y: string){ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts index 89ee457a521..c85f1d0043a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts @@ -8,6 +8,6 @@ //// |]} verify.rangeAfterCodeFix(`f1(): string { - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts index bd221ceb8cb..4d6afaefedc 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts @@ -7,6 +7,6 @@ //// class C implements I {[| |]} verify.rangeAfterCodeFix(`f(x: T){ - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts index 01f7789620a..beab89c06a5 100644 --- a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts @@ -17,12 +17,12 @@ x: number; y: number; z: number; f() { - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } g() { - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } h() { - throw new Error('Method not Implemented'); + throw new Error('Method not implemented.'); } `); \ No newline at end of file From ba80ce63add216ae6e588a056ec2c2fe29de93a3 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 29 Nov 2016 14:33:20 -0600 Subject: [PATCH 093/289] stubbing extra completions --- src/services/codefixes/helpers.ts | 15 +++++++ ...edClassMissingAbstractGettersAndSetters.ts | 44 +++++++++++++++++++ ...eFixUnImplementedInterface39 - Copy (3).ts | 18 ++++++++ ...eFixUnImplementedInterface39 - Copy (4).ts | 18 ++++++++ ...eFixUnImplementedInterface39 - Copy (5).ts | 18 ++++++++ ...eFixUnImplementedInterface39 - Copy (6).ts | 18 ++++++++ ...nImplementedInterfaceMultipleSignatures.ts | 30 +++++++++++++ 7 files changed, 161 insertions(+) create mode 100644 tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index bcab7d59b37..3c06ae6288f 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -28,6 +28,7 @@ namespace ts.codefix { } const node = declarations[0]; const visibility = getVisibilityPrefix(getModifierFlags(node)); + let getOrSetPrefix: string = undefined; switch (node.kind) { case SyntaxKind.PropertySignature: case SyntaxKind.PropertyDeclaration: @@ -44,6 +45,20 @@ namespace ts.codefix { const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + case SyntaxKind.GetAccessor: + getOrSetPrefix = "get"; + case SyntaxKind.SetAccessor: + getOrSetPrefix = getOrSetPrefix ? getOrSetPrefix : "set"; + + throw new Error('Not implemented, getter and setter.'); + case SyntaxKind.ComputedPropertyName: + if (hasDynamicName(node)) { + return ""; + } + throw new Error('Not implemented, computed property name.'); + case SyntaxKind.IndexSignature: + throw new Error('Not implemented.'); + default: return ""; } diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts new file mode 100644 index 00000000000..5540b20cfb9 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts @@ -0,0 +1,44 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +let passcode = "secret passcode"; + +abstract class A { + private _a: string; + + abstract get a(): string; + abstract set a(newName: string); +} + +class B extends A { + a: string; +} + + +abstract class AA { + private _a: string; + + abstract get a(): string { + return this._a; + } + + abstract set a(newName: string) { + this._a = newName; + } +} + +verify.rangeAfterCodeFix(`f1(): string{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts new file mode 100644 index 00000000000..f81dea49782 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.rangeAfterCodeFix(`f1(): string{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts new file mode 100644 index 00000000000..f81dea49782 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.rangeAfterCodeFix(`f1(): string{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts new file mode 100644 index 00000000000..f81dea49782 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.rangeAfterCodeFix(`f1(): string{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts new file mode 100644 index 00000000000..f81dea49782 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts @@ -0,0 +1,18 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +verify.rangeAfterCodeFix(`f1(): string{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts new file mode 100644 index 00000000000..a7142931eed --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts @@ -0,0 +1,30 @@ +/// + +//// namespace N1 { +//// export interface I1 { +//// f1():string; +//// } +//// } +//// interface I1 { +//// f1(); +//// } +//// +//// class C1 implements N1.I1 {[| +//// |]} + +//// interface I { +//// method(a: number, b: string): boolean; +//// method(a: string, b: number): Function; +//// method(a: string): Function; +//// } +//// +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + method(a: number, b: string): boolean; + method(a: string, b: number): Function; + method(a: string): Function; + method(a: number | string, b?: string | number): boolean | Function { + throw new Error("Method not implemented"); + } +`); From 9e6a83db20478303aa00b2161081302bdd08ec05 Mon Sep 17 00:00:00 2001 From: vvakame Date: Fri, 25 Nov 2016 00:53:42 +0900 Subject: [PATCH 094/289] change class inheritance code --- src/compiler/transformers/es2015.ts | 2 +- ...straintsClassHeritageListMemberTypeAnnotations.js | 2 +- ...sWithInaccessibleTypeInTypeParameterConstraint.js | 2 +- .../baselines/reference/abstractClassInLocalScope.js | 2 +- .../reference/abstractClassInLocalScopeIsAbstract.js | 2 +- tests/baselines/reference/abstractProperty.js | 2 +- .../baselines/reference/abstractPropertyNegative.js | 2 +- .../reference/accessOverriddenBaseClassMember1.js | 2 +- .../accessors_spec_section-4.5_inference.js | 2 +- .../reference/aliasUsageInAccessorsOfClass.js | 2 +- tests/baselines/reference/aliasUsageInArray.js | 2 +- .../reference/aliasUsageInFunctionExpression.js | 2 +- .../reference/aliasUsageInGenericFunction.js | 2 +- .../reference/aliasUsageInIndexerOfClass.js | 2 +- .../baselines/reference/aliasUsageInObjectLiteral.js | 2 +- .../baselines/reference/aliasUsageInOrExpression.js | 2 +- .../aliasUsageInTypeArgumentOfExtendsClause.js | 4 ++-- .../baselines/reference/aliasUsageInVarAssignment.js | 2 +- .../reference/ambiguousOverloadResolution.js | 2 +- tests/baselines/reference/apparentTypeSubtyping.js | 2 +- tests/baselines/reference/apparentTypeSupertype.js | 2 +- tests/baselines/reference/arrayAssignmentTest1.js | 2 +- tests/baselines/reference/arrayAssignmentTest2.js | 2 +- tests/baselines/reference/arrayBestCommonTypes.js | 2 +- .../baselines/reference/arrayLiteralTypeInference.js | 2 +- tests/baselines/reference/arrayLiterals.js | 2 +- .../reference/arrayLiteralsWithRecursiveGenerics.js | 2 +- .../arrayOfSubtypeIsAssignableToReadonlyArray.js | 2 +- tests/baselines/reference/arrowFunctionContexts.js | 2 +- .../reference/assignmentCompatWithCallSignatures3.js | 2 +- .../reference/assignmentCompatWithCallSignatures4.js | 2 +- .../reference/assignmentCompatWithCallSignatures5.js | 2 +- .../reference/assignmentCompatWithCallSignatures6.js | 2 +- .../assignmentCompatWithConstructSignatures3.js | 2 +- .../assignmentCompatWithConstructSignatures4.js | 2 +- .../assignmentCompatWithConstructSignatures5.js | 2 +- .../assignmentCompatWithConstructSignatures6.js | 2 +- .../reference/assignmentCompatWithNumericIndexer.js | 2 +- .../reference/assignmentCompatWithNumericIndexer3.js | 2 +- .../reference/assignmentCompatWithObjectMembers4.js | 2 +- .../assignmentCompatWithObjectMembersOptionality.js | 2 +- .../assignmentCompatWithObjectMembersOptionality2.js | 2 +- .../reference/assignmentCompatWithStringIndexer.js | 2 +- tests/baselines/reference/assignmentLHSIsValue.js | 2 +- .../baselines/reference/asyncImportedPromise_es5.js | 2 +- tests/baselines/reference/autolift4.js | 2 +- tests/baselines/reference/baseCheck.js | 2 +- .../reference/baseIndexSignatureResolution.js | 2 +- tests/baselines/reference/baseTypeOrderChecking.js | 2 +- .../reference/baseTypeWrappingInstantiationChain.js | 2 +- tests/baselines/reference/bases.js | 2 +- .../bestCommonTypeOfConditionalExpressions.js | 2 +- .../bestCommonTypeOfConditionalExpressions2.js | 2 +- tests/baselines/reference/bestCommonTypeOfTuple2.js | 2 +- .../callSignatureAssignabilityInInheritance2.js | 2 +- .../callSignatureAssignabilityInInheritance3.js | 2 +- .../callSignatureAssignabilityInInheritance4.js | 2 +- .../callSignatureAssignabilityInInheritance5.js | 2 +- .../callSignatureAssignabilityInInheritance6.js | 2 +- tests/baselines/reference/callWithSpread.js | 2 +- tests/baselines/reference/captureThisInSuperCall.js | 2 +- tests/baselines/reference/castingTuple.js | 2 +- tests/baselines/reference/chainedAssignment3.js | 2 +- ...thTypeParameterConstrainedToOtherTypeParameter.js | 2 +- tests/baselines/reference/checkForObjectTooStrict.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing1.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing2.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing3.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing4.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing5.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing6.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing7.js | 2 +- .../reference/checkSuperCallBeforeThisAccessing8.js | 2 +- tests/baselines/reference/circularImportAlias.js | 2 +- .../reference/circularTypeofWithFunctionModule.js | 2 +- .../classAbstractConstructorAssignability.js | 2 +- .../baselines/reference/classAbstractCrashedOnce.js | 2 +- tests/baselines/reference/classAbstractExtends.js | 2 +- .../reference/classAbstractFactoryFunction.js | 2 +- tests/baselines/reference/classAbstractGeneric.js | 2 +- tests/baselines/reference/classAbstractInAModule.js | 2 +- .../baselines/reference/classAbstractInheritance.js | 2 +- .../reference/classAbstractInstantiations1.js | 2 +- .../reference/classAbstractInstantiations2.js | 2 +- .../reference/classAbstractOverrideWithAbstract.js | 2 +- tests/baselines/reference/classAbstractSuperCalls.js | 2 +- .../reference/classAbstractUsingAbstractMethod1.js | 2 +- .../reference/classAbstractUsingAbstractMethods2.js | 2 +- .../reference/classConstructorAccessibility2.js | 2 +- .../reference/classConstructorAccessibility4.js | 2 +- .../reference/classConstructorAccessibility5.js | 2 +- .../classConstructorParametersAccessibility.js | 2 +- .../classConstructorParametersAccessibility2.js | 2 +- .../classConstructorParametersAccessibility3.js | 2 +- ...classDeclarationMergedInModuleWithContinuation.js | 2 +- .../reference/classDeclaredBeforeClassFactory.js | 2 +- .../reference/classDoesNotDependOnBaseTypes.js | 2 +- tests/baselines/reference/classExpression2.js | 2 +- tests/baselines/reference/classExpression3.js | 2 +- .../classExpressionExtendingAbstractClass.js | 2 +- .../baselines/reference/classExtendingBuiltinType.js | 2 +- tests/baselines/reference/classExtendingClass.js | 2 +- .../reference/classExtendingClassLikeType.js | 2 +- .../reference/classExtendingNonConstructor.js | 2 +- tests/baselines/reference/classExtendingNull.js | 2 +- tests/baselines/reference/classExtendingPrimitive.js | 2 +- .../baselines/reference/classExtendingPrimitive2.js | 2 +- .../reference/classExtendingQualifiedName.js | 2 +- .../reference/classExtendingQualifiedName2.js | 2 +- tests/baselines/reference/classExtendsAcrossFiles.js | 4 ++-- ...useClassMergedWithModuleNotReferingConstructor.js | 2 +- ...classExtendsClauseClassNotReferringConstructor.js | 2 +- .../reference/classExtendsEveryObjectType.js | 2 +- .../reference/classExtendsEveryObjectType2.js | 2 +- tests/baselines/reference/classExtendsInterface.js | 2 +- .../reference/classExtendsInterfaceInExpression.js | 2 +- .../reference/classExtendsInterfaceInModule.js | 2 +- tests/baselines/reference/classExtendsItself.js | 2 +- .../reference/classExtendsItselfIndirectly.js | 2 +- .../reference/classExtendsItselfIndirectly2.js | 2 +- .../reference/classExtendsItselfIndirectly3.js | 12 ++++++------ .../reference/classExtendsMultipleBaseClasses.js | 2 +- tests/baselines/reference/classExtendsNull.js | 2 +- .../classExtendsShadowedConstructorFunction.js | 2 +- .../classExtendsValidConstructorFunction.js | 2 +- .../reference/classHeritageWithTrailingSeparator.js | 2 +- tests/baselines/reference/classImplementsClass2.js | 2 +- tests/baselines/reference/classImplementsClass3.js | 2 +- tests/baselines/reference/classImplementsClass4.js | 2 +- tests/baselines/reference/classImplementsClass5.js | 2 +- tests/baselines/reference/classImplementsClass6.js | 2 +- tests/baselines/reference/classIndexer3.js | 2 +- tests/baselines/reference/classInheritence.js | 2 +- .../baselines/reference/classIsSubtypeOfBaseType.js | 2 +- tests/baselines/reference/classOrder2.js | 2 +- tests/baselines/reference/classOrderBug.js | 2 +- tests/baselines/reference/classSideInheritance1.js | 2 +- tests/baselines/reference/classSideInheritance2.js | 2 +- tests/baselines/reference/classSideInheritance3.js | 2 +- tests/baselines/reference/classUpdateTests.js | 2 +- .../reference/classWithBaseClassButNoConstructor.js | 2 +- tests/baselines/reference/classWithConstructors.js | 2 +- .../reference/classWithProtectedProperty.js | 2 +- tests/baselines/reference/classWithStaticMembers.js | 2 +- tests/baselines/reference/classdecl.js | 2 +- tests/baselines/reference/clodulesDerivedClasses.js | 2 +- .../collisionSuperAndLocalFunctionInAccessors.js | 2 +- .../collisionSuperAndLocalFunctionInConstructor.js | 2 +- .../collisionSuperAndLocalFunctionInMethod.js | 2 +- .../collisionSuperAndLocalFunctionInProperty.js | 2 +- .../collisionSuperAndLocalVarInAccessors.js | 2 +- .../collisionSuperAndLocalVarInConstructor.js | 2 +- .../reference/collisionSuperAndLocalVarInMethod.js | 2 +- .../reference/collisionSuperAndLocalVarInProperty.js | 2 +- .../reference/collisionSuperAndNameResolution.js | 2 +- .../reference/collisionSuperAndParameter.js | 2 +- .../reference/collisionSuperAndParameter1.js | 2 +- ...isionSuperAndPropertyNameAsConstuctorParameter.js | 2 +- ...onThisExpressionAndLocalVarWithSuperExperssion.js | 2 +- tests/baselines/reference/commentsInheritance.js | 2 +- .../comparisonOperatorWithIdenticalObjects.js | 2 +- ...eratorWithNoRelationshipObjectsOnCallSignature.js | 2 +- ...ithNoRelationshipObjectsOnConstructorSignature.js | 2 +- ...ratorWithNoRelationshipObjectsOnIndexSignature.js | 2 +- ...RelationshipObjectsOnInstantiatedCallSignature.js | 2 +- ...nshipObjectsOnInstantiatedConstructorSignature.js | 2 +- ...arisonOperatorWithSubtypeObjectOnCallSignature.js | 2 +- ...peratorWithSubtypeObjectOnConstructorSignature.js | 2 +- ...risonOperatorWithSubtypeObjectOnIndexSignature.js | 2 +- ...orWithSubtypeObjectOnInstantiatedCallSignature.js | 2 +- ...ubtypeObjectOnInstantiatedConstructorSignature.js | 2 +- .../comparisonOperatorWithSubtypeObjectOnProperty.js | 2 +- .../baselines/reference/complexClassRelationships.js | 2 +- .../complicatedGenericRecursiveBaseClassReference.js | 2 +- .../reference/compoundAssignmentLHSIsValue.js | 2 +- .../compoundExponentiationAssignmentLHSIsValue.js | 2 +- .../reference/computedPropertyNames24_ES5.js | 2 +- .../reference/computedPropertyNames25_ES5.js | 2 +- .../reference/computedPropertyNames26_ES5.js | 2 +- .../reference/computedPropertyNames27_ES5.js | 2 +- .../reference/computedPropertyNames28_ES5.js | 2 +- .../reference/computedPropertyNames30_ES5.js | 2 +- .../reference/computedPropertyNames31_ES5.js | 2 +- .../reference/computedPropertyNames43_ES5.js | 2 +- .../reference/computedPropertyNames44_ES5.js | 2 +- .../reference/computedPropertyNames45_ES5.js | 2 +- .../reference/conditionalOperatorWithIdenticalBCT.js | 2 +- .../conditionalOperatorWithoutIdenticalBCT.js | 2 +- .../baselines/reference/constantOverloadFunction.js | 2 +- .../constantOverloadFunctionNoSubtypeError.js | 2 +- .../constraintCheckInGenericBaseTypeReference.js | 2 +- .../constructSignatureAssignabilityInInheritance2.js | 2 +- .../constructSignatureAssignabilityInInheritance3.js | 2 +- .../constructSignatureAssignabilityInInheritance4.js | 2 +- .../constructSignatureAssignabilityInInheritance5.js | 2 +- .../constructSignatureAssignabilityInInheritance6.js | 2 +- tests/baselines/reference/constructorArgs.js | 2 +- .../constructorFunctionTypeIsAssignableToBaseType.js | 2 +- ...constructorFunctionTypeIsAssignableToBaseType2.js | 2 +- .../reference/constructorHasPrototypeProperty.js | 2 +- tests/baselines/reference/constructorOverloads2.js | 2 +- tests/baselines/reference/constructorOverloads3.js | 2 +- .../reference/constructorWithCapturedSuper.js | 2 +- .../constructorWithIncompleteTypeAnnotation.js | 2 +- .../reference/contextualTypingArrayOfLambdas.js | 2 +- .../contextualTypingOfConditionalExpression.js | 2 +- .../contextualTypingOfConditionalExpression2.js | 2 +- ...ashInsourcePropertyIsRelatableToTargetProperty.js | 2 +- .../baselines/reference/declFileClassExtendsNull.js | 2 +- .../declFileForFunctionTypeAsTypeParameter.js | 2 +- .../declFileGenericClassWithGenericExtendedClass.js | 2 +- tests/baselines/reference/declFileGenericType.js | 2 +- tests/baselines/reference/declFileGenericType2.js | 2 +- ...ameConflictingWithClassReferredByExtendsClause.js | 2 +- ...thExtendsClauseThatHasItsContainerNameConflict.js | 2 +- .../reference/declarationEmitExpressionInExtends.js | 2 +- .../reference/declarationEmitExpressionInExtends2.js | 2 +- .../reference/declarationEmitExpressionInExtends3.js | 2 +- .../reference/declarationEmitExpressionInExtends4.js | 2 +- .../reference/declarationEmitNameConflicts3.js | 2 +- .../reference/declarationEmitProtectedMembers.js | 2 +- .../reference/declarationEmitThisPredicates01.js | 2 +- ...declarationEmitThisPredicatesWithPrivateName01.js | 2 +- tests/baselines/reference/declareDottedExtend.js | 2 +- .../reference/decoratorOnClassConstructor2.js | 2 +- .../reference/decoratorOnClassConstructor3.js | 2 +- .../baselines/reference/decoratorOnClassMethod12.js | 2 +- .../derivedClassConstructorWithExplicitReturns01.js | 2 +- ...assConstructorWithExplicitReturns01.sourcemap.txt | 2 +- .../derivedClassConstructorWithoutSuperCall.js | 2 +- ...derivedClassFunctionOverridesBaseClassAccessor.js | 2 +- .../derivedClassIncludesInheritedMembers.js | 2 +- ...ssOverridesIndexersWithAssignmentCompatibility.js | 2 +- .../derivedClassOverridesPrivateFunction1.js | 2 +- .../reference/derivedClassOverridesPrivates.js | 2 +- .../derivedClassOverridesProtectedMembers.js | 2 +- .../derivedClassOverridesProtectedMembers2.js | 2 +- .../derivedClassOverridesProtectedMembers3.js | 2 +- .../derivedClassOverridesProtectedMembers4.js | 2 +- .../reference/derivedClassOverridesPublicMembers.js | 2 +- .../reference/derivedClassOverridesWithoutSubtype.js | 2 +- .../reference/derivedClassParameterProperties.js | 2 +- .../derivedClassSuperCallsInNonConstructorMembers.js | 2 +- .../reference/derivedClassSuperCallsWithThisArg.js | 2 +- .../baselines/reference/derivedClassTransitivity.js | 2 +- .../baselines/reference/derivedClassTransitivity2.js | 2 +- .../baselines/reference/derivedClassTransitivity3.js | 2 +- .../baselines/reference/derivedClassTransitivity4.js | 2 +- tests/baselines/reference/derivedClassWithAny.js | 2 +- ...sWithPrivateInstanceShadowingProtectedInstance.js | 2 +- ...lassWithPrivateInstanceShadowingPublicInstance.js | 2 +- ...ClassWithPrivateStaticShadowingProtectedStatic.js | 2 +- ...vedClassWithPrivateStaticShadowingPublicStatic.js | 2 +- .../derivedClassWithoutExplicitConstructor.js | 2 +- .../derivedClassWithoutExplicitConstructor2.js | 2 +- .../derivedClassWithoutExplicitConstructor3.js | 2 +- tests/baselines/reference/derivedClasses.js | 2 +- .../reference/derivedGenericClassWithAny.js | 2 +- ...peAccessesHiddenBaseCallViaSuperPropertyAccess.js | 2 +- .../derivedTypeDoesNotRequireExtendsClause.js | 2 +- .../reference/destructuringParameterDeclaration5.js | 2 +- ...perCallBeforeEmitParameterPropertyDeclaration1.js | 2 +- .../emitSuperCallBeforeEmitPropertyDeclaration1.js | 2 +- ...rtyDeclarationAndParameterPropertyDeclaration1.js | 2 +- .../baselines/reference/emitThisInSuperMethodCall.js | 2 +- tests/baselines/reference/emptyModuleName.js | 2 +- .../errorForwardReferenceForwadingConstructor.js | 2 +- tests/baselines/reference/errorSuperCalls.js | 2 +- .../baselines/reference/errorSuperPropertyAccess.js | 2 +- .../reference/errorsInGenericTypeReference.js | 2 +- tests/baselines/reference/es6ClassSuperCodegenBug.js | 2 +- tests/baselines/reference/es6ClassTest.js | 2 +- tests/baselines/reference/es6ClassTest2.js | 2 +- tests/baselines/reference/es6ClassTest7.js | 2 +- .../reference/exportAssignmentOfGenericType1.js | 2 +- .../reference/exportDeclarationInInternalModule.js | 2 +- tests/baselines/reference/extBaseClass1.js | 2 +- tests/baselines/reference/extBaseClass2.js | 2 +- .../reference/extendAndImplementTheSameBaseType.js | 2 +- .../reference/extendAndImplementTheSameBaseType2.js | 2 +- .../reference/extendBaseClassBeforeItsDeclared.js | 2 +- .../reference/extendClassExpressionFromModule.js | 2 +- .../reference/extendConstructSignatureInInterface.js | 2 +- tests/baselines/reference/extendNonClassSymbol1.js | 2 +- tests/baselines/reference/extendNonClassSymbol2.js | 2 +- .../reference/extendPrivateConstructorClass.js | 2 +- .../extendingClassFromAliasAndUsageInIndexer.js | 4 ++-- .../baselines/reference/extendsClauseAlreadySeen.js | 2 +- .../baselines/reference/extendsClauseAlreadySeen2.js | 2 +- tests/baselines/reference/fluentClasses.js | 2 +- tests/baselines/reference/for-inStatements.js | 2 +- tests/baselines/reference/for-inStatementsInvalid.js | 2 +- .../reference/forStatementsMultipleInvalidDecl.js | 2 +- .../reference/functionImplementationErrors.js | 2 +- tests/baselines/reference/functionImplementations.js | 2 +- .../reference/functionSubtypingOfVarArgs.js | 2 +- .../reference/functionSubtypingOfVarArgs2.js | 2 +- .../baselines/reference/generatedContextualTyping.js | 2 +- .../reference/genericBaseClassLiteralProperty.js | 2 +- .../reference/genericBaseClassLiteralProperty2.js | 2 +- ...enericCallWithConstraintsTypeArgumentInference.js | 2 +- .../reference/genericCallWithObjectTypeArgs2.js | 2 +- .../genericCallWithObjectTypeArgsAndConstraints2.js | 2 +- .../genericCallWithObjectTypeArgsAndConstraints3.js | 2 +- .../reference/genericCallbacksAndClassHierarchy.js | 2 +- .../reference/genericClassExpressionInFunction.js | 2 +- ...ricClassInheritsConstructorFromNonGenericClass.js | 2 +- .../genericClassPropertyInheritanceSpecialization.js | 2 +- .../baselines/reference/genericClassStaticMethod.js | 2 +- tests/baselines/reference/genericClasses3.js | 2 +- .../genericConstraintOnExtendedBuiltinTypes.js | 2 +- .../genericConstraintOnExtendedBuiltinTypes2.js | 2 +- .../genericDerivedTypeWithSpecializedBase.js | 2 +- .../genericDerivedTypeWithSpecializedBase2.js | 2 +- .../reference/genericInheritedDefaultConstructors.js | 2 +- .../baselines/reference/genericPrototypeProperty2.js | 2 +- .../baselines/reference/genericPrototypeProperty3.js | 2 +- .../genericRecursiveImplicitConstructorErrors2.js | 2 +- .../genericRecursiveImplicitConstructorErrors3.js | 2 +- tests/baselines/reference/genericTypeAssertions2.js | 2 +- tests/baselines/reference/genericTypeAssertions4.js | 2 +- tests/baselines/reference/genericTypeAssertions6.js | 2 +- tests/baselines/reference/genericTypeConstraints.js | 2 +- .../genericTypeReferenceWithoutTypeArgument.js | 2 +- .../genericTypeReferenceWithoutTypeArgument2.js | 2 +- .../genericWithIndexerOfTypeParameterType2.js | 2 +- .../reference/heterogeneousArrayLiterals.js | 2 +- tests/baselines/reference/ifDoWhileStatements.js | 2 +- .../reference/illegalSuperCallsInConstructor.js | 2 +- .../reference/implementClausePrecedingExtends.js | 2 +- ...ementingAnInterfaceExtendingClassWithPrivates2.js | 2 +- ...mentingAnInterfaceExtendingClassWithProtecteds.js | 2 +- tests/baselines/reference/importAsBaseClass.js | 2 +- tests/baselines/reference/importHelpers.js | 2 +- tests/baselines/reference/importHelpersNoHelpers.js | 2 +- tests/baselines/reference/importHelpersNoModule.js | 2 +- tests/baselines/reference/importShadowsGlobalName.js | 2 +- .../baselines/reference/importUsedInExtendsList1.js | 2 +- tests/baselines/reference/indexerConstraints2.js | 2 +- tests/baselines/reference/indirectSelfReference.js | 2 +- .../reference/indirectSelfReferenceGeneric.js | 2 +- .../infinitelyExpandingTypesNonGenericBase.js | 2 +- .../reference/inheritFromGenericTypeParameter.js | 2 +- ...inheritSameNamePrivatePropertiesFromSameOrigin.js | 2 +- tests/baselines/reference/inheritance.js | 2 +- tests/baselines/reference/inheritance1.js | 2 +- .../inheritanceGrandParentPrivateMemberCollision.js | 2 +- ...ndParentPrivateMemberCollisionWithPublicMember.js | 2 +- ...ndParentPublicMemberCollisionWithPrivateMember.js | 2 +- .../inheritanceMemberAccessorOverridingAccessor.js | 2 +- .../inheritanceMemberAccessorOverridingMethod.js | 2 +- .../inheritanceMemberAccessorOverridingProperty.js | 2 +- .../inheritanceMemberFuncOverridingAccessor.js | 2 +- .../inheritanceMemberFuncOverridingMethod.js | 2 +- .../inheritanceMemberFuncOverridingProperty.js | 2 +- .../inheritanceMemberPropertyOverridingAccessor.js | 2 +- .../inheritanceMemberPropertyOverridingMethod.js | 2 +- .../inheritanceMemberPropertyOverridingProperty.js | 2 +- .../inheritanceOfGenericConstructorMethod1.js | 2 +- .../inheritanceOfGenericConstructorMethod2.js | 2 +- .../inheritanceStaticAccessorOverridingAccessor.js | 2 +- .../inheritanceStaticAccessorOverridingMethod.js | 2 +- .../inheritanceStaticAccessorOverridingProperty.js | 2 +- .../inheritanceStaticFuncOverridingAccessor.js | 2 +- ...eritanceStaticFuncOverridingAccessorOfFuncType.js | 2 +- .../inheritanceStaticFuncOverridingMethod.js | 2 +- .../inheritanceStaticFuncOverridingProperty.js | 2 +- ...eritanceStaticFuncOverridingPropertyOfFuncType.js | 2 +- ...itanceStaticFunctionOverridingInstanceProperty.js | 2 +- .../reference/inheritanceStaticMembersCompatible.js | 2 +- .../inheritanceStaticMembersIncompatible.js | 2 +- .../inheritanceStaticPropertyOverridingAccessor.js | 2 +- .../inheritanceStaticPropertyOverridingMethod.js | 2 +- .../inheritanceStaticPropertyOverridingProperty.js | 2 +- .../reference/inheritedConstructorWithRestParams.js | 2 +- .../reference/inheritedConstructorWithRestParams2.js | 2 +- .../reference/inheritedModuleMembersForClodule.js | 2 +- tests/baselines/reference/instanceOfAssignability.js | 2 +- .../instancePropertiesInheritedIntoClassType.js | 2 +- tests/baselines/reference/instanceSubtypeCheck2.js | 2 +- .../instanceofWithStructurallyIdenticalTypes.js | 2 +- .../instantiatedReturnTypeContravariance.js | 2 +- tests/baselines/reference/interfaceClassMerging.js | 2 +- tests/baselines/reference/interfaceClassMerging2.js | 2 +- tests/baselines/reference/interfaceExtendsClass1.js | 2 +- .../reference/interfaceExtendsClassWithPrivate1.js | 2 +- .../reference/interfaceExtendsClassWithPrivate2.js | 2 +- .../baselines/reference/interfaceImplementation8.js | 2 +- .../invalidModuleWithStatementsOfEveryKind.js | 2 +- .../reference/invalidMultipleVariableDeclarations.js | 2 +- tests/baselines/reference/invalidReturnStatements.js | 2 +- .../reference/isolatedModulesImportExportElision.js | 2 +- tests/baselines/reference/jsxViaImport.js | 2 +- tests/baselines/reference/keyofAndIndexedAccess.js | 2 +- tests/baselines/reference/lambdaArgCrash.js | 2 +- tests/baselines/reference/lift.js | 2 +- tests/baselines/reference/localTypes1.js | 2 +- tests/baselines/reference/m7Bugs.js | 2 +- tests/baselines/reference/mergedDeclarations5.js | 2 +- tests/baselines/reference/mergedDeclarations6.js | 2 +- .../reference/mergedInheritedClassInterface.js | 2 +- .../mergedInterfacesWithInheritedPrivates2.js | 2 +- .../mergedInterfacesWithInheritedPrivates3.js | 2 +- .../reference/missingPropertiesOfClassExpression.js | 2 +- tests/baselines/reference/moduleAsBaseType.js | 2 +- .../moduleImportedForTypeArgumentPosition.js | 2 +- .../reference/moduleWithStatementsOfEveryKind.js | 2 +- tests/baselines/reference/multipleInheritance.js | 2 +- .../reference/mutuallyRecursiveGenericBaseTypes2.js | 2 +- .../reference/noImplicitAnyMissingGetAccessor.js | 2 +- .../reference/noImplicitAnyMissingSetAccessor.js | 2 +- .../nonGenericClassExtendingGenericClassWithAny.js | 2 +- .../numericIndexerConstrainsPropertyDeclarations2.js | 2 +- .../baselines/reference/numericIndexerConstraint3.js | 2 +- .../baselines/reference/numericIndexerConstraint4.js | 2 +- tests/baselines/reference/numericIndexerTyping2.js | 2 +- .../objectCreationOfElementAccessExpression.js | 2 +- .../objectTypeHidingMembersOfExtendedObject.js | 2 +- .../objectTypesIdentityWithNumericIndexers1.js | 2 +- .../objectTypesIdentityWithNumericIndexers2.js | 2 +- .../objectTypesIdentityWithNumericIndexers3.js | 2 +- .../reference/objectTypesIdentityWithPrivates.js | 2 +- .../reference/objectTypesIdentityWithPrivates2.js | 2 +- .../reference/objectTypesIdentityWithPrivates3.js | 2 +- .../objectTypesIdentityWithStringIndexers.js | 2 +- .../objectTypesIdentityWithStringIndexers2.js | 2 +- .../reference/optionalConstructorArgInSuper.js | 2 +- tests/baselines/reference/optionalMethods.js | 2 +- tests/baselines/reference/optionalParamArgsTest.js | 2 +- tests/baselines/reference/optionalParamInOverride.js | 2 +- .../baselines/reference/optionalParameterProperty.js | 2 +- tests/baselines/reference/outModuleConcatAmd.js | 2 +- .../reference/outModuleConcatAmd.sourcemap.txt | 2 +- tests/baselines/reference/outModuleConcatSystem.js | 2 +- .../reference/outModuleConcatSystem.sourcemap.txt | 2 +- .../baselines/reference/outModuleTripleSlashRefs.js | 2 +- .../reference/outModuleTripleSlashRefs.sourcemap.txt | 2 +- tests/baselines/reference/overload1.js | 2 +- .../reference/overloadOnConstConstraintChecks1.js | 2 +- .../reference/overloadOnConstConstraintChecks2.js | 2 +- .../reference/overloadOnConstConstraintChecks3.js | 2 +- .../reference/overloadOnConstConstraintChecks4.js | 2 +- .../reference/overloadOnConstantsInvalidOverload1.js | 2 +- tests/baselines/reference/overloadResolution.js | 2 +- .../reference/overloadResolutionClassConstructors.js | 2 +- .../reference/overloadResolutionConstructors.js | 2 +- tests/baselines/reference/overloadingOnConstants1.js | 2 +- tests/baselines/reference/overloadingOnConstants2.js | 2 +- .../reference/overridingPrivateStaticMembers.js | 2 +- .../reference/parseErrorInHeritageClause1.js | 2 +- tests/baselines/reference/parser509630.js | 2 +- tests/baselines/reference/parserAstSpans1.js | 2 +- tests/baselines/reference/parserClassDeclaration1.js | 2 +- tests/baselines/reference/parserClassDeclaration3.js | 2 +- tests/baselines/reference/parserClassDeclaration4.js | 2 +- tests/baselines/reference/parserClassDeclaration5.js | 2 +- tests/baselines/reference/parserClassDeclaration6.js | 2 +- ...parserErrorRecovery_ExtendsOrImplementsClause2.js | 2 +- ...parserErrorRecovery_ExtendsOrImplementsClause4.js | 2 +- ...parserErrorRecovery_ExtendsOrImplementsClause5.js | 2 +- .../reference/parserGenericsInTypeContexts1.js | 2 +- .../reference/parserGenericsInTypeContexts2.js | 2 +- tests/baselines/reference/parserRealSource10.js | 2 +- tests/baselines/reference/parserRealSource11.js | 2 +- tests/baselines/reference/parserharness.js | 2 +- .../partiallyAnnotatedFunctionInferenceError.js | 2 +- ...llyAnnotatedFunctionInferenceWithTypeParameter.js | 2 +- tests/baselines/reference/primitiveMembers.js | 2 +- tests/baselines/reference/privacyClass.js | 2 +- .../reference/privacyClassExtendsClauseDeclFile.js | 4 ++-- tests/baselines/reference/privacyGloClass.js | 2 +- .../baselines/reference/privateAccessInSubclass1.js | 2 +- .../reference/privateInstanceMemberAccessibility.js | 2 +- ...eProtectedMembersAreNotAccessibleDestructuring.js | 2 +- .../reference/privateStaticMemberAccessibility.js | 2 +- .../privateStaticNotAccessibleInClodule2.js | 2 +- .../amd/testGlo.js | 2 +- .../node/testGlo.js | 2 +- .../reference/project/prologueEmit/amd/out.js | 2 +- .../reference/project/prologueEmit/node/out.js | 2 +- .../quotesInFileAndDirectoryNames/amd/m'ain.js | 2 +- .../quotesInFileAndDirectoryNames/node/m'ain.js | 2 +- tests/baselines/reference/propertiesAndIndexers.js | 2 +- tests/baselines/reference/propertyAccess.js | 2 +- .../propertyAccessOnTypeParameterWithConstraints2.js | 2 +- .../propertyAccessOnTypeParameterWithConstraints3.js | 2 +- .../propertyAccessOnTypeParameterWithConstraints5.js | 2 +- ...tedClassPropertyAccessibleWithinNestedSubclass.js | 2 +- ...edClassPropertyAccessibleWithinNestedSubclass1.js | 2 +- ...protectedClassPropertyAccessibleWithinSubclass.js | 2 +- ...rotectedClassPropertyAccessibleWithinSubclass2.js | 2 +- ...rotectedClassPropertyAccessibleWithinSubclass3.js | 2 +- .../protectedInstanceMemberAccessibility.js | 2 +- tests/baselines/reference/protectedMembers.js | 2 +- ...tedStaticClassPropertyAccessibleWithinSubclass.js | 2 +- ...edStaticClassPropertyAccessibleWithinSubclass2.js | 2 +- ...name-resolution-does-not-affect-class-heritage.js | 2 +- .../reference/readonlyConstructorAssignment.js | 2 +- tests/baselines/reference/recursiveBaseCheck3.js | 2 +- tests/baselines/reference/recursiveBaseCheck4.js | 2 +- tests/baselines/reference/recursiveBaseCheck6.js | 2 +- .../reference/recursiveBaseConstructorCreation1.js | 2 +- ...siveClassInstantiationsWithDefaultConstructors.js | 2 +- .../reference/recursiveClassReferenceTest.js | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 2 +- .../reference/recursiveComplicatedClasses.js | 2 +- .../recursivelySpecializedConstructorDeclaration.js | 2 +- tests/baselines/reference/reexportClassDefinition.js | 2 +- ...olvingClassDeclarationWhenInBaseTypeResolution.js | 2 +- tests/baselines/reference/returnInConstructor1.js | 2 +- tests/baselines/reference/returnStatements.js | 2 +- .../scopeCheckExtendedClassInsidePublicMethod2.js | 2 +- .../scopeCheckExtendedClassInsideStaticMethod1.js | 2 +- tests/baselines/reference/scopeTests.js | 2 +- tests/baselines/reference/shadowPrivateMembers.js | 2 +- ...ionClassWithDefaultConstructorAndExtendsClause.js | 2 +- ...hDefaultConstructorAndExtendsClause.sourcemap.txt | 2 +- .../reference/specializedInheritedConstructors1.js | 2 +- .../specializedOverloadWithRestParameters.js | 2 +- tests/baselines/reference/staticFactory1.js | 2 +- tests/baselines/reference/staticInheritance.js | 2 +- .../reference/staticMemberAccessOffDerivedType1.js | 2 +- tests/baselines/reference/staticPropSuper.js | 2 +- tests/baselines/reference/strictModeInConstructor.js | 2 +- tests/baselines/reference/strictModeReservedWord.js | 2 +- .../strictModeReservedWordInClassDeclaration.js | 2 +- .../stringIndexerConstrainsPropertyDeclarations2.js | 2 +- tests/baselines/reference/subtypesOfTypeParameter.js | 2 +- .../subtypesOfTypeParameterWithConstraints.js | 2 +- .../subtypesOfTypeParameterWithConstraints4.js | 2 +- ...ubtypesOfTypeParameterWithRecursiveConstraints.js | 2 +- tests/baselines/reference/subtypingTransitivity.js | 2 +- .../reference/subtypingWithCallSignatures2.js | 2 +- .../reference/subtypingWithCallSignatures3.js | 2 +- .../reference/subtypingWithCallSignatures4.js | 2 +- .../reference/subtypingWithConstructSignatures2.js | 2 +- .../reference/subtypingWithConstructSignatures3.js | 2 +- .../reference/subtypingWithConstructSignatures4.js | 2 +- .../reference/subtypingWithConstructSignatures5.js | 2 +- .../reference/subtypingWithConstructSignatures6.js | 2 +- .../reference/subtypingWithNumericIndexer.js | 2 +- .../reference/subtypingWithNumericIndexer3.js | 2 +- .../reference/subtypingWithNumericIndexer4.js | 2 +- .../reference/subtypingWithObjectMembers.js | 2 +- .../reference/subtypingWithObjectMembers4.js | 2 +- .../subtypingWithObjectMembersAccessibility.js | 2 +- .../subtypingWithObjectMembersAccessibility2.js | 2 +- .../reference/subtypingWithStringIndexer.js | 2 +- .../reference/subtypingWithStringIndexer3.js | 2 +- .../reference/subtypingWithStringIndexer4.js | 2 +- tests/baselines/reference/super.js | 2 +- tests/baselines/reference/super1.js | 2 +- tests/baselines/reference/super2.js | 2 +- tests/baselines/reference/superAccess.js | 2 +- tests/baselines/reference/superAccess2.js | 2 +- tests/baselines/reference/superAccessInFatArrow1.js | 2 +- tests/baselines/reference/superCallArgsMustMatch.js | 2 +- tests/baselines/reference/superCallAssignResult.js | 2 +- .../reference/superCallBeforeThisAccessing1.js | 2 +- .../reference/superCallBeforeThisAccessing2.js | 2 +- .../reference/superCallBeforeThisAccessing3.js | 2 +- .../reference/superCallBeforeThisAccessing4.js | 2 +- .../reference/superCallBeforeThisAccessing5.js | 2 +- .../reference/superCallBeforeThisAccessing6.js | 2 +- .../reference/superCallBeforeThisAccessing7.js | 2 +- .../reference/superCallBeforeThisAccessing8.js | 2 +- .../superCallFromClassThatDerivesFromGenericType1.js | 2 +- .../superCallFromClassThatDerivesFromGenericType2.js | 2 +- ...ericTypeButWithIncorrectNumberOfTypeArguments1.js | 2 +- ...tDerivesFromGenericTypeButWithNoTypeArguments1.js | 2 +- ...ThatDerivesNonGenericTypeButWithTypeArguments1.js | 2 +- .../reference/superCallInNonStaticMethod.js | 2 +- tests/baselines/reference/superCallInStaticMethod.js | 2 +- .../reference/superCallInsideClassDeclaration.js | 2 +- .../reference/superCallInsideClassExpression.js | 2 +- .../superCallInsideObjectLiteralExpression.js | 2 +- .../reference/superCallOutsideConstructor.js | 2 +- .../reference/superCallParameterContextualTyping1.js | 2 +- .../reference/superCallParameterContextualTyping2.js | 2 +- .../reference/superCallParameterContextualTyping3.js | 2 +- .../reference/superCallWithCommentEmit01.js | 2 +- .../reference/superCallWithMissingBaseClass.js | 2 +- tests/baselines/reference/superCalls.js | 2 +- tests/baselines/reference/superCallsInConstructor.js | 2 +- tests/baselines/reference/superErrors.js | 2 +- tests/baselines/reference/superInCatchBlock1.js | 2 +- .../baselines/reference/superInConstructorParam1.js | 2 +- tests/baselines/reference/superInLambdas.js | 2 +- .../baselines/reference/superInObjectLiterals_ES5.js | 2 +- tests/baselines/reference/superNewCall1.js | 2 +- tests/baselines/reference/superPropertyAccess.js | 2 +- tests/baselines/reference/superPropertyAccess1.js | 2 +- tests/baselines/reference/superPropertyAccess2.js | 2 +- ...ertyAccessInComputedPropertiesOfNestedType_ES5.js | 2 +- .../reference/superPropertyAccessNoError.js | 2 +- tests/baselines/reference/superPropertyAccess_ES5.js | 2 +- .../baselines/reference/superSymbolIndexedAccess5.js | 2 +- .../baselines/reference/superSymbolIndexedAccess6.js | 2 +- .../reference/superWithGenericSpecialization.js | 2 +- tests/baselines/reference/superWithGenerics.js | 2 +- tests/baselines/reference/superWithTypeArgument.js | 2 +- tests/baselines/reference/superWithTypeArgument2.js | 2 +- tests/baselines/reference/superWithTypeArgument3.js | 2 +- ...uper_inside-object-literal-getters-and-setters.js | 2 +- tests/baselines/reference/switchStatements.js | 2 +- .../reference/systemModuleWithSuperClass.js | 2 +- tests/baselines/reference/targetTypeBaseCalls.js | 2 +- tests/baselines/reference/thisInInvalidContexts.js | 2 +- .../reference/thisInInvalidContextsExternalModule.js | 2 +- tests/baselines/reference/thisInSuperCall.js | 2 +- tests/baselines/reference/thisInSuperCall1.js | 2 +- tests/baselines/reference/thisInSuperCall2.js | 2 +- tests/baselines/reference/thisInSuperCall3.js | 2 +- tests/baselines/reference/thisTypeInFunctions.js | 2 +- .../reference/thisTypeInFunctionsNegative.js | 2 +- .../tsxCorrectlyParseLessThanComparison1.js | 2 +- tests/baselines/reference/tsxDynamicTagName5.js | 2 +- tests/baselines/reference/tsxDynamicTagName7.js | 2 +- tests/baselines/reference/tsxDynamicTagName8.js | 2 +- tests/baselines/reference/tsxDynamicTagName9.js | 2 +- tests/baselines/reference/tsxExternalModuleEmit1.js | 4 ++-- .../reference/tsxStatelessFunctionComponents2.js | 2 +- tests/baselines/reference/tsxUnionTypeComponent1.js | 2 +- tests/baselines/reference/typeAssertions.js | 2 +- tests/baselines/reference/typeGuardFunction.js | 2 +- tests/baselines/reference/typeGuardFunctionErrors.js | 2 +- .../baselines/reference/typeGuardFunctionGenerics.js | 2 +- .../reference/typeGuardFunctionOfFormThis.js | 2 +- .../reference/typeGuardFunctionOfFormThisErrors.js | 2 +- .../baselines/reference/typeGuardOfFormInstanceOf.js | 2 +- tests/baselines/reference/typeGuardOfFormIsType.js | 2 +- .../baselines/reference/typeGuardOfFormThisMember.js | 2 +- .../reference/typeGuardOfFormThisMemberErrors.js | 2 +- tests/baselines/reference/typeMatch2.js | 2 +- tests/baselines/reference/typeOfSuperCall.js | 2 +- .../baselines/reference/typeParameterAsBaseClass.js | 2 +- tests/baselines/reference/typeParameterAsBaseType.js | 2 +- .../reference/typeParameterExtendingUnion1.js | 2 +- .../reference/typeParameterExtendingUnion2.js | 2 +- tests/baselines/reference/typeRelationships.js | 2 +- tests/baselines/reference/typeValueConflict1.js | 2 +- tests/baselines/reference/typeValueConflict2.js | 2 +- tests/baselines/reference/typeofClass2.js | 2 +- .../reference/typesWithSpecializedCallSignatures.js | 2 +- .../typesWithSpecializedConstructSignatures.js | 2 +- tests/baselines/reference/undeclaredBase.js | 2 +- .../reference/undefinedIsSubtypeOfEverything.js | 2 +- tests/baselines/reference/underscoreMapFirst.js | 2 +- .../reference/underscoreThisInDerivedClass01.js | 2 +- .../reference/underscoreThisInDerivedClass02.js | 2 +- tests/baselines/reference/unionTypeEquivalence.js | 2 +- .../baselines/reference/unionTypeFromArrayLiteral.js | 2 +- tests/baselines/reference/unionTypesAssignability.js | 2 +- tests/baselines/reference/unknownSymbols1.js | 2 +- .../baselines/reference/unspecializedConstraints.js | 2 +- .../untypedFunctionCallsWithTypeParameters1.js | 2 +- .../baselines/reference/unusedClassesinNamespace4.js | 2 +- .../reference/unusedIdentifiersConsolidated1.js | 2 +- tests/baselines/reference/validUseOfThisInSuper.js | 2 +- .../baselines/reference/varArgsOnConstructorTypes.js | 2 +- 660 files changed, 670 insertions(+), 670 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index bc9341a4b4f..5dc78701316 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3338,7 +3338,7 @@ namespace ts { priority: 0, text: ` var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };` diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index ec0ed5494a4..b15cd7f6eb7 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -22,7 +22,7 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index bae9593fb98..955adc72817 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -26,7 +26,7 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index db5144be399..b413326e26a 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -9,7 +9,7 @@ //// [abstractClassInLocalScope.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 1b3e11cfa32..f143171b54c 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -9,7 +9,7 @@ //// [abstractClassInLocalScopeIsAbstract.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index fb7deaa09dd..12735de42cb 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -23,7 +23,7 @@ class C extends B { //// [abstractProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index bebf9026a0e..eaad20d1804 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -45,7 +45,7 @@ abstract class AbstractAccessorMismatch { //// [abstractPropertyNegative.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 02d092dfd39..2d06be8df96 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -17,7 +17,7 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index dbaeec1f688..eddb75c2666 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -26,7 +26,7 @@ class LanguageSpec_section_4_5_inference { //// [accessors_spec_section-4.5_inference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 8b60ed8e76d..817e589d995 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -38,7 +38,7 @@ exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index bf573aa9abb..e0d30fb608b 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -32,7 +32,7 @@ exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 49bdd493aac..35bf66fed02 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -31,7 +31,7 @@ exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index dc3a8a88bab..373aa0c3b40 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -35,7 +35,7 @@ exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index cb7ad3027ca..9769a4b005f 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -37,7 +37,7 @@ exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index 81e3e621e85..2f4abf75161 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -32,7 +32,7 @@ exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 4faa41dd034..c4902a1b894 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -35,7 +35,7 @@ exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 2cf4aefab6c..c79f820b106 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -35,7 +35,7 @@ exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -51,7 +51,7 @@ exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 80bb2dca20e..87c41811d4a 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -31,7 +31,7 @@ exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 01002792921..9b141141862 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -10,7 +10,7 @@ var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 6ca9d343a72..dc30b51a448 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -25,7 +25,7 @@ class Derived2 extends Base2 { // error because of the prototy // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index c6d3378872e..bb002a9798d 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -15,7 +15,7 @@ class Derived extends Base { // error // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index a887203cd5e..410fb80b323 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -87,7 +87,7 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index d82dedff29d..e051b8187cf 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -61,7 +61,7 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index b7ddaa5d6da..acaa6c76ffc 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -109,7 +109,7 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 919d3a5e922..d836e0afe1d 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -53,7 +53,7 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 530cdedec73..5e57d827c72 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -39,7 +39,7 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index c0f320ac1e5..5b8237c2556 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -27,7 +27,7 @@ var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index d1d75e8041c..6fecfadd07b 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -21,7 +21,7 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 64727398f72..7075cdc0a58 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -98,7 +98,7 @@ var asserted2: any; //// [arrowFunctionContexts.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index c5a1f415437..d4761781bd3 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -102,7 +102,7 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 58faf663ea8..1a3d939ba23 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -101,7 +101,7 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 87506cad08f..8d33f3565bf 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -68,7 +68,7 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 2c05d5960b2..5949ad582fa 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -45,7 +45,7 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 76ad53e4e05..97da2c58848 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -102,7 +102,7 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index f516df153c6..44e9c8e8a36 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -101,7 +101,7 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index ef7de7f011b..a80ece9d4d5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -68,7 +68,7 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index 3d58ae707a5..ea5c5c61e3b 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -45,7 +45,7 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 37160506683..f5ec41091e0 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -46,7 +46,7 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 2e6ecd72741..c6e262c4446 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -43,7 +43,7 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 2cc2510c8da..b7ff16e11fc 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -94,7 +94,7 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 3b12701b3d9..b5148d063a7 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -91,7 +91,7 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index f965d18e2ce..4b22c469791 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -93,7 +93,7 @@ module SourceHasOptional { // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index 8d081c90794..b319af595cd 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -56,7 +56,7 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 155fa26fa81..add2c59e15f 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -72,7 +72,7 @@ foo() = value; //// [assignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index e5c28eb2dc1..f13b4f962c7 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -12,7 +12,7 @@ class Test { //// [task.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 1c29bfeeff7..5d27475ba42 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -25,7 +25,7 @@ class Point3D extends Point { //// [autolift4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 870f811c09f..80271d13e83 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -31,7 +31,7 @@ function f() { //// [baseCheck.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 7e922cf83b2..bd6dd5a40e8 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -26,7 +26,7 @@ var z: Derived = b.foo(); //// [baseIndexSignatureResolution.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index ec96b80a999..1c87fb1dd5d 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -38,7 +38,7 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index 5f8dcbd0e10..cc6c091b6c7 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -29,7 +29,7 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 6b73eb9556b..f23750c4391 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -22,7 +22,7 @@ new C().y; //// [bases.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index 6d0f19dd37d..755c3f4ab84 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -30,7 +30,7 @@ function foo5(t: T, u: U): Object { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 2e2d0bcb1e2..796706dd248 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -28,7 +28,7 @@ function foo3(t: T, u: U) { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 928909f4c38..1bd3ac45bcc 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -24,7 +24,7 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 0ae7648c7f9..3c581096d6b 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -72,7 +72,7 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 7a7791280ad..909a9bbb8cb 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -117,7 +117,7 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 19d66ce8d46..d42769a1e67 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -52,7 +52,7 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 1c53de5d26e..94f5fecd2f8 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -52,7 +52,7 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index c42e36389ca..b73ed7070d8 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -55,7 +55,7 @@ interface I9 extends A { // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 69f7e4e30b0..2bce24e4637 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -60,7 +60,7 @@ class D extends C { //// [callWithSpread.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 2c4df5db961..1a1d5562531 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -10,7 +10,7 @@ class B extends A { //// [captureThisInSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index f0178dcbbf0..331a61a6f78 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -34,7 +34,7 @@ t4[2] = 10; //// [castingTuple.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 3857867043c..3bfe61f2664 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -24,7 +24,7 @@ a = b = new A(); //// [chainedAssignment3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 26d341e1f6a..59a4b8b12ce 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -21,7 +21,7 @@ class C extends B { //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index ade99e9319b..80f12196d0d 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -33,7 +33,7 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index 8ced6fce500..006bdbf356f 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -12,7 +12,7 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 95b34f27b68..5c35d42ca4f 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -12,7 +12,7 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 0e882f71fdb..16b8181ac5d 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -17,7 +17,7 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 00f2ed22fbf..9ac1fdaaa21 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -21,7 +21,7 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index 4cce975d6d9..6f8d7589163 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -9,7 +9,7 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 782e3236271..415bbb06501 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -12,7 +12,7 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index ca12c16e047..39eea670c57 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -11,7 +11,7 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index 5dd3708a3bb..ff1801d1f93 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -12,7 +12,7 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 6fe5e604e57..49e1124b467 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -22,7 +22,7 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index 1c38b9625e3..aa2987725bd 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -15,7 +15,7 @@ namespace maker { //// [circularTypeofWithFunctionModule.js] // Repro from #6072 var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 35d9e75884f..20f3de041be 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -16,7 +16,7 @@ new CC; //// [classAbstractConstructorAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index fe23e60c94f..2037dbbc64f 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -12,7 +12,7 @@ var x = new bar(); //// [classAbstractCrashedOnce.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index e899cb82d6d..d7e9a04d189 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -18,7 +18,7 @@ class E extends B { //// [classAbstractExtends.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index 50e232a9fca..71850654425 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -19,7 +19,7 @@ NewB(B); //// [classAbstractFactoryFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index 96df8f5f19e..e5f5598c14c 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -27,7 +27,7 @@ class G extends A { //// [classAbstractGeneric.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index c6a9e206bcc..5ff60d21ca9 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -9,7 +9,7 @@ new M.B; //// [classAbstractInAModule.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index 297a80dd99c..90d8216647a 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -23,7 +23,7 @@ abstract class GG extends CC {} //// [classAbstractInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 5abbb9c1baa..4c6ed144e0b 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -29,7 +29,7 @@ c = new B; // Calling new with (non)abstract classes. // var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index dea4c744ae0..e5b678ee715 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -53,7 +53,7 @@ class H { // error -- not declared abstract //// [classAbstractInstantiations2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index 4ecebdf7b32..0cf9c039b35 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -25,7 +25,7 @@ class DD extends BB { //// [classAbstractOverrideWithAbstract.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index 0197f48a429..30c33822be9 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -29,7 +29,7 @@ abstract class BB extends AA { //// [classAbstractSuperCalls.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 74b5d62aaf5..5aa616dcb7c 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -19,7 +19,7 @@ a.foo(); //// [classAbstractUsingAbstractMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 25cf1a307c7..56aa3937772 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -29,7 +29,7 @@ class DD extends AA { //// [classAbstractUsingAbstractMethods2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index ef637611e8d..eeff60323b7 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -48,7 +48,7 @@ var dc = new DerivedC(1); //// [classConstructorAccessibility2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 4772ac68d11..199383b6a71 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -32,7 +32,7 @@ class D { //// [classConstructorAccessibility4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index d658349c2a5..cb01b233781 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -13,7 +13,7 @@ class Unrelated { //// [classConstructorAccessibility5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index e0e75bcfeeb..4b086a854a1 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -28,7 +28,7 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 84da66c3e3c..244b56dddc0 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -28,7 +28,7 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index db9f94cf0fb..ef3e6d5b4bd 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -15,7 +15,7 @@ d.p; // public, OK //// [classConstructorParametersAccessibility3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index 5a5440a92b5..1fa51632ba7 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -13,7 +13,7 @@ module M { //// [classDeclarationMergedInModuleWithContinuation.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index 3dd1e7a4aaf..c30c913a010 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -9,7 +9,7 @@ function makeBaseClass() { //// [classDeclaredBeforeClassFactory.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index 076412e164d..e195506c294 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -14,7 +14,7 @@ class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 59b62c60cfe..7e78007badc 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -4,7 +4,7 @@ var v = class C extends D {}; //// [classExpression2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index c0376c54c27..9c29f35cd19 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -8,7 +8,7 @@ c.c; //// [classExpression3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index 7312ab6567d..3031f69117a 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -10,7 +10,7 @@ var C = class extends A { // no error reported! //// [classExpressionExtendingAbstractClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index 4c95e3008ea..c0988a01296 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -13,7 +13,7 @@ class C10 extends Array { } //// [classExtendingBuiltinType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index 91e3752980c..5b5a1386322 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -33,7 +33,7 @@ var r8 = D2.other(1); //// [classExtendingClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index bfc10c23563..1d16866904e 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -60,7 +60,7 @@ class D5 extends getBadBase() { //// [classExtendingClassLikeType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index 574d5004486..74070c3bc0c 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -16,7 +16,7 @@ class C7 extends foo { } //// [classExtendingNonConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 8d5d73329aa..3a227b564e9 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -5,7 +5,7 @@ class C2 extends (null) { } //// [classExtendingNull.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 53cb45c2081..04fd2d57e52 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -17,7 +17,7 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index b32dc31a5b4..a85bcb21f09 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -7,7 +7,7 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index fced8c2a373..6c2d5b6c2e4 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -9,7 +9,7 @@ module M { //// [classExtendingQualifiedName.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index c133ceb87dc..946a7604ca4 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -9,7 +9,7 @@ module M { //// [classExtendingQualifiedName2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index 5be0ab8f9c0..0fa873d378f 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -22,7 +22,7 @@ export const b = { //// [b.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -47,7 +47,7 @@ exports.b = { //// [a.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 91f96450d87..b164b77d319 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -15,7 +15,7 @@ module Foo { //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 6c3dc789445..619d1488ff8 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -8,7 +8,7 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index a19f5d5cdd6..044ef0fca51 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -18,7 +18,7 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index fbc364ca5da..88929e72c57 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -5,7 +5,7 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index b5946224317..1005ccbdd3f 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -10,7 +10,7 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index 9dcd8dd7279..511d22e93f1 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -10,7 +10,7 @@ class C extends factory(A) {} //// [classExtendsInterfaceInExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 9da8831a138..a3034d59df7 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -17,7 +17,7 @@ class D extends Mod.Nested.I {} //// [classExtendsInterfaceInModule.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index 36f2263d671..ad4ce10cfc6 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -7,7 +7,7 @@ class E extends E { } // error //// [classExtendsItself.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index 0f3f48d2f2c..dfbfb7720fa 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -13,7 +13,7 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index e215a07c357..6751b19335d 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -24,7 +24,7 @@ module O { //// [classExtendsItselfIndirectly2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index f8366d77e13..750e5ddfd1c 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -20,7 +20,7 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -33,7 +33,7 @@ var C = (function (_super) { }(E)); // error //// [classExtendsItselfIndirectly_file2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -46,7 +46,7 @@ var D = (function (_super) { }(C)); //// [classExtendsItselfIndirectly_file3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -59,7 +59,7 @@ var E = (function (_super) { }(D)); //// [classExtendsItselfIndirectly_file4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -72,7 +72,7 @@ var C2 = (function (_super) { }(E2)); // error //// [classExtendsItselfIndirectly_file5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -85,7 +85,7 @@ var D2 = (function (_super) { }(C2)); //// [classExtendsItselfIndirectly_file6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index cd9c28ad283..6cb987186c4 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -5,7 +5,7 @@ class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index 1eeb5172cad..45cd0132bda 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -14,7 +14,7 @@ class D extends null { //// [classExtendsNull.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index ddaadc2dc62..fde420bca39 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -10,7 +10,7 @@ module M { //// [classExtendsShadowedConstructorFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index 31bff6e430c..7346096d803 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -7,7 +7,7 @@ class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 12265f569bd..ab37b45f3be 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -5,7 +5,7 @@ class D extends C, { //// [classHeritageWithTrailingSeparator.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 5e3eae46543..372f8ce84ef 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -15,7 +15,7 @@ c2 = c; //// [classImplementsClass2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 5fd003e93b9..09c2a9fbe6b 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -16,7 +16,7 @@ c2 = c; //// [classImplementsClass3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 477288972df..c80e2152598 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -18,7 +18,7 @@ c2 = c; //// [classImplementsClass4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 0ec258ab77b..de0bb4469e1 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -19,7 +19,7 @@ c2 = c; //// [classImplementsClass5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 0771c56415c..c87c1b59d2f 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -23,7 +23,7 @@ c2.bar(); // should error //// [classImplementsClass6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 2e55c894645..759804baa41 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -12,7 +12,7 @@ class D123 extends C123 { //// [classIndexer3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index f68d76fad47..614124c7a09 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -4,7 +4,7 @@ class A extends A { } //// [classInheritence.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index 52300987d8e..fe056e41813 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -17,7 +17,7 @@ class Derived2 extends Base<{ bar: string; }> { //// [classIsSubtypeOfBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 63490fa29b1..34bbf93fd2f 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -21,7 +21,7 @@ a.foo(); //// [classOrder2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index e21a5ed64cf..69ed7723a98 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -17,7 +17,7 @@ class foo extends baz {} //// [classOrderBug.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 9443509032c..b3882d64b87 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -17,7 +17,7 @@ C2.bar(); // valid //// [classSideInheritance1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index 67ee666749b..8a6564f4f9f 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -22,7 +22,7 @@ class TextBase implements IText { //// [classSideInheritance2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index 589dd81c5c6..44035af4f30 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -20,7 +20,7 @@ var r3: typeof A = C; // ok //// [classSideInheritance3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 53ef71d0e4b..d29277a84e4 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -115,7 +115,7 @@ class R { //// [classUpdateTests.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index c25687d3c74..db10ddb0727 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -42,7 +42,7 @@ var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index f445d22d18f..3e038e3a424 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -51,7 +51,7 @@ module Generics { //// [classWithConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 2cb8a4e0a50..35c26afef98 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -30,7 +30,7 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 9e79780d5cc..5deb8f99643 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -21,7 +21,7 @@ var r3 = r.foo; //// [classWithStaticMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index a3059757d2f..99d7bba92b0 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -95,7 +95,7 @@ class e { //// [classdecl.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index ea4bfcf301f..209b135fb15 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -24,7 +24,7 @@ module Path.Utils { //// [clodulesDerivedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index 85c0e398fbd..ec87855ba46 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -41,7 +41,7 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInAccessors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index d4a22b731f2..09f1db5dd40 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -26,7 +26,7 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 81c069da169..40084c7c2a5 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -30,7 +30,7 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 67b7f0e3991..457779fe395 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -20,7 +20,7 @@ class b extends Foo { //// [collisionSuperAndLocalFunctionInProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 26f782c0d17..92a538bea04 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -34,7 +34,7 @@ class c extends Foo { //// [collisionSuperAndLocalVarInAccessors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index e3069352c08..c498658a974 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -22,7 +22,7 @@ class c extends Foo { //// [collisionSuperAndLocalVarInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 0524d993ba1..94e42d35691 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -20,7 +20,7 @@ class c extends Foo { //// [collisionSuperAndLocalVarInMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index d793e022c6b..750de147841 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -19,7 +19,7 @@ class b extends Foo { //// [collisionSuperAndLocalVarInProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index cb5636ec904..dcfd4529266 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -13,7 +13,7 @@ class Foo extends base { //// [collisionSuperAndNameResolution.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index f5765043c55..408158ba2a5 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -64,7 +64,7 @@ class Foo4 extends Foo { //// [collisionSuperAndParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index ed19500f9d4..58b1cbd4989 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -11,7 +11,7 @@ class Foo2 extends Foo { //// [collisionSuperAndParameter1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index 5fa7fe29091..f6f38b6f099 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -32,7 +32,7 @@ class b4 extends a { //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index 9e8132c6883..68707fd675d 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -20,7 +20,7 @@ class b2 extends a { //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 3527f5d23bb..a1e87482843 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -153,7 +153,7 @@ i2_i = i3_i; //// [commentsInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index a263a30e382..91482033255 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -196,7 +196,7 @@ var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index b8584522b7b..95dfc215bfe 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -170,7 +170,7 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 93e1e876a7f..fbcd4a72b99 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -170,7 +170,7 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index a8973bf2c10..ec2e2556cc9 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -113,7 +113,7 @@ var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 4539538782d..2e38deb0e55 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -151,7 +151,7 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index 5e8412bc361..675cce7d49a 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -151,7 +151,7 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index d30c3586b12..634a6448581 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -261,7 +261,7 @@ var r8b11 = b11 !== a11; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index 4235c1352d4..d7857dcfd2a 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -223,7 +223,7 @@ var r8b9 = b9 !== a9; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index 9a6fecd668d..08f08546aa9 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -109,7 +109,7 @@ var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 5721a452486..ada0ee77486 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -166,7 +166,7 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index b6bf8a16e61..28d960fc3c9 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -166,7 +166,7 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 690214fc00f..62fee91b7a3 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -80,7 +80,7 @@ var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index 4f48e5fc2c5..3094d43eed2 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -49,7 +49,7 @@ class FooBase { //// [complexClassRelationships.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 326c0830c4f..d9317789455 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -7,7 +7,7 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index df3015731c7..a1f6274b38b 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -125,7 +125,7 @@ foo() += value; //// [compoundAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index d188a592588..0c90b7b60f8 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -87,7 +87,7 @@ foo() **= value; //// [compoundExponentiationAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index ff9112755bd..03b7347165c 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -10,7 +10,7 @@ class C extends Base { //// [computedPropertyNames24_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index dad9c5c291a..e98865176fb 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -15,7 +15,7 @@ class C extends Base { //// [computedPropertyNames25_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 5db7768270a..c10c3b112e4 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -12,7 +12,7 @@ class C extends Base { //// [computedPropertyNames26_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index 381805659e2..0801b4b5e71 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -7,7 +7,7 @@ class C extends Base { //// [computedPropertyNames27_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index ab765c56dd7..dc360dfd86a 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -12,7 +12,7 @@ class C extends Base { //// [computedPropertyNames28_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index c2c7cddd971..30c6fa33bbe 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -17,7 +17,7 @@ class C extends Base { //// [computedPropertyNames30_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 00cc765f4cc..856fbe88f68 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -17,7 +17,7 @@ class C extends Base { //// [computedPropertyNames31_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index b1bb0fec72c..ccc7aed3725 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -14,7 +14,7 @@ class D extends C { //// [computedPropertyNames43_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index bf940f15014..d16c7fc2f46 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -13,7 +13,7 @@ class D extends C { //// [computedPropertyNames44_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 5b5d64f9bf0..8585f28e5d6 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -14,7 +14,7 @@ class D extends C { //// [computedPropertyNames45_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 408571af42a..030fba2525b 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -49,7 +49,7 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 0ac935a582a..85633af2a25 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -25,7 +25,7 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 160191c5ca0..09e0c2788c4 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -15,7 +15,7 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 509f9ba70e6..dd5bbf27d61 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -16,7 +16,7 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index 7908d36a56a..a68f1411821 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -21,7 +21,7 @@ class Container { //// [constraintCheckInGenericBaseTypeReference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 6b308d88896..f082035064b 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -72,7 +72,7 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index 09abd6e0868..ad834dd6cb4 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -115,7 +115,7 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 4e9a8c59bf9..12fc6bc872f 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -62,7 +62,7 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 91ec3b313bb..10172a751ab 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -52,7 +52,7 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index edafb009916..8c0fc83b406 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -55,7 +55,7 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 6bbea0fddf7..333cc843162 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -17,7 +17,7 @@ class Sub extends Super { //// [constructorArgs.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 45ed976e191..806ff9581ca 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -21,7 +21,7 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index c5e27748f52..4308710ef81 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -35,7 +35,7 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index a16694cdbf5..c36307ee7fe 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -33,7 +33,7 @@ module Generic { //// [constructorHasPrototypeProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index 2d26194f2e7..43553c8f72c 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -27,7 +27,7 @@ f1.bar1(); //// [constructorOverloads2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index c0ae9b452f9..fc916a1b283 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -24,7 +24,7 @@ f1.bar1(); //// [constructorOverloads3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithCapturedSuper.js b/tests/baselines/reference/constructorWithCapturedSuper.js index 895f78eb04b..f128a5f25a0 100644 --- a/tests/baselines/reference/constructorWithCapturedSuper.js +++ b/tests/baselines/reference/constructorWithCapturedSuper.js @@ -54,7 +54,7 @@ class D extends A { //// [constructorWithCapturedSuper.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index d4cd737ab46..bcf6ee23d91 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -282,7 +282,7 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index caf7ed445e5..6358453f4fa 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -16,7 +16,7 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index a6ce98f61e2..70234ea3fec 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -16,7 +16,7 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index e3bd1643cfb..5c40163b2e0 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -14,7 +14,7 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 89979da4812..2afea65e32a 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -12,7 +12,7 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index 30ddc3f08bf..0638373ab22 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -5,7 +5,7 @@ class ExtendsNull extends null { //// [declFileClassExtendsNull.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index 442007d9b9a..889ab313c01 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -11,7 +11,7 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index 47593dc9d68..005e33950bc 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -14,7 +14,7 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index b2e99a73ad7..47af8dc415a 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -42,7 +42,7 @@ export var j = C.F6; //// [declFileGenericType.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index 720be79b28d..f6fb93cb28b 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -44,7 +44,7 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 17d885788dd..45cde43ee4f 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -22,7 +22,7 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index 70d0cd5a3dd..c7b4a7483e9 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -20,7 +20,7 @@ module A.B.C { //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index 726c7b22446..34b8206e43a 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -16,7 +16,7 @@ q.s; //// [declarationEmitExpressionInExtends.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 4081de6d3ed..106fe00152b 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -14,7 +14,7 @@ class MyClass extends getClass(2) { //// [declarationEmitExpressionInExtends2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index f36a7e250a2..c1fbd1fea90 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -46,7 +46,7 @@ export class MyClass4 extends getExportedClass(undefined)>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index e76f3445c8e..55ceea201ed 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -35,7 +35,7 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index 7f6b83593ca..fe6be20e2ac 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -16,7 +16,7 @@ class Derived extends Base { //// [derivedClassFunctionOverridesBaseClassAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 8224473cb54..8b6f6fe34cb 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -42,7 +42,7 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index 4753e395390..80fd6fd251c 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -19,7 +19,7 @@ class Derived2 extends Base2 { //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index 981c072d47c..c5d48de031e 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -17,7 +17,7 @@ new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index 1a58c038fea..fa4b88bdc56 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -17,7 +17,7 @@ class Derived2 extends Base2 { //// [derivedClassOverridesPrivates.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index b8997769eb7..b4fb59ffd2c 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -38,7 +38,7 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 6797eef0e77..13f2cfc4698 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -65,7 +65,7 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d0d9d8fa0f5..24602737e6b 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -73,7 +73,7 @@ class Derived10 extends Base { //// [derivedClassOverridesProtectedMembers3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index 06f80997600..add886d1985 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -16,7 +16,7 @@ class Derived2 extends Derived1 { //// [derivedClassOverridesProtectedMembers4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 7943d904dea..d8fa9e82683 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -64,7 +64,7 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index e42ff9c9e1d..bcd4e505721 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -25,7 +25,7 @@ class Derived2 extends Base2 { //// [derivedClassOverridesWithoutSubtype.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index 27dcc4b7d5d..cb08d4d8545 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -97,7 +97,7 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index b778d7bbca2..cf7845a4d9a 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -34,7 +34,7 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 504d414a608..59a4ff7e1d1 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -30,7 +30,7 @@ class Derived4 extends Base { //// [derivedClassSuperCallsWithThisArg.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index a76ac8101a0..6a6b713f250 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -23,7 +23,7 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index a3894863696..2d05dd09cee 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -23,7 +23,7 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index 71dfecb346f..6c02e2055d9 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -23,7 +23,7 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 0030ce702d8..7d375e8e94e 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -23,7 +23,7 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 2a199e55861..51b4e5739f6 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -61,7 +61,7 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 0542815c4e4..8a86f4ab4a9 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -24,7 +24,7 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 41869cad416..fab643265cb 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -34,7 +34,7 @@ Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 10ae3cb35c8..322514e1c82 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -23,7 +23,7 @@ class Derived extends Base { //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 3f2c2a3b811..8c01a45e1ae 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -35,7 +35,7 @@ Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index 7a6a7ecbb63..462819c551d 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -27,7 +27,7 @@ var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 62beb4bf28f..6e7c75ef37d 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -35,7 +35,7 @@ var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index c96d0c96723..4d4527c172e 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -49,7 +49,7 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index 3e097a9b139..00bdfcfde4e 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -32,7 +32,7 @@ b.hue(); //// [derivedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 1822f3fcc47..410027ce76d 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -44,7 +44,7 @@ var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index c17922e05ee..367b0d895cf 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -19,7 +19,7 @@ class Derived extends Base { //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index 6fe690fd692..c890a28b110 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -22,7 +22,7 @@ var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index 7ba178823df..d7b75ede23d 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -53,7 +53,7 @@ d3({ y: "world" }); //// [destructuringParameterDeclaration5.js] // Parameter Declaration with generic var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index 05b061116d3..fbc08b66624 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -15,7 +15,7 @@ class B extends A { //// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index 2cf2cb02073..1328ece2af0 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -17,7 +17,7 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index eaa52e39285..a9883b26e30 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -15,7 +15,7 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 1f7ed8bfa94..1e23553a2d9 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -29,7 +29,7 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index 3ed21cf217a..404abf6a42c 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -6,7 +6,7 @@ class B extends A { //// [emptyModuleName.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index ed2e1aa7f06..2bfac7ec0f0 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -13,7 +13,7 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 720894e50c0..4e228777567 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -76,7 +76,7 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index e12a758b053..62bb9919171 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -130,7 +130,7 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 6dd9f62edcb..bb80f73f216 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -74,7 +74,7 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index 2eec250211e..fc6ad83738d 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -16,7 +16,7 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 067e57c2581..8fa5be0ba3e 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -86,7 +86,7 @@ declare module AmbientMod { //// [es6ClassTest.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 533b332422d..7004c7056f2 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -160,7 +160,7 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index f786fce4461..20d46e6b53c 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -10,7 +10,7 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 7c1831ecac4..431da58c12e 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -25,7 +25,7 @@ define(["require", "exports"], function (require, exports) { }); //// [exportAssignmentOfGenericType1_1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index b6d6d982a32..ddc2e15a5b2 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -20,7 +20,7 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index 91dfba7a9bf..d8eb5e75f9f 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -21,7 +21,7 @@ module N { //// [extBaseClass1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index 3ab217eb019..474a91d2a72 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -12,7 +12,7 @@ module M { //// [extBaseClass2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index 74bbf3a27ac..1342df1b992 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -15,7 +15,7 @@ d.foo; //// [extendAndImplementTheSameBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index fa7963487d5..38b76b19942 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -18,7 +18,7 @@ var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 596ab319b2c..8cf51642831 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -5,7 +5,7 @@ class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 895cdedfaff..27420b55d1c 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -22,7 +22,7 @@ module.exports = x; //// [foo2.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index 4bf92dd0315..db87c4c14fd 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -12,7 +12,7 @@ var e: E = new E(1); //// [extendConstructSignatureInInterface.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index b23b601bc29..00326e24103 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -5,7 +5,7 @@ class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 78dfaa91827..ce030629af5 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -7,7 +7,7 @@ class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 8893e9735ff..52b96e31611 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -11,7 +11,7 @@ class C extends abc.XYZ { //// [extendPrivateConstructorClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index da081154d8a..92c5dc69681 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -43,7 +43,7 @@ exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -59,7 +59,7 @@ exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index 267cd86eed0..37cdd0eb9bc 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -8,7 +8,7 @@ class D extends C extends C { //// [extendsClauseAlreadySeen.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 76fbc3365af..bc4306884a3 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -8,7 +8,7 @@ class D extends C extends C { //// [extendsClauseAlreadySeen2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index ac44416e133..ade60a06331 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -20,7 +20,7 @@ var z = c.foo().bar().baz(); // Fluent pattern //// [fluentClasses.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 15d771bf587..b34fd91192b 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -82,7 +82,7 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index d1181760a36..3d39fb2903b 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -65,7 +65,7 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 3666ad930a6..8ca8c794cf5 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -56,7 +56,7 @@ for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 433418af41d..5c8defcf814 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -76,7 +76,7 @@ var f13 = () => { //// [functionImplementationErrors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 86636b84a87..e73e5095701 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -159,7 +159,7 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC //// [functionImplementations.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 55917962184..89e8b1e95ef 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -16,7 +16,7 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index a676316459f..be9c293ae72 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -16,7 +16,7 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 2a6911d9cf5..06abd1b9a8b 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -357,7 +357,7 @@ var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } //// [generatedContextualTyping.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index a075eff9550..b572cfae97d 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -14,7 +14,7 @@ class SubClass extends BaseClass { //// [genericBaseClassLiteralProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 2b562742bf7..9e99dee2b4c 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -17,7 +17,7 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index afef6224ba1..68a3e77f9ae 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -110,7 +110,7 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index 7b621b3ffd9..0b643db14cb 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -34,7 +34,7 @@ var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index 892cda0ee2d..98448645d15 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -42,7 +42,7 @@ var r7 = f3(null, x => x); // any // Generic call with constraints infering type parameter from object member properties // No errors expected var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index addfbc756a8..71bf682b0dc 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -40,7 +40,7 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index c2ad2ba29a3..67d0df1bc22 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -25,7 +25,7 @@ module M { //// [genericCallbacksAndClassHierarchy.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index dc574dedb00..3db4d9693af 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -33,7 +33,7 @@ s.genericVar = 12; //// [genericClassExpressionInFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index 1f3a6e17f14..307c891f928 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -7,7 +7,7 @@ class C { //// [genericClassInheritsConstructorFromNonGenericClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 28eaf464968..147bbd8fb87 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -77,7 +77,7 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 4609e3bc9db..257e7dbce97 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -12,7 +12,7 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 5371e2479aa..fbc62b23aab 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -19,7 +19,7 @@ var z = v2.b; //// [genericClasses3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index d990f76d2c3..4043924bf54 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -28,7 +28,7 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index 4291b315933..33394ee4fce 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -27,7 +27,7 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 1b455073196..413eed2a4c8 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -14,7 +14,7 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 0abd655e1da..da81eaf5640 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -14,7 +14,7 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index 059a3213b7a..d7aaa6224ef 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -12,7 +12,7 @@ var c:Constructor> = B; // shouldn't error here //// [genericInheritedDefaultConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index eac025cce9b..6ce627694ca 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -17,7 +17,7 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index 9e3ede0019d..a2817d82e9f 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -16,7 +16,7 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index 401a2e94b68..2fbb5f7ef50 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -28,7 +28,7 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index c7643d4a9a2..c88dd78765a 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -32,7 +32,7 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index 687d593f01e..25e4d3f3bae 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -15,7 +15,7 @@ var r5: A = >[]; // error //// [genericTypeAssertions2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index 50dbe5debbd..d54f37408a3 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -27,7 +27,7 @@ function foo2(x: T) { //// [genericTypeAssertions4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 7bbd7351f1d..6ace4b38a13 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -26,7 +26,7 @@ var c: A = >b; //// [genericTypeAssertions6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index 67303166aa3..4aae830a0d1 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -15,7 +15,7 @@ class BarExtended extends Bar { //// [genericTypeConstraints.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index cf19feede34..ec7029135a9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -41,7 +41,7 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 973ee231762..d3797663e0e 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -41,7 +41,7 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index d6fb98b67ca..b5c3316ab12 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -16,7 +16,7 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index 9b15cf743f0..43ec9a09587 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -134,7 +134,7 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 483370bee5c..8d1ad1a834f 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -165,7 +165,7 @@ do { }while(fn) //// [ifDoWhileStatements.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 868d53daad5..5299bac5eb3 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -22,7 +22,7 @@ class Derived extends Base { //// [illegalSuperCallsInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index df725cde43a..669a6794618 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -4,7 +4,7 @@ class D implements C extends C { } //// [implementClausePrecedingExtends.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index a5a5e02c156..5d93d2b04a4 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -87,7 +87,7 @@ module M2 { //// [implementingAnInterfaceExtendingClassWithPrivates2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index d0f74847141..082b9d801dc 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -43,7 +43,7 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index b4f45cac806..f61703de5f0 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -22,7 +22,7 @@ exports.Greeter = Greeter; //// [importAsBaseClass_1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index ae4d3127010..ec294a342de 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -69,7 +69,7 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index a9c2deb76b6..3a2e4823337 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -71,7 +71,7 @@ var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 41df9710f33..991733f4b37 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -61,7 +61,7 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 34cc0604e7a..abdf7e28cbb 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -22,7 +22,7 @@ define(["require", "exports"], function (require, exports) { }); //// [Bar.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index a40c3a51a78..941436e7e75 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -22,7 +22,7 @@ exports.Super = Super; //// [importUsedInExtendsList1_1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index d7357f021d0..81bb114e394 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -30,7 +30,7 @@ class K extends J { //// [indexerConstraints2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index 2f4f37b9b53..a61a14a2d6b 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -4,7 +4,7 @@ class b extends a{ } //// [indirectSelfReference.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index 9171bb0eeb6..989a02b1943 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -4,7 +4,7 @@ class b extends a { } //// [indirectSelfReferenceGeneric.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index ad1a063bfb0..7336e2c0f69 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -26,7 +26,7 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index 40e6abd3e53..57ad5b71bd8 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -4,7 +4,7 @@ interface I extends T { } //// [inheritFromGenericTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index a0874eb1c72..679e91dc38a 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -12,7 +12,7 @@ interface A extends C, C2 { // ok //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index cbfef2d3382..01fdd0a3d67 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -36,7 +36,7 @@ class Baad extends Good { //// [inheritance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index 86de0b76350..c33c73a6e60 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -63,7 +63,7 @@ l1 = c; //// [inheritance1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 57a9c897583..180f48f613c 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -12,7 +12,7 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index 83c5aa3e4cd..73121951e7c 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -12,7 +12,7 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index b11b6e318a7..60183c5749e 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -12,7 +12,7 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index 09ea08899d9..fc1ff97e8cf 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -19,7 +19,7 @@ class b extends a { //// [inheritanceMemberAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 59d2abdaab2..0ba2a70f257 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -16,7 +16,7 @@ class b extends a { //// [inheritanceMemberAccessorOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index 98a95747a8e..26c911694a2 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -14,7 +14,7 @@ class b extends a { //// [inheritanceMemberAccessorOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 0d54e5d42fa..d0dfcc5923a 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -16,7 +16,7 @@ class b extends a { //// [inheritanceMemberFuncOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index 9af25c6fdb8..64e5e923178 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -13,7 +13,7 @@ class b extends a { //// [inheritanceMemberFuncOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 5c77ce08101..f3835a78f14 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceMemberFuncOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index 82c7a94d17c..82fc4906ca6 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -15,7 +15,7 @@ class b extends a { //// [inheritanceMemberPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index e6929218e63..e13a111fef9 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceMemberPropertyOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 85764cddc52..b6496085a61 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -9,7 +9,7 @@ class b extends a { //// [inheritanceMemberPropertyOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 28fe8144509..ac99c90e829 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -9,7 +9,7 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 0cc71e168f4..406675d88d9 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -16,7 +16,7 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index bb91ee5f9ea..3faa8f8388d 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -19,7 +19,7 @@ class b extends a { //// [inheritanceStaticAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index 363852a84bf..543651ea6f0 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -16,7 +16,7 @@ class b extends a { //// [inheritanceStaticAccessorOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index ba8df7a5f0b..5053cd3946a 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -14,7 +14,7 @@ class b extends a { //// [inheritanceStaticAccessorOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index e464029fba5..6090bd4f74f 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -16,7 +16,7 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index cc825cfa9b5..5213eae20dd 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -13,7 +13,7 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index 466c65fa7d5..4d85f383ef6 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -13,7 +13,7 @@ class b extends a { //// [inheritanceStaticFuncOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index dfc0ce2c13f..a548d70861b 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceStaticFuncOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index da7850f2071..9f2a7acfd14 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index d5916a9d452..c489493375e 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceStaticFunctionOverridingInstanceProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index b4cae99b64b..b57ada54212 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -9,7 +9,7 @@ class b extends a { //// [inheritanceStaticMembersCompatible.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index 38c637dd8d1..11e8e0117db 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -9,7 +9,7 @@ class b extends a { //// [inheritanceStaticMembersIncompatible.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index 49dc86fc500..7283ee4dbb0 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -14,7 +14,7 @@ class b extends a { //// [inheritanceStaticPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index bcd63537540..e9308f977db 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -11,7 +11,7 @@ class b extends a { //// [inheritanceStaticPropertyOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index c1bdd9b66a2..4feb0e06b8c 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -9,7 +9,7 @@ class b extends a { //// [inheritanceStaticPropertyOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index 6a30836d728..4d3b055dcdb 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -16,7 +16,7 @@ new Derived(3); //// [inheritedConstructorWithRestParams.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 9a1b13a8434..146677ff09c 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -36,7 +36,7 @@ new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index cd49009fed9..666f4d703be 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -23,7 +23,7 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index b8f39c5b0e2..1492a9f919b 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -91,7 +91,7 @@ function fn8(x: Alpha|Beta|Gamma) { //// [instanceOfAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 8dc5227685f..a421814ea2d 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -44,7 +44,7 @@ module Generic { //// [instancePropertiesInheritedIntoClassType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index 914f3796001..c6c657aa82e 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -9,7 +9,7 @@ class C2 extends C1 { //// [instanceSubtypeCheck2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 54a574238e5..46c842c86a7 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -73,7 +73,7 @@ function goo(x: A) { //// [instanceofWithStructurallyIdenticalTypes.js] // Repro from #7271 var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index bc496a63632..ac3470cb288 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -32,7 +32,7 @@ return null; //// [instantiatedReturnTypeContravariance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 6542376a19b..931d94f6eda 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -42,7 +42,7 @@ obj = bar; //// [interfaceClassMerging.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index 70a62da4131..c0c9b17b3e8 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -38,7 +38,7 @@ foo = bar; //// [interfaceClassMerging2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 8324a001f91..85b4a42302d 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -20,7 +20,7 @@ class Location { //// [interfaceExtendsClass1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index 1179ff101df..05ae7d83678 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -29,7 +29,7 @@ d = c; // error //// [interfaceExtendsClassWithPrivate1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index 49b5efbd012..a1ff0fff763 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -25,7 +25,7 @@ class D2 extends C implements I { // error //// [interfaceExtendsClassWithPrivate2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index afb5a795264..2193189eaf1 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -42,7 +42,7 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 6e9b09c906f..dc4284495b1 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -81,7 +81,7 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 340429cc398..2117e176f08 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -55,7 +55,7 @@ var m = M.A; //// [invalidMultipleVariableDeclarations.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index a6b07b7d7bd..8f1adc05fa6 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -22,7 +22,7 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index 6f1d38dcbb5..e98932901e3 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -16,7 +16,7 @@ export var z = x; //// [file1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 604787af744..99b9229f2a5 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -26,7 +26,7 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 0e630be9a43..50bb51dbae7 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -295,7 +295,7 @@ var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index 47db7f3ce64..911232722bd 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -36,7 +36,7 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 364d52d9385..cd6f4fffd00 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -19,7 +19,7 @@ class C extends B { //// [lift.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index 100452b7a96..a887a3e07b0 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -143,7 +143,7 @@ function f6() { //// [localTypes1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index e5a4d11f00c..078c77c5e3c 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -28,7 +28,7 @@ var y3: C1 = {}; //// [m7Bugs.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index b24e86eca58..f731d4de428 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -20,7 +20,7 @@ var A = (function () { }()); //// [b.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index d610e4ab46f..42ef5702061 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -38,7 +38,7 @@ define(["require", "exports"], function (require, exports) { }); //// [b.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 0f598f2cf78..38d4f94adde 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -48,7 +48,7 @@ grandchild.method2(); //// [mergedInheritedClassInterface.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index 6dccf1dfdd9..fd3d2da41e3 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -33,7 +33,7 @@ var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index a3ca796575c..1c8ba88d786 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -40,7 +40,7 @@ module M { //// [mergedInterfacesWithInheritedPrivates3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index c7b30882b14..8df4153b72d 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -8,7 +8,7 @@ class George extends class { reset() { return this.y; } } { //// [missingPropertiesOfClassExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index fc0533a2470..a4caea585ac 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -6,7 +6,7 @@ class C2 implements M { } //// [moduleAsBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index 51d9eb89b1d..bf074378d4b 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -17,7 +17,7 @@ define(["require", "exports"], function (require, exports) { }); //// [moduleImportedForTypeArgumentPosition_1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index 4243c9849cf..6efcddf7201 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -60,7 +60,7 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 9c0e865cdb7..d05f10568ad 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -40,7 +40,7 @@ class Baad extends Good { //// [multipleInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 8b59564d465..570a93e8534 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -12,7 +12,7 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index cc4c9422373..78ea4e74a97 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -14,7 +14,7 @@ class Child extends Parent { //// [noImplicitAnyMissingGetAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index 1323955c05e..64c480cc8e1 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -13,7 +13,7 @@ class Child extends Parent { //// [noImplicitAnyMissingSetAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index b0a3365193d..33f7e696126 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -7,7 +7,7 @@ class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 92c8b380e00..c8ec0d9da78 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -48,7 +48,7 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 29cb75b4234..02b54a2bbad 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -14,7 +14,7 @@ class C { //// [numericIndexerConstraint3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 135e169c4a9..0f82789285d 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -14,7 +14,7 @@ var x: { //// [numericIndexerConstraint4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index 5b9e797bdec..1086d974590 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -14,7 +14,7 @@ var r2: string = i2[1]; // error: numeric indexer returns the type of the string //// [numericIndexerTyping2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index a1739ce0d8e..2b7ac176c7e 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -57,7 +57,7 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 17045d65af0..301761c2849 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -56,7 +56,7 @@ var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index e82cef9bdd6..1b889269724 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -125,7 +125,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index abcea113670..767f10adc88 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -128,7 +128,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index f5aeb177472..8ae7b92b4dd 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -125,7 +125,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index 3946027063f..9f9319a3cf8 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -123,7 +123,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 9cae6960a2e..e1426e4a3b5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -41,7 +41,7 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 68754a583aa..1105c06c204 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -27,7 +27,7 @@ var c3: C3; //// [objectTypesIdentityWithPrivates3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index b0211bbbba7..9f076b52c60 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -125,7 +125,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 00d7d1e81d8..75ad2243fe3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -128,7 +128,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index e460ab3fb15..4ebc1226146 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -12,7 +12,7 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index 28ed0bcd76e..5cbd798ec89 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -59,7 +59,7 @@ class Derived extends Base { //// [optionalMethods.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 1b603898aa6..23ab5150579 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -126,7 +126,7 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index 1312a89502a..9d318cd9ae5 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -9,7 +9,7 @@ class Y extends Z { //// [optionalParamInOverride.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index f9b9ecaf990..3203c4e2e09 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -13,7 +13,7 @@ class D extends C { //// [optionalParameterProperty.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 5054c2a3c33..cab6be31d07 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -10,7 +10,7 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index 34ab74816ad..f07a95163f6 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -9,7 +9,7 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index a615090f33a..6f6e1c3b366 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -10,7 +10,7 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 732214237fa..47558a3812a 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -9,7 +9,7 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index b9ff7c15b61..5f6def67a48 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -32,7 +32,7 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index ce41bae6de3..9f15bc0eaee 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -9,7 +9,7 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/b.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index 41aafdfb29c..6cbfb843812 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -41,7 +41,7 @@ var v=x.g; //// [overload1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index f9d1c81b06b..8bc8ccd1612 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -24,7 +24,7 @@ class D implements MyDoc { //// [overloadOnConstConstraintChecks1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index a680a62ddfe..16cfb630a5d 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -13,7 +13,7 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 025e449fd6f..1540bc4dc49 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -14,7 +14,7 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index 0f436a5f0b2..a634547a36b 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -15,7 +15,7 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index e3f58c0f7d0..0edadc3c692 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -13,7 +13,7 @@ foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index e5cc35c39c4..56ebebc454e 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -96,7 +96,7 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 7c8b2e2ccb6..5cf41a3b44a 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -103,7 +103,7 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 44bbfbcec2b..85ec9fb06fb 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -104,7 +104,7 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index 96f4f7baf24..c8f5a8fd9ae 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -27,7 +27,7 @@ var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 0c34d0f4b76..9792485e1cf 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -29,7 +29,7 @@ var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index ca5616450ba..50f957c7fdd 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -9,7 +9,7 @@ class Derived2 extends Base2 { //// [overridingPrivateStaticMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index a9ca0a6db73..3409c13e2f1 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -4,7 +4,7 @@ class C extends A # { //// [parseErrorInHeritageClause1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index d3648dc5b64..cce7df3db54 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -8,7 +8,7 @@ class Any extends Type { //// [parser509630.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index 6b86353b959..12de33e4738 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -221,7 +221,7 @@ class c6 extends c5 { //// [parserAstSpans1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index a61b492b7a9..555d625d522 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -4,7 +4,7 @@ class C extends A extends B { //// [parserClassDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index f58f0ab00cb..b63483411b2 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -4,7 +4,7 @@ class C implements A extends B { //// [parserClassDeclaration3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index 912aa8c6581..2f3cdf0e166 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -4,7 +4,7 @@ class C extends A implements B extends C { //// [parserClassDeclaration4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index 054aaf0eb7a..da843d06292 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -4,7 +4,7 @@ class C extends A implements B implements C { //// [parserClassDeclaration5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 1423edfe037..842b811de9b 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -4,7 +4,7 @@ class C extends A, B { //// [parserClassDeclaration6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index aa0679bb8f5..22225819435 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -4,7 +4,7 @@ class C extends A, { //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 1308c7c194b..92af44f7cc4 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -4,7 +4,7 @@ class C extends A implements { //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index b1471628fbd..07adb1e2001 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -4,7 +4,7 @@ class C extends A, implements B, { //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index 641d296dc43..ef93433301b 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -19,7 +19,7 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index b0f14a090ae..a3bfafc19b4 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -19,7 +19,7 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 11cfbdfa1f2..b89e47d3e75 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -459,7 +459,7 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index eb05d13f4ed..daaa9f79cee 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2368,7 +2368,7 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 14ce4338176..fd432660b52 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2097,7 +2097,7 @@ module Harness { // limitations under the License. // var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index 9702595fffb..c81647e79b5 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -17,7 +17,7 @@ testError((t1, t2, t3: D) => {}) //// [partiallyAnnotatedFunctionInferenceError.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index d20b35625e9..e54441df4d6 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -36,7 +36,7 @@ testRest((t2, ...t3: D[]) => {}) //// [partiallyAnnotatedFunctionInferenceWithTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 7b94b555eb1..64b699496bf 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -33,7 +33,7 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index 7e56edf2cf1..64e1c63eca1 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -130,7 +130,7 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo //// [privacyClass.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index e0828809416..377b4082bea 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -100,7 +100,7 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -286,7 +286,7 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index fa769a606ae..b93ed51025d 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -62,7 +62,7 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 21ff4793fb3..2118eb072d7 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -11,7 +11,7 @@ class D extends Base { //// [privateAccessInSubclass1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 6fa05178f91..98b2671d23e 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -15,7 +15,7 @@ class Derived extends Base { //// [privateInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index b732661edfc..bcef17bf63f 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -23,7 +23,7 @@ let { priv: a, prot: b, privateMethod: f } = k; // error //// [privateProtectedMembersAreNotAccessibleDestructuring.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index c1897e8503a..438f485e031 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -10,7 +10,7 @@ class Derived extends Base { //// [privateStaticMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index a93823654d4..618d6d88e8a 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -17,7 +17,7 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 99a4842f636..ef754cba47d 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,5 +1,5 @@ var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 99a4842f636..ef754cba47d 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,5 +1,5 @@ var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 7ee160b82ef..8273c054fbd 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,5 +1,5 @@ var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 7ee160b82ef..8273c054fbd 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,5 +1,5 @@ var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index b793b07534c..dac535093f5 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,6 +1,6 @@ /// var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index b793b07534c..dac535093f5 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,6 +1,6 @@ /// var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index dff86f3954e..ccf7c50ebc9 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -53,7 +53,7 @@ var c: { //// [propertiesAndIndexers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 0a4c9082a21..3240f46a935 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -152,7 +152,7 @@ var x3: A; //// [propertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index d36d7e27efe..e813239484b 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -84,7 +84,7 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index 4aedfe12b04..b10642c73c5 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -59,7 +59,7 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 3cb14438141..97f8e18f917 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -46,7 +46,7 @@ var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't //// [propertyAccessOnTypeParameterWithConstraints5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index 429dfdf6b14..226ad97f81f 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -40,7 +40,7 @@ class E extends C { //// [protectedClassPropertyAccessibleWithinNestedSubclass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index 0571b85ea9e..c98abd2a89a 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -116,7 +116,7 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index a10b39b402e..2557a8abcf9 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -22,7 +22,7 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index a404b8049bc..8ee957ec64f 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -96,7 +96,7 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 7d449bdcbd4..31c2f3d149c 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -15,7 +15,7 @@ class Derived extends Base { //// [protectedClassPropertyAccessibleWithinSubclass3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index 3259d401270..84400a37aa7 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -46,7 +46,7 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index 46b4691dff7..4757f6134a3 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -117,7 +117,7 @@ class B3 extends A3 { //// [protectedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index ad1b1682aa7..ffe163716ed 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -45,7 +45,7 @@ Derived3.x; // Error, neither within their declaring class nor classes deriv //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index a2346b8be40..d21e6511c34 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -23,7 +23,7 @@ class Derived2 extends Derived1 { //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index a881eb55a18..d345bb7e1b1 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -8,7 +8,7 @@ class Beta extends Alpha.x { //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index 872c00486c0..d8275690d4a 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -42,7 +42,7 @@ class E extends D { //// [readonlyConstructorAssignment.js] // Tests that readonly parameter properties behave like regular readonly properties var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index 250a9e0b618..92835b848ce 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -6,7 +6,7 @@ class C extends A { } //// [recursiveBaseCheck3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index 7f0c6b5f95d..f0271b2d36a 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -4,7 +4,7 @@ class M extends M { } //// [recursiveBaseCheck4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index 53a608baeca..97e6cb483e3 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -4,7 +4,7 @@ class S18 extends S18<{ S19: A; }>{ } //// [recursiveBaseCheck6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index 344750974cb..d20d43c405d 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -8,7 +8,7 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 34aa110b7ee..eeda7ef86f4 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -11,7 +11,7 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index a2cf3319474..e59f3ad4c36 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -106,7 +106,7 @@ module Sample.Thing.Languages.PlainText { // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index f99a062e2c6..8bfac267dbf 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -27,7 +27,7 @@ sourceFile:recursiveClassReferenceTest.ts 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index 8441ff9e15a..57000180db4 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -26,7 +26,7 @@ class TypeSymbol extends InferenceSymbol { //// [recursiveComplicatedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index 76224741e60..5f6e3ab0b06 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -31,7 +31,7 @@ declare module MsPortal.Controls.Base.ItemList { //// [recursivelySpecializedConstructorDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index a75a90d4d86..d7b644514cc 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -34,7 +34,7 @@ module.exports = { //// [foo3.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 94dc537298a..77417da53f3 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1021,7 +1021,7 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index a47fa7ed513..cd56b78f0a3 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -68,7 +68,7 @@ class I extends G { //// [returnInConstructor1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index f786e994963..783ffb5899e 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -26,7 +26,7 @@ function fn13(): C { return null; } //// [returnStatements.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 1474f8ab29a..1ab4b160e7c 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -10,7 +10,7 @@ class D extends C { //// [scopeCheckExtendedClassInsidePublicMethod2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 0baf0187009..9d1fafea4c9 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -10,7 +10,7 @@ class D extends C { //// [scopeCheckExtendedClassInsideStaticMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index 48863404a8e..0ab152adf11 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -13,7 +13,7 @@ class D extends C { //// [scopeTests.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 4906814f7eb..305c7581959 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -5,7 +5,7 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index 4bac0210c85..d3ac854d4dd 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -9,7 +9,7 @@ class Greeter extends AbstractGreeter { //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 91e284fd063..68dea53e96b 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -9,7 +9,7 @@ emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorA sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; +>>> Object.setPrototypeOf(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index f65f42941bf..56fd271bb34 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -19,7 +19,7 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index b76afaff08c..3f31e7f61df 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -14,7 +14,7 @@ function g(tagName: any): Base { //// [specializedOverloadWithRestParameters.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index de7588c3ebe..d8c53470b81 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -15,7 +15,7 @@ d.foo(); //// [staticFactory1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index d204c1aed47..c6c95c1e6bf 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -13,7 +13,7 @@ doThing(B); //OK //// [staticInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index 7b8ca52b9a4..ededeec9c5c 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -11,7 +11,7 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index 6240f8c454f..fdb63a556e0 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -37,7 +37,7 @@ class E extends A { //// [staticPropSuper.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index da45bda5c6e..ac78decef58 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -62,7 +62,7 @@ class Ds extends A { //// [strictModeInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index 29715745890..e376167c667 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -29,7 +29,7 @@ function foo() { //// [strictModeReservedWord.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index 1507e53d8cf..f6b864047a8 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -30,7 +30,7 @@ class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index b532df7b120..6836a7adff3 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -42,7 +42,7 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 38f5b5f1d4b..4407e02a1e7 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -108,7 +108,7 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 82bcbf14ecc..ec44364d4a4 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -170,7 +170,7 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index e0baced37a4..f25a43a353f 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -81,7 +81,7 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 0b17fc07f24..16797d0e5b5 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -160,7 +160,7 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 9c4c9011758..ca52f7ed49f 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -21,7 +21,7 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 3b5fada2012..8086362951f 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -175,7 +175,7 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index 4ac7d3a7f24..1fa01910cdb 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -122,7 +122,7 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index 94f549c62c1..5aaa139f19a 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -114,7 +114,7 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 1d12aeb945f..1f7ae528b5b 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -175,7 +175,7 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index 78582304cb8..d86b0519ebe 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -124,7 +124,7 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 17252fdb809..f11d2e3c211 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -114,7 +114,7 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index a0561606393..bdce522f104 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -52,7 +52,7 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index c508781e089..2c0b10744f2 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -55,7 +55,7 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index 3cf75dd83fd..efe3d5927a9 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -42,7 +42,7 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index e9e8d39bf3c..a3b1034d6a8 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -46,7 +46,7 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 798e775083f..f2657654c8b 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -30,7 +30,7 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 3675ed6a410..04f05b81cef 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -69,7 +69,7 @@ module TwoLevels { //// [subtypingWithObjectMembers.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 404b6cbe988..2cdf1b4401b 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -36,7 +36,7 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 8b168ea73b5..386ce781675 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -36,7 +36,7 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 0a83b760218..5227eac7db4 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -64,7 +64,7 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index 195b7d2192e..a1ec5e1f46f 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -43,7 +43,7 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 0b2a57324eb..ea193a206ed 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -46,7 +46,7 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index 2937261ad05..b5a8c75a03e 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -30,7 +30,7 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 504e8542d4d..6607c7897dd 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -39,7 +39,7 @@ s.foo() + ss.foo(); //// [super.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index 0094f696faf..44a48adab77 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -68,7 +68,7 @@ module Base4 { //// [super1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index 1d2331052db..e46b2825481 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -52,7 +52,7 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index 0bd9d305d2e..b300f75b5fa 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -15,7 +15,7 @@ class MyDerived extends MyBase { //// [superAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index da19770584a..0388b8d7f10 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -26,7 +26,7 @@ class Q extends P { //// [superAccess2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index a7f964309f7..ec8488f0dad 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -17,7 +17,7 @@ module test { //// [superAccessInFatArrow1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index 106d7433bf5..7ca13891555 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -27,7 +27,7 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index 6e30cc64052..d7ad39fc7a6 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -12,7 +12,7 @@ class H extends E { //// [superCallAssignResult.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index e3aed9e40e9..916d1568232 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -18,7 +18,7 @@ class D extends Base { //// [superCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index 7331718a9ed..c5a8d293fff 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -12,7 +12,7 @@ class D extends Base { //// [superCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 185767fefb6..8a59226d1d6 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -15,7 +15,7 @@ class D extends Base { //// [superCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 91acb88ce22..6870662435e 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -17,7 +17,7 @@ class E extends null { //// [superCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 57228538faf..0c2f3aa1c2d 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -9,7 +9,7 @@ class D extends null { //// [superCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index e4dfb3f714a..2fe03ab52b5 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -12,7 +12,7 @@ class D extends Base { //// [superCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index 9cfe8736774..a843456be76 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -15,7 +15,7 @@ class D extends Base { //// [superCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index fe459b5e031..3b23949584f 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -15,7 +15,7 @@ class D extends Base { //// [superCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index bc196299bf9..e4f1d4ed105 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -13,7 +13,7 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 8a0ef085590..47d1b5007fe 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -12,7 +12,7 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index 0529d5e3dc2..d29377ed246 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -12,7 +12,7 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index fb08ec28902..844b24a0698 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -12,7 +12,7 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index 50153391f62..71587371fa0 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -12,7 +12,7 @@ class B extends A { //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index cd84052ca3c..99a026a38fd 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -52,7 +52,7 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index b31110fdf78..b65b2b270c5 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -48,7 +48,7 @@ class Other extends Doing { //// [superCallInStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 05e44119608..0b6c768c86f 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -18,7 +18,7 @@ class B extends A { //// [superCallInsideClassDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index 3d55fe11cff..c3bd2425dd4 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -18,7 +18,7 @@ class B extends A { //// [superCallInsideClassExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index 636b03c227f..45b6301a871 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -14,7 +14,7 @@ class B extends A { //// [superCallInsideObjectLiteralExpression.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index e32bfc66050..a98a9b3a322 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -24,7 +24,7 @@ var d = new D(); //// [superCallOutsideConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index d8491b4ee83..46aeb976987 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -14,7 +14,7 @@ class B extends A { //// [superCallParameterContextualTyping1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index 9868a7db124..a6aed2d1cae 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -13,7 +13,7 @@ class C extends A { //// [superCallParameterContextualTyping2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index 6a43d58c471..8445e86cfce 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -33,7 +33,7 @@ class C extends CBase { //// [superCallParameterContextualTyping3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithCommentEmit01.js b/tests/baselines/reference/superCallWithCommentEmit01.js index c7ea3cc8b85..ea23eb3be03 100644 --- a/tests/baselines/reference/superCallWithCommentEmit01.js +++ b/tests/baselines/reference/superCallWithCommentEmit01.js @@ -12,7 +12,7 @@ class B extends A { //// [superCallWithCommentEmit01.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 16f11088640..9dff2bc4c56 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -11,7 +11,7 @@ class Foo extends Bar { //// [superCallWithMissingBaseClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index 99a3b78752c..d5a9af8e06a 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -32,7 +32,7 @@ class OtherDerived extends OtherBase { //// [superCalls.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 48b79acadf4..540eef99840 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -22,7 +22,7 @@ class Derived extends Base { //// [superCallsInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 19f0d74f677..c52b2a22173 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -53,7 +53,7 @@ class RegisteredUser extends User { //// [superErrors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index e1fc0f97024..17ac62b8491 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -15,7 +15,7 @@ class B extends A { //// [superInCatchBlock1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 8c99b649917..7f53128e99e 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -12,7 +12,7 @@ class C extends B { //// [superInConstructorParam1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 73ca53c3b5c..8c3d37efb34 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -69,7 +69,7 @@ class RegisteredUser4 extends User { //// [superInLambdas.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 816277e4e9e..f31a2492f3d 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -61,7 +61,7 @@ class B extends A { //// [superInObjectLiterals_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index 30b07308bb2..2b6231691b2 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -14,7 +14,7 @@ class B extends A { //// [superNewCall1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 7b5823e598b..72353c27624 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -38,7 +38,7 @@ class MyDerived extends MyBase { //// [superPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index 0b1e4fc280f..7e07c236eec 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -29,7 +29,7 @@ class D extends C { //// [superPropertyAccess1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index 7c72ad5d1bb..f0776992312 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -29,7 +29,7 @@ class D extends C { //// [superPropertyAccess2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index 956bce4ef2e..cb5e98ee2d2 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -16,7 +16,7 @@ class B extends A { //// [superPropertyAccessInComputedPropertiesOfNestedType_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index 88a5da8b8fb..0f4efbc719f 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -78,7 +78,7 @@ instance.returnThis().fn(); //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 45c32076be9..159b3b86c4c 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -31,7 +31,7 @@ class B extends A { //// [superPropertyAccess_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index dd37deb5af3..43565251f79 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -15,7 +15,7 @@ class Bar extends Foo { //// [superSymbolIndexedAccess5.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 8c8534b428a..2f47d38660e 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -15,7 +15,7 @@ class Bar extends Foo { //// [superSymbolIndexedAccess6.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index a0381d0b944..e024285dc9e 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -16,7 +16,7 @@ var r2: number = d.y; //// [superWithGenericSpecialization.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index 803f229bd4b..c8c99ef56cf 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -13,7 +13,7 @@ class D extends B { //// [superWithGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index a1c04975404..638b970d7ff 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -11,7 +11,7 @@ class D extends C { //// [superWithTypeArgument.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index 42a0e46d4c0..4241cc6a699 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -11,7 +11,7 @@ class D extends C { //// [superWithTypeArgument2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 803e5c264c2..8f9d6252a87 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -15,7 +15,7 @@ class D extends C { //// [superWithTypeArgument3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 6815b71ce11..e244f318328 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -29,7 +29,7 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 2e1aecc7288..20a92712670 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -57,7 +57,7 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index 78c09355fa0..cbb2b5d05dd 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -33,7 +33,7 @@ System.register([], function (exports_1, context_1) { System.register(["./foo"], function (exports_1, context_1) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index cac93023a00..3c1daae5d31 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -20,7 +20,7 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 1fc1c734639..5eaac48383c 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -50,7 +50,7 @@ enum SomeEnum { //// [thisInInvalidContexts.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index f8cb6d695dc..788eb974e89 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -51,7 +51,7 @@ export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index 2a4d15973ab..f49a0b8eb65 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -24,7 +24,7 @@ class Foo3 extends Base { //// [thisInSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index e3eea1fb91d..bfc9d8b4f17 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -12,7 +12,7 @@ class Foo extends Base { //// [thisInSuperCall1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index eabfa9d562c..df5dee1a321 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -21,7 +21,7 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index 6a72f17248f..ac47e685c38 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -14,7 +14,7 @@ class Foo extends Base { //// [thisInSuperCall3.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index 6400f410a09..3169e0cd06b 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -196,7 +196,7 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } //// [thisTypeInFunctions.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index 446bc15e6d9..4b936e0198f 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -178,7 +178,7 @@ c.explicitProperty = (this, m) => m + this.n; //// [thisTypeInFunctionsNegative.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index f5d35ccaf77..6cfb957dd39 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -22,7 +22,7 @@ export class ShortDetails extends React.Component<{ id: number }, {}> { //// [tsxCorrectlyParseLessThanComparison1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index d3bb404ceea..200a8e2d78d 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -22,7 +22,7 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index 84debfd3e71..717caa83310 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -22,7 +22,7 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index 6166b99f4ac..725eeec0326 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -22,7 +22,7 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index 928649264c8..ff7e4a9a7e2 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -22,7 +22,7 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 58e7f1c8d85..0d515ac2114 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -34,7 +34,7 @@ export class Button extends React.Component { //// [button.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -53,7 +53,7 @@ exports.Button = Button; //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index 88d91723501..7352f7edef7 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -41,7 +41,7 @@ let i =
x.propertyNotOnHtmlDivElement} />; //// [file.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 3520b5af372..a832e26806e 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -27,7 +27,7 @@ class MyButtonComponent extends React.Component<{},{}> { //// [file.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index a57fb222a77..9e7e39be710 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -53,7 +53,7 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index b88d1038969..e261492d35f 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -85,7 +85,7 @@ let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 99c25faaa88..2ceec7e12e2 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -147,7 +147,7 @@ if (hasMissingParameter()) { //// [typeGuardFunctionErrors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index 703c809274f..a2b9df419ad 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -35,7 +35,7 @@ let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index c052ea7d72b..f9f102e06ae 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -143,7 +143,7 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index a85a207a665..c1e5b6b0af1 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -61,7 +61,7 @@ else { //// [typeGuardFunctionOfFormThisErrors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index a181a446a81..75f0ccdf492 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -74,7 +74,7 @@ else { // it is a subtype of the type of x, or // - when false, has no effect on the type of x. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index 14e9259a9e7..c48034dfc36 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -39,7 +39,7 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 52097af34f7..eaaa656a08e 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -84,7 +84,7 @@ namespace Test { //// [typeGuardOfFormThisMember.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index c65445a3a5a..cb7fa087fe1 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -34,7 +34,7 @@ namespace Test { //// [typeGuardOfFormThisMemberErrors.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 2cae93924bc..9721d17aac4 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -46,7 +46,7 @@ function f4() { //// [typeMatch2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 179e981b8d1..7bad868e33c 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -10,7 +10,7 @@ class D extends C { //// [typeOfSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 15d1c3b396e..4629854dd37 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -4,7 +4,7 @@ class C2 implements T {} //// [typeParameterAsBaseClass.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 2d0962f01d7..64d0f20c2f0 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -14,7 +14,7 @@ interface I2 extends U { } // type parameters cannot be used as base types // these are all errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 2738aa20528..73efba3f0d7 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -14,7 +14,7 @@ function f(a: T) { //// [typeParameterExtendingUnion1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index b3754436f26..17d8d02cd9a 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -14,7 +14,7 @@ function f(a: T) { //// [typeParameterExtendingUnion2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 2f97f4b0d1c..0d30916767e 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -42,7 +42,7 @@ class D extends C { //// [typeRelationships.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index 8711a656bf5..3abbb5cd21b 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -13,7 +13,7 @@ module M2 { //// [typeValueConflict1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 7abda8110b6..604acf71d15 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -20,7 +20,7 @@ module M3 { //// [typeValueConflict2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index f1ec6a77b14..fb04510e23f 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -23,7 +23,7 @@ var r2: typeof d; //// [typeofClass2.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index 045f7b40e55..e46c2a3c267 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -44,7 +44,7 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index b4d42d819ed..37fc51c3f3a 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -42,7 +42,7 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index 4b7813231cf..3d07bc89571 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -5,7 +5,7 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index 7e480d18a0a..393c5e24544 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -124,7 +124,7 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index c8e936af527..3edb48cd2d1 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -50,7 +50,7 @@ class MyView extends View { //// [underscoreMapFirst.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index 000176c213f..c7f30f0ec87 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -26,7 +26,7 @@ class D extends C { //// [underscoreThisInDerivedClass01.js] // @target es5 var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index c1e9494376b..89d3bf5a4f9 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -20,7 +20,7 @@ class D extends C { //// [underscoreThisInDerivedClass02.js] // @target es5 var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index e4d0acc893c..bcb1f28f12b 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -21,7 +21,7 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index 83ad2a34394..a908067574f 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -29,7 +29,7 @@ var arr9 = [e, f]; // (E|F)[] // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index 231b8b27f3b..38c991bed61 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -75,7 +75,7 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index 832868c4b8f..9fed0f3a716 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -34,7 +34,7 @@ class C5 { //// [unknownSymbols1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index 1343bea602e..e4c102d882d 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -155,7 +155,7 @@ module ts { //// [unspecializedConstraints.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index b82a7cbc0ae..a651fdf7e8e 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -45,7 +45,7 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index 0ab1227bf3d..bf5e996d2d2 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -16,7 +16,7 @@ namespace Validation { //// [unusedClassesinNamespace4.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index dbb261e5f2a..6419fbe250b 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -104,7 +104,7 @@ namespace Greeter { //// [unusedIdentifiersConsolidated1.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index 483e905b48a..b5eecf1720d 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -11,7 +11,7 @@ class Super extends Base { //// [validUseOfThisInSuper.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index 0875f2ba1dd..547260c6197 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -26,7 +26,7 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + Object.setPrototypeOf(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; From 7ea37342408df46b9005560235fbcb7eac8bcdd9 Mon Sep 17 00:00:00 2001 From: vvakame Date: Fri, 25 Nov 2016 13:45:37 +0900 Subject: [PATCH 095/289] address feedback --- src/compiler/transformers/es2015.ts | 6 +- ...sClassHeritageListMemberTypeAnnotations.js | 6 +- ...accessibleTypeInTypeParameterConstraint.js | 6 +- .../reference/abstractClassInLocalScope.js | 6 +- .../abstractClassInLocalScopeIsAbstract.js | 6 +- tests/baselines/reference/abstractProperty.js | 6 +- .../reference/abstractPropertyNegative.js | 6 +- .../accessOverriddenBaseClassMember1.js | 6 +- .../accessors_spec_section-4.5_inference.js | 6 +- .../reference/aliasUsageInAccessorsOfClass.js | 6 +- .../baselines/reference/aliasUsageInArray.js | 6 +- .../aliasUsageInFunctionExpression.js | 6 +- .../reference/aliasUsageInGenericFunction.js | 6 +- .../reference/aliasUsageInIndexerOfClass.js | 6 +- .../reference/aliasUsageInObjectLiteral.js | 6 +- .../reference/aliasUsageInOrExpression.js | 6 +- ...aliasUsageInTypeArgumentOfExtendsClause.js | 12 +- .../reference/aliasUsageInVarAssignment.js | 6 +- .../reference/ambiguousOverloadResolution.js | 6 +- .../reference/apparentTypeSubtyping.js | 6 +- .../reference/apparentTypeSupertype.js | 6 +- .../reference/arrayAssignmentTest1.js | 6 +- .../reference/arrayAssignmentTest2.js | 6 +- .../reference/arrayBestCommonTypes.js | 6 +- .../reference/arrayLiteralTypeInference.js | 6 +- tests/baselines/reference/arrayLiterals.js | 6 +- .../arrayLiteralsWithRecursiveGenerics.js | 6 +- ...rayOfSubtypeIsAssignableToReadonlyArray.js | 6 +- .../reference/arrowFunctionContexts.js | 6 +- .../assignmentCompatWithCallSignatures3.js | 6 +- .../assignmentCompatWithCallSignatures4.js | 6 +- .../assignmentCompatWithCallSignatures5.js | 6 +- .../assignmentCompatWithCallSignatures6.js | 6 +- ...ssignmentCompatWithConstructSignatures3.js | 6 +- ...ssignmentCompatWithConstructSignatures4.js | 6 +- ...ssignmentCompatWithConstructSignatures5.js | 6 +- ...ssignmentCompatWithConstructSignatures6.js | 6 +- .../assignmentCompatWithNumericIndexer.js | 6 +- .../assignmentCompatWithNumericIndexer3.js | 6 +- .../assignmentCompatWithObjectMembers4.js | 6 +- ...nmentCompatWithObjectMembersOptionality.js | 6 +- ...mentCompatWithObjectMembersOptionality2.js | 6 +- .../assignmentCompatWithStringIndexer.js | 6 +- .../reference/assignmentLHSIsValue.js | 6 +- .../reference/asyncImportedPromise_es5.js | 6 +- tests/baselines/reference/autolift4.js | 6 +- tests/baselines/reference/baseCheck.js | 6 +- .../reference/baseIndexSignatureResolution.js | 6 +- .../reference/baseTypeOrderChecking.js | 6 +- .../baseTypeWrappingInstantiationChain.js | 6 +- tests/baselines/reference/bases.js | 6 +- .../bestCommonTypeOfConditionalExpressions.js | 6 +- ...bestCommonTypeOfConditionalExpressions2.js | 6 +- .../reference/bestCommonTypeOfTuple2.js | 6 +- ...allSignatureAssignabilityInInheritance2.js | 6 +- ...allSignatureAssignabilityInInheritance3.js | 6 +- ...allSignatureAssignabilityInInheritance4.js | 6 +- ...allSignatureAssignabilityInInheritance5.js | 6 +- ...allSignatureAssignabilityInInheritance6.js | 6 +- tests/baselines/reference/callWithSpread.js | 6 +- .../reference/captureThisInSuperCall.js | 6 +- tests/baselines/reference/castingTuple.js | 6 +- .../baselines/reference/chainedAssignment3.js | 6 +- ...arameterConstrainedToOtherTypeParameter.js | 6 +- .../reference/checkForObjectTooStrict.js | 6 +- .../checkSuperCallBeforeThisAccessing1.js | 6 +- .../checkSuperCallBeforeThisAccessing2.js | 6 +- .../checkSuperCallBeforeThisAccessing3.js | 6 +- .../checkSuperCallBeforeThisAccessing4.js | 6 +- .../checkSuperCallBeforeThisAccessing5.js | 6 +- .../checkSuperCallBeforeThisAccessing6.js | 6 +- .../checkSuperCallBeforeThisAccessing7.js | 6 +- .../checkSuperCallBeforeThisAccessing8.js | 6 +- .../reference/circularImportAlias.js | 6 +- .../circularTypeofWithFunctionModule.js | 6 +- .../classAbstractConstructorAssignability.js | 6 +- .../reference/classAbstractCrashedOnce.js | 6 +- .../reference/classAbstractExtends.js | 6 +- .../reference/classAbstractFactoryFunction.js | 6 +- .../reference/classAbstractGeneric.js | 6 +- .../reference/classAbstractInAModule.js | 6 +- .../reference/classAbstractInheritance.js | 6 +- .../reference/classAbstractInstantiations1.js | 6 +- .../reference/classAbstractInstantiations2.js | 6 +- .../classAbstractOverrideWithAbstract.js | 6 +- .../reference/classAbstractSuperCalls.js | 6 +- .../classAbstractUsingAbstractMethod1.js | 6 +- .../classAbstractUsingAbstractMethods2.js | 6 +- .../classConstructorAccessibility2.js | 6 +- .../classConstructorAccessibility4.js | 6 +- .../classConstructorAccessibility5.js | 6 +- ...classConstructorParametersAccessibility.js | 6 +- ...lassConstructorParametersAccessibility2.js | 6 +- ...lassConstructorParametersAccessibility3.js | 6 +- ...clarationMergedInModuleWithContinuation.js | 6 +- .../classDeclaredBeforeClassFactory.js | 6 +- .../classDoesNotDependOnBaseTypes.js | 6 +- tests/baselines/reference/classExpression2.js | 6 +- tests/baselines/reference/classExpression3.js | 6 +- .../classExpressionExtendingAbstractClass.js | 6 +- .../reference/classExtendingBuiltinType.js | 6 +- .../reference/classExtendingClass.js | 6 +- .../reference/classExtendingClassLikeType.js | 6 +- .../reference/classExtendingNonConstructor.js | 6 +- .../baselines/reference/classExtendingNull.js | 6 +- .../reference/classExtendingPrimitive.js | 6 +- .../reference/classExtendingPrimitive2.js | 6 +- .../reference/classExtendingQualifiedName.js | 6 +- .../reference/classExtendingQualifiedName2.js | 6 +- .../reference/classExtendsAcrossFiles.js | 12 +- ...sMergedWithModuleNotReferingConstructor.js | 6 +- ...tendsClauseClassNotReferringConstructor.js | 6 +- .../reference/classExtendsEveryObjectType.js | 6 +- .../reference/classExtendsEveryObjectType2.js | 6 +- .../reference/classExtendsInterface.js | 6 +- .../classExtendsInterfaceInExpression.js | 6 +- .../classExtendsInterfaceInModule.js | 6 +- .../baselines/reference/classExtendsItself.js | 6 +- .../reference/classExtendsItselfIndirectly.js | 6 +- .../classExtendsItselfIndirectly2.js | 6 +- .../classExtendsItselfIndirectly3.js | 36 +- .../classExtendsMultipleBaseClasses.js | 6 +- tests/baselines/reference/classExtendsNull.js | 6 +- ...classExtendsShadowedConstructorFunction.js | 6 +- .../classExtendsValidConstructorFunction.js | 6 +- .../classHeritageWithTrailingSeparator.js | 6 +- .../reference/classImplementsClass2.js | 6 +- .../reference/classImplementsClass3.js | 6 +- .../reference/classImplementsClass4.js | 6 +- .../reference/classImplementsClass5.js | 6 +- .../reference/classImplementsClass6.js | 6 +- tests/baselines/reference/classIndexer3.js | 6 +- tests/baselines/reference/classInheritence.js | 6 +- .../reference/classIsSubtypeOfBaseType.js | 6 +- tests/baselines/reference/classOrder2.js | 6 +- tests/baselines/reference/classOrderBug.js | 6 +- .../reference/classSideInheritance1.js | 6 +- .../reference/classSideInheritance2.js | 6 +- .../reference/classSideInheritance3.js | 6 +- tests/baselines/reference/classUpdateTests.js | 6 +- .../classWithBaseClassButNoConstructor.js | 6 +- .../reference/classWithConstructors.js | 6 +- .../reference/classWithProtectedProperty.js | 6 +- .../reference/classWithStaticMembers.js | 6 +- tests/baselines/reference/classdecl.js | 6 +- .../reference/clodulesDerivedClasses.js | 6 +- ...llisionSuperAndLocalFunctionInAccessors.js | 6 +- ...isionSuperAndLocalFunctionInConstructor.js | 6 +- .../collisionSuperAndLocalFunctionInMethod.js | 6 +- ...ollisionSuperAndLocalFunctionInProperty.js | 6 +- .../collisionSuperAndLocalVarInAccessors.js | 6 +- .../collisionSuperAndLocalVarInConstructor.js | 6 +- .../collisionSuperAndLocalVarInMethod.js | 6 +- .../collisionSuperAndLocalVarInProperty.js | 6 +- .../collisionSuperAndNameResolution.js | 6 +- .../reference/collisionSuperAndParameter.js | 6 +- .../reference/collisionSuperAndParameter1.js | 6 +- ...perAndPropertyNameAsConstuctorParameter.js | 6 +- ...xpressionAndLocalVarWithSuperExperssion.js | 6 +- .../reference/commentsInheritance.js | 6 +- .../comparisonOperatorWithIdenticalObjects.js | 6 +- ...ithNoRelationshipObjectsOnCallSignature.js | 6 +- ...lationshipObjectsOnConstructorSignature.js | 6 +- ...thNoRelationshipObjectsOnIndexSignature.js | 6 +- ...nshipObjectsOnInstantiatedCallSignature.js | 6 +- ...jectsOnInstantiatedConstructorSignature.js | 6 +- ...peratorWithSubtypeObjectOnCallSignature.js | 6 +- ...WithSubtypeObjectOnConstructorSignature.js | 6 +- ...eratorWithSubtypeObjectOnIndexSignature.js | 6 +- ...ubtypeObjectOnInstantiatedCallSignature.js | 6 +- ...bjectOnInstantiatedConstructorSignature.js | 6 +- ...isonOperatorWithSubtypeObjectOnProperty.js | 6 +- .../reference/complexClassRelationships.js | 6 +- ...catedGenericRecursiveBaseClassReference.js | 6 +- .../reference/compoundAssignmentLHSIsValue.js | 6 +- ...poundExponentiationAssignmentLHSIsValue.js | 6 +- .../reference/computedPropertyNames24_ES5.js | 6 +- .../reference/computedPropertyNames25_ES5.js | 6 +- .../reference/computedPropertyNames26_ES5.js | 6 +- .../reference/computedPropertyNames27_ES5.js | 6 +- .../reference/computedPropertyNames28_ES5.js | 6 +- .../reference/computedPropertyNames30_ES5.js | 6 +- .../reference/computedPropertyNames31_ES5.js | 6 +- .../reference/computedPropertyNames43_ES5.js | 6 +- .../reference/computedPropertyNames44_ES5.js | 6 +- .../reference/computedPropertyNames45_ES5.js | 6 +- .../conditionalOperatorWithIdenticalBCT.js | 6 +- .../conditionalOperatorWithoutIdenticalBCT.js | 6 +- .../reference/constantOverloadFunction.js | 6 +- .../constantOverloadFunctionNoSubtypeError.js | 6 +- ...nstraintCheckInGenericBaseTypeReference.js | 6 +- ...uctSignatureAssignabilityInInheritance2.js | 6 +- ...uctSignatureAssignabilityInInheritance3.js | 6 +- ...uctSignatureAssignabilityInInheritance4.js | 6 +- ...uctSignatureAssignabilityInInheritance5.js | 6 +- ...uctSignatureAssignabilityInInheritance6.js | 6 +- tests/baselines/reference/constructorArgs.js | 6 +- ...uctorFunctionTypeIsAssignableToBaseType.js | 6 +- ...ctorFunctionTypeIsAssignableToBaseType2.js | 6 +- .../constructorHasPrototypeProperty.js | 6 +- .../reference/constructorOverloads2.js | 6 +- .../reference/constructorOverloads3.js | 6 +- .../reference/constructorWithCapturedSuper.js | 6 +- ...constructorWithIncompleteTypeAnnotation.js | 6 +- .../contextualTypingArrayOfLambdas.js | 6 +- ...contextualTypingOfConditionalExpression.js | 6 +- ...ontextualTypingOfConditionalExpression2.js | 6 +- ...urcePropertyIsRelatableToTargetProperty.js | 6 +- .../reference/declFileClassExtendsNull.js | 6 +- .../declFileForFunctionTypeAsTypeParameter.js | 6 +- ...ileGenericClassWithGenericExtendedClass.js | 6 +- .../reference/declFileGenericType.js | 6 +- .../reference/declFileGenericType2.js | 6 +- ...lictingWithClassReferredByExtendsClause.js | 6 +- ...dsClauseThatHasItsContainerNameConflict.js | 6 +- .../declarationEmitExpressionInExtends.js | 6 +- .../declarationEmitExpressionInExtends2.js | 6 +- .../declarationEmitExpressionInExtends3.js | 6 +- .../declarationEmitExpressionInExtends4.js | 6 +- .../declarationEmitNameConflicts3.js | 6 +- .../declarationEmitProtectedMembers.js | 6 +- .../declarationEmitThisPredicates01.js | 6 +- ...tionEmitThisPredicatesWithPrivateName01.js | 6 +- .../reference/declareDottedExtend.js | 6 +- .../reference/decoratorOnClassConstructor2.js | 6 +- .../reference/decoratorOnClassConstructor3.js | 6 +- .../reference/decoratorOnClassMethod12.js | 6 +- ...edClassConstructorWithExplicitReturns01.js | 6 +- ...assConstructorWithExplicitReturns01.js.map | 2 +- ...tructorWithExplicitReturns01.sourcemap.txt | 268 +++--- ...derivedClassConstructorWithoutSuperCall.js | 6 +- ...ClassFunctionOverridesBaseClassAccessor.js | 6 +- .../derivedClassIncludesInheritedMembers.js | 6 +- ...idesIndexersWithAssignmentCompatibility.js | 6 +- .../derivedClassOverridesPrivateFunction1.js | 6 +- .../derivedClassOverridesPrivates.js | 6 +- .../derivedClassOverridesProtectedMembers.js | 6 +- .../derivedClassOverridesProtectedMembers2.js | 6 +- .../derivedClassOverridesProtectedMembers3.js | 6 +- .../derivedClassOverridesProtectedMembers4.js | 6 +- .../derivedClassOverridesPublicMembers.js | 6 +- .../derivedClassOverridesWithoutSubtype.js | 6 +- .../derivedClassParameterProperties.js | 6 +- ...dClassSuperCallsInNonConstructorMembers.js | 6 +- .../derivedClassSuperCallsWithThisArg.js | 6 +- .../reference/derivedClassTransitivity.js | 6 +- .../reference/derivedClassTransitivity2.js | 6 +- .../reference/derivedClassTransitivity3.js | 6 +- .../reference/derivedClassTransitivity4.js | 6 +- .../reference/derivedClassWithAny.js | 6 +- ...ivateInstanceShadowingProtectedInstance.js | 6 +- ...hPrivateInstanceShadowingPublicInstance.js | 6 +- ...thPrivateStaticShadowingProtectedStatic.js | 6 +- ...sWithPrivateStaticShadowingPublicStatic.js | 6 +- .../derivedClassWithoutExplicitConstructor.js | 6 +- ...derivedClassWithoutExplicitConstructor2.js | 6 +- ...derivedClassWithoutExplicitConstructor3.js | 6 +- tests/baselines/reference/derivedClasses.js | 6 +- .../reference/derivedGenericClassWithAny.js | 6 +- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 6 +- .../derivedTypeDoesNotRequireExtendsClause.js | 6 +- .../destructuringParameterDeclaration5.js | 6 +- ...BeforeEmitParameterPropertyDeclaration1.js | 6 +- ...SuperCallBeforeEmitPropertyDeclaration1.js | 6 +- ...arationAndParameterPropertyDeclaration1.js | 6 +- .../reference/emitThisInSuperMethodCall.js | 6 +- tests/baselines/reference/emptyModuleName.js | 6 +- ...rorForwardReferenceForwadingConstructor.js | 6 +- tests/baselines/reference/errorSuperCalls.js | 6 +- .../reference/errorSuperPropertyAccess.js | 6 +- .../reference/errorsInGenericTypeReference.js | 6 +- .../reference/es6ClassSuperCodegenBug.js | 6 +- tests/baselines/reference/es6ClassTest.js | 6 +- tests/baselines/reference/es6ClassTest2.js | 6 +- tests/baselines/reference/es6ClassTest7.js | 6 +- .../exportAssignmentOfGenericType1.js | 6 +- .../exportDeclarationInInternalModule.js | 6 +- tests/baselines/reference/extBaseClass1.js | 6 +- tests/baselines/reference/extBaseClass2.js | 6 +- .../extendAndImplementTheSameBaseType.js | 6 +- .../extendAndImplementTheSameBaseType2.js | 6 +- .../extendBaseClassBeforeItsDeclared.js | 6 +- .../extendClassExpressionFromModule.js | 6 +- .../extendConstructSignatureInInterface.js | 6 +- .../reference/extendNonClassSymbol1.js | 6 +- .../reference/extendNonClassSymbol2.js | 6 +- .../extendPrivateConstructorClass.js | 6 +- ...xtendingClassFromAliasAndUsageInIndexer.js | 12 +- .../reference/extendsClauseAlreadySeen.js | 6 +- .../reference/extendsClauseAlreadySeen2.js | 6 +- tests/baselines/reference/fluentClasses.js | 6 +- tests/baselines/reference/for-inStatements.js | 6 +- .../reference/for-inStatementsInvalid.js | 6 +- .../forStatementsMultipleInvalidDecl.js | 6 +- .../reference/functionImplementationErrors.js | 6 +- .../reference/functionImplementations.js | 6 +- .../reference/functionSubtypingOfVarArgs.js | 6 +- .../reference/functionSubtypingOfVarArgs2.js | 6 +- .../reference/generatedContextualTyping.js | 6 +- .../genericBaseClassLiteralProperty.js | 6 +- .../genericBaseClassLiteralProperty2.js | 6 +- ...allWithConstraintsTypeArgumentInference.js | 6 +- .../genericCallWithObjectTypeArgs2.js | 6 +- ...icCallWithObjectTypeArgsAndConstraints2.js | 6 +- ...icCallWithObjectTypeArgsAndConstraints3.js | 6 +- .../genericCallbacksAndClassHierarchy.js | 6 +- .../genericClassExpressionInFunction.js | 6 +- ...sInheritsConstructorFromNonGenericClass.js | 6 +- ...cClassPropertyInheritanceSpecialization.js | 6 +- .../reference/genericClassStaticMethod.js | 6 +- tests/baselines/reference/genericClasses3.js | 6 +- ...genericConstraintOnExtendedBuiltinTypes.js | 6 +- ...enericConstraintOnExtendedBuiltinTypes2.js | 6 +- .../genericDerivedTypeWithSpecializedBase.js | 6 +- .../genericDerivedTypeWithSpecializedBase2.js | 6 +- .../genericInheritedDefaultConstructors.js | 6 +- .../reference/genericPrototypeProperty2.js | 6 +- .../reference/genericPrototypeProperty3.js | 6 +- ...ericRecursiveImplicitConstructorErrors2.js | 6 +- ...ericRecursiveImplicitConstructorErrors3.js | 6 +- .../reference/genericTypeAssertions2.js | 6 +- .../reference/genericTypeAssertions4.js | 6 +- .../reference/genericTypeAssertions6.js | 6 +- .../reference/genericTypeConstraints.js | 6 +- ...genericTypeReferenceWithoutTypeArgument.js | 6 +- ...enericTypeReferenceWithoutTypeArgument2.js | 6 +- .../genericWithIndexerOfTypeParameterType2.js | 6 +- .../reference/heterogeneousArrayLiterals.js | 6 +- .../reference/ifDoWhileStatements.js | 6 +- .../illegalSuperCallsInConstructor.js | 6 +- .../implementClausePrecedingExtends.js | 6 +- ...gAnInterfaceExtendingClassWithPrivates2.js | 6 +- ...AnInterfaceExtendingClassWithProtecteds.js | 6 +- .../baselines/reference/importAsBaseClass.js | 6 +- tests/baselines/reference/importHelpers.js | 6 +- .../reference/importHelpersNoHelpers.js | 6 +- .../reference/importHelpersNoModule.js | 6 +- .../reference/importShadowsGlobalName.js | 6 +- .../reference/importUsedInExtendsList1.js | 6 +- .../reference/indexerConstraints2.js | 6 +- .../reference/indirectSelfReference.js | 6 +- .../reference/indirectSelfReferenceGeneric.js | 6 +- .../infinitelyExpandingTypesNonGenericBase.js | 6 +- .../inheritFromGenericTypeParameter.js | 6 +- ...SameNamePrivatePropertiesFromSameOrigin.js | 6 +- tests/baselines/reference/inheritance.js | 6 +- tests/baselines/reference/inheritance1.js | 6 +- ...itanceGrandParentPrivateMemberCollision.js | 6 +- ...tPrivateMemberCollisionWithPublicMember.js | 6 +- ...tPublicMemberCollisionWithPrivateMember.js | 6 +- ...ritanceMemberAccessorOverridingAccessor.js | 6 +- ...heritanceMemberAccessorOverridingMethod.js | 6 +- ...ritanceMemberAccessorOverridingProperty.js | 6 +- ...inheritanceMemberFuncOverridingAccessor.js | 6 +- .../inheritanceMemberFuncOverridingMethod.js | 6 +- ...inheritanceMemberFuncOverridingProperty.js | 6 +- ...ritanceMemberPropertyOverridingAccessor.js | 6 +- ...heritanceMemberPropertyOverridingMethod.js | 6 +- ...ritanceMemberPropertyOverridingProperty.js | 6 +- .../inheritanceOfGenericConstructorMethod1.js | 6 +- .../inheritanceOfGenericConstructorMethod2.js | 6 +- ...ritanceStaticAccessorOverridingAccessor.js | 6 +- ...heritanceStaticAccessorOverridingMethod.js | 6 +- ...ritanceStaticAccessorOverridingProperty.js | 6 +- ...inheritanceStaticFuncOverridingAccessor.js | 6 +- ...eStaticFuncOverridingAccessorOfFuncType.js | 6 +- .../inheritanceStaticFuncOverridingMethod.js | 6 +- ...inheritanceStaticFuncOverridingProperty.js | 6 +- ...eStaticFuncOverridingPropertyOfFuncType.js | 6 +- ...taticFunctionOverridingInstanceProperty.js | 6 +- .../inheritanceStaticMembersCompatible.js | 6 +- .../inheritanceStaticMembersIncompatible.js | 6 +- ...ritanceStaticPropertyOverridingAccessor.js | 6 +- ...heritanceStaticPropertyOverridingMethod.js | 6 +- ...ritanceStaticPropertyOverridingProperty.js | 6 +- .../inheritedConstructorWithRestParams.js | 6 +- .../inheritedConstructorWithRestParams2.js | 6 +- .../inheritedModuleMembersForClodule.js | 6 +- .../reference/instanceOfAssignability.js | 6 +- ...nstancePropertiesInheritedIntoClassType.js | 6 +- .../reference/instanceSubtypeCheck2.js | 6 +- ...nstanceofWithStructurallyIdenticalTypes.js | 6 +- .../instantiatedReturnTypeContravariance.js | 6 +- .../reference/interfaceClassMerging.js | 6 +- .../reference/interfaceClassMerging2.js | 6 +- .../reference/interfaceExtendsClass1.js | 6 +- .../interfaceExtendsClassWithPrivate1.js | 6 +- .../interfaceExtendsClassWithPrivate2.js | 6 +- .../reference/interfaceImplementation8.js | 6 +- .../invalidModuleWithStatementsOfEveryKind.js | 6 +- .../invalidMultipleVariableDeclarations.js | 6 +- .../reference/invalidReturnStatements.js | 6 +- .../isolatedModulesImportExportElision.js | 6 +- tests/baselines/reference/jsxViaImport.js | 6 +- .../reference/keyofAndIndexedAccess.js | 6 +- tests/baselines/reference/lambdaArgCrash.js | 6 +- tests/baselines/reference/lift.js | 6 +- tests/baselines/reference/localTypes1.js | 6 +- tests/baselines/reference/m7Bugs.js | 6 +- .../reference/mergedDeclarations5.js | 6 +- .../reference/mergedDeclarations6.js | 6 +- .../mergedInheritedClassInterface.js | 6 +- .../mergedInterfacesWithInheritedPrivates2.js | 6 +- .../mergedInterfacesWithInheritedPrivates3.js | 6 +- .../missingPropertiesOfClassExpression.js | 6 +- tests/baselines/reference/moduleAsBaseType.js | 6 +- .../moduleImportedForTypeArgumentPosition.js | 6 +- .../moduleWithStatementsOfEveryKind.js | 6 +- .../reference/multipleInheritance.js | 6 +- .../mutuallyRecursiveGenericBaseTypes2.js | 6 +- .../noImplicitAnyMissingGetAccessor.js | 6 +- .../noImplicitAnyMissingSetAccessor.js | 6 +- ...enericClassExtendingGenericClassWithAny.js | 6 +- ...cIndexerConstrainsPropertyDeclarations2.js | 6 +- .../reference/numericIndexerConstraint3.js | 6 +- .../reference/numericIndexerConstraint4.js | 6 +- .../reference/numericIndexerTyping2.js | 6 +- ...objectCreationOfElementAccessExpression.js | 6 +- ...objectTypeHidingMembersOfExtendedObject.js | 6 +- ...objectTypesIdentityWithNumericIndexers1.js | 6 +- ...objectTypesIdentityWithNumericIndexers2.js | 6 +- ...objectTypesIdentityWithNumericIndexers3.js | 6 +- .../objectTypesIdentityWithPrivates.js | 6 +- .../objectTypesIdentityWithPrivates2.js | 6 +- .../objectTypesIdentityWithPrivates3.js | 6 +- .../objectTypesIdentityWithStringIndexers.js | 6 +- .../objectTypesIdentityWithStringIndexers2.js | 6 +- .../optionalConstructorArgInSuper.js | 6 +- tests/baselines/reference/optionalMethods.js | 6 +- .../reference/optionalParamArgsTest.js | 6 +- .../reference/optionalParamInOverride.js | 6 +- .../reference/optionalParameterProperty.js | 6 +- .../baselines/reference/outModuleConcatAmd.js | 6 +- .../reference/outModuleConcatAmd.js.map | 2 +- .../outModuleConcatAmd.sourcemap.txt | 62 +- .../reference/outModuleConcatSystem.js | 6 +- .../reference/outModuleConcatSystem.js.map | 2 +- .../outModuleConcatSystem.sourcemap.txt | 62 +- .../reference/outModuleTripleSlashRefs.js | 6 +- .../reference/outModuleTripleSlashRefs.js.map | 2 +- .../outModuleTripleSlashRefs.sourcemap.txt | 90 +- tests/baselines/reference/overload1.js | 6 +- .../overloadOnConstConstraintChecks1.js | 6 +- .../overloadOnConstConstraintChecks2.js | 6 +- .../overloadOnConstConstraintChecks3.js | 6 +- .../overloadOnConstConstraintChecks4.js | 6 +- .../overloadOnConstantsInvalidOverload1.js | 6 +- .../baselines/reference/overloadResolution.js | 6 +- .../overloadResolutionClassConstructors.js | 6 +- .../overloadResolutionConstructors.js | 6 +- .../reference/overloadingOnConstants1.js | 6 +- .../reference/overloadingOnConstants2.js | 6 +- .../overridingPrivateStaticMembers.js | 6 +- .../reference/parseErrorInHeritageClause1.js | 6 +- tests/baselines/reference/parser509630.js | 6 +- tests/baselines/reference/parserAstSpans1.js | 6 +- .../reference/parserClassDeclaration1.js | 6 +- .../reference/parserClassDeclaration3.js | 6 +- .../reference/parserClassDeclaration4.js | 6 +- .../reference/parserClassDeclaration5.js | 6 +- .../reference/parserClassDeclaration6.js | 6 +- ...rrorRecovery_ExtendsOrImplementsClause2.js | 6 +- ...rrorRecovery_ExtendsOrImplementsClause4.js | 6 +- ...rrorRecovery_ExtendsOrImplementsClause5.js | 6 +- .../parserGenericsInTypeContexts1.js | 6 +- .../parserGenericsInTypeContexts2.js | 6 +- .../baselines/reference/parserRealSource10.js | 6 +- .../baselines/reference/parserRealSource11.js | 6 +- tests/baselines/reference/parserharness.js | 6 +- ...artiallyAnnotatedFunctionInferenceError.js | 6 +- ...tatedFunctionInferenceWithTypeParameter.js | 6 +- tests/baselines/reference/primitiveMembers.js | 6 +- tests/baselines/reference/privacyClass.js | 6 +- .../privacyClassExtendsClauseDeclFile.js | 12 +- tests/baselines/reference/privacyGloClass.js | 6 +- .../reference/privateAccessInSubclass1.js | 6 +- .../privateInstanceMemberAccessibility.js | 6 +- ...tedMembersAreNotAccessibleDestructuring.js | 6 +- .../privateStaticMemberAccessibility.js | 6 +- .../privateStaticNotAccessibleInClodule2.js | 6 +- .../amd/testGlo.js | 6 +- .../node/testGlo.js | 6 +- .../reference/project/prologueEmit/amd/out.js | 6 +- .../project/prologueEmit/node/out.js | 6 +- .../amd/m'ain.js | 6 +- .../node/m'ain.js | 6 +- .../reference/propertiesAndIndexers.js | 6 +- tests/baselines/reference/propertyAccess.js | 6 +- ...tyAccessOnTypeParameterWithConstraints2.js | 6 +- ...tyAccessOnTypeParameterWithConstraints3.js | 6 +- ...tyAccessOnTypeParameterWithConstraints5.js | 6 +- ...sPropertyAccessibleWithinNestedSubclass.js | 6 +- ...PropertyAccessibleWithinNestedSubclass1.js | 6 +- ...edClassPropertyAccessibleWithinSubclass.js | 6 +- ...dClassPropertyAccessibleWithinSubclass2.js | 6 +- ...dClassPropertyAccessibleWithinSubclass3.js | 6 +- .../protectedInstanceMemberAccessibility.js | 6 +- tests/baselines/reference/protectedMembers.js | 6 +- ...icClassPropertyAccessibleWithinSubclass.js | 6 +- ...cClassPropertyAccessibleWithinSubclass2.js | 6 +- ...solution-does-not-affect-class-heritage.js | 6 +- .../readonlyConstructorAssignment.js | 6 +- .../reference/recursiveBaseCheck3.js | 6 +- .../reference/recursiveBaseCheck4.js | 6 +- .../reference/recursiveBaseCheck6.js | 6 +- .../recursiveBaseConstructorCreation1.js | 6 +- ...ssInstantiationsWithDefaultConstructors.js | 6 +- .../reference/recursiveClassReferenceTest.js | 6 +- .../recursiveClassReferenceTest.js.map | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 776 +++++++++--------- .../reference/recursiveComplicatedClasses.js | 6 +- ...sivelySpecializedConstructorDeclaration.js | 6 +- .../reference/reexportClassDefinition.js | 6 +- ...lassDeclarationWhenInBaseTypeResolution.js | 6 +- .../reference/returnInConstructor1.js | 6 +- tests/baselines/reference/returnStatements.js | 6 +- ...peCheckExtendedClassInsidePublicMethod2.js | 6 +- ...peCheckExtendedClassInsideStaticMethod1.js | 6 +- tests/baselines/reference/scopeTests.js | 6 +- .../reference/shadowPrivateMembers.js | 6 +- ...sWithDefaultConstructorAndExtendsClause.js | 6 +- ...hDefaultConstructorAndExtendsClause.js.map | 2 +- ...tConstructorAndExtendsClause.sourcemap.txt | 78 +- .../specializedInheritedConstructors1.js | 6 +- .../specializedOverloadWithRestParameters.js | 6 +- tests/baselines/reference/staticFactory1.js | 6 +- .../baselines/reference/staticInheritance.js | 6 +- .../staticMemberAccessOffDerivedType1.js | 6 +- tests/baselines/reference/staticPropSuper.js | 6 +- .../reference/strictModeInConstructor.js | 6 +- .../reference/strictModeReservedWord.js | 6 +- ...trictModeReservedWordInClassDeclaration.js | 6 +- ...gIndexerConstrainsPropertyDeclarations2.js | 6 +- .../reference/subtypesOfTypeParameter.js | 6 +- .../subtypesOfTypeParameterWithConstraints.js | 6 +- ...subtypesOfTypeParameterWithConstraints4.js | 6 +- ...OfTypeParameterWithRecursiveConstraints.js | 6 +- .../reference/subtypingTransitivity.js | 6 +- .../reference/subtypingWithCallSignatures2.js | 6 +- .../reference/subtypingWithCallSignatures3.js | 6 +- .../reference/subtypingWithCallSignatures4.js | 6 +- .../subtypingWithConstructSignatures2.js | 6 +- .../subtypingWithConstructSignatures3.js | 6 +- .../subtypingWithConstructSignatures4.js | 6 +- .../subtypingWithConstructSignatures5.js | 6 +- .../subtypingWithConstructSignatures6.js | 6 +- .../reference/subtypingWithNumericIndexer.js | 6 +- .../reference/subtypingWithNumericIndexer3.js | 6 +- .../reference/subtypingWithNumericIndexer4.js | 6 +- .../reference/subtypingWithObjectMembers.js | 6 +- .../reference/subtypingWithObjectMembers4.js | 6 +- ...subtypingWithObjectMembersAccessibility.js | 6 +- ...ubtypingWithObjectMembersAccessibility2.js | 6 +- .../reference/subtypingWithStringIndexer.js | 6 +- .../reference/subtypingWithStringIndexer3.js | 6 +- .../reference/subtypingWithStringIndexer4.js | 6 +- tests/baselines/reference/super.js | 6 +- tests/baselines/reference/super1.js | 6 +- tests/baselines/reference/super2.js | 6 +- tests/baselines/reference/superAccess.js | 6 +- tests/baselines/reference/superAccess2.js | 6 +- .../reference/superAccessInFatArrow1.js | 6 +- .../reference/superCallArgsMustMatch.js | 6 +- .../reference/superCallAssignResult.js | 6 +- .../superCallBeforeThisAccessing1.js | 6 +- .../superCallBeforeThisAccessing2.js | 6 +- .../superCallBeforeThisAccessing3.js | 6 +- .../superCallBeforeThisAccessing4.js | 6 +- .../superCallBeforeThisAccessing5.js | 6 +- .../superCallBeforeThisAccessing6.js | 6 +- .../superCallBeforeThisAccessing7.js | 6 +- .../superCallBeforeThisAccessing8.js | 6 +- ...allFromClassThatDerivesFromGenericType1.js | 6 +- ...allFromClassThatDerivesFromGenericType2.js | 6 +- ...eButWithIncorrectNumberOfTypeArguments1.js | 6 +- ...sFromGenericTypeButWithNoTypeArguments1.js | 6 +- ...ivesNonGenericTypeButWithTypeArguments1.js | 6 +- .../reference/superCallInNonStaticMethod.js | 6 +- .../reference/superCallInStaticMethod.js | 6 +- .../superCallInsideClassDeclaration.js | 6 +- .../superCallInsideClassExpression.js | 6 +- .../superCallInsideObjectLiteralExpression.js | 6 +- .../reference/superCallOutsideConstructor.js | 6 +- .../superCallParameterContextualTyping1.js | 6 +- .../superCallParameterContextualTyping2.js | 6 +- .../superCallParameterContextualTyping3.js | 6 +- .../reference/superCallWithCommentEmit01.js | 6 +- .../superCallWithMissingBaseClass.js | 6 +- tests/baselines/reference/superCalls.js | 6 +- .../reference/superCallsInConstructor.js | 6 +- tests/baselines/reference/superErrors.js | 6 +- .../baselines/reference/superInCatchBlock1.js | 6 +- .../reference/superInConstructorParam1.js | 6 +- tests/baselines/reference/superInLambdas.js | 6 +- .../reference/superInObjectLiterals_ES5.js | 6 +- tests/baselines/reference/superNewCall1.js | 6 +- .../reference/superPropertyAccess.js | 6 +- .../reference/superPropertyAccess1.js | 6 +- .../reference/superPropertyAccess2.js | 6 +- ...essInComputedPropertiesOfNestedType_ES5.js | 6 +- .../reference/superPropertyAccessNoError.js | 6 +- .../reference/superPropertyAccess_ES5.js | 6 +- .../reference/superSymbolIndexedAccess5.js | 6 +- .../reference/superSymbolIndexedAccess6.js | 6 +- .../superWithGenericSpecialization.js | 6 +- .../baselines/reference/superWithGenerics.js | 6 +- .../reference/superWithTypeArgument.js | 6 +- .../reference/superWithTypeArgument2.js | 6 +- .../reference/superWithTypeArgument3.js | 6 +- ...side-object-literal-getters-and-setters.js | 6 +- tests/baselines/reference/switchStatements.js | 6 +- .../reference/systemModuleWithSuperClass.js | 6 +- .../reference/targetTypeBaseCalls.js | 6 +- .../reference/thisInInvalidContexts.js | 6 +- .../thisInInvalidContextsExternalModule.js | 6 +- tests/baselines/reference/thisInSuperCall.js | 6 +- tests/baselines/reference/thisInSuperCall1.js | 6 +- tests/baselines/reference/thisInSuperCall2.js | 6 +- tests/baselines/reference/thisInSuperCall3.js | 6 +- .../reference/thisTypeInFunctions.js | 6 +- .../reference/thisTypeInFunctionsNegative.js | 6 +- .../tsxCorrectlyParseLessThanComparison1.js | 6 +- .../baselines/reference/tsxDynamicTagName5.js | 6 +- .../baselines/reference/tsxDynamicTagName7.js | 6 +- .../baselines/reference/tsxDynamicTagName8.js | 6 +- .../baselines/reference/tsxDynamicTagName9.js | 6 +- .../reference/tsxExternalModuleEmit1.js | 12 +- .../tsxStatelessFunctionComponents2.js | 6 +- .../reference/tsxUnionTypeComponent1.js | 6 +- tests/baselines/reference/typeAssertions.js | 6 +- .../baselines/reference/typeGuardFunction.js | 6 +- .../reference/typeGuardFunctionErrors.js | 6 +- .../reference/typeGuardFunctionGenerics.js | 6 +- .../reference/typeGuardFunctionOfFormThis.js | 6 +- .../typeGuardFunctionOfFormThisErrors.js | 6 +- .../reference/typeGuardOfFormInstanceOf.js | 6 +- .../reference/typeGuardOfFormIsType.js | 6 +- .../reference/typeGuardOfFormThisMember.js | 6 +- .../typeGuardOfFormThisMemberErrors.js | 6 +- tests/baselines/reference/typeMatch2.js | 6 +- tests/baselines/reference/typeOfSuperCall.js | 6 +- .../reference/typeParameterAsBaseClass.js | 6 +- .../reference/typeParameterAsBaseType.js | 6 +- .../reference/typeParameterExtendingUnion1.js | 6 +- .../reference/typeParameterExtendingUnion2.js | 6 +- .../baselines/reference/typeRelationships.js | 6 +- .../baselines/reference/typeValueConflict1.js | 6 +- .../baselines/reference/typeValueConflict2.js | 6 +- tests/baselines/reference/typeofClass2.js | 6 +- .../typesWithSpecializedCallSignatures.js | 6 +- ...typesWithSpecializedConstructSignatures.js | 6 +- tests/baselines/reference/undeclaredBase.js | 6 +- .../undefinedIsSubtypeOfEverything.js | 6 +- .../baselines/reference/underscoreMapFirst.js | 6 +- .../underscoreThisInDerivedClass01.js | 6 +- .../underscoreThisInDerivedClass02.js | 6 +- .../reference/unionTypeEquivalence.js | 6 +- .../reference/unionTypeFromArrayLiteral.js | 6 +- .../reference/unionTypesAssignability.js | 6 +- tests/baselines/reference/unknownSymbols1.js | 6 +- .../reference/unspecializedConstraints.js | 6 +- ...untypedFunctionCallsWithTypeParameters1.js | 6 +- .../reference/unusedClassesinNamespace4.js | 6 +- .../unusedIdentifiersConsolidated1.js | 6 +- .../reference/validUseOfThisInSuper.js | 6 +- .../reference/varArgsOnConstructorTypes.js | 6 +- 666 files changed, 4006 insertions(+), 1326 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 5dc78701316..fff52a8705e 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3338,7 +3338,11 @@ namespace ts { priority: 0, text: ` var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };` diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index b15cd7f6eb7..fb158c687ba 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -22,7 +22,11 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 955adc72817..ec67e66bd3f 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -26,7 +26,11 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index b413326e26a..8e16f9ccc29 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -9,7 +9,11 @@ //// [abstractClassInLocalScope.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index f143171b54c..40eae697b44 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -9,7 +9,11 @@ //// [abstractClassInLocalScopeIsAbstract.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index 12735de42cb..900f7aebcdd 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -23,7 +23,11 @@ class C extends B { //// [abstractProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index eaad20d1804..fa137057be4 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -45,7 +45,11 @@ abstract class AbstractAccessorMismatch { //// [abstractPropertyNegative.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 2d06be8df96..b468f1307df 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -17,7 +17,11 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index eddb75c2666..aacadd6589f 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -26,7 +26,11 @@ class LanguageSpec_section_4_5_inference { //// [accessors_spec_section-4.5_inference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 817e589d995..df8662ac8cf 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -38,7 +38,11 @@ exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index e0d30fb608b..a8606050394 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -32,7 +32,11 @@ exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 35bf66fed02..2ce51261eaa 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -31,7 +31,11 @@ exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 373aa0c3b40..8e69665b03c 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -35,7 +35,11 @@ exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 9769a4b005f..cf96549def6 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -37,7 +37,11 @@ exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index 2f4abf75161..d660bf2db67 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -32,7 +32,11 @@ exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index c4902a1b894..e81917ed8a3 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -35,7 +35,11 @@ exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index c79f820b106..ee4a62008b1 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -35,7 +35,11 @@ exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -51,7 +55,11 @@ exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 87c41811d4a..83c9bf080be 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -31,7 +31,11 @@ exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 9b141141862..319d3a75d01 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -10,7 +10,11 @@ var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index dc30b51a448..8cc81a46cd7 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -25,7 +25,11 @@ class Derived2 extends Base2 { // error because of the prototy // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index bb002a9798d..ba5d63e3579 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -15,7 +15,11 @@ class Derived extends Base { // error // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 410fb80b323..ac8ada2d86f 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -87,7 +87,11 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index e051b8187cf..a112a5a7a90 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -61,7 +61,11 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index acaa6c76ffc..9ce41a2563a 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -109,7 +109,11 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index d836e0afe1d..a14277c795b 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -53,7 +53,11 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 5e57d827c72..1e5dcd2e45e 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -39,7 +39,11 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index 5b8237c2556..e6e097c8b44 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -27,7 +27,11 @@ var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 6fecfadd07b..701811e33de 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -21,7 +21,11 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 7075cdc0a58..e425ebf9337 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -98,7 +98,11 @@ var asserted2: any; //// [arrowFunctionContexts.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index d4761781bd3..f241b28597d 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -102,7 +102,11 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 1a3d939ba23..eade43f4dc8 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -101,7 +101,11 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 8d33f3565bf..36a024cbd3f 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -68,7 +68,11 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 5949ad582fa..eb727863c77 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -45,7 +45,11 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 97da2c58848..bff2b84f273 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -102,7 +102,11 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 44e9c8e8a36..8aefc846d9b 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -101,7 +101,11 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index a80ece9d4d5..b21074b8ff3 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -68,7 +68,11 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index ea5c5c61e3b..95f585e8929 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -45,7 +45,11 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index f5ec41091e0..05dce80507d 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -46,7 +46,11 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index c6e262c4446..7785aa2b01f 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -43,7 +43,11 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index b7ff16e11fc..dbc0612153f 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -94,7 +94,11 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index b5148d063a7..fcbea350773 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -91,7 +91,11 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 4b22c469791..91f212c9fd9 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -93,7 +93,11 @@ module SourceHasOptional { // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index b319af595cd..a0fb08df8d2 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -56,7 +56,11 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index add2c59e15f..e4fa0fcc6b7 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -72,7 +72,11 @@ foo() = value; //// [assignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index f13b4f962c7..a90d4254c61 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -12,7 +12,11 @@ class Test { //// [task.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 5d27475ba42..d516e1e9b7b 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -25,7 +25,11 @@ class Point3D extends Point { //// [autolift4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 80271d13e83..9684189d565 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -31,7 +31,11 @@ function f() { //// [baseCheck.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index bd6dd5a40e8..b1cb7c05ffc 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -26,7 +26,11 @@ var z: Derived = b.foo(); //// [baseIndexSignatureResolution.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index 1c87fb1dd5d..5f7f6550ab9 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -38,7 +38,11 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index cc6c091b6c7..822c9584e1f 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -29,7 +29,11 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index f23750c4391..e45b934f1ad 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -22,7 +22,11 @@ new C().y; //// [bases.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index 755c3f4ab84..c5e124e638a 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -30,7 +30,11 @@ function foo5(t: T, u: U): Object { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 796706dd248..1390eeb5a5d 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -28,7 +28,11 @@ function foo3(t: T, u: U) { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 1bd3ac45bcc..17c9242e6aa 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -24,7 +24,11 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 3c581096d6b..3d7d1167db5 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -72,7 +72,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 909a9bbb8cb..8674a9def64 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -117,7 +117,11 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index d42769a1e67..3173b6bd661 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -52,7 +52,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 94f5fecd2f8..b1c387fb3e7 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -52,7 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index b73ed7070d8..1b7688262cb 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -55,7 +55,11 @@ interface I9 extends A { // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 2bce24e4637..c5d6bbf2401 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -60,7 +60,11 @@ class D extends C { //// [callWithSpread.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 1a1d5562531..062d50e8ad9 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -10,7 +10,11 @@ class B extends A { //// [captureThisInSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 331a61a6f78..4b45f444f54 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -34,7 +34,11 @@ t4[2] = 10; //// [castingTuple.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 3bfe61f2664..6c8453c2348 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -24,7 +24,11 @@ a = b = new A(); //// [chainedAssignment3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 59a4b8b12ce..769f74d39ae 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -21,7 +21,11 @@ class C extends B { //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index 80f12196d0d..cd65885b152 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -33,7 +33,11 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index 006bdbf356f..fece927ea9c 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -12,7 +12,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 5c35d42ca4f..143514be551 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -12,7 +12,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 16b8181ac5d..a080d62434f 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -17,7 +17,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 9ac1fdaaa21..2309600b2b8 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -21,7 +21,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index 6f8d7589163..cc3838fd40d 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -9,7 +9,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 415bbb06501..e6183330d97 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -12,7 +12,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index 39eea670c57..3040a118a75 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -11,7 +11,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index ff1801d1f93..899128b6836 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -12,7 +12,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 49e1124b467..6f2d3213aeb 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -22,7 +22,11 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index aa2987725bd..92403f0cb6b 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -15,7 +15,11 @@ namespace maker { //// [circularTypeofWithFunctionModule.js] // Repro from #6072 var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 20f3de041be..704ff554a00 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -16,7 +16,11 @@ new CC; //// [classAbstractConstructorAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index 2037dbbc64f..107d8274369 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -12,7 +12,11 @@ var x = new bar(); //// [classAbstractCrashedOnce.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index d7e9a04d189..f9fa0ba2b32 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -18,7 +18,11 @@ class E extends B { //// [classAbstractExtends.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index 71850654425..addb71da717 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -19,7 +19,11 @@ NewB(B); //// [classAbstractFactoryFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index e5f5598c14c..486fe97f838 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -27,7 +27,11 @@ class G extends A { //// [classAbstractGeneric.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 5ff60d21ca9..4681a422c8d 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -9,7 +9,11 @@ new M.B; //// [classAbstractInAModule.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index 90d8216647a..ebaef77181a 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -23,7 +23,11 @@ abstract class GG extends CC {} //// [classAbstractInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 4c6ed144e0b..96a0c1207be 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -29,7 +29,11 @@ c = new B; // Calling new with (non)abstract classes. // var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index e5b678ee715..3b93e78aebd 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -53,7 +53,11 @@ class H { // error -- not declared abstract //// [classAbstractInstantiations2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index 0cf9c039b35..59cd1186ef9 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -25,7 +25,11 @@ class DD extends BB { //// [classAbstractOverrideWithAbstract.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index 30c33822be9..c63b2673713 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -29,7 +29,11 @@ abstract class BB extends AA { //// [classAbstractSuperCalls.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 5aa616dcb7c..421f3278489 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -19,7 +19,11 @@ a.foo(); //// [classAbstractUsingAbstractMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 56aa3937772..397d5a3a411 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -29,7 +29,11 @@ class DD extends AA { //// [classAbstractUsingAbstractMethods2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index eeff60323b7..6cbf33cddff 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -48,7 +48,11 @@ var dc = new DerivedC(1); //// [classConstructorAccessibility2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 199383b6a71..61ce64ef19b 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -32,7 +32,11 @@ class D { //// [classConstructorAccessibility4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index cb01b233781..8d0f9ad4069 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -13,7 +13,11 @@ class Unrelated { //// [classConstructorAccessibility5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index 4b086a854a1..2433a6d3934 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -28,7 +28,11 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 244b56dddc0..b29e3f06503 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -28,7 +28,11 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index ef3e6d5b4bd..10031b9c74e 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -15,7 +15,11 @@ d.p; // public, OK //// [classConstructorParametersAccessibility3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index 1fa51632ba7..1521745f951 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -13,7 +13,11 @@ module M { //// [classDeclarationMergedInModuleWithContinuation.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index c30c913a010..24df98a089f 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -9,7 +9,11 @@ function makeBaseClass() { //// [classDeclaredBeforeClassFactory.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index e195506c294..88a1ab19d14 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -14,7 +14,11 @@ class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 7e78007badc..86d4509310d 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -4,7 +4,11 @@ var v = class C extends D {}; //// [classExpression2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 9c29f35cd19..0d999b57a1a 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -8,7 +8,11 @@ c.c; //// [classExpression3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index 3031f69117a..3c9db5e28ac 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -10,7 +10,11 @@ var C = class extends A { // no error reported! //// [classExpressionExtendingAbstractClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index c0988a01296..d2be7a12da2 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -13,7 +13,11 @@ class C10 extends Array { } //// [classExtendingBuiltinType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index 5b5a1386322..a81efb38bd0 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -33,7 +33,11 @@ var r8 = D2.other(1); //// [classExtendingClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index 1d16866904e..7760490a244 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -60,7 +60,11 @@ class D5 extends getBadBase() { //// [classExtendingClassLikeType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index 74070c3bc0c..d14663b4edc 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -16,7 +16,11 @@ class C7 extends foo { } //// [classExtendingNonConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 3a227b564e9..9ce3714c1bd 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -5,7 +5,11 @@ class C2 extends (null) { } //// [classExtendingNull.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 04fd2d57e52..9e1a855379c 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -17,7 +17,11 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index a85bcb21f09..ff7f19fc68d 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -7,7 +7,11 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index 6c2d5b6c2e4..9a7d4551cf3 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -9,7 +9,11 @@ module M { //// [classExtendingQualifiedName.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index 946a7604ca4..adf590b6804 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -9,7 +9,11 @@ module M { //// [classExtendingQualifiedName2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index 0fa873d378f..45598142549 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -22,7 +22,11 @@ export const b = { //// [b.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -47,7 +51,11 @@ exports.b = { //// [a.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index b164b77d319..187108fcf54 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -15,7 +15,11 @@ module Foo { //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 619d1488ff8..4d63c45f2c9 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -8,7 +8,11 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 044ef0fca51..e5b5651153c 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -18,7 +18,11 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 88929e72c57..9e935e789e4 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -5,7 +5,11 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index 1005ccbdd3f..68167082021 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -10,7 +10,11 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index 511d22e93f1..fa433e139c7 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -10,7 +10,11 @@ class C extends factory(A) {} //// [classExtendsInterfaceInExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index a3034d59df7..933c5162477 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -17,7 +17,11 @@ class D extends Mod.Nested.I {} //// [classExtendsInterfaceInModule.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index ad4ce10cfc6..e13cd6dee6e 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -7,7 +7,11 @@ class E extends E { } // error //// [classExtendsItself.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index dfbfb7720fa..bef7ca9f8cf 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -13,7 +13,11 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 6751b19335d..e9df1ddf908 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -24,7 +24,11 @@ module O { //// [classExtendsItselfIndirectly2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index 750e5ddfd1c..a324fa1ce72 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -20,7 +20,11 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -33,7 +37,11 @@ var C = (function (_super) { }(E)); // error //// [classExtendsItselfIndirectly_file2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -46,7 +54,11 @@ var D = (function (_super) { }(C)); //// [classExtendsItselfIndirectly_file3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -59,7 +71,11 @@ var E = (function (_super) { }(D)); //// [classExtendsItselfIndirectly_file4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -72,7 +88,11 @@ var C2 = (function (_super) { }(E2)); // error //// [classExtendsItselfIndirectly_file5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -85,7 +105,11 @@ var D2 = (function (_super) { }(C2)); //// [classExtendsItselfIndirectly_file6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 6cb987186c4..7cef2b247cc 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -5,7 +5,11 @@ class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index 45cd0132bda..5171dbc0085 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -14,7 +14,11 @@ class D extends null { //// [classExtendsNull.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index fde420bca39..ad16e0aacaa 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -10,7 +10,11 @@ module M { //// [classExtendsShadowedConstructorFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index 7346096d803..4e284b0c64c 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -7,7 +7,11 @@ class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index ab37b45f3be..3314583f338 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -5,7 +5,11 @@ class D extends C, { //// [classHeritageWithTrailingSeparator.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 372f8ce84ef..0aeda35463f 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -15,7 +15,11 @@ c2 = c; //// [classImplementsClass2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 09c2a9fbe6b..40fd20005e1 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -16,7 +16,11 @@ c2 = c; //// [classImplementsClass3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index c80e2152598..631b5b38560 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -18,7 +18,11 @@ c2 = c; //// [classImplementsClass4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index de0bb4469e1..a54c02f4b6b 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -19,7 +19,11 @@ c2 = c; //// [classImplementsClass5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index c87c1b59d2f..c2987ac066e 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -23,7 +23,11 @@ c2.bar(); // should error //// [classImplementsClass6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 759804baa41..8bce9236899 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -12,7 +12,11 @@ class D123 extends C123 { //// [classIndexer3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index 614124c7a09..23506947e9b 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -4,7 +4,11 @@ class A extends A { } //// [classInheritence.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index fe056e41813..df822eff312 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -17,7 +17,11 @@ class Derived2 extends Base<{ bar: string; }> { //// [classIsSubtypeOfBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 34bbf93fd2f..d05dd72e245 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -21,7 +21,11 @@ a.foo(); //// [classOrder2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index 69ed7723a98..22596246d64 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -17,7 +17,11 @@ class foo extends baz {} //// [classOrderBug.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index b3882d64b87..bdaaec468f8 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -17,7 +17,11 @@ C2.bar(); // valid //// [classSideInheritance1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index 8a6564f4f9f..34c7467a864 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -22,7 +22,11 @@ class TextBase implements IText { //// [classSideInheritance2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index 44035af4f30..a9fb0919930 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -20,7 +20,11 @@ var r3: typeof A = C; // ok //// [classSideInheritance3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index d29277a84e4..89dd0bded24 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -115,7 +115,11 @@ class R { //// [classUpdateTests.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index db10ddb0727..b23e0a13ba1 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -42,7 +42,11 @@ var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index 3e038e3a424..c3609f99b86 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -51,7 +51,11 @@ module Generics { //// [classWithConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 35c26afef98..4a1b09ff350 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -30,7 +30,11 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 5deb8f99643..5563e859c6a 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -21,7 +21,11 @@ var r3 = r.foo; //// [classWithStaticMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index 99d7bba92b0..c88b0ccae0e 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -95,7 +95,11 @@ class e { //// [classdecl.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index 209b135fb15..1bb3fc7b705 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -24,7 +24,11 @@ module Path.Utils { //// [clodulesDerivedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index ec87855ba46..2242c6667a6 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -41,7 +41,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInAccessors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index 09f1db5dd40..e761534649e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -26,7 +26,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 40084c7c2a5..70a9b22ddbd 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -30,7 +30,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 457779fe395..258ad86c096 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -20,7 +20,11 @@ class b extends Foo { //// [collisionSuperAndLocalFunctionInProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 92a538bea04..81ef63068e6 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -34,7 +34,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInAccessors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index c498658a974..355bf0af8af 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -22,7 +22,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 94e42d35691..33512c60658 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -20,7 +20,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index 750de147841..ee582bddbc5 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -19,7 +19,11 @@ class b extends Foo { //// [collisionSuperAndLocalVarInProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index dcfd4529266..e36a2a3cbad 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -13,7 +13,11 @@ class Foo extends base { //// [collisionSuperAndNameResolution.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index 408158ba2a5..7413002635d 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -64,7 +64,11 @@ class Foo4 extends Foo { //// [collisionSuperAndParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 58b1cbd4989..0a7e21e8ca2 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -11,7 +11,11 @@ class Foo2 extends Foo { //// [collisionSuperAndParameter1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index f6f38b6f099..5b12a0f9a9d 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -32,7 +32,11 @@ class b4 extends a { //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index 68707fd675d..d3270d4db57 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -20,7 +20,11 @@ class b2 extends a { //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index a1e87482843..691854bffb0 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -153,7 +153,11 @@ i2_i = i3_i; //// [commentsInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 91482033255..3053f86f345 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -196,7 +196,11 @@ var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 95dfc215bfe..bf522a88367 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -170,7 +170,11 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index fbcd4a72b99..50e31f1d79c 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -170,7 +170,11 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index ec2e2556cc9..8e4e7e7840d 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -113,7 +113,11 @@ var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 2e38deb0e55..f208bd500cd 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -151,7 +151,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index 675cce7d49a..4cff1bf0584 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -151,7 +151,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index 634a6448581..0a7cbce0c32 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -261,7 +261,11 @@ var r8b11 = b11 !== a11; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index d7857dcfd2a..bf8a6024faa 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -223,7 +223,11 @@ var r8b9 = b9 !== a9; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index 08f08546aa9..f1e06f733e4 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -109,7 +109,11 @@ var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index ada0ee77486..78a7b456924 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -166,7 +166,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index 28d960fc3c9..d08b7fbf11b 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -166,7 +166,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 62fee91b7a3..d1f29b650c6 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -80,7 +80,11 @@ var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index 3094d43eed2..34cc2754746 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -49,7 +49,11 @@ class FooBase { //// [complexClassRelationships.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index d9317789455..0e3dc9f3d31 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -7,7 +7,11 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index a1f6274b38b..8d17fcbfe10 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -125,7 +125,11 @@ foo() += value; //// [compoundAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index 0c90b7b60f8..e7d1bef436e 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -87,7 +87,11 @@ foo() **= value; //// [compoundExponentiationAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 03b7347165c..426b7cbaa65 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -10,7 +10,11 @@ class C extends Base { //// [computedPropertyNames24_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index e98865176fb..239a5cada1a 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -15,7 +15,11 @@ class C extends Base { //// [computedPropertyNames25_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index c10c3b112e4..89e8dd39169 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -12,7 +12,11 @@ class C extends Base { //// [computedPropertyNames26_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index 0801b4b5e71..7438ea49fd2 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -7,7 +7,11 @@ class C extends Base { //// [computedPropertyNames27_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index dc360dfd86a..132f811b49e 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -12,7 +12,11 @@ class C extends Base { //// [computedPropertyNames28_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 30c6fa33bbe..63e448df3c1 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -17,7 +17,11 @@ class C extends Base { //// [computedPropertyNames30_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 856fbe88f68..e3145b8c0a1 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -17,7 +17,11 @@ class C extends Base { //// [computedPropertyNames31_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index ccc7aed3725..383da77c550 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -14,7 +14,11 @@ class D extends C { //// [computedPropertyNames43_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index d16c7fc2f46..43bf2849333 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -13,7 +13,11 @@ class D extends C { //// [computedPropertyNames44_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 8585f28e5d6..933e6ea66ff 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -14,7 +14,11 @@ class D extends C { //// [computedPropertyNames45_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 030fba2525b..c3a197e2a64 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -49,7 +49,11 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 85633af2a25..0a1e2be65e9 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -25,7 +25,11 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 09e0c2788c4..05cb517f9e0 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -15,7 +15,11 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index dd5bbf27d61..754abfd106e 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -16,7 +16,11 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index a68f1411821..c1747ba54ff 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -21,7 +21,11 @@ class Container { //// [constraintCheckInGenericBaseTypeReference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index f082035064b..9b6d7599516 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -72,7 +72,11 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index ad834dd6cb4..c7b62f9521f 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -115,7 +115,11 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 12fc6bc872f..c328a70455f 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -62,7 +62,11 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 10172a751ab..4f2addd338b 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -52,7 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index 8c0fc83b406..a8bac464ac3 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -55,7 +55,11 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 333cc843162..001a0656c91 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -17,7 +17,11 @@ class Sub extends Super { //// [constructorArgs.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 806ff9581ca..4132399c970 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -21,7 +21,11 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index 4308710ef81..339edd29823 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -35,7 +35,11 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index c36307ee7fe..551b2644518 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -33,7 +33,11 @@ module Generic { //// [constructorHasPrototypeProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index 43553c8f72c..5aca4c6583a 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -27,7 +27,11 @@ f1.bar1(); //// [constructorOverloads2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index fc916a1b283..063f4c72443 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -24,7 +24,11 @@ f1.bar1(); //// [constructorOverloads3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithCapturedSuper.js b/tests/baselines/reference/constructorWithCapturedSuper.js index f128a5f25a0..706d2522cfb 100644 --- a/tests/baselines/reference/constructorWithCapturedSuper.js +++ b/tests/baselines/reference/constructorWithCapturedSuper.js @@ -54,7 +54,11 @@ class D extends A { //// [constructorWithCapturedSuper.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index bcf6ee23d91..6c670b245c5 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -282,7 +282,11 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 6358453f4fa..9a172c202b2 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -16,7 +16,11 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index 70234ea3fec..c573962825b 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -16,7 +16,11 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index 5c40163b2e0..9ee11aeb985 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -14,7 +14,11 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 2afea65e32a..2d7ca989a81 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -12,7 +12,11 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index 0638373ab22..483c1ca4481 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -5,7 +5,11 @@ class ExtendsNull extends null { //// [declFileClassExtendsNull.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index 889ab313c01..f7465149b92 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -11,7 +11,11 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index 005e33950bc..8d0e10f73f9 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -14,7 +14,11 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 47af8dc415a..f579968df06 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -42,7 +42,11 @@ export var j = C.F6; //// [declFileGenericType.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index f6fb93cb28b..4f01f058b19 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -44,7 +44,11 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 45cde43ee4f..8f38d09160f 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -22,7 +22,11 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index c7b4a7483e9..cacaa587609 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -20,7 +20,11 @@ module A.B.C { //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index 34b8206e43a..acda2589195 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -16,7 +16,11 @@ q.s; //// [declarationEmitExpressionInExtends.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 106fe00152b..8f0c53f66ac 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -14,7 +14,11 @@ class MyClass extends getClass(2) { //// [declarationEmitExpressionInExtends2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index c1fbd1fea90..902ddc08bc0 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -46,7 +46,11 @@ export class MyClass4 extends getExportedClass(undefined)>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -18,7 +22,7 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 >^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(6, 1) Source(2, 1) + SourceIndex(0) +1 >Emitted(10, 1) Source(2, 1) + SourceIndex(0) --- >>> function C(value) { 1->^^^^ @@ -33,9 +37,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > constructor( 3 > value: number -1->Emitted(7, 5) Source(7, 5) + SourceIndex(0) -2 >Emitted(7, 16) Source(7, 17) + SourceIndex(0) -3 >Emitted(7, 21) Source(7, 30) + SourceIndex(0) +1->Emitted(11, 5) Source(7, 5) + SourceIndex(0) +2 >Emitted(11, 16) Source(7, 17) + SourceIndex(0) +3 >Emitted(11, 21) Source(7, 30) + SourceIndex(0) --- >>> this.cProp = 10; 1->^^^^^^^^ @@ -48,11 +52,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > = 4 > 10 5 > ; -1->Emitted(8, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(8, 19) Source(3, 10) + SourceIndex(0) -3 >Emitted(8, 22) Source(3, 13) + SourceIndex(0) -4 >Emitted(8, 24) Source(3, 15) + SourceIndex(0) -5 >Emitted(8, 25) Source(3, 16) + SourceIndex(0) +1->Emitted(12, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(12, 19) Source(3, 10) + SourceIndex(0) +3 >Emitted(12, 22) Source(3, 13) + SourceIndex(0) +4 >Emitted(12, 24) Source(3, 15) + SourceIndex(0) +5 >Emitted(12, 25) Source(3, 16) + SourceIndex(0) --- >>> return { 1 >^^^^^^^^ @@ -67,9 +71,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > return 3 > -1 >Emitted(9, 9) Source(8, 9) + SourceIndex(0) -2 >Emitted(9, 15) Source(8, 15) + SourceIndex(0) -3 >Emitted(9, 16) Source(8, 16) + SourceIndex(0) +1 >Emitted(13, 9) Source(8, 9) + SourceIndex(0) +2 >Emitted(13, 15) Source(8, 15) + SourceIndex(0) +3 >Emitted(13, 16) Source(8, 16) + SourceIndex(0) --- >>> cProp: value, 1->^^^^^^^^^^^^ @@ -82,10 +86,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > cProp 3 > : 4 > value -1->Emitted(10, 13) Source(9, 13) + SourceIndex(0) -2 >Emitted(10, 18) Source(9, 18) + SourceIndex(0) -3 >Emitted(10, 20) Source(9, 20) + SourceIndex(0) -4 >Emitted(10, 25) Source(9, 25) + SourceIndex(0) +1->Emitted(14, 13) Source(9, 13) + SourceIndex(0) +2 >Emitted(14, 18) Source(9, 18) + SourceIndex(0) +3 >Emitted(14, 20) Source(9, 20) + SourceIndex(0) +4 >Emitted(14, 25) Source(9, 25) + SourceIndex(0) --- >>> foo: function () { 1->^^^^^^^^^^^^ @@ -94,8 +98,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1->, > 2 > foo -1->Emitted(11, 13) Source(10, 13) + SourceIndex(0) -2 >Emitted(11, 16) Source(10, 16) + SourceIndex(0) +1->Emitted(15, 13) Source(10, 13) + SourceIndex(0) +2 >Emitted(15, 16) Source(10, 16) + SourceIndex(0) --- >>> return "well this looks kinda C-ish."; 1->^^^^^^^^^^^^^^^^ @@ -109,11 +113,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > 4 > "well this looks kinda C-ish." 5 > ; -1->Emitted(12, 17) Source(11, 17) + SourceIndex(0) -2 >Emitted(12, 23) Source(11, 23) + SourceIndex(0) -3 >Emitted(12, 24) Source(11, 24) + SourceIndex(0) -4 >Emitted(12, 54) Source(11, 54) + SourceIndex(0) -5 >Emitted(12, 55) Source(11, 55) + SourceIndex(0) +1->Emitted(16, 17) Source(11, 17) + SourceIndex(0) +2 >Emitted(16, 23) Source(11, 23) + SourceIndex(0) +3 >Emitted(16, 24) Source(11, 24) + SourceIndex(0) +4 >Emitted(16, 54) Source(11, 54) + SourceIndex(0) +5 >Emitted(16, 55) Source(11, 55) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^ @@ -121,8 +125,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(13, 13) Source(12, 13) + SourceIndex(0) -2 >Emitted(13, 14) Source(12, 14) + SourceIndex(0) +1 >Emitted(17, 13) Source(12, 13) + SourceIndex(0) +2 >Emitted(17, 14) Source(12, 14) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^ @@ -130,8 +134,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > } 2 > -1 >Emitted(14, 10) Source(13, 10) + SourceIndex(0) -2 >Emitted(14, 11) Source(13, 10) + SourceIndex(0) +1 >Emitted(18, 10) Source(13, 10) + SourceIndex(0) +2 >Emitted(18, 11) Source(13, 10) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -140,8 +144,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(15, 5) Source(14, 5) + SourceIndex(0) -2 >Emitted(15, 6) Source(14, 6) + SourceIndex(0) +1 >Emitted(19, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(19, 6) Source(14, 6) + SourceIndex(0) --- >>> C.prototype.foo = function () { return "this never gets used."; }; 1->^^^^ @@ -164,16 +168,16 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 8 > ; 9 > 10> } -1->Emitted(16, 5) Source(5, 5) + SourceIndex(0) -2 >Emitted(16, 20) Source(5, 8) + SourceIndex(0) -3 >Emitted(16, 23) Source(5, 5) + SourceIndex(0) -4 >Emitted(16, 37) Source(5, 13) + SourceIndex(0) -5 >Emitted(16, 43) Source(5, 19) + SourceIndex(0) -6 >Emitted(16, 44) Source(5, 20) + SourceIndex(0) -7 >Emitted(16, 67) Source(5, 43) + SourceIndex(0) -8 >Emitted(16, 68) Source(5, 44) + SourceIndex(0) -9 >Emitted(16, 69) Source(5, 45) + SourceIndex(0) -10>Emitted(16, 70) Source(5, 46) + SourceIndex(0) +1->Emitted(20, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(20, 20) Source(5, 8) + SourceIndex(0) +3 >Emitted(20, 23) Source(5, 5) + SourceIndex(0) +4 >Emitted(20, 37) Source(5, 13) + SourceIndex(0) +5 >Emitted(20, 43) Source(5, 19) + SourceIndex(0) +6 >Emitted(20, 44) Source(5, 20) + SourceIndex(0) +7 >Emitted(20, 67) Source(5, 43) + SourceIndex(0) +8 >Emitted(20, 68) Source(5, 44) + SourceIndex(0) +9 >Emitted(20, 69) Source(5, 45) + SourceIndex(0) +10>Emitted(20, 70) Source(5, 46) + SourceIndex(0) --- >>> return C; 1 >^^^^ @@ -190,8 +194,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > } > 2 > } -1 >Emitted(17, 5) Source(15, 1) + SourceIndex(0) -2 >Emitted(17, 13) Source(15, 2) + SourceIndex(0) +1 >Emitted(21, 5) Source(15, 1) + SourceIndex(0) +2 >Emitted(21, 13) Source(15, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -216,10 +220,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > } > } > } -1 >Emitted(18, 1) Source(15, 1) + SourceIndex(0) -2 >Emitted(18, 2) Source(15, 2) + SourceIndex(0) -3 >Emitted(18, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(18, 6) Source(15, 2) + SourceIndex(0) +1 >Emitted(22, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(22, 2) Source(15, 2) + SourceIndex(0) +3 >Emitted(22, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(22, 6) Source(15, 2) + SourceIndex(0) --- >>>var D = (function (_super) { 1-> @@ -227,15 +231,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > > -1->Emitted(19, 1) Source(17, 1) + SourceIndex(0) +1->Emitted(23, 1) Source(17, 1) + SourceIndex(0) --- >>> __extends(D, _super); 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->class D extends 2 > C -1->Emitted(20, 5) Source(17, 17) + SourceIndex(0) -2 >Emitted(20, 26) Source(17, 18) + SourceIndex(0) +1->Emitted(24, 5) Source(17, 17) + SourceIndex(0) +2 >Emitted(24, 26) Source(17, 18) + SourceIndex(0) --- >>> function D(a) { 1 >^^^^ @@ -248,9 +252,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > constructor( 3 > a = 100 -1 >Emitted(21, 5) Source(20, 5) + SourceIndex(0) -2 >Emitted(21, 16) Source(20, 17) + SourceIndex(0) -3 >Emitted(21, 17) Source(20, 24) + SourceIndex(0) +1 >Emitted(25, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(25, 16) Source(20, 17) + SourceIndex(0) +3 >Emitted(25, 17) Source(20, 24) + SourceIndex(0) --- >>> if (a === void 0) { a = 100; } 1->^^^^^^^^ @@ -262,10 +266,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > 3 > 4 > a = 100 -1->Emitted(22, 9) Source(20, 17) + SourceIndex(0) -2 >Emitted(22, 27) Source(20, 17) + SourceIndex(0) -3 >Emitted(22, 29) Source(20, 17) + SourceIndex(0) -4 >Emitted(22, 36) Source(20, 24) + SourceIndex(0) +1->Emitted(26, 9) Source(20, 17) + SourceIndex(0) +2 >Emitted(26, 27) Source(20, 17) + SourceIndex(0) +3 >Emitted(26, 29) Source(20, 17) + SourceIndex(0) +4 >Emitted(26, 36) Source(20, 24) + SourceIndex(0) --- >>> var _this = _super.call(this, a) || this; 1->^^^^^^^^ @@ -294,12 +298,12 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > else > return null; > } -1->Emitted(23, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(23, 21) Source(21, 9) + SourceIndex(0) -3 >Emitted(23, 39) Source(21, 15) + SourceIndex(0) -4 >Emitted(23, 40) Source(21, 16) + SourceIndex(0) -5 >Emitted(23, 41) Source(21, 17) + SourceIndex(0) -6 >Emitted(23, 50) Source(33, 6) + SourceIndex(0) +1->Emitted(27, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(27, 21) Source(21, 9) + SourceIndex(0) +3 >Emitted(27, 39) Source(21, 15) + SourceIndex(0) +4 >Emitted(27, 40) Source(21, 16) + SourceIndex(0) +5 >Emitted(27, 41) Source(21, 17) + SourceIndex(0) +6 >Emitted(27, 50) Source(33, 6) + SourceIndex(0) --- >>> _this.dProp = function () { return _this; }; 1->^^^^^^^^ @@ -320,15 +324,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 7 > 8 > this 9 > ; -1->Emitted(24, 9) Source(18, 5) + SourceIndex(0) -2 >Emitted(24, 20) Source(18, 10) + SourceIndex(0) -3 >Emitted(24, 23) Source(18, 13) + SourceIndex(0) -4 >Emitted(24, 37) Source(18, 19) + SourceIndex(0) -5 >Emitted(24, 44) Source(18, 19) + SourceIndex(0) -6 >Emitted(24, 49) Source(18, 23) + SourceIndex(0) -7 >Emitted(24, 51) Source(18, 19) + SourceIndex(0) -8 >Emitted(24, 52) Source(18, 23) + SourceIndex(0) -9 >Emitted(24, 53) Source(18, 24) + SourceIndex(0) +1->Emitted(28, 9) Source(18, 5) + SourceIndex(0) +2 >Emitted(28, 20) Source(18, 10) + SourceIndex(0) +3 >Emitted(28, 23) Source(18, 13) + SourceIndex(0) +4 >Emitted(28, 37) Source(18, 19) + SourceIndex(0) +5 >Emitted(28, 44) Source(18, 19) + SourceIndex(0) +6 >Emitted(28, 49) Source(18, 23) + SourceIndex(0) +7 >Emitted(28, 51) Source(18, 19) + SourceIndex(0) +8 >Emitted(28, 52) Source(18, 23) + SourceIndex(0) +9 >Emitted(28, 53) Source(18, 24) + SourceIndex(0) --- >>> if (Math.random() < 0.5) { 1 >^^^^^^^^ @@ -362,19 +366,19 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 11> ) 12> 13> { -1 >Emitted(25, 9) Source(23, 9) + SourceIndex(0) -2 >Emitted(25, 11) Source(23, 11) + SourceIndex(0) -3 >Emitted(25, 12) Source(23, 12) + SourceIndex(0) -4 >Emitted(25, 13) Source(23, 13) + SourceIndex(0) -5 >Emitted(25, 17) Source(23, 17) + SourceIndex(0) -6 >Emitted(25, 18) Source(23, 18) + SourceIndex(0) -7 >Emitted(25, 24) Source(23, 24) + SourceIndex(0) -8 >Emitted(25, 26) Source(23, 26) + SourceIndex(0) -9 >Emitted(25, 29) Source(23, 29) + SourceIndex(0) -10>Emitted(25, 32) Source(23, 32) + SourceIndex(0) -11>Emitted(25, 33) Source(23, 33) + SourceIndex(0) -12>Emitted(25, 34) Source(23, 34) + SourceIndex(0) -13>Emitted(25, 35) Source(23, 35) + SourceIndex(0) +1 >Emitted(29, 9) Source(23, 9) + SourceIndex(0) +2 >Emitted(29, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(29, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(29, 13) Source(23, 13) + SourceIndex(0) +5 >Emitted(29, 17) Source(23, 17) + SourceIndex(0) +6 >Emitted(29, 18) Source(23, 18) + SourceIndex(0) +7 >Emitted(29, 24) Source(23, 24) + SourceIndex(0) +8 >Emitted(29, 26) Source(23, 26) + SourceIndex(0) +9 >Emitted(29, 29) Source(23, 29) + SourceIndex(0) +10>Emitted(29, 32) Source(23, 32) + SourceIndex(0) +11>Emitted(29, 33) Source(23, 33) + SourceIndex(0) +12>Emitted(29, 34) Source(23, 34) + SourceIndex(0) +13>Emitted(29, 35) Source(23, 35) + SourceIndex(0) --- >>> "You win!"; 1 >^^^^^^^^^^^^ @@ -384,9 +388,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > "You win!" 3 > -1 >Emitted(26, 13) Source(24, 13) + SourceIndex(0) -2 >Emitted(26, 23) Source(24, 23) + SourceIndex(0) -3 >Emitted(26, 24) Source(24, 23) + SourceIndex(0) +1 >Emitted(30, 13) Source(24, 13) + SourceIndex(0) +2 >Emitted(30, 23) Source(24, 23) + SourceIndex(0) +3 >Emitted(30, 24) Source(24, 23) + SourceIndex(0) --- >>> return { 1 >^^^^^^^^^^^^ @@ -397,9 +401,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > return 3 > -1 >Emitted(27, 13) Source(25, 13) + SourceIndex(0) -2 >Emitted(27, 19) Source(25, 19) + SourceIndex(0) -3 >Emitted(27, 20) Source(25, 20) + SourceIndex(0) +1 >Emitted(31, 13) Source(25, 13) + SourceIndex(0) +2 >Emitted(31, 19) Source(25, 19) + SourceIndex(0) +3 >Emitted(31, 20) Source(25, 20) + SourceIndex(0) --- >>> cProp: 1, 1->^^^^^^^^^^^^^^^^ @@ -412,10 +416,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > cProp 3 > : 4 > 1 -1->Emitted(28, 17) Source(26, 17) + SourceIndex(0) -2 >Emitted(28, 22) Source(26, 22) + SourceIndex(0) -3 >Emitted(28, 24) Source(26, 24) + SourceIndex(0) -4 >Emitted(28, 25) Source(26, 25) + SourceIndex(0) +1->Emitted(32, 17) Source(26, 17) + SourceIndex(0) +2 >Emitted(32, 22) Source(26, 22) + SourceIndex(0) +3 >Emitted(32, 24) Source(26, 24) + SourceIndex(0) +4 >Emitted(32, 25) Source(26, 25) + SourceIndex(0) --- >>> dProp: function () { return _this; }, 1->^^^^^^^^^^^^^^^^ @@ -436,14 +440,14 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 6 > this 7 > 8 > this -1->Emitted(29, 17) Source(27, 17) + SourceIndex(0) -2 >Emitted(29, 22) Source(27, 22) + SourceIndex(0) -3 >Emitted(29, 24) Source(27, 24) + SourceIndex(0) -4 >Emitted(29, 38) Source(27, 30) + SourceIndex(0) -5 >Emitted(29, 45) Source(27, 30) + SourceIndex(0) -6 >Emitted(29, 50) Source(27, 34) + SourceIndex(0) -7 >Emitted(29, 52) Source(27, 30) + SourceIndex(0) -8 >Emitted(29, 53) Source(27, 34) + SourceIndex(0) +1->Emitted(33, 17) Source(27, 17) + SourceIndex(0) +2 >Emitted(33, 22) Source(27, 22) + SourceIndex(0) +3 >Emitted(33, 24) Source(27, 24) + SourceIndex(0) +4 >Emitted(33, 38) Source(27, 30) + SourceIndex(0) +5 >Emitted(33, 45) Source(27, 30) + SourceIndex(0) +6 >Emitted(33, 50) Source(27, 34) + SourceIndex(0) +7 >Emitted(33, 52) Source(27, 30) + SourceIndex(0) +8 >Emitted(33, 53) Source(27, 34) + SourceIndex(0) --- >>> foo: function () { return "You win!!!!!"; } 1->^^^^^^^^^^^^^^^^ @@ -465,15 +469,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 7 > 8 > 9 > } -1->Emitted(30, 17) Source(28, 17) + SourceIndex(0) -2 >Emitted(30, 20) Source(28, 20) + SourceIndex(0) -3 >Emitted(30, 36) Source(28, 25) + SourceIndex(0) -4 >Emitted(30, 42) Source(28, 31) + SourceIndex(0) -5 >Emitted(30, 43) Source(28, 32) + SourceIndex(0) -6 >Emitted(30, 57) Source(28, 46) + SourceIndex(0) -7 >Emitted(30, 58) Source(28, 46) + SourceIndex(0) -8 >Emitted(30, 59) Source(28, 47) + SourceIndex(0) -9 >Emitted(30, 60) Source(28, 48) + SourceIndex(0) +1->Emitted(34, 17) Source(28, 17) + SourceIndex(0) +2 >Emitted(34, 20) Source(28, 20) + SourceIndex(0) +3 >Emitted(34, 36) Source(28, 25) + SourceIndex(0) +4 >Emitted(34, 42) Source(28, 31) + SourceIndex(0) +5 >Emitted(34, 43) Source(28, 32) + SourceIndex(0) +6 >Emitted(34, 57) Source(28, 46) + SourceIndex(0) +7 >Emitted(34, 58) Source(28, 46) + SourceIndex(0) +8 >Emitted(34, 59) Source(28, 47) + SourceIndex(0) +9 >Emitted(34, 60) Source(28, 48) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^ @@ -481,8 +485,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > } 2 > ; -1 >Emitted(31, 14) Source(29, 14) + SourceIndex(0) -2 >Emitted(31, 15) Source(29, 15) + SourceIndex(0) +1 >Emitted(35, 14) Source(29, 14) + SourceIndex(0) +2 >Emitted(35, 15) Source(29, 15) + SourceIndex(0) --- >>> } 1 >^^^^^^^^ @@ -491,8 +495,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(32, 9) Source(30, 9) + SourceIndex(0) -2 >Emitted(32, 10) Source(30, 10) + SourceIndex(0) +1 >Emitted(36, 9) Source(30, 9) + SourceIndex(0) +2 >Emitted(36, 10) Source(30, 10) + SourceIndex(0) --- >>> else 1->^^^^^^^^ @@ -501,8 +505,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > 2 > else -1->Emitted(33, 9) Source(31, 9) + SourceIndex(0) -2 >Emitted(33, 13) Source(31, 13) + SourceIndex(0) +1->Emitted(37, 9) Source(31, 9) + SourceIndex(0) +2 >Emitted(37, 13) Source(31, 13) + SourceIndex(0) --- >>> return null; 1->^^^^^^^^^^^^ @@ -516,11 +520,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > 4 > null 5 > ; -1->Emitted(34, 13) Source(32, 13) + SourceIndex(0) -2 >Emitted(34, 19) Source(32, 19) + SourceIndex(0) -3 >Emitted(34, 20) Source(32, 20) + SourceIndex(0) -4 >Emitted(34, 24) Source(32, 24) + SourceIndex(0) -5 >Emitted(34, 25) Source(32, 25) + SourceIndex(0) +1->Emitted(38, 13) Source(32, 13) + SourceIndex(0) +2 >Emitted(38, 19) Source(32, 19) + SourceIndex(0) +3 >Emitted(38, 20) Source(32, 20) + SourceIndex(0) +4 >Emitted(38, 24) Source(32, 24) + SourceIndex(0) +5 >Emitted(38, 25) Source(32, 25) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -529,8 +533,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(35, 5) Source(33, 5) + SourceIndex(0) -2 >Emitted(35, 6) Source(33, 6) + SourceIndex(0) +1 >Emitted(39, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(39, 6) Source(33, 6) + SourceIndex(0) --- >>> return D; 1->^^^^ @@ -538,8 +542,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > 2 > } -1->Emitted(36, 5) Source(34, 1) + SourceIndex(0) -2 >Emitted(36, 13) Source(34, 2) + SourceIndex(0) +1->Emitted(40, 5) Source(34, 1) + SourceIndex(0) +2 >Emitted(40, 13) Source(34, 2) + SourceIndex(0) --- >>>}(C)); 1 > @@ -572,11 +576,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > return null; > } > } -1 >Emitted(37, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(37, 2) Source(34, 2) + SourceIndex(0) -3 >Emitted(37, 2) Source(17, 1) + SourceIndex(0) -4 >Emitted(37, 3) Source(17, 17) + SourceIndex(0) -5 >Emitted(37, 4) Source(17, 18) + SourceIndex(0) -6 >Emitted(37, 7) Source(34, 2) + SourceIndex(0) +1 >Emitted(41, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(41, 2) Source(34, 2) + SourceIndex(0) +3 >Emitted(41, 2) Source(17, 1) + SourceIndex(0) +4 >Emitted(41, 3) Source(17, 17) + SourceIndex(0) +5 >Emitted(41, 4) Source(17, 18) + SourceIndex(0) +6 >Emitted(41, 7) Source(34, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 55ceea201ed..31c8c3f722c 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -35,7 +35,11 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index fe6be20e2ac..b948302a2d5 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -16,7 +16,11 @@ class Derived extends Base { //// [derivedClassFunctionOverridesBaseClassAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 8b6f6fe34cb..cf5454d704f 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -42,7 +42,11 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index 80fd6fd251c..0d483a3eff6 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -19,7 +19,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index c5d48de031e..8306e702cb1 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -17,7 +17,11 @@ new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index fa4b88bdc56..c32560eca59 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -17,7 +17,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesPrivates.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index b4fb59ffd2c..03addf8ace5 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -38,7 +38,11 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 13f2cfc4698..0cfe6f3dd9d 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -65,7 +65,11 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index 24602737e6b..d18fd9d1a30 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -73,7 +73,11 @@ class Derived10 extends Base { //// [derivedClassOverridesProtectedMembers3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index add886d1985..2d89040ff13 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -16,7 +16,11 @@ class Derived2 extends Derived1 { //// [derivedClassOverridesProtectedMembers4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index d8fa9e82683..2ef057082bd 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -64,7 +64,11 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index bcd4e505721..4a1f7c0cbeb 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -25,7 +25,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesWithoutSubtype.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index cb08d4d8545..cdf1ab4cbbd 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -97,7 +97,11 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index cf7845a4d9a..c7a90e31dfe 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -34,7 +34,11 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 59a4ff7e1d1..3d3aacdf55b 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -30,7 +30,11 @@ class Derived4 extends Base { //// [derivedClassSuperCallsWithThisArg.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index 6a6b713f250..c5ea3722feb 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -23,7 +23,11 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index 2d05dd09cee..bf9f1dbb574 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -23,7 +23,11 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index 6c02e2055d9..d149d9f5aa9 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -23,7 +23,11 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 7d375e8e94e..2d48cf28728 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -23,7 +23,11 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 51b4e5739f6..b376364e542 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -61,7 +61,11 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 8a86f4ab4a9..e5fe6eb2560 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -24,7 +24,11 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index fab643265cb..5ac36e99b57 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -34,7 +34,11 @@ Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 322514e1c82..9994c1bfb05 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -23,7 +23,11 @@ class Derived extends Base { //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 8c01a45e1ae..4183017f378 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -35,7 +35,11 @@ Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index 462819c551d..d21cb14bcc4 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -27,7 +27,11 @@ var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 6e7c75ef37d..0acf65cd177 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -35,7 +35,11 @@ var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index 4d4527c172e..696ebcc1f9e 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -49,7 +49,11 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index 00bdfcfde4e..36f1dcc799b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -32,7 +32,11 @@ b.hue(); //// [derivedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 410027ce76d..afba93ccac6 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -44,7 +44,11 @@ var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index 367b0d895cf..c33bd3713fc 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -19,7 +19,11 @@ class Derived extends Base { //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index c890a28b110..3e28aece101 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -22,7 +22,11 @@ var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index d7b75ede23d..0c27e9b7f85 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -53,7 +53,11 @@ d3({ y: "world" }); //// [destructuringParameterDeclaration5.js] // Parameter Declaration with generic var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index fbc08b66624..80613c66be8 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -15,7 +15,11 @@ class B extends A { //// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index 1328ece2af0..c0478a993c4 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -17,7 +17,11 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index a9883b26e30..5d63f4f32af 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -15,7 +15,11 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 1e23553a2d9..22d641e3414 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -29,7 +29,11 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index 404abf6a42c..f6f4ea759a6 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -6,7 +6,11 @@ class B extends A { //// [emptyModuleName.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 2bfac7ec0f0..3320b144f11 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -13,7 +13,11 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 4e228777567..69691a62bb7 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -76,7 +76,11 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 62bb9919171..ed9ac2d8dd5 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -130,7 +130,11 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index bb80f73f216..e63005bfe1a 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -74,7 +74,11 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index fc6ad83738d..af87c3db821 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -16,7 +16,11 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 8fa5be0ba3e..a20d939a794 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -86,7 +86,11 @@ declare module AmbientMod { //// [es6ClassTest.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 7004c7056f2..11d494c6291 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -160,7 +160,11 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 20d46e6b53c..9cd21f44685 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -10,7 +10,11 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 431da58c12e..e5d43bfaa9e 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -25,7 +25,11 @@ define(["require", "exports"], function (require, exports) { }); //// [exportAssignmentOfGenericType1_1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index ddc2e15a5b2..934b3bb6ef0 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -20,7 +20,11 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index d8eb5e75f9f..4603ff26320 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -21,7 +21,11 @@ module N { //// [extBaseClass1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index 474a91d2a72..285c96551b5 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -12,7 +12,11 @@ module M { //// [extBaseClass2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index 1342df1b992..b3150a12bde 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -15,7 +15,11 @@ d.foo; //// [extendAndImplementTheSameBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index 38b76b19942..1ecd77668d3 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -18,7 +18,11 @@ var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 8cf51642831..73c19b72565 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -5,7 +5,11 @@ class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 27420b55d1c..bd3e01a7b29 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -22,7 +22,11 @@ module.exports = x; //// [foo2.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index db87c4c14fd..28c5108f238 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -12,7 +12,11 @@ var e: E = new E(1); //// [extendConstructSignatureInInterface.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index 00326e24103..8a6da5f4fa7 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -5,7 +5,11 @@ class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index ce030629af5..60f7a46a14f 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -7,7 +7,11 @@ class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 52b96e31611..983c7220397 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -11,7 +11,11 @@ class C extends abc.XYZ { //// [extendPrivateConstructorClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index 92c5dc69681..af5f78dfcec 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -43,7 +43,11 @@ exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -59,7 +63,11 @@ exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index 37cdd0eb9bc..06326b54282 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -8,7 +8,11 @@ class D extends C extends C { //// [extendsClauseAlreadySeen.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index bc4306884a3..71555248556 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -8,7 +8,11 @@ class D extends C extends C { //// [extendsClauseAlreadySeen2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index ade60a06331..360c7775d35 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -20,7 +20,11 @@ var z = c.foo().bar().baz(); // Fluent pattern //// [fluentClasses.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index b34fd91192b..90ab9a3f96b 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -82,7 +82,11 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 3d39fb2903b..2ba55110f2e 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -65,7 +65,11 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 8ca8c794cf5..31398cb2af9 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -56,7 +56,11 @@ for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 5c8defcf814..a91b1b78f07 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -76,7 +76,11 @@ var f13 = () => { //// [functionImplementationErrors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index e73e5095701..4854d715c32 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -159,7 +159,11 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC //// [functionImplementations.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 89e8b1e95ef..4cd1f1096f3 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -16,7 +16,11 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index be9c293ae72..fc3562ca339 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -16,7 +16,11 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 06abd1b9a8b..0cf8767aa58 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -357,7 +357,11 @@ var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } //// [generatedContextualTyping.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index b572cfae97d..753aa2f0733 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -14,7 +14,11 @@ class SubClass extends BaseClass { //// [genericBaseClassLiteralProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 9e99dee2b4c..131fc2d36ab 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -17,7 +17,11 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index 68a3e77f9ae..055ef9d2f86 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -110,7 +110,11 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index 0b643db14cb..e4399d19037 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -34,7 +34,11 @@ var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index 98448645d15..f86cc2da293 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -42,7 +42,11 @@ var r7 = f3(null, x => x); // any // Generic call with constraints infering type parameter from object member properties // No errors expected var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index 71bf682b0dc..01a11c7f90b 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -40,7 +40,11 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index 67d0df1bc22..d4303fa2037 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -25,7 +25,11 @@ module M { //// [genericCallbacksAndClassHierarchy.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index 3db4d9693af..ab826e2916d 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -33,7 +33,11 @@ s.genericVar = 12; //// [genericClassExpressionInFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index 307c891f928..dbd654576ec 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -7,7 +7,11 @@ class C { //// [genericClassInheritsConstructorFromNonGenericClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 147bbd8fb87..fa64843f29f 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -77,7 +77,11 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 257e7dbce97..8345b3d93a7 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -12,7 +12,11 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index fbc62b23aab..2f8d09eae03 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -19,7 +19,11 @@ var z = v2.b; //// [genericClasses3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index 4043924bf54..73fed8b3ea2 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -28,7 +28,11 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index 33394ee4fce..8ec4552b70d 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -27,7 +27,11 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 413eed2a4c8..9da46a15ef7 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -14,7 +14,11 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index da81eaf5640..df9c113ceb5 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -14,7 +14,11 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index d7aaa6224ef..f287a5f934c 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -12,7 +12,11 @@ var c:Constructor> = B; // shouldn't error here //// [genericInheritedDefaultConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index 6ce627694ca..892e6cc0217 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -17,7 +17,11 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index a2817d82e9f..03755b28683 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -16,7 +16,11 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index 2fbb5f7ef50..f5c12bacce8 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -28,7 +28,11 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index c88dd78765a..3c680337351 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -32,7 +32,11 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index 25e4d3f3bae..d13e06a8ddd 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -15,7 +15,11 @@ var r5: A = >[]; // error //// [genericTypeAssertions2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index d54f37408a3..e1c4cab059c 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -27,7 +27,11 @@ function foo2(x: T) { //// [genericTypeAssertions4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 6ace4b38a13..20a13d5718e 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -26,7 +26,11 @@ var c: A = >b; //// [genericTypeAssertions6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index 4aae830a0d1..b2332451507 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -15,7 +15,11 @@ class BarExtended extends Bar { //// [genericTypeConstraints.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index ec7029135a9..267666439b1 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -41,7 +41,11 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index d3797663e0e..7fce4984d9c 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -41,7 +41,11 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index b5c3316ab12..444043fbeac 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -16,7 +16,11 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index 43ec9a09587..6a9f8ae1453 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -134,7 +134,11 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 8d1ad1a834f..fea4eee36fa 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -165,7 +165,11 @@ do { }while(fn) //// [ifDoWhileStatements.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 5299bac5eb3..3de32da45c0 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -22,7 +22,11 @@ class Derived extends Base { //// [illegalSuperCallsInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index 669a6794618..5d717358863 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -4,7 +4,11 @@ class D implements C extends C { } //// [implementClausePrecedingExtends.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 5d93d2b04a4..87b22c74f6b 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -87,7 +87,11 @@ module M2 { //// [implementingAnInterfaceExtendingClassWithPrivates2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 082b9d801dc..68ecf9ede2b 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -43,7 +43,11 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index f61703de5f0..ea7c757e035 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -22,7 +22,11 @@ exports.Greeter = Greeter; //// [importAsBaseClass_1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index ec294a342de..0a9dcd4a780 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -69,7 +69,11 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index 3a2e4823337..c7c575f5402 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -71,7 +71,11 @@ var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 991733f4b37..212bc7a54f7 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -61,7 +61,11 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index abdf7e28cbb..8431a87ce03 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -22,7 +22,11 @@ define(["require", "exports"], function (require, exports) { }); //// [Bar.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index 941436e7e75..f44a0fcfce4 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -22,7 +22,11 @@ exports.Super = Super; //// [importUsedInExtendsList1_1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index 81bb114e394..45980beb09c 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -30,7 +30,11 @@ class K extends J { //// [indexerConstraints2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index a61a14a2d6b..931525d4b6b 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -4,7 +4,11 @@ class b extends a{ } //// [indirectSelfReference.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index 989a02b1943..e7d2bdf2a2b 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -4,7 +4,11 @@ class b extends a { } //// [indirectSelfReferenceGeneric.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index 7336e2c0f69..96a8e84ff60 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -26,7 +26,11 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index 57ad5b71bd8..d95150bbccc 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -4,7 +4,11 @@ interface I extends T { } //// [inheritFromGenericTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index 679e91dc38a..b1224117ede 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -12,7 +12,11 @@ interface A extends C, C2 { // ok //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 01fdd0a3d67..b9a7c5a336f 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -36,7 +36,11 @@ class Baad extends Good { //// [inheritance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index c33c73a6e60..0e5bff48a3b 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -63,7 +63,11 @@ l1 = c; //// [inheritance1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 180f48f613c..bd4b70f7938 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -12,7 +12,11 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index 73121951e7c..d72f85cf599 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -12,7 +12,11 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index 60183c5749e..c6b32f6bc5d 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -12,7 +12,11 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index fc1ff97e8cf..fdc53cc7e9c 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -19,7 +19,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 0ba2a70f257..13e624a9d57 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -16,7 +16,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index 26c911694a2..243992d5bd3 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -14,7 +14,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index d0dfcc5923a..001f7b888e3 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -16,7 +16,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index 64e5e923178..33a35428b8e 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -13,7 +13,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index f3835a78f14..0675aead222 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index 82fc4906ca6..ec3e8519e62 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -15,7 +15,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index e13a111fef9..e2e1d734001 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index b6496085a61..50d6b108588 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -9,7 +9,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index ac99c90e829..871acd1d624 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -9,7 +9,11 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 406675d88d9..72f12c8f81f 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -16,7 +16,11 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index 3faa8f8388d..c58a0643a06 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -19,7 +19,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index 543651ea6f0..beba3dbdf5e 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -16,7 +16,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index 5053cd3946a..d3f4b177e95 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -14,7 +14,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index 6090bd4f74f..d86d08e7add 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -16,7 +16,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index 5213eae20dd..1decf45e015 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -13,7 +13,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index 4d85f383ef6..e9ea5d2f6a1 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -13,7 +13,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index a548d70861b..dd2260ecf31 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 9f2a7acfd14..9a555ce218f 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index c489493375e..e357eb6e01f 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceStaticFunctionOverridingInstanceProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index b57ada54212..044db517290 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -9,7 +9,11 @@ class b extends a { //// [inheritanceStaticMembersCompatible.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index 11e8e0117db..0c21f4a1af5 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -9,7 +9,11 @@ class b extends a { //// [inheritanceStaticMembersIncompatible.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index 7283ee4dbb0..de05071c116 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -14,7 +14,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index e9308f977db..4c1ca7e00cb 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -11,7 +11,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index 4feb0e06b8c..a351a84d98b 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -9,7 +9,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index 4d3b055dcdb..e9f362ead42 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -16,7 +16,11 @@ new Derived(3); //// [inheritedConstructorWithRestParams.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 146677ff09c..3d89d237ad5 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -36,7 +36,11 @@ new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 666f4d703be..512d8bbca57 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -23,7 +23,11 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index 1492a9f919b..4f7b0bead56 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -91,7 +91,11 @@ function fn8(x: Alpha|Beta|Gamma) { //// [instanceOfAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index a421814ea2d..57c7e5161b2 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -44,7 +44,11 @@ module Generic { //// [instancePropertiesInheritedIntoClassType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index c6c657aa82e..7f4b0803382 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -9,7 +9,11 @@ class C2 extends C1 { //// [instanceSubtypeCheck2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 46c842c86a7..59ea1270155 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -73,7 +73,11 @@ function goo(x: A) { //// [instanceofWithStructurallyIdenticalTypes.js] // Repro from #7271 var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index ac3470cb288..338a60610a0 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -32,7 +32,11 @@ return null; //// [instantiatedReturnTypeContravariance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 931d94f6eda..36e4719549a 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -42,7 +42,11 @@ obj = bar; //// [interfaceClassMerging.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index c0c9b17b3e8..f230544e492 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -38,7 +38,11 @@ foo = bar; //// [interfaceClassMerging2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 85b4a42302d..0afae83d4b9 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -20,7 +20,11 @@ class Location { //// [interfaceExtendsClass1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index 05ae7d83678..0b493aded80 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -29,7 +29,11 @@ d = c; // error //// [interfaceExtendsClassWithPrivate1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index a1ff0fff763..699b924a854 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -25,7 +25,11 @@ class D2 extends C implements I { // error //// [interfaceExtendsClassWithPrivate2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index 2193189eaf1..04f341d1f06 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -42,7 +42,11 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index dc4284495b1..8fa200638e4 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -81,7 +81,11 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 2117e176f08..3380d5847a9 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -55,7 +55,11 @@ var m = M.A; //// [invalidMultipleVariableDeclarations.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 8f1adc05fa6..01982b322bb 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -22,7 +22,11 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index e98932901e3..747e69d7c59 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -16,7 +16,11 @@ export var z = x; //// [file1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 99b9229f2a5..61e196daaa4 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -26,7 +26,11 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 50bb51dbae7..319875eef2c 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -295,7 +295,11 @@ var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index 911232722bd..c4343a67452 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -36,7 +36,11 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index cd6f4fffd00..44932a3ad14 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -19,7 +19,11 @@ class C extends B { //// [lift.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index a887a3e07b0..2a3510860ef 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -143,7 +143,11 @@ function f6() { //// [localTypes1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index 078c77c5e3c..0ae1f77a62a 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -28,7 +28,11 @@ var y3: C1 = {}; //// [m7Bugs.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index f731d4de428..d8426a5ce28 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -20,7 +20,11 @@ var A = (function () { }()); //// [b.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index 42ef5702061..c573190dc8b 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -38,7 +38,11 @@ define(["require", "exports"], function (require, exports) { }); //// [b.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 38d4f94adde..ec1b72bf5d7 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -48,7 +48,11 @@ grandchild.method2(); //// [mergedInheritedClassInterface.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index fd3d2da41e3..ac82060f270 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -33,7 +33,11 @@ var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index 1c8ba88d786..31c3deff6d1 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -40,7 +40,11 @@ module M { //// [mergedInterfacesWithInheritedPrivates3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index 8df4153b72d..aa832f39416 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -8,7 +8,11 @@ class George extends class { reset() { return this.y; } } { //// [missingPropertiesOfClassExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index a4caea585ac..00a4f417804 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -6,7 +6,11 @@ class C2 implements M { } //// [moduleAsBaseType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index bf074378d4b..a12c2af9439 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -17,7 +17,11 @@ define(["require", "exports"], function (require, exports) { }); //// [moduleImportedForTypeArgumentPosition_1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index 6efcddf7201..7a36ad10376 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -60,7 +60,11 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index d05f10568ad..4122bcb40ee 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -40,7 +40,11 @@ class Baad extends Good { //// [multipleInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 570a93e8534..1ac0e7db55d 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -12,7 +12,11 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index 78ea4e74a97..e08985796c3 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -14,7 +14,11 @@ class Child extends Parent { //// [noImplicitAnyMissingGetAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index 64c480cc8e1..45cf29fd567 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -13,7 +13,11 @@ class Child extends Parent { //// [noImplicitAnyMissingSetAccessor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 33f7e696126..270ea7f3bfc 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -7,7 +7,11 @@ class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index c8ec0d9da78..2f2be923f17 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -48,7 +48,11 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 02b54a2bbad..85556b4c83d 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -14,7 +14,11 @@ class C { //// [numericIndexerConstraint3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 0f82789285d..8958392fe78 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -14,7 +14,11 @@ var x: { //// [numericIndexerConstraint4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index 1086d974590..5ce85e4c5eb 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -14,7 +14,11 @@ var r2: string = i2[1]; // error: numeric indexer returns the type of the string //// [numericIndexerTyping2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index 2b7ac176c7e..3f251e47029 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -57,7 +57,11 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 301761c2849..05dfd4bc818 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -56,7 +56,11 @@ var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index 1b889269724..9518317f230 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -125,7 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index 767f10adc88..a5b93a32853 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -128,7 +128,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index 8ae7b92b4dd..14a70059adc 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -125,7 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index 9f9319a3cf8..0d3ebae0bb8 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -123,7 +123,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index e1426e4a3b5..4fa90889d81 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -41,7 +41,11 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 1105c06c204..6ca413637f5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -27,7 +27,11 @@ var c3: C3; //// [objectTypesIdentityWithPrivates3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index 9f076b52c60..6758afd5cb3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -125,7 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 75ad2243fe3..370c71533fb 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -128,7 +128,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index 4ebc1226146..e13ea6a702d 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -12,7 +12,11 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index 5cbd798ec89..b0af91c92f8 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -59,7 +59,11 @@ class Derived extends Base { //// [optionalMethods.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 23ab5150579..91507916a55 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -126,7 +126,11 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index 9d318cd9ae5..bc60d2507b0 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -9,7 +9,11 @@ class Y extends Z { //// [optionalParamInOverride.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index 3203c4e2e09..62058c1ecb3 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -13,7 +13,11 @@ class D extends C { //// [optionalParameterProperty.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index cab6be31d07..8a28677dbbf 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -10,7 +10,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.js.map b/tests/baselines/reference/outModuleConcatAmd.js.map index 9187aca0646..937bec93969 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js.map +++ b/tests/baselines/reference/outModuleConcatAmd.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAL,cAAC;;;;ICAd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAL,cAAC;;;;ICAd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index f07a95163f6..75af3bb54ac 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -9,7 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -20,13 +24,13 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(8, 5) Source(2, 1) + SourceIndex(0) +1 >Emitted(12, 5) Source(2, 1) + SourceIndex(0) --- >>> function A() { 1->^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(9, 9) Source(2, 1) + SourceIndex(0) +1->Emitted(13, 9) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^^^^^ @@ -34,16 +38,16 @@ sourceFile:tests/cases/compiler/ref/a.ts 3 > ^^^^^^^^^-> 1->export class A { 2 > } -1->Emitted(10, 9) Source(2, 18) + SourceIndex(0) -2 >Emitted(10, 10) Source(2, 19) + SourceIndex(0) +1->Emitted(14, 9) Source(2, 18) + SourceIndex(0) +2 >Emitted(14, 10) Source(2, 19) + SourceIndex(0) --- >>> return A; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(11, 9) Source(2, 18) + SourceIndex(0) -2 >Emitted(11, 17) Source(2, 19) + SourceIndex(0) +1->Emitted(15, 9) Source(2, 18) + SourceIndex(0) +2 >Emitted(15, 17) Source(2, 19) + SourceIndex(0) --- >>> }()); 1 >^^^^ @@ -55,18 +59,18 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > } 3 > 4 > export class A { } -1 >Emitted(12, 5) Source(2, 18) + SourceIndex(0) -2 >Emitted(12, 6) Source(2, 19) + SourceIndex(0) -3 >Emitted(12, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(12, 10) Source(2, 19) + SourceIndex(0) +1 >Emitted(16, 5) Source(2, 18) + SourceIndex(0) +2 >Emitted(16, 6) Source(2, 19) + SourceIndex(0) +3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(16, 10) Source(2, 19) + SourceIndex(0) --- >>> exports.A = A; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > A -1->Emitted(13, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(13, 19) Source(2, 15) + SourceIndex(0) +1->Emitted(17, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(17, 19) Source(2, 15) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -80,21 +84,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(17, 5) Source(2, 1) + SourceIndex(1) +1 >Emitted(21, 5) Source(2, 1) + SourceIndex(1) --- >>> __extends(B, _super); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(18, 9) Source(2, 24) + SourceIndex(1) -2 >Emitted(18, 30) Source(2, 25) + SourceIndex(1) +1->Emitted(22, 9) Source(2, 24) + SourceIndex(1) +2 >Emitted(22, 30) Source(2, 25) + SourceIndex(1) --- >>> function B() { 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(19, 9) Source(2, 1) + SourceIndex(1) +1 >Emitted(23, 9) Source(2, 1) + SourceIndex(1) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -103,16 +107,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(21, 9) Source(2, 28) + SourceIndex(1) -2 >Emitted(21, 10) Source(2, 29) + SourceIndex(1) +1->Emitted(25, 9) Source(2, 28) + SourceIndex(1) +2 >Emitted(25, 10) Source(2, 29) + SourceIndex(1) --- >>> return B; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(22, 9) Source(2, 28) + SourceIndex(1) -2 >Emitted(22, 17) Source(2, 29) + SourceIndex(1) +1->Emitted(26, 9) Source(2, 28) + SourceIndex(1) +2 >Emitted(26, 17) Source(2, 29) + SourceIndex(1) --- >>> }(a_1.A)); 1 >^^^^ @@ -128,20 +132,20 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(23, 5) Source(2, 28) + SourceIndex(1) -2 >Emitted(23, 6) Source(2, 29) + SourceIndex(1) -3 >Emitted(23, 6) Source(2, 1) + SourceIndex(1) -4 >Emitted(23, 7) Source(2, 24) + SourceIndex(1) -5 >Emitted(23, 12) Source(2, 25) + SourceIndex(1) -6 >Emitted(23, 15) Source(2, 29) + SourceIndex(1) +1 >Emitted(27, 5) Source(2, 28) + SourceIndex(1) +2 >Emitted(27, 6) Source(2, 29) + SourceIndex(1) +3 >Emitted(27, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(27, 7) Source(2, 24) + SourceIndex(1) +5 >Emitted(27, 12) Source(2, 25) + SourceIndex(1) +6 >Emitted(27, 15) Source(2, 29) + SourceIndex(1) --- >>> exports.B = B; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > B -1->Emitted(24, 5) Source(2, 14) + SourceIndex(1) -2 >Emitted(24, 19) Source(2, 15) + SourceIndex(1) +1->Emitted(28, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(28, 19) Source(2, 15) + SourceIndex(1) --- >>>}); >>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index 6f6e1c3b366..4a7552bcde8 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -10,7 +10,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map index ac8fb23d87c..275b47b1363 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js.map +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;;gBAA2B,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;;gBAA2B,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 47558a3812a..e5a439aea1a 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -9,7 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -25,13 +29,13 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(13, 13) Source(2, 1) + SourceIndex(0) +1 >Emitted(17, 13) Source(2, 1) + SourceIndex(0) --- >>> function A() { 1->^^^^^^^^^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(14, 17) Source(2, 1) + SourceIndex(0) +1->Emitted(18, 17) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^^^^^^^^^^^^^ @@ -39,16 +43,16 @@ sourceFile:tests/cases/compiler/ref/a.ts 3 > ^^^^^^^^^-> 1->export class A { 2 > } -1->Emitted(15, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(15, 18) Source(2, 19) + SourceIndex(0) +1->Emitted(19, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(19, 18) Source(2, 19) + SourceIndex(0) --- >>> return A; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(16, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(16, 25) Source(2, 19) + SourceIndex(0) +1->Emitted(20, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(20, 25) Source(2, 19) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -60,10 +64,10 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > } 3 > 4 > export class A { } -1 >Emitted(17, 13) Source(2, 18) + SourceIndex(0) -2 >Emitted(17, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(17, 14) Source(2, 1) + SourceIndex(0) -4 >Emitted(17, 18) Source(2, 19) + SourceIndex(0) +1 >Emitted(21, 13) Source(2, 18) + SourceIndex(0) +2 >Emitted(21, 14) Source(2, 19) + SourceIndex(0) +3 >Emitted(21, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(21, 18) Source(2, 19) + SourceIndex(0) --- >>> exports_1("A", A); >>> } @@ -72,8 +76,8 @@ sourceFile:tests/cases/compiler/ref/a.ts 1-> > 2 > -1->Emitted(19, 9) Source(3, 1) + SourceIndex(0) -2 >Emitted(19, 10) Source(3, 2) + SourceIndex(0) +1->Emitted(23, 9) Source(3, 1) + SourceIndex(0) +2 >Emitted(23, 10) Source(3, 2) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -97,21 +101,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(33, 13) Source(2, 1) + SourceIndex(1) +1 >Emitted(37, 13) Source(2, 1) + SourceIndex(1) --- >>> __extends(B, _super); 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(34, 17) Source(2, 24) + SourceIndex(1) -2 >Emitted(34, 38) Source(2, 25) + SourceIndex(1) +1->Emitted(38, 17) Source(2, 24) + SourceIndex(1) +2 >Emitted(38, 38) Source(2, 25) + SourceIndex(1) --- >>> function B() { 1 >^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(35, 17) Source(2, 1) + SourceIndex(1) +1 >Emitted(39, 17) Source(2, 1) + SourceIndex(1) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -120,16 +124,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(37, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(37, 18) Source(2, 29) + SourceIndex(1) +1->Emitted(41, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(41, 18) Source(2, 29) + SourceIndex(1) --- >>> return B; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(38, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(38, 25) Source(2, 29) + SourceIndex(1) +1->Emitted(42, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(42, 25) Source(2, 29) + SourceIndex(1) --- >>> }(a_1.A)); 1 >^^^^^^^^^^^^ @@ -145,12 +149,12 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(39, 13) Source(2, 28) + SourceIndex(1) -2 >Emitted(39, 14) Source(2, 29) + SourceIndex(1) -3 >Emitted(39, 14) Source(2, 1) + SourceIndex(1) -4 >Emitted(39, 15) Source(2, 24) + SourceIndex(1) -5 >Emitted(39, 20) Source(2, 25) + SourceIndex(1) -6 >Emitted(39, 23) Source(2, 29) + SourceIndex(1) +1 >Emitted(43, 13) Source(2, 28) + SourceIndex(1) +2 >Emitted(43, 14) Source(2, 29) + SourceIndex(1) +3 >Emitted(43, 14) Source(2, 1) + SourceIndex(1) +4 >Emitted(43, 15) Source(2, 24) + SourceIndex(1) +5 >Emitted(43, 20) Source(2, 25) + SourceIndex(1) +6 >Emitted(43, 23) Source(2, 29) + SourceIndex(1) --- >>> exports_2("B", B); >>> } @@ -158,8 +162,8 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^ 1-> 2 > -1->Emitted(41, 9) Source(2, 29) + SourceIndex(1) -2 >Emitted(41, 10) Source(2, 30) + SourceIndex(1) +1->Emitted(45, 9) Source(2, 29) + SourceIndex(1) +2 >Emitted(45, 10) Source(2, 30) + SourceIndex(1) --- >>> }; >>>}); diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index 5f6def67a48..c5f6da0fdf5 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -32,7 +32,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js.map b/tests/baselines/reference/outModuleTripleSlashRefs.js.map index 5ccc59aeabf..cb10515edd2 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js.map +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFY,cAAC;;;;ICDd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFY,cAAC;;;;ICDd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 9f15bc0eaee..c3e619a4c2d 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -9,7 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/b.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -18,21 +22,21 @@ sourceFile:tests/cases/compiler/ref/b.ts 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 >/// -1 >Emitted(6, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(6, 34) Source(1, 34) + SourceIndex(0) +1 >Emitted(10, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(10, 34) Source(1, 34) + SourceIndex(0) --- >>>var Foo = (function () { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(7, 1) Source(2, 1) + SourceIndex(0) +1 >Emitted(11, 1) Source(2, 1) + SourceIndex(0) --- >>> function Foo() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(8, 5) Source(2, 1) + SourceIndex(0) +1->Emitted(12, 5) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -42,16 +46,16 @@ sourceFile:tests/cases/compiler/ref/b.ts > member: Bar; > 2 > } -1->Emitted(9, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(9, 6) Source(4, 2) + SourceIndex(0) +1->Emitted(13, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(13, 6) Source(4, 2) + SourceIndex(0) --- >>> return Foo; 1->^^^^ 2 > ^^^^^^^^^^ 1-> 2 > } -1->Emitted(10, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(10, 15) Source(4, 2) + SourceIndex(0) +1->Emitted(14, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(14, 15) Source(4, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -65,10 +69,10 @@ sourceFile:tests/cases/compiler/ref/b.ts 4 > class Foo { > member: Bar; > } -1 >Emitted(11, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(11, 2) Source(4, 2) + SourceIndex(0) -3 >Emitted(11, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(11, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(15, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(4, 2) + SourceIndex(0) +3 >Emitted(15, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(15, 6) Source(4, 2) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -82,21 +86,21 @@ sourceFile:tests/cases/compiler/ref/a.ts 1-> > 2 > /// -1->Emitted(14, 5) Source(2, 1) + SourceIndex(1) -2 >Emitted(14, 36) Source(2, 32) + SourceIndex(1) +1->Emitted(18, 5) Source(2, 1) + SourceIndex(1) +2 >Emitted(18, 36) Source(2, 32) + SourceIndex(1) --- >>> var A = (function () { 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(15, 5) Source(3, 1) + SourceIndex(1) +1 >Emitted(19, 5) Source(3, 1) + SourceIndex(1) --- >>> function A() { 1->^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(16, 9) Source(3, 1) + SourceIndex(1) +1->Emitted(20, 9) Source(3, 1) + SourceIndex(1) --- >>> } 1->^^^^^^^^ @@ -106,16 +110,16 @@ sourceFile:tests/cases/compiler/ref/a.ts > member: typeof GlobalFoo; > 2 > } -1->Emitted(17, 9) Source(5, 1) + SourceIndex(1) -2 >Emitted(17, 10) Source(5, 2) + SourceIndex(1) +1->Emitted(21, 9) Source(5, 1) + SourceIndex(1) +2 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) --- >>> return A; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(18, 9) Source(5, 1) + SourceIndex(1) -2 >Emitted(18, 17) Source(5, 2) + SourceIndex(1) +1->Emitted(22, 9) Source(5, 1) + SourceIndex(1) +2 >Emitted(22, 17) Source(5, 2) + SourceIndex(1) --- >>> }()); 1 >^^^^ @@ -129,18 +133,18 @@ sourceFile:tests/cases/compiler/ref/a.ts 4 > export class A { > member: typeof GlobalFoo; > } -1 >Emitted(19, 5) Source(5, 1) + SourceIndex(1) -2 >Emitted(19, 6) Source(5, 2) + SourceIndex(1) -3 >Emitted(19, 6) Source(3, 1) + SourceIndex(1) -4 >Emitted(19, 10) Source(5, 2) + SourceIndex(1) +1 >Emitted(23, 5) Source(5, 1) + SourceIndex(1) +2 >Emitted(23, 6) Source(5, 2) + SourceIndex(1) +3 >Emitted(23, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(23, 10) Source(5, 2) + SourceIndex(1) --- >>> exports.A = A; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > A -1->Emitted(20, 5) Source(3, 14) + SourceIndex(1) -2 >Emitted(20, 19) Source(3, 15) + SourceIndex(1) +1->Emitted(24, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(24, 19) Source(3, 15) + SourceIndex(1) --- ------------------------------------------------------------------- emittedFile:all.js @@ -154,21 +158,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(24, 5) Source(2, 1) + SourceIndex(2) +1 >Emitted(28, 5) Source(2, 1) + SourceIndex(2) --- >>> __extends(B, _super); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(25, 9) Source(2, 24) + SourceIndex(2) -2 >Emitted(25, 30) Source(2, 25) + SourceIndex(2) +1->Emitted(29, 9) Source(2, 24) + SourceIndex(2) +2 >Emitted(29, 30) Source(2, 25) + SourceIndex(2) --- >>> function B() { 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(26, 9) Source(2, 1) + SourceIndex(2) +1 >Emitted(30, 9) Source(2, 1) + SourceIndex(2) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -177,16 +181,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(28, 9) Source(2, 28) + SourceIndex(2) -2 >Emitted(28, 10) Source(2, 29) + SourceIndex(2) +1->Emitted(32, 9) Source(2, 28) + SourceIndex(2) +2 >Emitted(32, 10) Source(2, 29) + SourceIndex(2) --- >>> return B; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(29, 9) Source(2, 28) + SourceIndex(2) -2 >Emitted(29, 17) Source(2, 29) + SourceIndex(2) +1->Emitted(33, 9) Source(2, 28) + SourceIndex(2) +2 >Emitted(33, 17) Source(2, 29) + SourceIndex(2) --- >>> }(a_1.A)); 1 >^^^^ @@ -202,20 +206,20 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(30, 5) Source(2, 28) + SourceIndex(2) -2 >Emitted(30, 6) Source(2, 29) + SourceIndex(2) -3 >Emitted(30, 6) Source(2, 1) + SourceIndex(2) -4 >Emitted(30, 7) Source(2, 24) + SourceIndex(2) -5 >Emitted(30, 12) Source(2, 25) + SourceIndex(2) -6 >Emitted(30, 15) Source(2, 29) + SourceIndex(2) +1 >Emitted(34, 5) Source(2, 28) + SourceIndex(2) +2 >Emitted(34, 6) Source(2, 29) + SourceIndex(2) +3 >Emitted(34, 6) Source(2, 1) + SourceIndex(2) +4 >Emitted(34, 7) Source(2, 24) + SourceIndex(2) +5 >Emitted(34, 12) Source(2, 25) + SourceIndex(2) +6 >Emitted(34, 15) Source(2, 29) + SourceIndex(2) --- >>> exports.B = B; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > B -1->Emitted(31, 5) Source(2, 14) + SourceIndex(2) -2 >Emitted(31, 19) Source(2, 15) + SourceIndex(2) +1->Emitted(35, 5) Source(2, 14) + SourceIndex(2) +2 >Emitted(35, 19) Source(2, 15) + SourceIndex(2) --- >>>}); >>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index 6cbfb843812..8377a62f2c7 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -41,7 +41,11 @@ var v=x.g; //// [overload1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index 8bc8ccd1612..ae8e1178be5 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -24,7 +24,11 @@ class D implements MyDoc { //// [overloadOnConstConstraintChecks1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index 16cfb630a5d..43468e15fd8 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -13,7 +13,11 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 1540bc4dc49..5e8d70d3d6e 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -14,7 +14,11 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index a634547a36b..c4ac235a671 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -15,7 +15,11 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index 0edadc3c692..58807808f5c 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -13,7 +13,11 @@ foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 56ebebc454e..bb1fce13a0a 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -96,7 +96,11 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 5cf41a3b44a..16bdd16eaa2 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -103,7 +103,11 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 85ec9fb06fb..4b7e487466c 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -104,7 +104,11 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index c8f5a8fd9ae..d52d97cefc7 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -27,7 +27,11 @@ var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 9792485e1cf..3b666b2351b 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -29,7 +29,11 @@ var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index 50f957c7fdd..f1cc4b05a40 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -9,7 +9,11 @@ class Derived2 extends Base2 { //// [overridingPrivateStaticMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index 3409c13e2f1..a82e4eb8ea7 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -4,7 +4,11 @@ class C extends A # { //// [parseErrorInHeritageClause1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index cce7df3db54..3c80c2bfd16 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -8,7 +8,11 @@ class Any extends Type { //// [parser509630.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index 12de33e4738..5ba4ba4d96d 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -221,7 +221,11 @@ class c6 extends c5 { //// [parserAstSpans1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 555d625d522..4ce80bdec21 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -4,7 +4,11 @@ class C extends A extends B { //// [parserClassDeclaration1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index b63483411b2..ac58fb23342 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -4,7 +4,11 @@ class C implements A extends B { //// [parserClassDeclaration3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index 2f3cdf0e166..fa85ee2659c 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -4,7 +4,11 @@ class C extends A implements B extends C { //// [parserClassDeclaration4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index da843d06292..a77e0867d59 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -4,7 +4,11 @@ class C extends A implements B implements C { //// [parserClassDeclaration5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 842b811de9b..23820f706df 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -4,7 +4,11 @@ class C extends A, B { //// [parserClassDeclaration6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index 22225819435..d81e0e7cf65 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -4,7 +4,11 @@ class C extends A, { //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 92af44f7cc4..34f0bce2d1c 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -4,7 +4,11 @@ class C extends A implements { //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 07adb1e2001..9eb5a995637 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -4,7 +4,11 @@ class C extends A, implements B, { //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index ef93433301b..99cfeb0c61f 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -19,7 +19,11 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index a3bfafc19b4..b34364d5b9e 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -19,7 +19,11 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index b89e47d3e75..25112efe231 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -459,7 +459,11 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index daaa9f79cee..23ea8da3d5c 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2368,7 +2368,11 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index fd432660b52..ac60a5b18ad 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2097,7 +2097,11 @@ module Harness { // limitations under the License. // var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index c81647e79b5..b57b3a8bff6 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -17,7 +17,11 @@ testError((t1, t2, t3: D) => {}) //// [partiallyAnnotatedFunctionInferenceError.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index e54441df4d6..f8bd04cde38 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -36,7 +36,11 @@ testRest((t2, ...t3: D[]) => {}) //// [partiallyAnnotatedFunctionInferenceWithTypeParameter.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 64b699496bf..2aa2efbba10 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -33,7 +33,11 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index 64e1c63eca1..c310bf6e77d 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -130,7 +130,11 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo //// [privacyClass.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index 377b4082bea..68feed955d3 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -100,7 +100,11 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -286,7 +290,11 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index b93ed51025d..4824da462ad 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -62,7 +62,11 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 2118eb072d7..63e8172576a 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -11,7 +11,11 @@ class D extends Base { //// [privateAccessInSubclass1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 98b2671d23e..3df2708569c 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -15,7 +15,11 @@ class Derived extends Base { //// [privateInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index bcef17bf63f..239d0a4281b 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -23,7 +23,11 @@ let { priv: a, prot: b, privateMethod: f } = k; // error //// [privateProtectedMembersAreNotAccessibleDestructuring.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 438f485e031..d21d13070d8 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -10,7 +10,11 @@ class Derived extends Base { //// [privateStaticMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index 618d6d88e8a..e7e1e468aed 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -17,7 +17,11 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index ef754cba47d..93d8685224b 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,5 +1,9 @@ var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index ef754cba47d..93d8685224b 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,5 +1,9 @@ var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 8273c054fbd..f80f316d3c8 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,5 +1,9 @@ var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 8273c054fbd..f80f316d3c8 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,5 +1,9 @@ var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index dac535093f5..65483bd492a 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,6 +1,10 @@ /// var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index dac535093f5..65483bd492a 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,6 +1,10 @@ /// var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index ccf7c50ebc9..9d65b48702e 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -53,7 +53,11 @@ var c: { //// [propertiesAndIndexers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 3240f46a935..3da9b5cc647 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -152,7 +152,11 @@ var x3: A; //// [propertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index e813239484b..cc874197c3c 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -84,7 +84,11 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index b10642c73c5..bcaa1458325 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -59,7 +59,11 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 97f8e18f917..8cc85faa100 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -46,7 +46,11 @@ var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't //// [propertyAccessOnTypeParameterWithConstraints5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index 226ad97f81f..babef969a10 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -40,7 +40,11 @@ class E extends C { //// [protectedClassPropertyAccessibleWithinNestedSubclass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index c98abd2a89a..3a3013d6704 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -116,7 +116,11 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 2557a8abcf9..3c59a316d71 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -22,7 +22,11 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index 8ee957ec64f..fb818c42c7e 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -96,7 +96,11 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 31c2f3d149c..20984b107b9 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -15,7 +15,11 @@ class Derived extends Base { //// [protectedClassPropertyAccessibleWithinSubclass3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index 84400a37aa7..c906f456d67 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -46,7 +46,11 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index 4757f6134a3..d2e8bfe47ce 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -117,7 +117,11 @@ class B3 extends A3 { //// [protectedMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index ffe163716ed..e0ad17934c3 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -45,7 +45,11 @@ Derived3.x; // Error, neither within their declaring class nor classes deriv //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index d21e6511c34..37ddb2b0d2c 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -23,7 +23,11 @@ class Derived2 extends Derived1 { //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index d345bb7e1b1..3fc3b29ff45 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -8,7 +8,11 @@ class Beta extends Alpha.x { //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index d8275690d4a..a3a46c4e14f 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -42,7 +42,11 @@ class E extends D { //// [readonlyConstructorAssignment.js] // Tests that readonly parameter properties behave like regular readonly properties var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index 92835b848ce..bd89b8c6574 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -6,7 +6,11 @@ class C extends A { } //// [recursiveBaseCheck3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index f0271b2d36a..f89b52e719f 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -4,7 +4,11 @@ class M extends M { } //// [recursiveBaseCheck4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index 97e6cb483e3..05a72e11213 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -4,7 +4,11 @@ class S18 extends S18<{ S19: A; }>{ } //// [recursiveBaseCheck6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index d20d43c405d..b0a11841dd8 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -8,7 +8,11 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index eeda7ef86f4..bfd014a3fe1 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -11,7 +11,11 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index e59f3ad4c36..11eb4f8ba8f 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -106,7 +106,11 @@ module Sample.Thing.Languages.PlainText { // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index 0b9bb8281bc..f322d6f0510 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;;oBAQA,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;;oBAQA,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 8bfac267dbf..5bb43de1b9f 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -27,7 +27,11 @@ sourceFile:recursiveClassReferenceTest.ts 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -81,10 +85,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(8, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(8, 5) Source(32, 8) + SourceIndex(0) -3 >Emitted(8, 11) Source(32, 14) + SourceIndex(0) -4 >Emitted(8, 12) Source(42, 2) + SourceIndex(0) +1 >Emitted(12, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(12, 5) Source(32, 8) + SourceIndex(0) +3 >Emitted(12, 11) Source(32, 14) + SourceIndex(0) +4 >Emitted(12, 12) Source(42, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -93,9 +97,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(9, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(9, 12) Source(32, 8) + SourceIndex(0) -3 >Emitted(9, 18) Source(32, 14) + SourceIndex(0) +1->Emitted(13, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(13, 12) Source(32, 8) + SourceIndex(0) +3 >Emitted(13, 18) Source(32, 14) + SourceIndex(0) --- >>> var Actions; 1 >^^^^ @@ -117,10 +121,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(10, 5) Source(32, 15) + SourceIndex(0) -2 >Emitted(10, 9) Source(32, 15) + SourceIndex(0) -3 >Emitted(10, 16) Source(32, 22) + SourceIndex(0) -4 >Emitted(10, 17) Source(42, 2) + SourceIndex(0) +1 >Emitted(14, 5) Source(32, 15) + SourceIndex(0) +2 >Emitted(14, 9) Source(32, 15) + SourceIndex(0) +3 >Emitted(14, 16) Source(32, 22) + SourceIndex(0) +4 >Emitted(14, 17) Source(42, 2) + SourceIndex(0) --- >>> (function (Actions) { 1->^^^^ @@ -129,9 +133,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Actions -1->Emitted(11, 5) Source(32, 15) + SourceIndex(0) -2 >Emitted(11, 16) Source(32, 15) + SourceIndex(0) -3 >Emitted(11, 23) Source(32, 22) + SourceIndex(0) +1->Emitted(15, 5) Source(32, 15) + SourceIndex(0) +2 >Emitted(15, 16) Source(32, 15) + SourceIndex(0) +3 >Emitted(15, 23) Source(32, 22) + SourceIndex(0) --- >>> var Thing; 1 >^^^^^^^^ @@ -153,10 +157,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(12, 9) Source(32, 23) + SourceIndex(0) -2 >Emitted(12, 13) Source(32, 23) + SourceIndex(0) -3 >Emitted(12, 18) Source(32, 28) + SourceIndex(0) -4 >Emitted(12, 19) Source(42, 2) + SourceIndex(0) +1 >Emitted(16, 9) Source(32, 23) + SourceIndex(0) +2 >Emitted(16, 13) Source(32, 23) + SourceIndex(0) +3 >Emitted(16, 18) Source(32, 28) + SourceIndex(0) +4 >Emitted(16, 19) Source(42, 2) + SourceIndex(0) --- >>> (function (Thing_1) { 1->^^^^^^^^ @@ -165,9 +169,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(13, 9) Source(32, 23) + SourceIndex(0) -2 >Emitted(13, 20) Source(32, 23) + SourceIndex(0) -3 >Emitted(13, 27) Source(32, 28) + SourceIndex(0) +1->Emitted(17, 9) Source(32, 23) + SourceIndex(0) +2 >Emitted(17, 20) Source(32, 23) + SourceIndex(0) +3 >Emitted(17, 27) Source(32, 28) + SourceIndex(0) --- >>> var Find; 1 >^^^^^^^^^^^^ @@ -189,10 +193,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(14, 13) Source(32, 29) + SourceIndex(0) -2 >Emitted(14, 17) Source(32, 29) + SourceIndex(0) -3 >Emitted(14, 21) Source(32, 33) + SourceIndex(0) -4 >Emitted(14, 22) Source(42, 2) + SourceIndex(0) +1 >Emitted(18, 13) Source(32, 29) + SourceIndex(0) +2 >Emitted(18, 17) Source(32, 29) + SourceIndex(0) +3 >Emitted(18, 21) Source(32, 33) + SourceIndex(0) +4 >Emitted(18, 22) Source(42, 2) + SourceIndex(0) --- >>> (function (Find) { 1->^^^^^^^^^^^^ @@ -202,22 +206,22 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Find -1->Emitted(15, 13) Source(32, 29) + SourceIndex(0) -2 >Emitted(15, 24) Source(32, 29) + SourceIndex(0) -3 >Emitted(15, 28) Source(32, 33) + SourceIndex(0) +1->Emitted(19, 13) Source(32, 29) + SourceIndex(0) +2 >Emitted(19, 24) Source(32, 29) + SourceIndex(0) +3 >Emitted(19, 28) Source(32, 33) + SourceIndex(0) --- >>> var StartFindAction = (function () { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > -1->Emitted(16, 17) Source(33, 2) + SourceIndex(0) +1->Emitted(20, 17) Source(33, 2) + SourceIndex(0) --- >>> function StartFindAction() { 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(17, 21) Source(33, 2) + SourceIndex(0) +1->Emitted(21, 21) Source(33, 2) + SourceIndex(0) --- >>> } 1->^^^^^^^^^^^^^^^^^^^^ @@ -233,8 +237,8 @@ sourceFile:recursiveClassReferenceTest.ts > } > 2 > } -1->Emitted(18, 21) Source(41, 2) + SourceIndex(0) -2 >Emitted(18, 22) Source(41, 3) + SourceIndex(0) +1->Emitted(22, 21) Source(41, 2) + SourceIndex(0) +2 >Emitted(22, 22) Source(41, 3) + SourceIndex(0) --- >>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ @@ -257,16 +261,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(19, 21) Source(35, 10) + SourceIndex(0) -2 >Emitted(19, 52) Source(35, 15) + SourceIndex(0) -3 >Emitted(19, 55) Source(35, 3) + SourceIndex(0) -4 >Emitted(19, 69) Source(35, 20) + SourceIndex(0) -5 >Emitted(19, 75) Source(35, 26) + SourceIndex(0) -6 >Emitted(19, 76) Source(35, 27) + SourceIndex(0) -7 >Emitted(19, 80) Source(35, 31) + SourceIndex(0) -8 >Emitted(19, 81) Source(35, 32) + SourceIndex(0) -9 >Emitted(19, 82) Source(35, 33) + SourceIndex(0) -10>Emitted(19, 83) Source(35, 34) + SourceIndex(0) +1->Emitted(23, 21) Source(35, 10) + SourceIndex(0) +2 >Emitted(23, 52) Source(35, 15) + SourceIndex(0) +3 >Emitted(23, 55) Source(35, 3) + SourceIndex(0) +4 >Emitted(23, 69) Source(35, 20) + SourceIndex(0) +5 >Emitted(23, 75) Source(35, 26) + SourceIndex(0) +6 >Emitted(23, 76) Source(35, 27) + SourceIndex(0) +7 >Emitted(23, 80) Source(35, 31) + SourceIndex(0) +8 >Emitted(23, 81) Source(35, 32) + SourceIndex(0) +9 >Emitted(23, 82) Source(35, 33) + SourceIndex(0) +10>Emitted(23, 83) Source(35, 34) + SourceIndex(0) --- >>> StartFindAction.prototype.run = function (Thing) { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -281,11 +285,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1 >Emitted(20, 21) Source(37, 10) + SourceIndex(0) -2 >Emitted(20, 50) Source(37, 13) + SourceIndex(0) -3 >Emitted(20, 53) Source(37, 3) + SourceIndex(0) -4 >Emitted(20, 63) Source(37, 14) + SourceIndex(0) -5 >Emitted(20, 68) Source(37, 43) + SourceIndex(0) +1 >Emitted(24, 21) Source(37, 10) + SourceIndex(0) +2 >Emitted(24, 50) Source(37, 13) + SourceIndex(0) +3 >Emitted(24, 53) Source(37, 3) + SourceIndex(0) +4 >Emitted(24, 63) Source(37, 14) + SourceIndex(0) +5 >Emitted(24, 68) Source(37, 43) + SourceIndex(0) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -300,11 +304,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(21, 25) Source(39, 4) + SourceIndex(0) -2 >Emitted(21, 31) Source(39, 10) + SourceIndex(0) -3 >Emitted(21, 32) Source(39, 11) + SourceIndex(0) -4 >Emitted(21, 36) Source(39, 15) + SourceIndex(0) -5 >Emitted(21, 37) Source(39, 16) + SourceIndex(0) +1 >Emitted(25, 25) Source(39, 4) + SourceIndex(0) +2 >Emitted(25, 31) Source(39, 10) + SourceIndex(0) +3 >Emitted(25, 32) Source(39, 11) + SourceIndex(0) +4 >Emitted(25, 36) Source(39, 15) + SourceIndex(0) +5 >Emitted(25, 37) Source(39, 16) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -313,8 +317,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(22, 21) Source(40, 3) + SourceIndex(0) -2 >Emitted(22, 22) Source(40, 4) + SourceIndex(0) +1 >Emitted(26, 21) Source(40, 3) + SourceIndex(0) +2 >Emitted(26, 22) Source(40, 4) + SourceIndex(0) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -322,8 +326,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(23, 21) Source(41, 2) + SourceIndex(0) -2 >Emitted(23, 43) Source(41, 3) + SourceIndex(0) +1->Emitted(27, 21) Source(41, 2) + SourceIndex(0) +2 >Emitted(27, 43) Source(41, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^^^^^ @@ -343,10 +347,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(24, 17) Source(41, 2) + SourceIndex(0) -2 >Emitted(24, 18) Source(41, 3) + SourceIndex(0) -3 >Emitted(24, 18) Source(33, 2) + SourceIndex(0) -4 >Emitted(24, 22) Source(41, 3) + SourceIndex(0) +1 >Emitted(28, 17) Source(41, 2) + SourceIndex(0) +2 >Emitted(28, 18) Source(41, 3) + SourceIndex(0) +3 >Emitted(28, 18) Source(33, 2) + SourceIndex(0) +4 >Emitted(28, 22) Source(41, 3) + SourceIndex(0) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -366,10 +370,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 4 > -1->Emitted(25, 17) Source(33, 15) + SourceIndex(0) -2 >Emitted(25, 37) Source(33, 30) + SourceIndex(0) -3 >Emitted(25, 55) Source(41, 3) + SourceIndex(0) -4 >Emitted(25, 56) Source(41, 3) + SourceIndex(0) +1->Emitted(29, 17) Source(33, 15) + SourceIndex(0) +2 >Emitted(29, 37) Source(33, 30) + SourceIndex(0) +3 >Emitted(29, 55) Source(41, 3) + SourceIndex(0) +4 >Emitted(29, 56) Source(41, 3) + SourceIndex(0) --- >>> })(Find = Thing_1.Find || (Thing_1.Find = {})); 1->^^^^^^^^^^^^ @@ -401,15 +405,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(26, 13) Source(42, 1) + SourceIndex(0) -2 >Emitted(26, 14) Source(42, 2) + SourceIndex(0) -3 >Emitted(26, 16) Source(32, 29) + SourceIndex(0) -4 >Emitted(26, 20) Source(32, 33) + SourceIndex(0) -5 >Emitted(26, 23) Source(32, 29) + SourceIndex(0) -6 >Emitted(26, 35) Source(32, 33) + SourceIndex(0) -7 >Emitted(26, 40) Source(32, 29) + SourceIndex(0) -8 >Emitted(26, 52) Source(32, 33) + SourceIndex(0) -9 >Emitted(26, 60) Source(42, 2) + SourceIndex(0) +1->Emitted(30, 13) Source(42, 1) + SourceIndex(0) +2 >Emitted(30, 14) Source(42, 2) + SourceIndex(0) +3 >Emitted(30, 16) Source(32, 29) + SourceIndex(0) +4 >Emitted(30, 20) Source(32, 33) + SourceIndex(0) +5 >Emitted(30, 23) Source(32, 29) + SourceIndex(0) +6 >Emitted(30, 35) Source(32, 33) + SourceIndex(0) +7 >Emitted(30, 40) Source(32, 29) + SourceIndex(0) +8 >Emitted(30, 52) Source(32, 33) + SourceIndex(0) +9 >Emitted(30, 60) Source(42, 2) + SourceIndex(0) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); 1 >^^^^^^^^ @@ -441,15 +445,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(27, 9) Source(42, 1) + SourceIndex(0) -2 >Emitted(27, 10) Source(42, 2) + SourceIndex(0) -3 >Emitted(27, 12) Source(32, 23) + SourceIndex(0) -4 >Emitted(27, 17) Source(32, 28) + SourceIndex(0) -5 >Emitted(27, 20) Source(32, 23) + SourceIndex(0) -6 >Emitted(27, 33) Source(32, 28) + SourceIndex(0) -7 >Emitted(27, 38) Source(32, 23) + SourceIndex(0) -8 >Emitted(27, 51) Source(32, 28) + SourceIndex(0) -9 >Emitted(27, 59) Source(42, 2) + SourceIndex(0) +1 >Emitted(31, 9) Source(42, 1) + SourceIndex(0) +2 >Emitted(31, 10) Source(42, 2) + SourceIndex(0) +3 >Emitted(31, 12) Source(32, 23) + SourceIndex(0) +4 >Emitted(31, 17) Source(32, 28) + SourceIndex(0) +5 >Emitted(31, 20) Source(32, 23) + SourceIndex(0) +6 >Emitted(31, 33) Source(32, 28) + SourceIndex(0) +7 >Emitted(31, 38) Source(32, 23) + SourceIndex(0) +8 >Emitted(31, 51) Source(32, 28) + SourceIndex(0) +9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -480,15 +484,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(28, 5) Source(42, 1) + SourceIndex(0) -2 >Emitted(28, 6) Source(42, 2) + SourceIndex(0) -3 >Emitted(28, 8) Source(32, 15) + SourceIndex(0) -4 >Emitted(28, 15) Source(32, 22) + SourceIndex(0) -5 >Emitted(28, 18) Source(32, 15) + SourceIndex(0) -6 >Emitted(28, 32) Source(32, 22) + SourceIndex(0) -7 >Emitted(28, 37) Source(32, 15) + SourceIndex(0) -8 >Emitted(28, 51) Source(32, 22) + SourceIndex(0) -9 >Emitted(28, 59) Source(42, 2) + SourceIndex(0) +1->Emitted(32, 5) Source(42, 1) + SourceIndex(0) +2 >Emitted(32, 6) Source(42, 2) + SourceIndex(0) +3 >Emitted(32, 8) Source(32, 15) + SourceIndex(0) +4 >Emitted(32, 15) Source(32, 22) + SourceIndex(0) +5 >Emitted(32, 18) Source(32, 15) + SourceIndex(0) +6 >Emitted(32, 32) Source(32, 22) + SourceIndex(0) +7 >Emitted(32, 37) Source(32, 15) + SourceIndex(0) +8 >Emitted(32, 51) Source(32, 22) + SourceIndex(0) +9 >Emitted(32, 59) Source(42, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -515,13 +519,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(29, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(29, 2) Source(42, 2) + SourceIndex(0) -3 >Emitted(29, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(29, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(29, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(29, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(29, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(33, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(33, 2) Source(42, 2) + SourceIndex(0) +3 >Emitted(33, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(33, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(33, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(33, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(33, 29) Source(42, 2) + SourceIndex(0) --- >>>(function (Sample) { 1 > @@ -532,9 +536,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >module 3 > Sample -1 >Emitted(30, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(30, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(30, 18) Source(44, 14) + SourceIndex(0) +1 >Emitted(34, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -566,10 +570,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(31, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(31, 9) Source(44, 15) + SourceIndex(0) -3 >Emitted(31, 14) Source(44, 20) + SourceIndex(0) -4 >Emitted(31, 15) Source(64, 2) + SourceIndex(0) +1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) +3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) +4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -579,9 +583,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(32, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(32, 16) Source(44, 15) + SourceIndex(0) -3 >Emitted(32, 21) Source(44, 20) + SourceIndex(0) +1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) +3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) --- >>> var Widgets; 1->^^^^^^^^ @@ -613,10 +617,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(33, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(33, 13) Source(44, 21) + SourceIndex(0) -3 >Emitted(33, 20) Source(44, 28) + SourceIndex(0) -4 >Emitted(33, 21) Source(64, 2) + SourceIndex(0) +1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) +3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) +4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -626,16 +630,16 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Widgets -1->Emitted(34, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(34, 20) Source(44, 21) + SourceIndex(0) -3 >Emitted(34, 27) Source(44, 28) + SourceIndex(0) +1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) +3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > -1->Emitted(35, 13) Source(45, 2) + SourceIndex(0) +1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -650,9 +654,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > codeThing: Sample.Thing.ICodeThing -1->Emitted(36, 17) Source(50, 3) + SourceIndex(0) -2 >Emitted(36, 37) Source(50, 23) + SourceIndex(0) -3 >Emitted(36, 46) Source(50, 57) + SourceIndex(0) +1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) +2 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) +3 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -665,11 +669,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(37, 21) Source(50, 23) + SourceIndex(0) -2 >Emitted(37, 35) Source(50, 32) + SourceIndex(0) -3 >Emitted(37, 38) Source(50, 23) + SourceIndex(0) -4 >Emitted(37, 47) Source(50, 32) + SourceIndex(0) -5 >Emitted(37, 48) Source(50, 57) + SourceIndex(0) +1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) +2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) +3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) +4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) +5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -682,11 +686,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(38, 21) Source(49, 11) + SourceIndex(0) -2 >Emitted(38, 33) Source(49, 18) + SourceIndex(0) -3 >Emitted(38, 36) Source(49, 25) + SourceIndex(0) -4 >Emitted(38, 40) Source(49, 29) + SourceIndex(0) -5 >Emitted(38, 41) Source(49, 30) + SourceIndex(0) +1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) +2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) +3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) +4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) +5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -696,8 +700,8 @@ sourceFile:recursiveClassReferenceTest.ts > constructor(private codeThing: Sample.Thing.ICodeThing) { > 2 > // scenario 1 -1 >Emitted(39, 21) Source(51, 7) + SourceIndex(0) -2 >Emitted(39, 34) Source(51, 20) + SourceIndex(0) +1 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) +2 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -721,16 +725,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(40, 21) Source(52, 7) + SourceIndex(0) -2 >Emitted(40, 30) Source(52, 16) + SourceIndex(0) -3 >Emitted(40, 31) Source(52, 17) + SourceIndex(0) -4 >Emitted(40, 40) Source(52, 26) + SourceIndex(0) -5 >Emitted(40, 41) Source(52, 27) + SourceIndex(0) -6 >Emitted(40, 52) Source(52, 38) + SourceIndex(0) -7 >Emitted(40, 54) Source(52, 40) + SourceIndex(0) -8 >Emitted(40, 58) Source(52, 44) + SourceIndex(0) -9 >Emitted(40, 59) Source(52, 45) + SourceIndex(0) -10>Emitted(40, 60) Source(52, 46) + SourceIndex(0) +1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) +2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) +3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) +4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) +5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) +6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) +7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) +8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) +9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) +10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^ @@ -739,8 +743,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(41, 17) Source(53, 3) + SourceIndex(0) -2 >Emitted(41, 18) Source(53, 4) + SourceIndex(0) +1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) +2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) --- >>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ @@ -769,19 +773,19 @@ sourceFile:recursiveClassReferenceTest.ts 11> ) 12> 13> { -1->Emitted(42, 17) Source(47, 10) + SourceIndex(0) -2 >Emitted(42, 41) Source(47, 13) + SourceIndex(0) -3 >Emitted(42, 44) Source(47, 3) + SourceIndex(0) -4 >Emitted(42, 54) Source(47, 14) + SourceIndex(0) -5 >Emitted(42, 60) Source(47, 55) + SourceIndex(0) -6 >Emitted(42, 64) Source(47, 59) + SourceIndex(0) -7 >Emitted(42, 66) Source(47, 61) + SourceIndex(0) -8 >Emitted(42, 67) Source(47, 62) + SourceIndex(0) -9 >Emitted(42, 68) Source(47, 63) + SourceIndex(0) -10>Emitted(42, 72) Source(47, 67) + SourceIndex(0) -11>Emitted(42, 73) Source(47, 68) + SourceIndex(0) -12>Emitted(42, 74) Source(47, 69) + SourceIndex(0) -13>Emitted(42, 75) Source(47, 70) + SourceIndex(0) +1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) +2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) +3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) +4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) +5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) +6 >Emitted(46, 64) Source(47, 59) + SourceIndex(0) +7 >Emitted(46, 66) Source(47, 61) + SourceIndex(0) +8 >Emitted(46, 67) Source(47, 62) + SourceIndex(0) +9 >Emitted(46, 68) Source(47, 63) + SourceIndex(0) +10>Emitted(46, 72) Source(47, 67) + SourceIndex(0) +11>Emitted(46, 73) Source(47, 68) + SourceIndex(0) +12>Emitted(46, 74) Source(47, 69) + SourceIndex(0) +13>Emitted(46, 75) Source(47, 70) + SourceIndex(0) --- >>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ @@ -800,14 +804,14 @@ sourceFile:recursiveClassReferenceTest.ts 6 > this 7 > ) 8 > ; -1 >Emitted(43, 21) Source(47, 70) + SourceIndex(0) -2 >Emitted(43, 27) Source(47, 76) + SourceIndex(0) -3 >Emitted(43, 28) Source(47, 77) + SourceIndex(0) -4 >Emitted(43, 34) Source(47, 83) + SourceIndex(0) -5 >Emitted(43, 35) Source(47, 84) + SourceIndex(0) -6 >Emitted(43, 39) Source(47, 88) + SourceIndex(0) -7 >Emitted(43, 40) Source(47, 89) + SourceIndex(0) -8 >Emitted(43, 41) Source(47, 90) + SourceIndex(0) +1 >Emitted(47, 21) Source(47, 70) + SourceIndex(0) +2 >Emitted(47, 27) Source(47, 76) + SourceIndex(0) +3 >Emitted(47, 28) Source(47, 77) + SourceIndex(0) +4 >Emitted(47, 34) Source(47, 83) + SourceIndex(0) +5 >Emitted(47, 35) Source(47, 84) + SourceIndex(0) +6 >Emitted(47, 39) Source(47, 88) + SourceIndex(0) +7 >Emitted(47, 40) Source(47, 89) + SourceIndex(0) +8 >Emitted(47, 41) Source(47, 90) + SourceIndex(0) --- >>> } }; 1 >^^^^^^^^^^^^^^^^ @@ -819,10 +823,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > } 3 > 4 > } -1 >Emitted(44, 17) Source(47, 90) + SourceIndex(0) -2 >Emitted(44, 18) Source(47, 91) + SourceIndex(0) -3 >Emitted(44, 19) Source(47, 91) + SourceIndex(0) -4 >Emitted(44, 20) Source(47, 92) + SourceIndex(0) +1 >Emitted(48, 17) Source(47, 90) + SourceIndex(0) +2 >Emitted(48, 18) Source(47, 91) + SourceIndex(0) +3 >Emitted(48, 19) Source(47, 91) + SourceIndex(0) +4 >Emitted(48, 20) Source(47, 92) + SourceIndex(0) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -839,9 +843,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(45, 17) Source(55, 10) + SourceIndex(0) -2 >Emitted(45, 48) Source(55, 20) + SourceIndex(0) -3 >Emitted(45, 51) Source(55, 3) + SourceIndex(0) +1->Emitted(49, 17) Source(55, 10) + SourceIndex(0) +2 >Emitted(49, 48) Source(55, 20) + SourceIndex(0) +3 >Emitted(49, 51) Source(55, 3) + SourceIndex(0) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -855,11 +859,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(46, 21) Source(56, 4) + SourceIndex(0) -2 >Emitted(46, 27) Source(56, 10) + SourceIndex(0) -3 >Emitted(46, 28) Source(56, 11) + SourceIndex(0) -4 >Emitted(46, 35) Source(56, 18) + SourceIndex(0) -5 >Emitted(46, 36) Source(56, 19) + SourceIndex(0) +1 >Emitted(50, 21) Source(56, 4) + SourceIndex(0) +2 >Emitted(50, 27) Source(56, 10) + SourceIndex(0) +3 >Emitted(50, 28) Source(56, 11) + SourceIndex(0) +4 >Emitted(50, 35) Source(56, 18) + SourceIndex(0) +5 >Emitted(50, 36) Source(56, 19) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -868,8 +872,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(47, 17) Source(57, 3) + SourceIndex(0) -2 >Emitted(47, 18) Source(57, 4) + SourceIndex(0) +1 >Emitted(51, 17) Source(57, 3) + SourceIndex(0) +2 >Emitted(51, 18) Source(57, 4) + SourceIndex(0) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -880,9 +884,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(48, 17) Source(59, 10) + SourceIndex(0) -2 >Emitted(48, 45) Source(59, 17) + SourceIndex(0) -3 >Emitted(48, 48) Source(59, 3) + SourceIndex(0) +1->Emitted(52, 17) Source(59, 10) + SourceIndex(0) +2 >Emitted(52, 45) Source(59, 17) + SourceIndex(0) +3 >Emitted(52, 48) Source(59, 3) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -892,8 +896,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(49, 17) Source(61, 3) + SourceIndex(0) -2 >Emitted(49, 18) Source(61, 4) + SourceIndex(0) +1 >Emitted(53, 17) Source(61, 3) + SourceIndex(0) +2 >Emitted(53, 18) Source(61, 4) + SourceIndex(0) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -902,8 +906,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(50, 17) Source(63, 2) + SourceIndex(0) -2 >Emitted(50, 34) Source(63, 3) + SourceIndex(0) +1->Emitted(54, 17) Source(63, 2) + SourceIndex(0) +2 >Emitted(54, 34) Source(63, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -933,10 +937,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(51, 13) Source(63, 2) + SourceIndex(0) -2 >Emitted(51, 14) Source(63, 3) + SourceIndex(0) -3 >Emitted(51, 14) Source(45, 2) + SourceIndex(0) -4 >Emitted(51, 18) Source(63, 3) + SourceIndex(0) +1 >Emitted(55, 13) Source(63, 2) + SourceIndex(0) +2 >Emitted(55, 14) Source(63, 3) + SourceIndex(0) +3 >Emitted(55, 14) Source(45, 2) + SourceIndex(0) +4 >Emitted(55, 18) Source(63, 3) + SourceIndex(0) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -966,10 +970,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(52, 13) Source(45, 15) + SourceIndex(0) -2 >Emitted(52, 31) Source(45, 25) + SourceIndex(0) -3 >Emitted(52, 44) Source(63, 3) + SourceIndex(0) -4 >Emitted(52, 45) Source(63, 3) + SourceIndex(0) +1->Emitted(56, 13) Source(45, 15) + SourceIndex(0) +2 >Emitted(56, 31) Source(45, 25) + SourceIndex(0) +3 >Emitted(56, 44) Source(63, 3) + SourceIndex(0) +4 >Emitted(56, 45) Source(63, 3) + SourceIndex(0) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1011,15 +1015,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(53, 9) Source(64, 1) + SourceIndex(0) -2 >Emitted(53, 10) Source(64, 2) + SourceIndex(0) -3 >Emitted(53, 12) Source(44, 21) + SourceIndex(0) -4 >Emitted(53, 19) Source(44, 28) + SourceIndex(0) -5 >Emitted(53, 22) Source(44, 21) + SourceIndex(0) -6 >Emitted(53, 35) Source(44, 28) + SourceIndex(0) -7 >Emitted(53, 40) Source(44, 21) + SourceIndex(0) -8 >Emitted(53, 53) Source(44, 28) + SourceIndex(0) -9 >Emitted(53, 61) Source(64, 2) + SourceIndex(0) +1->Emitted(57, 9) Source(64, 1) + SourceIndex(0) +2 >Emitted(57, 10) Source(64, 2) + SourceIndex(0) +3 >Emitted(57, 12) Source(44, 21) + SourceIndex(0) +4 >Emitted(57, 19) Source(44, 28) + SourceIndex(0) +5 >Emitted(57, 22) Source(44, 21) + SourceIndex(0) +6 >Emitted(57, 35) Source(44, 28) + SourceIndex(0) +7 >Emitted(57, 40) Source(44, 21) + SourceIndex(0) +8 >Emitted(57, 53) Source(44, 28) + SourceIndex(0) +9 >Emitted(57, 61) Source(64, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1060,15 +1064,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(54, 5) Source(64, 1) + SourceIndex(0) -2 >Emitted(54, 6) Source(64, 2) + SourceIndex(0) -3 >Emitted(54, 8) Source(44, 15) + SourceIndex(0) -4 >Emitted(54, 13) Source(44, 20) + SourceIndex(0) -5 >Emitted(54, 16) Source(44, 15) + SourceIndex(0) -6 >Emitted(54, 28) Source(44, 20) + SourceIndex(0) -7 >Emitted(54, 33) Source(44, 15) + SourceIndex(0) -8 >Emitted(54, 45) Source(44, 20) + SourceIndex(0) -9 >Emitted(54, 53) Source(64, 2) + SourceIndex(0) +1 >Emitted(58, 5) Source(64, 1) + SourceIndex(0) +2 >Emitted(58, 6) Source(64, 2) + SourceIndex(0) +3 >Emitted(58, 8) Source(44, 15) + SourceIndex(0) +4 >Emitted(58, 13) Source(44, 20) + SourceIndex(0) +5 >Emitted(58, 16) Source(44, 15) + SourceIndex(0) +6 >Emitted(58, 28) Source(44, 20) + SourceIndex(0) +7 >Emitted(58, 33) Source(44, 15) + SourceIndex(0) +8 >Emitted(58, 45) Source(44, 20) + SourceIndex(0) +9 >Emitted(58, 53) Source(64, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -1106,13 +1110,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(55, 1) Source(64, 1) + SourceIndex(0) -2 >Emitted(55, 2) Source(64, 2) + SourceIndex(0) -3 >Emitted(55, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(55, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(55, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(55, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(55, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(59, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(59, 2) Source(64, 2) + SourceIndex(0) +3 >Emitted(59, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(59, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(59, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(59, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(59, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1121,13 +1125,13 @@ sourceFile:recursiveClassReferenceTest.ts > >interface IMode { getInitialState(): IState;} > -1->Emitted(56, 1) Source(67, 1) + SourceIndex(0) +1->Emitted(60, 1) Source(67, 1) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(57, 5) Source(67, 1) + SourceIndex(0) +1->Emitted(61, 5) Source(67, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -1135,8 +1139,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->class AbstractMode implements IMode { public getInitialState(): IState { return null;} 2 > } -1->Emitted(58, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(58, 6) Source(67, 89) + SourceIndex(0) +1->Emitted(62, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(62, 6) Source(67, 89) + SourceIndex(0) --- >>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ @@ -1159,24 +1163,24 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(59, 5) Source(67, 46) + SourceIndex(0) -2 >Emitted(59, 43) Source(67, 61) + SourceIndex(0) -3 >Emitted(59, 46) Source(67, 39) + SourceIndex(0) -4 >Emitted(59, 60) Source(67, 74) + SourceIndex(0) -5 >Emitted(59, 66) Source(67, 80) + SourceIndex(0) -6 >Emitted(59, 67) Source(67, 81) + SourceIndex(0) -7 >Emitted(59, 71) Source(67, 85) + SourceIndex(0) -8 >Emitted(59, 72) Source(67, 86) + SourceIndex(0) -9 >Emitted(59, 73) Source(67, 86) + SourceIndex(0) -10>Emitted(59, 74) Source(67, 87) + SourceIndex(0) +1->Emitted(63, 5) Source(67, 46) + SourceIndex(0) +2 >Emitted(63, 43) Source(67, 61) + SourceIndex(0) +3 >Emitted(63, 46) Source(67, 39) + SourceIndex(0) +4 >Emitted(63, 60) Source(67, 74) + SourceIndex(0) +5 >Emitted(63, 66) Source(67, 80) + SourceIndex(0) +6 >Emitted(63, 67) Source(67, 81) + SourceIndex(0) +7 >Emitted(63, 71) Source(67, 85) + SourceIndex(0) +8 >Emitted(63, 72) Source(67, 86) + SourceIndex(0) +9 >Emitted(63, 73) Source(67, 86) + SourceIndex(0) +10>Emitted(63, 74) Source(67, 87) + SourceIndex(0) --- >>> return AbstractMode; 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ 1 > 2 > } -1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(60, 24) Source(67, 89) + SourceIndex(0) +1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(64, 24) Source(67, 89) + SourceIndex(0) --- >>>}()); 1 > @@ -1188,10 +1192,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(61, 1) Source(67, 88) + SourceIndex(0) -2 >Emitted(61, 2) Source(67, 89) + SourceIndex(0) -3 >Emitted(61, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(61, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(65, 1) Source(67, 88) + SourceIndex(0) +2 >Emitted(65, 2) Source(67, 89) + SourceIndex(0) +3 >Emitted(65, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(65, 6) Source(67, 89) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1209,9 +1213,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >module 3 > Sample -1->Emitted(62, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(62, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(62, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(66, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(66, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(66, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1247,10 +1251,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(63, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(63, 9) Source(76, 15) + SourceIndex(0) -3 >Emitted(63, 14) Source(76, 20) + SourceIndex(0) -4 >Emitted(63, 15) Source(100, 2) + SourceIndex(0) +1 >Emitted(67, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(67, 9) Source(76, 15) + SourceIndex(0) +3 >Emitted(67, 14) Source(76, 20) + SourceIndex(0) +4 >Emitted(67, 15) Source(100, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -1260,9 +1264,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(64, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(64, 16) Source(76, 15) + SourceIndex(0) -3 >Emitted(64, 21) Source(76, 20) + SourceIndex(0) +1->Emitted(68, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(68, 16) Source(76, 15) + SourceIndex(0) +3 >Emitted(68, 21) Source(76, 20) + SourceIndex(0) --- >>> var Languages; 1->^^^^^^^^ @@ -1298,10 +1302,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(65, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(65, 13) Source(76, 21) + SourceIndex(0) -3 >Emitted(65, 22) Source(76, 30) + SourceIndex(0) -4 >Emitted(65, 23) Source(100, 2) + SourceIndex(0) +1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(69, 13) Source(76, 21) + SourceIndex(0) +3 >Emitted(69, 22) Source(76, 30) + SourceIndex(0) +4 >Emitted(69, 23) Source(100, 2) + SourceIndex(0) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1310,9 +1314,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(66, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(66, 20) Source(76, 21) + SourceIndex(0) -3 >Emitted(66, 29) Source(76, 30) + SourceIndex(0) +1->Emitted(70, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(70, 20) Source(76, 21) + SourceIndex(0) +3 >Emitted(70, 29) Source(76, 30) + SourceIndex(0) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1348,10 +1352,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(67, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(67, 17) Source(76, 31) + SourceIndex(0) -3 >Emitted(67, 26) Source(76, 40) + SourceIndex(0) -4 >Emitted(67, 27) Source(100, 2) + SourceIndex(0) +1 >Emitted(71, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(71, 17) Source(76, 31) + SourceIndex(0) +3 >Emitted(71, 26) Source(76, 40) + SourceIndex(0) +4 >Emitted(71, 27) Source(100, 2) + SourceIndex(0) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1361,9 +1365,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > PlainText -1->Emitted(68, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(68, 24) Source(76, 31) + SourceIndex(0) -3 >Emitted(68, 33) Source(76, 40) + SourceIndex(0) +1->Emitted(72, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(72, 24) Source(76, 31) + SourceIndex(0) +3 >Emitted(72, 33) Source(76, 40) + SourceIndex(0) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1371,7 +1375,7 @@ sourceFile:recursiveClassReferenceTest.ts 1-> { > > -1->Emitted(69, 17) Source(78, 2) + SourceIndex(0) +1->Emitted(73, 17) Source(78, 2) + SourceIndex(0) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1382,9 +1386,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > mode: IMode -1->Emitted(70, 21) Source(79, 9) + SourceIndex(0) -2 >Emitted(70, 36) Source(79, 29) + SourceIndex(0) -3 >Emitted(70, 40) Source(79, 40) + SourceIndex(0) +1->Emitted(74, 21) Source(79, 9) + SourceIndex(0) +2 >Emitted(74, 36) Source(79, 29) + SourceIndex(0) +3 >Emitted(74, 40) Source(79, 40) + SourceIndex(0) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1397,11 +1401,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(71, 25) Source(79, 29) + SourceIndex(0) -2 >Emitted(71, 34) Source(79, 33) + SourceIndex(0) -3 >Emitted(71, 37) Source(79, 29) + SourceIndex(0) -4 >Emitted(71, 41) Source(79, 33) + SourceIndex(0) -5 >Emitted(71, 42) Source(79, 40) + SourceIndex(0) +1->Emitted(75, 25) Source(79, 29) + SourceIndex(0) +2 >Emitted(75, 34) Source(79, 33) + SourceIndex(0) +3 >Emitted(75, 37) Source(79, 29) + SourceIndex(0) +4 >Emitted(75, 41) Source(79, 33) + SourceIndex(0) +5 >Emitted(75, 42) Source(79, 40) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1409,8 +1413,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(72, 21) Source(79, 44) + SourceIndex(0) -2 >Emitted(72, 22) Source(79, 45) + SourceIndex(0) +1 >Emitted(76, 21) Source(79, 44) + SourceIndex(0) +2 >Emitted(76, 22) Source(79, 45) + SourceIndex(0) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1420,9 +1424,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(73, 21) Source(80, 10) + SourceIndex(0) -2 >Emitted(73, 42) Source(80, 15) + SourceIndex(0) -3 >Emitted(73, 45) Source(80, 3) + SourceIndex(0) +1->Emitted(77, 21) Source(80, 10) + SourceIndex(0) +2 >Emitted(77, 42) Source(80, 15) + SourceIndex(0) +3 >Emitted(77, 45) Source(80, 3) + SourceIndex(0) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1436,11 +1440,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(74, 25) Source(81, 4) + SourceIndex(0) -2 >Emitted(74, 31) Source(81, 10) + SourceIndex(0) -3 >Emitted(74, 32) Source(81, 11) + SourceIndex(0) -4 >Emitted(74, 36) Source(81, 15) + SourceIndex(0) -5 >Emitted(74, 37) Source(81, 16) + SourceIndex(0) +1 >Emitted(78, 25) Source(81, 4) + SourceIndex(0) +2 >Emitted(78, 31) Source(81, 10) + SourceIndex(0) +3 >Emitted(78, 32) Source(81, 11) + SourceIndex(0) +4 >Emitted(78, 36) Source(81, 15) + SourceIndex(0) +5 >Emitted(78, 37) Source(81, 16) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1449,8 +1453,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(75, 21) Source(82, 3) + SourceIndex(0) -2 >Emitted(75, 22) Source(82, 4) + SourceIndex(0) +1 >Emitted(79, 21) Source(82, 3) + SourceIndex(0) +2 >Emitted(79, 22) Source(82, 4) + SourceIndex(0) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1465,11 +1469,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(76, 21) Source(84, 10) + SourceIndex(0) -2 >Emitted(76, 43) Source(84, 16) + SourceIndex(0) -3 >Emitted(76, 46) Source(84, 3) + SourceIndex(0) -4 >Emitted(76, 56) Source(84, 17) + SourceIndex(0) -5 >Emitted(76, 61) Source(84, 29) + SourceIndex(0) +1->Emitted(80, 21) Source(84, 10) + SourceIndex(0) +2 >Emitted(80, 43) Source(84, 16) + SourceIndex(0) +3 >Emitted(80, 46) Source(84, 3) + SourceIndex(0) +4 >Emitted(80, 56) Source(84, 17) + SourceIndex(0) +5 >Emitted(80, 61) Source(84, 29) + SourceIndex(0) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1487,13 +1491,13 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(77, 25) Source(85, 4) + SourceIndex(0) -2 >Emitted(77, 31) Source(85, 10) + SourceIndex(0) -3 >Emitted(77, 32) Source(85, 11) + SourceIndex(0) -4 >Emitted(77, 36) Source(85, 15) + SourceIndex(0) -5 >Emitted(77, 41) Source(85, 20) + SourceIndex(0) -6 >Emitted(77, 46) Source(85, 25) + SourceIndex(0) -7 >Emitted(77, 47) Source(85, 26) + SourceIndex(0) +1 >Emitted(81, 25) Source(85, 4) + SourceIndex(0) +2 >Emitted(81, 31) Source(85, 10) + SourceIndex(0) +3 >Emitted(81, 32) Source(85, 11) + SourceIndex(0) +4 >Emitted(81, 36) Source(85, 15) + SourceIndex(0) +5 >Emitted(81, 41) Source(85, 20) + SourceIndex(0) +6 >Emitted(81, 46) Source(85, 25) + SourceIndex(0) +7 >Emitted(81, 47) Source(85, 26) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1502,8 +1506,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(78, 21) Source(86, 3) + SourceIndex(0) -2 >Emitted(78, 22) Source(86, 4) + SourceIndex(0) +1 >Emitted(82, 21) Source(86, 3) + SourceIndex(0) +2 >Emitted(82, 22) Source(86, 4) + SourceIndex(0) --- >>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1528,16 +1532,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(79, 21) Source(88, 10) + SourceIndex(0) -2 >Emitted(79, 44) Source(88, 17) + SourceIndex(0) -3 >Emitted(79, 47) Source(88, 3) + SourceIndex(0) -4 >Emitted(79, 61) Source(88, 29) + SourceIndex(0) -5 >Emitted(79, 67) Source(88, 35) + SourceIndex(0) -6 >Emitted(79, 68) Source(88, 36) + SourceIndex(0) -7 >Emitted(79, 72) Source(88, 40) + SourceIndex(0) -8 >Emitted(79, 73) Source(88, 41) + SourceIndex(0) -9 >Emitted(79, 74) Source(88, 42) + SourceIndex(0) -10>Emitted(79, 75) Source(88, 43) + SourceIndex(0) +1->Emitted(83, 21) Source(88, 10) + SourceIndex(0) +2 >Emitted(83, 44) Source(88, 17) + SourceIndex(0) +3 >Emitted(83, 47) Source(88, 3) + SourceIndex(0) +4 >Emitted(83, 61) Source(88, 29) + SourceIndex(0) +5 >Emitted(83, 67) Source(88, 35) + SourceIndex(0) +6 >Emitted(83, 68) Source(88, 36) + SourceIndex(0) +7 >Emitted(83, 72) Source(88, 40) + SourceIndex(0) +8 >Emitted(83, 73) Source(88, 41) + SourceIndex(0) +9 >Emitted(83, 74) Source(88, 42) + SourceIndex(0) +10>Emitted(83, 75) Source(88, 43) + SourceIndex(0) --- >>> return State; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1545,8 +1549,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(80, 21) Source(89, 2) + SourceIndex(0) -2 >Emitted(80, 33) Source(89, 3) + SourceIndex(0) +1 >Emitted(84, 21) Source(89, 2) + SourceIndex(0) +2 >Emitted(84, 33) Source(89, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^^^^^ @@ -1569,10 +1573,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(81, 17) Source(89, 2) + SourceIndex(0) -2 >Emitted(81, 18) Source(89, 3) + SourceIndex(0) -3 >Emitted(81, 18) Source(78, 2) + SourceIndex(0) -4 >Emitted(81, 22) Source(89, 3) + SourceIndex(0) +1 >Emitted(85, 17) Source(89, 2) + SourceIndex(0) +2 >Emitted(85, 18) Source(89, 3) + SourceIndex(0) +3 >Emitted(85, 18) Source(78, 2) + SourceIndex(0) +4 >Emitted(85, 22) Source(89, 3) + SourceIndex(0) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1595,10 +1599,10 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 4 > -1->Emitted(82, 17) Source(78, 15) + SourceIndex(0) -2 >Emitted(82, 32) Source(78, 20) + SourceIndex(0) -3 >Emitted(82, 40) Source(89, 3) + SourceIndex(0) -4 >Emitted(82, 41) Source(89, 3) + SourceIndex(0) +1->Emitted(86, 17) Source(78, 15) + SourceIndex(0) +2 >Emitted(86, 32) Source(78, 20) + SourceIndex(0) +3 >Emitted(86, 40) Source(89, 3) + SourceIndex(0) +4 >Emitted(86, 41) Source(89, 3) + SourceIndex(0) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1606,21 +1610,21 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > > -1->Emitted(83, 17) Source(91, 2) + SourceIndex(0) +1->Emitted(87, 17) Source(91, 2) + SourceIndex(0) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 1->export class Mode extends 2 > AbstractMode -1->Emitted(84, 21) Source(91, 28) + SourceIndex(0) -2 >Emitted(84, 45) Source(91, 40) + SourceIndex(0) +1->Emitted(88, 21) Source(91, 28) + SourceIndex(0) +2 >Emitted(88, 45) Source(91, 40) + SourceIndex(0) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(85, 21) Source(91, 2) + SourceIndex(0) +1 >Emitted(89, 21) Source(91, 2) + SourceIndex(0) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -1637,8 +1641,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(87, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(87, 22) Source(99, 3) + SourceIndex(0) +1->Emitted(91, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(91, 22) Source(99, 3) + SourceIndex(0) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1646,8 +1650,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(88, 21) Source(93, 3) + SourceIndex(0) -2 >Emitted(88, 34) Source(93, 16) + SourceIndex(0) +1->Emitted(92, 21) Source(93, 3) + SourceIndex(0) +2 >Emitted(92, 34) Source(93, 16) + SourceIndex(0) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1657,9 +1661,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(89, 21) Source(94, 10) + SourceIndex(0) -2 >Emitted(89, 51) Source(94, 25) + SourceIndex(0) -3 >Emitted(89, 54) Source(94, 3) + SourceIndex(0) +1->Emitted(93, 21) Source(94, 10) + SourceIndex(0) +2 >Emitted(93, 51) Source(94, 25) + SourceIndex(0) +3 >Emitted(93, 54) Source(94, 3) + SourceIndex(0) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1681,15 +1685,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(90, 25) Source(95, 4) + SourceIndex(0) -2 >Emitted(90, 31) Source(95, 10) + SourceIndex(0) -3 >Emitted(90, 32) Source(95, 11) + SourceIndex(0) -4 >Emitted(90, 36) Source(95, 15) + SourceIndex(0) -5 >Emitted(90, 41) Source(95, 20) + SourceIndex(0) -6 >Emitted(90, 42) Source(95, 21) + SourceIndex(0) -7 >Emitted(90, 46) Source(95, 25) + SourceIndex(0) -8 >Emitted(90, 47) Source(95, 26) + SourceIndex(0) -9 >Emitted(90, 48) Source(95, 27) + SourceIndex(0) +1 >Emitted(94, 25) Source(95, 4) + SourceIndex(0) +2 >Emitted(94, 31) Source(95, 10) + SourceIndex(0) +3 >Emitted(94, 32) Source(95, 11) + SourceIndex(0) +4 >Emitted(94, 36) Source(95, 15) + SourceIndex(0) +5 >Emitted(94, 41) Source(95, 20) + SourceIndex(0) +6 >Emitted(94, 42) Source(95, 21) + SourceIndex(0) +7 >Emitted(94, 46) Source(95, 25) + SourceIndex(0) +8 >Emitted(94, 47) Source(95, 26) + SourceIndex(0) +9 >Emitted(94, 48) Source(95, 27) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1698,8 +1702,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(91, 21) Source(96, 3) + SourceIndex(0) -2 >Emitted(91, 22) Source(96, 4) + SourceIndex(0) +1 >Emitted(95, 21) Source(96, 3) + SourceIndex(0) +2 >Emitted(95, 22) Source(96, 4) + SourceIndex(0) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1710,8 +1714,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(92, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(92, 32) Source(99, 3) + SourceIndex(0) +1->Emitted(96, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(96, 32) Source(99, 3) + SourceIndex(0) --- >>> }(AbstractMode)); 1->^^^^^^^^^^^^^^^^ @@ -1735,12 +1739,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(93, 17) Source(99, 2) + SourceIndex(0) -2 >Emitted(93, 18) Source(99, 3) + SourceIndex(0) -3 >Emitted(93, 18) Source(91, 2) + SourceIndex(0) -4 >Emitted(93, 19) Source(91, 28) + SourceIndex(0) -5 >Emitted(93, 31) Source(91, 40) + SourceIndex(0) -6 >Emitted(93, 34) Source(99, 3) + SourceIndex(0) +1->Emitted(97, 17) Source(99, 2) + SourceIndex(0) +2 >Emitted(97, 18) Source(99, 3) + SourceIndex(0) +3 >Emitted(97, 18) Source(91, 2) + SourceIndex(0) +4 >Emitted(97, 19) Source(91, 28) + SourceIndex(0) +5 >Emitted(97, 31) Source(91, 40) + SourceIndex(0) +6 >Emitted(97, 34) Source(99, 3) + SourceIndex(0) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1760,10 +1764,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(94, 17) Source(91, 15) + SourceIndex(0) -2 >Emitted(94, 31) Source(91, 19) + SourceIndex(0) -3 >Emitted(94, 38) Source(99, 3) + SourceIndex(0) -4 >Emitted(94, 39) Source(99, 3) + SourceIndex(0) +1->Emitted(98, 17) Source(91, 15) + SourceIndex(0) +2 >Emitted(98, 31) Source(91, 19) + SourceIndex(0) +3 >Emitted(98, 38) Source(99, 3) + SourceIndex(0) +4 >Emitted(98, 39) Source(99, 3) + SourceIndex(0) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -1809,15 +1813,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(95, 13) Source(100, 1) + SourceIndex(0) -2 >Emitted(95, 14) Source(100, 2) + SourceIndex(0) -3 >Emitted(95, 16) Source(76, 31) + SourceIndex(0) -4 >Emitted(95, 25) Source(76, 40) + SourceIndex(0) -5 >Emitted(95, 28) Source(76, 31) + SourceIndex(0) -6 >Emitted(95, 47) Source(76, 40) + SourceIndex(0) -7 >Emitted(95, 52) Source(76, 31) + SourceIndex(0) -8 >Emitted(95, 71) Source(76, 40) + SourceIndex(0) -9 >Emitted(95, 79) Source(100, 2) + SourceIndex(0) +1->Emitted(99, 13) Source(100, 1) + SourceIndex(0) +2 >Emitted(99, 14) Source(100, 2) + SourceIndex(0) +3 >Emitted(99, 16) Source(76, 31) + SourceIndex(0) +4 >Emitted(99, 25) Source(76, 40) + SourceIndex(0) +5 >Emitted(99, 28) Source(76, 31) + SourceIndex(0) +6 >Emitted(99, 47) Source(76, 40) + SourceIndex(0) +7 >Emitted(99, 52) Source(76, 31) + SourceIndex(0) +8 >Emitted(99, 71) Source(76, 40) + SourceIndex(0) +9 >Emitted(99, 79) Source(100, 2) + SourceIndex(0) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -1862,15 +1866,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(96, 9) Source(100, 1) + SourceIndex(0) -2 >Emitted(96, 10) Source(100, 2) + SourceIndex(0) -3 >Emitted(96, 12) Source(76, 21) + SourceIndex(0) -4 >Emitted(96, 21) Source(76, 30) + SourceIndex(0) -5 >Emitted(96, 24) Source(76, 21) + SourceIndex(0) -6 >Emitted(96, 39) Source(76, 30) + SourceIndex(0) -7 >Emitted(96, 44) Source(76, 21) + SourceIndex(0) -8 >Emitted(96, 59) Source(76, 30) + SourceIndex(0) -9 >Emitted(96, 67) Source(100, 2) + SourceIndex(0) +1 >Emitted(100, 9) Source(100, 1) + SourceIndex(0) +2 >Emitted(100, 10) Source(100, 2) + SourceIndex(0) +3 >Emitted(100, 12) Source(76, 21) + SourceIndex(0) +4 >Emitted(100, 21) Source(76, 30) + SourceIndex(0) +5 >Emitted(100, 24) Source(76, 21) + SourceIndex(0) +6 >Emitted(100, 39) Source(76, 30) + SourceIndex(0) +7 >Emitted(100, 44) Source(76, 21) + SourceIndex(0) +8 >Emitted(100, 59) Source(76, 30) + SourceIndex(0) +9 >Emitted(100, 67) Source(100, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1915,15 +1919,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(97, 5) Source(100, 1) + SourceIndex(0) -2 >Emitted(97, 6) Source(100, 2) + SourceIndex(0) -3 >Emitted(97, 8) Source(76, 15) + SourceIndex(0) -4 >Emitted(97, 13) Source(76, 20) + SourceIndex(0) -5 >Emitted(97, 16) Source(76, 15) + SourceIndex(0) -6 >Emitted(97, 28) Source(76, 20) + SourceIndex(0) -7 >Emitted(97, 33) Source(76, 15) + SourceIndex(0) -8 >Emitted(97, 45) Source(76, 20) + SourceIndex(0) -9 >Emitted(97, 53) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 5) Source(100, 1) + SourceIndex(0) +2 >Emitted(101, 6) Source(100, 2) + SourceIndex(0) +3 >Emitted(101, 8) Source(76, 15) + SourceIndex(0) +4 >Emitted(101, 13) Source(76, 20) + SourceIndex(0) +5 >Emitted(101, 16) Source(76, 15) + SourceIndex(0) +6 >Emitted(101, 28) Source(76, 20) + SourceIndex(0) +7 >Emitted(101, 33) Source(76, 15) + SourceIndex(0) +8 >Emitted(101, 45) Source(76, 20) + SourceIndex(0) +9 >Emitted(101, 53) Source(100, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -1965,12 +1969,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(98, 1) Source(100, 1) + SourceIndex(0) -2 >Emitted(98, 2) Source(100, 2) + SourceIndex(0) -3 >Emitted(98, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(98, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(98, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(98, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(98, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(102, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(102, 2) Source(100, 2) + SourceIndex(0) +3 >Emitted(102, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(102, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(102, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(102, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(102, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index 57000180db4..c9b3dfb6d7a 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -26,7 +26,11 @@ class TypeSymbol extends InferenceSymbol { //// [recursiveComplicatedClasses.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index 5f6e3ab0b06..e7ce63794fd 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -31,7 +31,11 @@ declare module MsPortal.Controls.Base.ItemList { //// [recursivelySpecializedConstructorDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index d7b644514cc..37ba6aab5d4 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -34,7 +34,11 @@ module.exports = { //// [foo3.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 77417da53f3..d81c9a0e2a7 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1021,7 +1021,11 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index cd56b78f0a3..2f2c4a3fdb5 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -68,7 +68,11 @@ class I extends G { //// [returnInConstructor1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 783ffb5899e..3488ebd8ac0 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -26,7 +26,11 @@ function fn13(): C { return null; } //// [returnStatements.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 1ab4b160e7c..67013c3922e 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -10,7 +10,11 @@ class D extends C { //// [scopeCheckExtendedClassInsidePublicMethod2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 9d1fafea4c9..7bb90a136ba 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -10,7 +10,11 @@ class D extends C { //// [scopeCheckExtendedClassInsideStaticMethod1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index 0ab152adf11..d2061241cac 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -13,7 +13,11 @@ class D extends C { //// [scopeTests.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 305c7581959..251622f1308 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -5,7 +5,11 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index d3ac854d4dd..07be6489141 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -9,7 +9,11 @@ class Greeter extends AbstractGreeter { //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map index 6b18a783dfa..27577a7e338 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map] -{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 68dea53e96b..cb083f766e8 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -9,7 +9,11 @@ emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorA sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || function (d, b) { ->>> Object.setPrototypeOf(d, b); +>>> if (typeof Object.setPrototypeOf === "function") { +>>> Object.setPrototypeOf(d, b); +>>> } else { +>>> d.__proto__ = b; +>>> } >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; @@ -17,13 +21,13 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(6, 1) Source(1, 1) + SourceIndex(0) +1 >Emitted(10, 1) Source(1, 1) + SourceIndex(0) --- >>> function AbstractGreeter() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(7, 5) Source(1, 1) + SourceIndex(0) +1->Emitted(11, 5) Source(1, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -32,16 +36,16 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1->class AbstractGreeter { > 2 > } -1->Emitted(8, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(8, 6) Source(2, 2) + SourceIndex(0) +1->Emitted(12, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(12, 6) Source(2, 2) + SourceIndex(0) --- >>> return AbstractGreeter; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(9, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(9, 27) Source(2, 2) + SourceIndex(0) +1->Emitted(13, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(13, 27) Source(2, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -54,10 +58,10 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > 4 > class AbstractGreeter { > } -1 >Emitted(10, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(10, 2) Source(2, 2) + SourceIndex(0) -3 >Emitted(10, 2) Source(1, 1) + SourceIndex(0) -4 >Emitted(10, 6) Source(2, 2) + SourceIndex(0) +1 >Emitted(14, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(2, 2) + SourceIndex(0) +3 >Emitted(14, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(14, 6) Source(2, 2) + SourceIndex(0) --- >>>var Greeter = (function (_super) { 1-> @@ -65,21 +69,21 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1-> > > -1->Emitted(11, 1) Source(4, 1) + SourceIndex(0) +1->Emitted(15, 1) Source(4, 1) + SourceIndex(0) --- >>> __extends(Greeter, _super); 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->class Greeter extends 2 > AbstractGreeter -1->Emitted(12, 5) Source(4, 23) + SourceIndex(0) -2 >Emitted(12, 32) Source(4, 38) + SourceIndex(0) +1->Emitted(16, 5) Source(4, 23) + SourceIndex(0) +2 >Emitted(16, 32) Source(4, 38) + SourceIndex(0) --- >>> function Greeter() { 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(13, 5) Source(4, 1) + SourceIndex(0) +1 >Emitted(17, 5) Source(4, 1) + SourceIndex(0) --- >>> var _this = _super.apply(this, arguments) || this; 1->^^^^^^^^ @@ -89,8 +93,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts > public a = 10; > public nameA = "Ten"; > } -1->Emitted(14, 9) Source(4, 1) + SourceIndex(0) -2 >Emitted(14, 59) Source(7, 2) + SourceIndex(0) +1->Emitted(18, 9) Source(4, 1) + SourceIndex(0) +2 >Emitted(18, 59) Source(7, 2) + SourceIndex(0) --- >>> _this.a = 10; 1 >^^^^^^^^ @@ -104,11 +108,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > = 4 > 10 5 > ; -1 >Emitted(15, 9) Source(5, 12) + SourceIndex(0) -2 >Emitted(15, 16) Source(5, 13) + SourceIndex(0) -3 >Emitted(15, 19) Source(5, 16) + SourceIndex(0) -4 >Emitted(15, 21) Source(5, 18) + SourceIndex(0) -5 >Emitted(15, 22) Source(5, 19) + SourceIndex(0) +1 >Emitted(19, 9) Source(5, 12) + SourceIndex(0) +2 >Emitted(19, 16) Source(5, 13) + SourceIndex(0) +3 >Emitted(19, 19) Source(5, 16) + SourceIndex(0) +4 >Emitted(19, 21) Source(5, 18) + SourceIndex(0) +5 >Emitted(19, 22) Source(5, 19) + SourceIndex(0) --- >>> _this.nameA = "Ten"; 1->^^^^^^^^ @@ -122,11 +126,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > = 4 > "Ten" 5 > ; -1->Emitted(16, 9) Source(6, 12) + SourceIndex(0) -2 >Emitted(16, 20) Source(6, 17) + SourceIndex(0) -3 >Emitted(16, 23) Source(6, 20) + SourceIndex(0) -4 >Emitted(16, 28) Source(6, 25) + SourceIndex(0) -5 >Emitted(16, 29) Source(6, 26) + SourceIndex(0) +1->Emitted(20, 9) Source(6, 12) + SourceIndex(0) +2 >Emitted(20, 20) Source(6, 17) + SourceIndex(0) +3 >Emitted(20, 23) Source(6, 20) + SourceIndex(0) +4 >Emitted(20, 28) Source(6, 25) + SourceIndex(0) +5 >Emitted(20, 29) Source(6, 26) + SourceIndex(0) --- >>> return _this; >>> } @@ -136,8 +140,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1 > > 2 > } -1 >Emitted(18, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(18, 6) Source(7, 2) + SourceIndex(0) +1 >Emitted(22, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(22, 6) Source(7, 2) + SourceIndex(0) --- >>> return Greeter; 1->^^^^ @@ -145,8 +149,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > ^^^-> 1-> 2 > } -1->Emitted(19, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(19, 19) Source(7, 2) + SourceIndex(0) +1->Emitted(23, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(23, 19) Source(7, 2) + SourceIndex(0) --- >>>}(AbstractGreeter)); 1-> @@ -165,11 +169,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts > public a = 10; > public nameA = "Ten"; > } -1->Emitted(20, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(20, 2) Source(7, 2) + SourceIndex(0) -3 >Emitted(20, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(20, 3) Source(4, 23) + SourceIndex(0) -5 >Emitted(20, 18) Source(4, 38) + SourceIndex(0) -6 >Emitted(20, 21) Source(7, 2) + SourceIndex(0) +1->Emitted(24, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(24, 2) Source(7, 2) + SourceIndex(0) +3 >Emitted(24, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(24, 3) Source(4, 23) + SourceIndex(0) +5 >Emitted(24, 18) Source(4, 38) + SourceIndex(0) +6 >Emitted(24, 21) Source(7, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 56fd271bb34..2560437b43d 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -19,7 +19,11 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index 3f31e7f61df..0ea23b1b850 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -14,7 +14,11 @@ function g(tagName: any): Base { //// [specializedOverloadWithRestParameters.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index d8c53470b81..e9e4a286eb6 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -15,7 +15,11 @@ d.foo(); //// [staticFactory1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index c6c95c1e6bf..181c8aa9659 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -13,7 +13,11 @@ doThing(B); //OK //// [staticInheritance.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index ededeec9c5c..6634d3c3519 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -11,7 +11,11 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index fdb63a556e0..10519dace00 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -37,7 +37,11 @@ class E extends A { //// [staticPropSuper.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index ac78decef58..0598932c4bb 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -62,7 +62,11 @@ class Ds extends A { //// [strictModeInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index e376167c667..f15efc6e765 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -29,7 +29,11 @@ function foo() { //// [strictModeReservedWord.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index f6b864047a8..6f13aac7608 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -30,7 +30,11 @@ class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index 6836a7adff3..adcc83a1841 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -42,7 +42,11 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 4407e02a1e7..2d42c1e4d79 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -108,7 +108,11 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index ec44364d4a4..a3b5ecaeb26 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -170,7 +170,11 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index f25a43a353f..1aa94ba7c99 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -81,7 +81,11 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 16797d0e5b5..05cc496f25a 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -160,7 +160,11 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index ca52f7ed49f..5c06121d5a2 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -21,7 +21,11 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 8086362951f..6b82e0d4841 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -175,7 +175,11 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index 1fa01910cdb..49405cbd070 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -122,7 +122,11 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index 5aaa139f19a..2e526d41fba 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -114,7 +114,11 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 1f7ae528b5b..867beb93596 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -175,7 +175,11 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index d86b0519ebe..f13a56664ce 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -124,7 +124,11 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index f11d2e3c211..32f9b33fc71 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -114,7 +114,11 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index bdce522f104..2c177201732 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -52,7 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 2c0b10744f2..065d312c086 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -55,7 +55,11 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index efe3d5927a9..1c1ade16a08 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -42,7 +42,11 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index a3b1034d6a8..2c0da66f8c9 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -46,7 +46,11 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index f2657654c8b..1881825eb24 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -30,7 +30,11 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 04f05b81cef..263bb117d34 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -69,7 +69,11 @@ module TwoLevels { //// [subtypingWithObjectMembers.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 2cdf1b4401b..03d7228b2f9 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -36,7 +36,11 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 386ce781675..0eb506d3210 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -36,7 +36,11 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 5227eac7db4..f171736911b 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -64,7 +64,11 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index a1ec5e1f46f..bffca920982 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -43,7 +43,11 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index ea193a206ed..0ff4b73c848 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -46,7 +46,11 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index b5a8c75a03e..347df7c1720 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -30,7 +30,11 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 6607c7897dd..bbf1862bd0f 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -39,7 +39,11 @@ s.foo() + ss.foo(); //// [super.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index 44a48adab77..d437c923fe6 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -68,7 +68,11 @@ module Base4 { //// [super1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index e46b2825481..b8a679c4c8d 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -52,7 +52,11 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index b300f75b5fa..f2f6ccbaf4a 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -15,7 +15,11 @@ class MyDerived extends MyBase { //// [superAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index 0388b8d7f10..021589c1e79 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -26,7 +26,11 @@ class Q extends P { //// [superAccess2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index ec8488f0dad..e62db8c823b 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -17,7 +17,11 @@ module test { //// [superAccessInFatArrow1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index 7ca13891555..ec83550a9f0 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -27,7 +27,11 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index d7ad39fc7a6..f1407cac107 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -12,7 +12,11 @@ class H extends E { //// [superCallAssignResult.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index 916d1568232..151e9da2f15 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -18,7 +18,11 @@ class D extends Base { //// [superCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index c5a8d293fff..7655b2df83b 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -12,7 +12,11 @@ class D extends Base { //// [superCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 8a59226d1d6..34555c677ba 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -15,7 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 6870662435e..9fc2987e96e 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -17,7 +17,11 @@ class E extends null { //// [superCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 0c2f3aa1c2d..1f3b0040e49 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -9,7 +9,11 @@ class D extends null { //// [superCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index 2fe03ab52b5..740f90d2e2b 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -12,7 +12,11 @@ class D extends Base { //// [superCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index a843456be76..65d95769c40 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -15,7 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index 3b23949584f..b5e454139c0 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -15,7 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index e4f1d4ed105..464c879212e 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -13,7 +13,11 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 47d1b5007fe..6ebe47532c8 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -12,7 +12,11 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index d29377ed246..19e480378a4 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -12,7 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index 844b24a0698..48855cb0d11 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -12,7 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index 71587371fa0..abfe5294a93 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -12,7 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index 99a026a38fd..dbea09ebced 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -52,7 +52,11 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index b65b2b270c5..104f8821dca 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -48,7 +48,11 @@ class Other extends Doing { //// [superCallInStaticMethod.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 0b6c768c86f..4f7a0087ab1 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -18,7 +18,11 @@ class B extends A { //// [superCallInsideClassDeclaration.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index c3bd2425dd4..01bce40d204 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -18,7 +18,11 @@ class B extends A { //// [superCallInsideClassExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index 45b6301a871..613997e789f 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -14,7 +14,11 @@ class B extends A { //// [superCallInsideObjectLiteralExpression.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index a98a9b3a322..0e1f3fbd837 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -24,7 +24,11 @@ var d = new D(); //// [superCallOutsideConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index 46aeb976987..132cb003921 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -14,7 +14,11 @@ class B extends A { //// [superCallParameterContextualTyping1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index a6aed2d1cae..bbb0871d385 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -13,7 +13,11 @@ class C extends A { //// [superCallParameterContextualTyping2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index 8445e86cfce..4469c918b31 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -33,7 +33,11 @@ class C extends CBase { //// [superCallParameterContextualTyping3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithCommentEmit01.js b/tests/baselines/reference/superCallWithCommentEmit01.js index ea23eb3be03..ae7f053e5d4 100644 --- a/tests/baselines/reference/superCallWithCommentEmit01.js +++ b/tests/baselines/reference/superCallWithCommentEmit01.js @@ -12,7 +12,11 @@ class B extends A { //// [superCallWithCommentEmit01.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 9dff2bc4c56..766c121d42b 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -11,7 +11,11 @@ class Foo extends Bar { //// [superCallWithMissingBaseClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index d5a9af8e06a..47292405faf 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -32,7 +32,11 @@ class OtherDerived extends OtherBase { //// [superCalls.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 540eef99840..707757b37b6 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -22,7 +22,11 @@ class Derived extends Base { //// [superCallsInConstructor.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index c52b2a22173..9b9681b2dee 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -53,7 +53,11 @@ class RegisteredUser extends User { //// [superErrors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index 17ac62b8491..bf8f9bd5e02 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -15,7 +15,11 @@ class B extends A { //// [superInCatchBlock1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 7f53128e99e..869dfde8e51 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -12,7 +12,11 @@ class C extends B { //// [superInConstructorParam1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 8c3d37efb34..1e040f627c8 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -69,7 +69,11 @@ class RegisteredUser4 extends User { //// [superInLambdas.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index f31a2492f3d..77f55772b69 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -61,7 +61,11 @@ class B extends A { //// [superInObjectLiterals_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index 2b6231691b2..c532b4556c8 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -14,7 +14,11 @@ class B extends A { //// [superNewCall1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 72353c27624..eb92e66a131 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -38,7 +38,11 @@ class MyDerived extends MyBase { //// [superPropertyAccess.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index 7e07c236eec..f15bdde29e2 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -29,7 +29,11 @@ class D extends C { //// [superPropertyAccess1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index f0776992312..98f1d0a190c 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -29,7 +29,11 @@ class D extends C { //// [superPropertyAccess2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index cb5e98ee2d2..d60310be5e7 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -16,7 +16,11 @@ class B extends A { //// [superPropertyAccessInComputedPropertiesOfNestedType_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index 0f4efbc719f..d2829eba561 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -78,7 +78,11 @@ instance.returnThis().fn(); //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 159b3b86c4c..e8f4dd3f872 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -31,7 +31,11 @@ class B extends A { //// [superPropertyAccess_ES5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index 43565251f79..3c5aaf9b843 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -15,7 +15,11 @@ class Bar extends Foo { //// [superSymbolIndexedAccess5.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 2f47d38660e..ff11a4c1b65 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -15,7 +15,11 @@ class Bar extends Foo { //// [superSymbolIndexedAccess6.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index e024285dc9e..8e23bfb25c4 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -16,7 +16,11 @@ var r2: number = d.y; //// [superWithGenericSpecialization.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index c8c99ef56cf..5e83df296d2 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -13,7 +13,11 @@ class D extends B { //// [superWithGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 638b970d7ff..51a4f93a4e4 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -11,7 +11,11 @@ class D extends C { //// [superWithTypeArgument.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index 4241cc6a699..3744e797615 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -11,7 +11,11 @@ class D extends C { //// [superWithTypeArgument2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 8f9d6252a87..9f76cc1ecff 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -15,7 +15,11 @@ class D extends C { //// [superWithTypeArgument3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index e244f318328..077affd0eda 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -29,7 +29,11 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 20a92712670..05a7fafb046 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -57,7 +57,11 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index cbb2b5d05dd..e31370d0acd 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -33,7 +33,11 @@ System.register([], function (exports_1, context_1) { System.register(["./foo"], function (exports_1, context_1) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index 3c1daae5d31..d359aa91628 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -20,7 +20,11 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 5eaac48383c..6b16742cca2 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -50,7 +50,11 @@ enum SomeEnum { //// [thisInInvalidContexts.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 788eb974e89..68579bb2368 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -51,7 +51,11 @@ export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index f49a0b8eb65..b8120fe732c 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -24,7 +24,11 @@ class Foo3 extends Base { //// [thisInSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index bfc9d8b4f17..3adc1c2a5b3 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -12,7 +12,11 @@ class Foo extends Base { //// [thisInSuperCall1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index df5dee1a321..f310654acae 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -21,7 +21,11 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index ac47e685c38..b0f4d62c746 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -14,7 +14,11 @@ class Foo extends Base { //// [thisInSuperCall3.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index 3169e0cd06b..ae95aac22b5 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -196,7 +196,11 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } //// [thisTypeInFunctions.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index 4b936e0198f..2591f9fe019 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -178,7 +178,11 @@ c.explicitProperty = (this, m) => m + this.n; //// [thisTypeInFunctionsNegative.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index 6cfb957dd39..b6c5295b482 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -22,7 +22,11 @@ export class ShortDetails extends React.Component<{ id: number }, {}> { //// [tsxCorrectlyParseLessThanComparison1.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index 200a8e2d78d..3a1ac6d2246 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -22,7 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index 717caa83310..f584dbf960a 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -22,7 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index 725eeec0326..bf3ab5d4a69 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -22,7 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index ff7e4a9a7e2..fefa118d704 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -22,7 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 0d515ac2114..29f4e78100e 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -34,7 +34,11 @@ export class Button extends React.Component { //// [button.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -53,7 +57,11 @@ exports.Button = Button; //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index 7352f7edef7..75284a28702 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -41,7 +41,11 @@ let i =
x.propertyNotOnHtmlDivElement} />; //// [file.jsx] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index a832e26806e..215046ba2b6 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -27,7 +27,11 @@ class MyButtonComponent extends React.Component<{},{}> { //// [file.js] "use strict"; var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index 9e7e39be710..e3cf89b0800 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -53,7 +53,11 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index e261492d35f..f16b6d1ce5a 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -85,7 +85,11 @@ let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 2ceec7e12e2..3e9b8f08cd4 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -147,7 +147,11 @@ if (hasMissingParameter()) { //// [typeGuardFunctionErrors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index a2b9df419ad..ffe263f9985 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -35,7 +35,11 @@ let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index f9f102e06ae..a1d1b7842d4 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -143,7 +143,11 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index c1e5b6b0af1..7ec705bdc2d 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -61,7 +61,11 @@ else { //// [typeGuardFunctionOfFormThisErrors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 75f0ccdf492..67d216d0f58 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -74,7 +74,11 @@ else { // it is a subtype of the type of x, or // - when false, has no effect on the type of x. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index c48034dfc36..88d0ac11a09 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -39,7 +39,11 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index eaaa656a08e..6dc97fb0152 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -84,7 +84,11 @@ namespace Test { //// [typeGuardOfFormThisMember.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index cb7fa087fe1..fbc2f23e547 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -34,7 +34,11 @@ namespace Test { //// [typeGuardOfFormThisMemberErrors.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 9721d17aac4..e4c7925a90b 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -46,7 +46,11 @@ function f4() { //// [typeMatch2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 7bad868e33c..9ac69544460 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -10,7 +10,11 @@ class D extends C { //// [typeOfSuperCall.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 4629854dd37..062ac61fd51 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -4,7 +4,11 @@ class C2 implements T {} //// [typeParameterAsBaseClass.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 64d0f20c2f0..e77c3b6e0d4 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -14,7 +14,11 @@ interface I2 extends U { } // type parameters cannot be used as base types // these are all errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 73efba3f0d7..5d15b09720f 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -14,7 +14,11 @@ function f(a: T) { //// [typeParameterExtendingUnion1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index 17d8d02cd9a..d274169391f 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -14,7 +14,11 @@ function f(a: T) { //// [typeParameterExtendingUnion2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 0d30916767e..745e2dffe00 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -42,7 +42,11 @@ class D extends C { //// [typeRelationships.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index 3abbb5cd21b..c66ed5fbfd4 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -13,7 +13,11 @@ module M2 { //// [typeValueConflict1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 604acf71d15..c72115d0dfc 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -20,7 +20,11 @@ module M3 { //// [typeValueConflict2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index fb04510e23f..46f9d7dc7f9 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -23,7 +23,11 @@ var r2: typeof d; //// [typeofClass2.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index e46c2a3c267..d011126edeb 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -44,7 +44,11 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index 37fc51c3f3a..79cd99f249d 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -42,7 +42,11 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index 3d07bc89571..a96a892e9a2 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -5,7 +5,11 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index 393c5e24544..aa4fac8d6eb 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -124,7 +124,11 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index 3edb48cd2d1..4f3990b7b57 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -50,7 +50,11 @@ class MyView extends View { //// [underscoreMapFirst.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index c7f30f0ec87..439c33df0ec 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -26,7 +26,11 @@ class D extends C { //// [underscoreThisInDerivedClass01.js] // @target es5 var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index 89d3bf5a4f9..26f2796e4b0 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -20,7 +20,11 @@ class D extends C { //// [underscoreThisInDerivedClass02.js] // @target es5 var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index bcb1f28f12b..1cafbc8d65c 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -21,7 +21,11 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index a908067574f..12d524f8616 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -29,7 +29,11 @@ var arr9 = [e, f]; // (E|F)[] // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index 38c991bed61..bf5c69f93e9 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -75,7 +75,11 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index 9fed0f3a716..3768213892a 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -34,7 +34,11 @@ class C5 { //// [unknownSymbols1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index e4c102d882d..fbb4c157665 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -155,7 +155,11 @@ module ts { //// [unspecializedConstraints.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index a651fdf7e8e..67e3d579dc4 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -45,7 +45,11 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index bf5e996d2d2..af2c9d96f52 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -16,7 +16,11 @@ namespace Validation { //// [unusedClassesinNamespace4.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 6419fbe250b..7bea43688ad 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -104,7 +104,11 @@ namespace Greeter { //// [unusedIdentifiersConsolidated1.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index b5eecf1720d..b32d9413bdf 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -11,7 +11,11 @@ class Super extends Base { //// [validUseOfThisInSuper.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index 547260c6197..f9674ceb328 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -26,7 +26,11 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] var __extends = (this && this.__extends) || function (d, b) { - Object.setPrototypeOf(d, b); + if (typeof Object.setPrototypeOf === "function") { + Object.setPrototypeOf(d, b); + } else { + d.__proto__ = b; + } function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; From 570575ad43678509f94ce6cbc49b292be6440e9e Mon Sep 17 00:00:00 2001 From: vvakame Date: Sat, 3 Dec 2016 11:30:36 +0900 Subject: [PATCH 096/289] address #12622 --- src/compiler/transformers/es2015.ts | 10 ++-- ...sClassHeritageListMemberTypeAnnotations.js | 10 ++-- ...accessibleTypeInTypeParameterConstraint.js | 10 ++-- .../reference/abstractClassInLocalScope.js | 10 ++-- .../abstractClassInLocalScopeIsAbstract.js | 10 ++-- tests/baselines/reference/abstractProperty.js | 10 ++-- .../reference/abstractPropertyNegative.js | 10 ++-- .../accessOverriddenBaseClassMember1.js | 10 ++-- .../accessors_spec_section-4.5_inference.js | 10 ++-- .../reference/aliasUsageInAccessorsOfClass.js | 10 ++-- .../baselines/reference/aliasUsageInArray.js | 10 ++-- .../aliasUsageInFunctionExpression.js | 10 ++-- .../reference/aliasUsageInGenericFunction.js | 10 ++-- .../reference/aliasUsageInIndexerOfClass.js | 10 ++-- .../reference/aliasUsageInObjectLiteral.js | 10 ++-- .../reference/aliasUsageInOrExpression.js | 10 ++-- ...aliasUsageInTypeArgumentOfExtendsClause.js | 20 +++---- .../reference/aliasUsageInVarAssignment.js | 10 ++-- .../reference/ambiguousOverloadResolution.js | 10 ++-- .../reference/apparentTypeSubtyping.js | 10 ++-- .../reference/apparentTypeSupertype.js | 10 ++-- .../reference/arrayAssignmentTest1.js | 10 ++-- .../reference/arrayAssignmentTest2.js | 10 ++-- .../reference/arrayBestCommonTypes.js | 10 ++-- .../reference/arrayLiteralTypeInference.js | 10 ++-- tests/baselines/reference/arrayLiterals.js | 10 ++-- .../arrayLiteralsWithRecursiveGenerics.js | 10 ++-- ...rayOfSubtypeIsAssignableToReadonlyArray.js | 10 ++-- .../reference/arrowFunctionContexts.js | 10 ++-- .../assignmentCompatWithCallSignatures3.js | 10 ++-- .../assignmentCompatWithCallSignatures4.js | 10 ++-- .../assignmentCompatWithCallSignatures5.js | 10 ++-- .../assignmentCompatWithCallSignatures6.js | 10 ++-- ...ssignmentCompatWithConstructSignatures3.js | 10 ++-- ...ssignmentCompatWithConstructSignatures4.js | 10 ++-- ...ssignmentCompatWithConstructSignatures5.js | 10 ++-- ...ssignmentCompatWithConstructSignatures6.js | 10 ++-- .../assignmentCompatWithNumericIndexer.js | 10 ++-- .../assignmentCompatWithNumericIndexer3.js | 10 ++-- .../assignmentCompatWithObjectMembers4.js | 10 ++-- ...nmentCompatWithObjectMembersOptionality.js | 10 ++-- ...mentCompatWithObjectMembersOptionality2.js | 10 ++-- .../assignmentCompatWithStringIndexer.js | 10 ++-- .../reference/assignmentLHSIsValue.js | 10 ++-- .../reference/asyncImportedPromise_es5.js | 10 ++-- tests/baselines/reference/autolift4.js | 10 ++-- tests/baselines/reference/baseCheck.js | 10 ++-- .../reference/baseIndexSignatureResolution.js | 10 ++-- .../reference/baseTypeOrderChecking.js | 10 ++-- .../baseTypeWrappingInstantiationChain.js | 10 ++-- tests/baselines/reference/bases.js | 10 ++-- .../bestCommonTypeOfConditionalExpressions.js | 10 ++-- ...bestCommonTypeOfConditionalExpressions2.js | 10 ++-- .../reference/bestCommonTypeOfTuple2.js | 10 ++-- ...allSignatureAssignabilityInInheritance2.js | 10 ++-- ...allSignatureAssignabilityInInheritance3.js | 10 ++-- ...allSignatureAssignabilityInInheritance4.js | 10 ++-- ...allSignatureAssignabilityInInheritance5.js | 10 ++-- ...allSignatureAssignabilityInInheritance6.js | 10 ++-- tests/baselines/reference/callWithSpread.js | 10 ++-- .../reference/captureThisInSuperCall.js | 10 ++-- tests/baselines/reference/castingTuple.js | 10 ++-- .../baselines/reference/chainedAssignment3.js | 10 ++-- ...arameterConstrainedToOtherTypeParameter.js | 10 ++-- .../reference/checkForObjectTooStrict.js | 10 ++-- .../checkSuperCallBeforeThisAccessing1.js | 10 ++-- .../checkSuperCallBeforeThisAccessing2.js | 10 ++-- .../checkSuperCallBeforeThisAccessing3.js | 10 ++-- .../checkSuperCallBeforeThisAccessing4.js | 10 ++-- .../checkSuperCallBeforeThisAccessing5.js | 10 ++-- .../checkSuperCallBeforeThisAccessing6.js | 10 ++-- .../checkSuperCallBeforeThisAccessing7.js | 10 ++-- .../checkSuperCallBeforeThisAccessing8.js | 10 ++-- .../reference/circularImportAlias.js | 10 ++-- .../circularTypeofWithFunctionModule.js | 10 ++-- .../classAbstractConstructorAssignability.js | 10 ++-- .../reference/classAbstractCrashedOnce.js | 10 ++-- .../reference/classAbstractExtends.js | 10 ++-- .../reference/classAbstractFactoryFunction.js | 10 ++-- .../reference/classAbstractGeneric.js | 10 ++-- .../reference/classAbstractInAModule.js | 10 ++-- .../reference/classAbstractInheritance.js | 10 ++-- .../reference/classAbstractInstantiations1.js | 10 ++-- .../reference/classAbstractInstantiations2.js | 10 ++-- .../classAbstractOverrideWithAbstract.js | 10 ++-- .../reference/classAbstractSuperCalls.js | 10 ++-- .../classAbstractUsingAbstractMethod1.js | 10 ++-- .../classAbstractUsingAbstractMethods2.js | 10 ++-- .../classConstructorAccessibility2.js | 10 ++-- .../classConstructorAccessibility4.js | 10 ++-- .../classConstructorAccessibility5.js | 10 ++-- ...classConstructorParametersAccessibility.js | 10 ++-- ...lassConstructorParametersAccessibility2.js | 10 ++-- ...lassConstructorParametersAccessibility3.js | 10 ++-- ...clarationMergedInModuleWithContinuation.js | 10 ++-- .../classDeclaredBeforeClassFactory.js | 10 ++-- .../classDoesNotDependOnBaseTypes.js | 10 ++-- tests/baselines/reference/classExpression2.js | 10 ++-- tests/baselines/reference/classExpression3.js | 10 ++-- .../classExpressionExtendingAbstractClass.js | 10 ++-- .../reference/classExtendingBuiltinType.js | 10 ++-- .../reference/classExtendingClass.js | 10 ++-- .../reference/classExtendingClassLikeType.js | 10 ++-- .../reference/classExtendingNonConstructor.js | 10 ++-- .../baselines/reference/classExtendingNull.js | 10 ++-- .../reference/classExtendingPrimitive.js | 10 ++-- .../reference/classExtendingPrimitive2.js | 10 ++-- .../reference/classExtendingQualifiedName.js | 10 ++-- .../reference/classExtendingQualifiedName2.js | 10 ++-- .../reference/classExtendsAcrossFiles.js | 20 +++---- ...sMergedWithModuleNotReferingConstructor.js | 10 ++-- ...tendsClauseClassNotReferringConstructor.js | 10 ++-- .../reference/classExtendsEveryObjectType.js | 10 ++-- .../reference/classExtendsEveryObjectType2.js | 10 ++-- .../reference/classExtendsInterface.js | 10 ++-- .../classExtendsInterfaceInExpression.js | 10 ++-- .../classExtendsInterfaceInModule.js | 10 ++-- .../baselines/reference/classExtendsItself.js | 10 ++-- .../reference/classExtendsItselfIndirectly.js | 10 ++-- .../classExtendsItselfIndirectly2.js | 10 ++-- .../classExtendsItselfIndirectly3.js | 60 +++++++++---------- .../classExtendsMultipleBaseClasses.js | 10 ++-- tests/baselines/reference/classExtendsNull.js | 10 ++-- ...classExtendsShadowedConstructorFunction.js | 10 ++-- .../classExtendsValidConstructorFunction.js | 10 ++-- .../classHeritageWithTrailingSeparator.js | 10 ++-- .../reference/classImplementsClass2.js | 10 ++-- .../reference/classImplementsClass3.js | 10 ++-- .../reference/classImplementsClass4.js | 10 ++-- .../reference/classImplementsClass5.js | 10 ++-- .../reference/classImplementsClass6.js | 10 ++-- tests/baselines/reference/classIndexer3.js | 10 ++-- tests/baselines/reference/classInheritence.js | 10 ++-- .../reference/classIsSubtypeOfBaseType.js | 10 ++-- tests/baselines/reference/classOrder2.js | 10 ++-- tests/baselines/reference/classOrderBug.js | 10 ++-- .../reference/classSideInheritance1.js | 10 ++-- .../reference/classSideInheritance2.js | 10 ++-- .../reference/classSideInheritance3.js | 10 ++-- tests/baselines/reference/classUpdateTests.js | 10 ++-- .../classWithBaseClassButNoConstructor.js | 10 ++-- .../reference/classWithConstructors.js | 10 ++-- .../reference/classWithProtectedProperty.js | 10 ++-- .../reference/classWithStaticMembers.js | 10 ++-- tests/baselines/reference/classdecl.js | 10 ++-- .../reference/clodulesDerivedClasses.js | 10 ++-- ...llisionSuperAndLocalFunctionInAccessors.js | 10 ++-- ...isionSuperAndLocalFunctionInConstructor.js | 10 ++-- .../collisionSuperAndLocalFunctionInMethod.js | 10 ++-- ...ollisionSuperAndLocalFunctionInProperty.js | 10 ++-- .../collisionSuperAndLocalVarInAccessors.js | 10 ++-- .../collisionSuperAndLocalVarInConstructor.js | 10 ++-- .../collisionSuperAndLocalVarInMethod.js | 10 ++-- .../collisionSuperAndLocalVarInProperty.js | 10 ++-- .../collisionSuperAndNameResolution.js | 10 ++-- .../reference/collisionSuperAndParameter.js | 10 ++-- .../reference/collisionSuperAndParameter1.js | 10 ++-- ...perAndPropertyNameAsConstuctorParameter.js | 10 ++-- ...xpressionAndLocalVarWithSuperExperssion.js | 10 ++-- .../reference/commentsInheritance.js | 10 ++-- .../comparisonOperatorWithIdenticalObjects.js | 10 ++-- ...ithNoRelationshipObjectsOnCallSignature.js | 10 ++-- ...lationshipObjectsOnConstructorSignature.js | 10 ++-- ...thNoRelationshipObjectsOnIndexSignature.js | 10 ++-- ...nshipObjectsOnInstantiatedCallSignature.js | 10 ++-- ...jectsOnInstantiatedConstructorSignature.js | 10 ++-- ...peratorWithSubtypeObjectOnCallSignature.js | 10 ++-- ...WithSubtypeObjectOnConstructorSignature.js | 10 ++-- ...eratorWithSubtypeObjectOnIndexSignature.js | 10 ++-- ...ubtypeObjectOnInstantiatedCallSignature.js | 10 ++-- ...bjectOnInstantiatedConstructorSignature.js | 10 ++-- ...isonOperatorWithSubtypeObjectOnProperty.js | 10 ++-- .../reference/complexClassRelationships.js | 10 ++-- ...catedGenericRecursiveBaseClassReference.js | 10 ++-- .../reference/compoundAssignmentLHSIsValue.js | 10 ++-- ...poundExponentiationAssignmentLHSIsValue.js | 10 ++-- .../reference/computedPropertyNames24_ES5.js | 10 ++-- .../reference/computedPropertyNames25_ES5.js | 10 ++-- .../reference/computedPropertyNames26_ES5.js | 10 ++-- .../reference/computedPropertyNames27_ES5.js | 10 ++-- .../reference/computedPropertyNames28_ES5.js | 10 ++-- .../reference/computedPropertyNames30_ES5.js | 10 ++-- .../reference/computedPropertyNames31_ES5.js | 10 ++-- .../reference/computedPropertyNames43_ES5.js | 10 ++-- .../reference/computedPropertyNames44_ES5.js | 10 ++-- .../reference/computedPropertyNames45_ES5.js | 10 ++-- .../conditionalOperatorWithIdenticalBCT.js | 10 ++-- .../conditionalOperatorWithoutIdenticalBCT.js | 10 ++-- .../reference/constantOverloadFunction.js | 10 ++-- .../constantOverloadFunctionNoSubtypeError.js | 10 ++-- ...nstraintCheckInGenericBaseTypeReference.js | 10 ++-- ...uctSignatureAssignabilityInInheritance2.js | 10 ++-- ...uctSignatureAssignabilityInInheritance3.js | 10 ++-- ...uctSignatureAssignabilityInInheritance4.js | 10 ++-- ...uctSignatureAssignabilityInInheritance5.js | 10 ++-- ...uctSignatureAssignabilityInInheritance6.js | 10 ++-- tests/baselines/reference/constructorArgs.js | 10 ++-- ...uctorFunctionTypeIsAssignableToBaseType.js | 10 ++-- ...ctorFunctionTypeIsAssignableToBaseType2.js | 10 ++-- .../constructorHasPrototypeProperty.js | 10 ++-- .../reference/constructorOverloads2.js | 10 ++-- .../reference/constructorOverloads3.js | 10 ++-- .../reference/constructorWithCapturedSuper.js | 10 ++-- ...constructorWithIncompleteTypeAnnotation.js | 10 ++-- .../contextualTypingArrayOfLambdas.js | 10 ++-- ...contextualTypingOfConditionalExpression.js | 10 ++-- ...ontextualTypingOfConditionalExpression2.js | 10 ++-- ...urcePropertyIsRelatableToTargetProperty.js | 10 ++-- .../reference/declFileClassExtendsNull.js | 10 ++-- .../declFileForFunctionTypeAsTypeParameter.js | 10 ++-- ...ileGenericClassWithGenericExtendedClass.js | 10 ++-- .../reference/declFileGenericType.js | 10 ++-- .../reference/declFileGenericType2.js | 10 ++-- ...lictingWithClassReferredByExtendsClause.js | 10 ++-- ...dsClauseThatHasItsContainerNameConflict.js | 10 ++-- .../declarationEmitExpressionInExtends.js | 10 ++-- .../declarationEmitExpressionInExtends2.js | 10 ++-- .../declarationEmitExpressionInExtends3.js | 10 ++-- .../declarationEmitExpressionInExtends4.js | 10 ++-- .../declarationEmitNameConflicts3.js | 10 ++-- .../declarationEmitProtectedMembers.js | 10 ++-- .../declarationEmitThisPredicates01.js | 10 ++-- ...tionEmitThisPredicatesWithPrivateName01.js | 10 ++-- .../reference/declareDottedExtend.js | 10 ++-- .../reference/decoratorOnClassConstructor2.js | 10 ++-- .../reference/decoratorOnClassConstructor3.js | 10 ++-- .../reference/decoratorOnClassMethod12.js | 10 ++-- ...edClassConstructorWithExplicitReturns01.js | 10 ++-- ...tructorWithExplicitReturns01.sourcemap.txt | 10 ++-- ...derivedClassConstructorWithoutSuperCall.js | 10 ++-- ...ClassFunctionOverridesBaseClassAccessor.js | 10 ++-- .../derivedClassIncludesInheritedMembers.js | 10 ++-- ...idesIndexersWithAssignmentCompatibility.js | 10 ++-- .../derivedClassOverridesPrivateFunction1.js | 10 ++-- .../derivedClassOverridesPrivates.js | 10 ++-- .../derivedClassOverridesProtectedMembers.js | 10 ++-- .../derivedClassOverridesProtectedMembers2.js | 10 ++-- .../derivedClassOverridesProtectedMembers3.js | 10 ++-- .../derivedClassOverridesProtectedMembers4.js | 10 ++-- .../derivedClassOverridesPublicMembers.js | 10 ++-- .../derivedClassOverridesWithoutSubtype.js | 10 ++-- .../derivedClassParameterProperties.js | 10 ++-- ...dClassSuperCallsInNonConstructorMembers.js | 10 ++-- .../derivedClassSuperCallsWithThisArg.js | 10 ++-- .../reference/derivedClassTransitivity.js | 10 ++-- .../reference/derivedClassTransitivity2.js | 10 ++-- .../reference/derivedClassTransitivity3.js | 10 ++-- .../reference/derivedClassTransitivity4.js | 10 ++-- .../reference/derivedClassWithAny.js | 10 ++-- ...ivateInstanceShadowingProtectedInstance.js | 10 ++-- ...hPrivateInstanceShadowingPublicInstance.js | 10 ++-- ...thPrivateStaticShadowingProtectedStatic.js | 10 ++-- ...sWithPrivateStaticShadowingPublicStatic.js | 10 ++-- .../derivedClassWithoutExplicitConstructor.js | 10 ++-- ...derivedClassWithoutExplicitConstructor2.js | 10 ++-- ...derivedClassWithoutExplicitConstructor3.js | 10 ++-- tests/baselines/reference/derivedClasses.js | 10 ++-- .../reference/derivedGenericClassWithAny.js | 10 ++-- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 10 ++-- .../derivedTypeDoesNotRequireExtendsClause.js | 10 ++-- .../destructuringParameterDeclaration5.js | 10 ++-- ...BeforeEmitParameterPropertyDeclaration1.js | 10 ++-- ...SuperCallBeforeEmitPropertyDeclaration1.js | 10 ++-- ...arationAndParameterPropertyDeclaration1.js | 10 ++-- .../reference/emitThisInSuperMethodCall.js | 10 ++-- tests/baselines/reference/emptyModuleName.js | 10 ++-- ...rorForwardReferenceForwadingConstructor.js | 10 ++-- tests/baselines/reference/errorSuperCalls.js | 10 ++-- .../reference/errorSuperPropertyAccess.js | 10 ++-- .../reference/errorsInGenericTypeReference.js | 10 ++-- .../reference/es6ClassSuperCodegenBug.js | 10 ++-- tests/baselines/reference/es6ClassTest.js | 10 ++-- tests/baselines/reference/es6ClassTest2.js | 10 ++-- tests/baselines/reference/es6ClassTest7.js | 10 ++-- .../exportAssignmentOfGenericType1.js | 10 ++-- .../exportDeclarationInInternalModule.js | 10 ++-- tests/baselines/reference/extBaseClass1.js | 10 ++-- tests/baselines/reference/extBaseClass2.js | 10 ++-- .../extendAndImplementTheSameBaseType.js | 10 ++-- .../extendAndImplementTheSameBaseType2.js | 10 ++-- .../extendBaseClassBeforeItsDeclared.js | 10 ++-- .../extendClassExpressionFromModule.js | 10 ++-- .../extendConstructSignatureInInterface.js | 10 ++-- .../reference/extendNonClassSymbol1.js | 10 ++-- .../reference/extendNonClassSymbol2.js | 10 ++-- .../extendPrivateConstructorClass.js | 10 ++-- ...xtendingClassFromAliasAndUsageInIndexer.js | 20 +++---- .../reference/extendsClauseAlreadySeen.js | 10 ++-- .../reference/extendsClauseAlreadySeen2.js | 10 ++-- tests/baselines/reference/fluentClasses.js | 10 ++-- tests/baselines/reference/for-inStatements.js | 10 ++-- .../reference/for-inStatementsInvalid.js | 10 ++-- .../forStatementsMultipleInvalidDecl.js | 10 ++-- .../reference/functionImplementationErrors.js | 10 ++-- .../reference/functionImplementations.js | 10 ++-- .../reference/functionSubtypingOfVarArgs.js | 10 ++-- .../reference/functionSubtypingOfVarArgs2.js | 10 ++-- .../reference/generatedContextualTyping.js | 10 ++-- .../genericBaseClassLiteralProperty.js | 10 ++-- .../genericBaseClassLiteralProperty2.js | 10 ++-- ...allWithConstraintsTypeArgumentInference.js | 10 ++-- .../genericCallWithObjectTypeArgs2.js | 10 ++-- ...icCallWithObjectTypeArgsAndConstraints2.js | 10 ++-- ...icCallWithObjectTypeArgsAndConstraints3.js | 10 ++-- .../genericCallbacksAndClassHierarchy.js | 10 ++-- .../genericClassExpressionInFunction.js | 10 ++-- ...sInheritsConstructorFromNonGenericClass.js | 10 ++-- ...cClassPropertyInheritanceSpecialization.js | 10 ++-- .../reference/genericClassStaticMethod.js | 10 ++-- tests/baselines/reference/genericClasses3.js | 10 ++-- ...genericConstraintOnExtendedBuiltinTypes.js | 10 ++-- ...enericConstraintOnExtendedBuiltinTypes2.js | 10 ++-- .../genericDerivedTypeWithSpecializedBase.js | 10 ++-- .../genericDerivedTypeWithSpecializedBase2.js | 10 ++-- .../genericInheritedDefaultConstructors.js | 10 ++-- .../reference/genericPrototypeProperty2.js | 10 ++-- .../reference/genericPrototypeProperty3.js | 10 ++-- ...ericRecursiveImplicitConstructorErrors2.js | 10 ++-- ...ericRecursiveImplicitConstructorErrors3.js | 10 ++-- .../reference/genericTypeAssertions2.js | 10 ++-- .../reference/genericTypeAssertions4.js | 10 ++-- .../reference/genericTypeAssertions6.js | 10 ++-- .../reference/genericTypeConstraints.js | 10 ++-- ...genericTypeReferenceWithoutTypeArgument.js | 10 ++-- ...enericTypeReferenceWithoutTypeArgument2.js | 10 ++-- .../genericWithIndexerOfTypeParameterType2.js | 10 ++-- .../reference/heterogeneousArrayLiterals.js | 10 ++-- .../reference/ifDoWhileStatements.js | 10 ++-- .../illegalSuperCallsInConstructor.js | 10 ++-- .../implementClausePrecedingExtends.js | 10 ++-- ...gAnInterfaceExtendingClassWithPrivates2.js | 10 ++-- ...AnInterfaceExtendingClassWithProtecteds.js | 10 ++-- .../baselines/reference/importAsBaseClass.js | 10 ++-- tests/baselines/reference/importHelpers.js | 10 ++-- .../reference/importHelpersNoHelpers.js | 10 ++-- .../reference/importHelpersNoModule.js | 10 ++-- .../reference/importShadowsGlobalName.js | 10 ++-- .../reference/importUsedInExtendsList1.js | 10 ++-- .../reference/indexerConstraints2.js | 10 ++-- .../reference/indirectSelfReference.js | 10 ++-- .../reference/indirectSelfReferenceGeneric.js | 10 ++-- .../infinitelyExpandingTypesNonGenericBase.js | 10 ++-- .../inheritFromGenericTypeParameter.js | 10 ++-- ...SameNamePrivatePropertiesFromSameOrigin.js | 10 ++-- tests/baselines/reference/inheritance.js | 10 ++-- tests/baselines/reference/inheritance1.js | 10 ++-- ...itanceGrandParentPrivateMemberCollision.js | 10 ++-- ...tPrivateMemberCollisionWithPublicMember.js | 10 ++-- ...tPublicMemberCollisionWithPrivateMember.js | 10 ++-- ...ritanceMemberAccessorOverridingAccessor.js | 10 ++-- ...heritanceMemberAccessorOverridingMethod.js | 10 ++-- ...ritanceMemberAccessorOverridingProperty.js | 10 ++-- ...inheritanceMemberFuncOverridingAccessor.js | 10 ++-- .../inheritanceMemberFuncOverridingMethod.js | 10 ++-- ...inheritanceMemberFuncOverridingProperty.js | 10 ++-- ...ritanceMemberPropertyOverridingAccessor.js | 10 ++-- ...heritanceMemberPropertyOverridingMethod.js | 10 ++-- ...ritanceMemberPropertyOverridingProperty.js | 10 ++-- .../inheritanceOfGenericConstructorMethod1.js | 10 ++-- .../inheritanceOfGenericConstructorMethod2.js | 10 ++-- ...ritanceStaticAccessorOverridingAccessor.js | 10 ++-- ...heritanceStaticAccessorOverridingMethod.js | 10 ++-- ...ritanceStaticAccessorOverridingProperty.js | 10 ++-- ...inheritanceStaticFuncOverridingAccessor.js | 10 ++-- ...eStaticFuncOverridingAccessorOfFuncType.js | 10 ++-- .../inheritanceStaticFuncOverridingMethod.js | 10 ++-- ...inheritanceStaticFuncOverridingProperty.js | 10 ++-- ...eStaticFuncOverridingPropertyOfFuncType.js | 10 ++-- ...taticFunctionOverridingInstanceProperty.js | 10 ++-- .../inheritanceStaticMembersCompatible.js | 10 ++-- .../inheritanceStaticMembersIncompatible.js | 10 ++-- ...ritanceStaticPropertyOverridingAccessor.js | 10 ++-- ...heritanceStaticPropertyOverridingMethod.js | 10 ++-- ...ritanceStaticPropertyOverridingProperty.js | 10 ++-- .../inheritedConstructorWithRestParams.js | 10 ++-- .../inheritedConstructorWithRestParams2.js | 10 ++-- .../inheritedModuleMembersForClodule.js | 10 ++-- .../reference/instanceOfAssignability.js | 10 ++-- ...nstancePropertiesInheritedIntoClassType.js | 10 ++-- .../reference/instanceSubtypeCheck2.js | 10 ++-- ...nstanceofWithStructurallyIdenticalTypes.js | 10 ++-- .../instantiatedReturnTypeContravariance.js | 10 ++-- .../reference/interfaceClassMerging.js | 10 ++-- .../reference/interfaceClassMerging2.js | 10 ++-- .../reference/interfaceExtendsClass1.js | 10 ++-- .../interfaceExtendsClassWithPrivate1.js | 10 ++-- .../interfaceExtendsClassWithPrivate2.js | 10 ++-- .../reference/interfaceImplementation8.js | 10 ++-- .../invalidModuleWithStatementsOfEveryKind.js | 10 ++-- .../invalidMultipleVariableDeclarations.js | 10 ++-- .../reference/invalidReturnStatements.js | 10 ++-- .../isolatedModulesImportExportElision.js | 10 ++-- tests/baselines/reference/jsxViaImport.js | 10 ++-- .../reference/keyofAndIndexedAccess.js | 10 ++-- tests/baselines/reference/lambdaArgCrash.js | 10 ++-- tests/baselines/reference/lift.js | 10 ++-- tests/baselines/reference/localTypes1.js | 10 ++-- tests/baselines/reference/m7Bugs.js | 10 ++-- .../reference/mergedDeclarations5.js | 10 ++-- .../reference/mergedDeclarations6.js | 10 ++-- .../mergedInheritedClassInterface.js | 10 ++-- .../mergedInterfacesWithInheritedPrivates2.js | 10 ++-- .../mergedInterfacesWithInheritedPrivates3.js | 10 ++-- .../missingPropertiesOfClassExpression.js | 10 ++-- tests/baselines/reference/moduleAsBaseType.js | 10 ++-- .../moduleImportedForTypeArgumentPosition.js | 10 ++-- .../moduleWithStatementsOfEveryKind.js | 10 ++-- .../reference/multipleInheritance.js | 10 ++-- .../mutuallyRecursiveGenericBaseTypes2.js | 10 ++-- .../noImplicitAnyMissingGetAccessor.js | 10 ++-- .../noImplicitAnyMissingSetAccessor.js | 10 ++-- ...enericClassExtendingGenericClassWithAny.js | 10 ++-- ...cIndexerConstrainsPropertyDeclarations2.js | 10 ++-- .../reference/numericIndexerConstraint3.js | 10 ++-- .../reference/numericIndexerConstraint4.js | 10 ++-- .../reference/numericIndexerTyping2.js | 10 ++-- ...objectCreationOfElementAccessExpression.js | 10 ++-- ...objectTypeHidingMembersOfExtendedObject.js | 10 ++-- ...objectTypesIdentityWithNumericIndexers1.js | 10 ++-- ...objectTypesIdentityWithNumericIndexers2.js | 10 ++-- ...objectTypesIdentityWithNumericIndexers3.js | 10 ++-- .../objectTypesIdentityWithPrivates.js | 10 ++-- .../objectTypesIdentityWithPrivates2.js | 10 ++-- .../objectTypesIdentityWithPrivates3.js | 10 ++-- .../objectTypesIdentityWithStringIndexers.js | 10 ++-- .../objectTypesIdentityWithStringIndexers2.js | 10 ++-- .../optionalConstructorArgInSuper.js | 10 ++-- tests/baselines/reference/optionalMethods.js | 10 ++-- .../reference/optionalParamArgsTest.js | 10 ++-- .../reference/optionalParamInOverride.js | 10 ++-- .../reference/optionalParameterProperty.js | 10 ++-- .../baselines/reference/outModuleConcatAmd.js | 10 ++-- .../outModuleConcatAmd.sourcemap.txt | 10 ++-- .../reference/outModuleConcatSystem.js | 10 ++-- .../outModuleConcatSystem.sourcemap.txt | 10 ++-- .../reference/outModuleTripleSlashRefs.js | 10 ++-- .../outModuleTripleSlashRefs.sourcemap.txt | 10 ++-- tests/baselines/reference/overload1.js | 10 ++-- .../overloadOnConstConstraintChecks1.js | 10 ++-- .../overloadOnConstConstraintChecks2.js | 10 ++-- .../overloadOnConstConstraintChecks3.js | 10 ++-- .../overloadOnConstConstraintChecks4.js | 10 ++-- .../overloadOnConstantsInvalidOverload1.js | 10 ++-- .../baselines/reference/overloadResolution.js | 10 ++-- .../overloadResolutionClassConstructors.js | 10 ++-- .../overloadResolutionConstructors.js | 10 ++-- .../reference/overloadingOnConstants1.js | 10 ++-- .../reference/overloadingOnConstants2.js | 10 ++-- .../overridingPrivateStaticMembers.js | 10 ++-- .../reference/parseErrorInHeritageClause1.js | 10 ++-- tests/baselines/reference/parser509630.js | 10 ++-- tests/baselines/reference/parserAstSpans1.js | 10 ++-- .../reference/parserClassDeclaration1.js | 10 ++-- .../reference/parserClassDeclaration3.js | 10 ++-- .../reference/parserClassDeclaration4.js | 10 ++-- .../reference/parserClassDeclaration5.js | 10 ++-- .../reference/parserClassDeclaration6.js | 10 ++-- ...rrorRecovery_ExtendsOrImplementsClause2.js | 10 ++-- ...rrorRecovery_ExtendsOrImplementsClause4.js | 10 ++-- ...rrorRecovery_ExtendsOrImplementsClause5.js | 10 ++-- .../parserGenericsInTypeContexts1.js | 10 ++-- .../parserGenericsInTypeContexts2.js | 10 ++-- .../baselines/reference/parserRealSource10.js | 10 ++-- .../baselines/reference/parserRealSource11.js | 10 ++-- tests/baselines/reference/parserharness.js | 10 ++-- ...artiallyAnnotatedFunctionInferenceError.js | 10 ++-- ...tatedFunctionInferenceWithTypeParameter.js | 10 ++-- tests/baselines/reference/primitiveMembers.js | 10 ++-- tests/baselines/reference/privacyClass.js | 10 ++-- .../privacyClassExtendsClauseDeclFile.js | 20 +++---- tests/baselines/reference/privacyGloClass.js | 10 ++-- .../reference/privateAccessInSubclass1.js | 10 ++-- .../privateInstanceMemberAccessibility.js | 10 ++-- ...tedMembersAreNotAccessibleDestructuring.js | 10 ++-- .../privateStaticMemberAccessibility.js | 10 ++-- .../privateStaticNotAccessibleInClodule2.js | 10 ++-- .../amd/testGlo.js | 10 ++-- .../node/testGlo.js | 10 ++-- .../reference/project/prologueEmit/amd/out.js | 10 ++-- .../project/prologueEmit/node/out.js | 10 ++-- .../amd/m'ain.js | 10 ++-- .../node/m'ain.js | 10 ++-- .../reference/propertiesAndIndexers.js | 10 ++-- tests/baselines/reference/propertyAccess.js | 10 ++-- ...tyAccessOnTypeParameterWithConstraints2.js | 10 ++-- ...tyAccessOnTypeParameterWithConstraints3.js | 10 ++-- ...tyAccessOnTypeParameterWithConstraints5.js | 10 ++-- ...sPropertyAccessibleWithinNestedSubclass.js | 10 ++-- ...PropertyAccessibleWithinNestedSubclass1.js | 10 ++-- ...edClassPropertyAccessibleWithinSubclass.js | 10 ++-- ...dClassPropertyAccessibleWithinSubclass2.js | 10 ++-- ...dClassPropertyAccessibleWithinSubclass3.js | 10 ++-- .../protectedInstanceMemberAccessibility.js | 10 ++-- tests/baselines/reference/protectedMembers.js | 10 ++-- ...icClassPropertyAccessibleWithinSubclass.js | 10 ++-- ...cClassPropertyAccessibleWithinSubclass2.js | 10 ++-- ...solution-does-not-affect-class-heritage.js | 10 ++-- .../readonlyConstructorAssignment.js | 10 ++-- .../reference/recursiveBaseCheck3.js | 10 ++-- .../reference/recursiveBaseCheck4.js | 10 ++-- .../reference/recursiveBaseCheck6.js | 10 ++-- .../recursiveBaseConstructorCreation1.js | 10 ++-- ...ssInstantiationsWithDefaultConstructors.js | 10 ++-- .../reference/recursiveClassReferenceTest.js | 10 ++-- .../recursiveClassReferenceTest.sourcemap.txt | 10 ++-- .../reference/recursiveComplicatedClasses.js | 10 ++-- ...sivelySpecializedConstructorDeclaration.js | 10 ++-- .../reference/reexportClassDefinition.js | 10 ++-- ...lassDeclarationWhenInBaseTypeResolution.js | 10 ++-- .../reference/returnInConstructor1.js | 10 ++-- tests/baselines/reference/returnStatements.js | 10 ++-- ...peCheckExtendedClassInsidePublicMethod2.js | 10 ++-- ...peCheckExtendedClassInsideStaticMethod1.js | 10 ++-- tests/baselines/reference/scopeTests.js | 10 ++-- .../reference/shadowPrivateMembers.js | 10 ++-- ...sWithDefaultConstructorAndExtendsClause.js | 10 ++-- ...tConstructorAndExtendsClause.sourcemap.txt | 10 ++-- .../specializedInheritedConstructors1.js | 10 ++-- .../specializedOverloadWithRestParameters.js | 10 ++-- tests/baselines/reference/staticFactory1.js | 10 ++-- .../baselines/reference/staticInheritance.js | 10 ++-- .../staticMemberAccessOffDerivedType1.js | 10 ++-- tests/baselines/reference/staticPropSuper.js | 10 ++-- .../reference/strictModeInConstructor.js | 10 ++-- .../reference/strictModeReservedWord.js | 10 ++-- ...trictModeReservedWordInClassDeclaration.js | 10 ++-- ...gIndexerConstrainsPropertyDeclarations2.js | 10 ++-- .../reference/subtypesOfTypeParameter.js | 10 ++-- .../subtypesOfTypeParameterWithConstraints.js | 10 ++-- ...subtypesOfTypeParameterWithConstraints4.js | 10 ++-- ...OfTypeParameterWithRecursiveConstraints.js | 10 ++-- .../reference/subtypingTransitivity.js | 10 ++-- .../reference/subtypingWithCallSignatures2.js | 10 ++-- .../reference/subtypingWithCallSignatures3.js | 10 ++-- .../reference/subtypingWithCallSignatures4.js | 10 ++-- .../subtypingWithConstructSignatures2.js | 10 ++-- .../subtypingWithConstructSignatures3.js | 10 ++-- .../subtypingWithConstructSignatures4.js | 10 ++-- .../subtypingWithConstructSignatures5.js | 10 ++-- .../subtypingWithConstructSignatures6.js | 10 ++-- .../reference/subtypingWithNumericIndexer.js | 10 ++-- .../reference/subtypingWithNumericIndexer3.js | 10 ++-- .../reference/subtypingWithNumericIndexer4.js | 10 ++-- .../reference/subtypingWithObjectMembers.js | 10 ++-- .../reference/subtypingWithObjectMembers4.js | 10 ++-- ...subtypingWithObjectMembersAccessibility.js | 10 ++-- ...ubtypingWithObjectMembersAccessibility2.js | 10 ++-- .../reference/subtypingWithStringIndexer.js | 10 ++-- .../reference/subtypingWithStringIndexer3.js | 10 ++-- .../reference/subtypingWithStringIndexer4.js | 10 ++-- tests/baselines/reference/super.js | 10 ++-- tests/baselines/reference/super1.js | 10 ++-- tests/baselines/reference/super2.js | 10 ++-- tests/baselines/reference/superAccess.js | 10 ++-- tests/baselines/reference/superAccess2.js | 10 ++-- .../reference/superAccessInFatArrow1.js | 10 ++-- .../reference/superCallArgsMustMatch.js | 10 ++-- .../reference/superCallAssignResult.js | 10 ++-- .../superCallBeforeThisAccessing1.js | 10 ++-- .../superCallBeforeThisAccessing2.js | 10 ++-- .../superCallBeforeThisAccessing3.js | 10 ++-- .../superCallBeforeThisAccessing4.js | 10 ++-- .../superCallBeforeThisAccessing5.js | 10 ++-- .../superCallBeforeThisAccessing6.js | 10 ++-- .../superCallBeforeThisAccessing7.js | 10 ++-- .../superCallBeforeThisAccessing8.js | 10 ++-- ...allFromClassThatDerivesFromGenericType1.js | 10 ++-- ...allFromClassThatDerivesFromGenericType2.js | 10 ++-- ...eButWithIncorrectNumberOfTypeArguments1.js | 10 ++-- ...sFromGenericTypeButWithNoTypeArguments1.js | 10 ++-- ...ivesNonGenericTypeButWithTypeArguments1.js | 10 ++-- .../reference/superCallInNonStaticMethod.js | 10 ++-- .../reference/superCallInStaticMethod.js | 10 ++-- .../superCallInsideClassDeclaration.js | 10 ++-- .../superCallInsideClassExpression.js | 10 ++-- .../superCallInsideObjectLiteralExpression.js | 10 ++-- .../reference/superCallOutsideConstructor.js | 10 ++-- .../superCallParameterContextualTyping1.js | 10 ++-- .../superCallParameterContextualTyping2.js | 10 ++-- .../superCallParameterContextualTyping3.js | 10 ++-- .../reference/superCallWithCommentEmit01.js | 10 ++-- .../superCallWithMissingBaseClass.js | 10 ++-- tests/baselines/reference/superCalls.js | 10 ++-- .../reference/superCallsInConstructor.js | 10 ++-- tests/baselines/reference/superErrors.js | 10 ++-- .../baselines/reference/superInCatchBlock1.js | 10 ++-- .../reference/superInConstructorParam1.js | 10 ++-- tests/baselines/reference/superInLambdas.js | 10 ++-- .../reference/superInObjectLiterals_ES5.js | 10 ++-- tests/baselines/reference/superNewCall1.js | 10 ++-- .../reference/superPropertyAccess.js | 10 ++-- .../reference/superPropertyAccess1.js | 10 ++-- .../reference/superPropertyAccess2.js | 10 ++-- ...essInComputedPropertiesOfNestedType_ES5.js | 10 ++-- .../reference/superPropertyAccessNoError.js | 10 ++-- .../reference/superPropertyAccess_ES5.js | 10 ++-- .../reference/superSymbolIndexedAccess5.js | 10 ++-- .../reference/superSymbolIndexedAccess6.js | 10 ++-- .../superWithGenericSpecialization.js | 10 ++-- .../baselines/reference/superWithGenerics.js | 10 ++-- .../reference/superWithTypeArgument.js | 10 ++-- .../reference/superWithTypeArgument2.js | 10 ++-- .../reference/superWithTypeArgument3.js | 10 ++-- ...side-object-literal-getters-and-setters.js | 10 ++-- tests/baselines/reference/switchStatements.js | 10 ++-- .../reference/systemModuleWithSuperClass.js | 10 ++-- .../reference/targetTypeBaseCalls.js | 10 ++-- .../reference/thisInInvalidContexts.js | 10 ++-- .../thisInInvalidContextsExternalModule.js | 10 ++-- tests/baselines/reference/thisInSuperCall.js | 10 ++-- tests/baselines/reference/thisInSuperCall1.js | 10 ++-- tests/baselines/reference/thisInSuperCall2.js | 10 ++-- tests/baselines/reference/thisInSuperCall3.js | 10 ++-- .../reference/thisTypeInFunctions.js | 10 ++-- .../reference/thisTypeInFunctionsNegative.js | 10 ++-- .../tsxCorrectlyParseLessThanComparison1.js | 10 ++-- .../baselines/reference/tsxDynamicTagName5.js | 10 ++-- .../baselines/reference/tsxDynamicTagName7.js | 10 ++-- .../baselines/reference/tsxDynamicTagName8.js | 10 ++-- .../baselines/reference/tsxDynamicTagName9.js | 10 ++-- .../reference/tsxExternalModuleEmit1.js | 20 +++---- .../tsxStatelessFunctionComponents2.js | 10 ++-- .../reference/tsxUnionTypeComponent1.js | 10 ++-- tests/baselines/reference/typeAssertions.js | 10 ++-- .../baselines/reference/typeGuardFunction.js | 10 ++-- .../reference/typeGuardFunctionErrors.js | 10 ++-- .../reference/typeGuardFunctionGenerics.js | 10 ++-- .../reference/typeGuardFunctionOfFormThis.js | 10 ++-- .../typeGuardFunctionOfFormThisErrors.js | 10 ++-- .../reference/typeGuardOfFormInstanceOf.js | 10 ++-- .../reference/typeGuardOfFormIsType.js | 10 ++-- .../reference/typeGuardOfFormThisMember.js | 10 ++-- .../typeGuardOfFormThisMemberErrors.js | 10 ++-- tests/baselines/reference/typeMatch2.js | 10 ++-- tests/baselines/reference/typeOfSuperCall.js | 10 ++-- .../reference/typeParameterAsBaseClass.js | 10 ++-- .../reference/typeParameterAsBaseType.js | 10 ++-- .../reference/typeParameterExtendingUnion1.js | 10 ++-- .../reference/typeParameterExtendingUnion2.js | 10 ++-- .../baselines/reference/typeRelationships.js | 10 ++-- .../baselines/reference/typeValueConflict1.js | 10 ++-- .../baselines/reference/typeValueConflict2.js | 10 ++-- tests/baselines/reference/typeofClass2.js | 10 ++-- .../typesWithSpecializedCallSignatures.js | 10 ++-- ...typesWithSpecializedConstructSignatures.js | 10 ++-- tests/baselines/reference/undeclaredBase.js | 10 ++-- .../undefinedIsSubtypeOfEverything.js | 10 ++-- .../baselines/reference/underscoreMapFirst.js | 10 ++-- .../underscoreThisInDerivedClass01.js | 10 ++-- .../underscoreThisInDerivedClass02.js | 10 ++-- .../reference/unionTypeEquivalence.js | 10 ++-- .../reference/unionTypeFromArrayLiteral.js | 10 ++-- .../reference/unionTypesAssignability.js | 10 ++-- tests/baselines/reference/unknownSymbols1.js | 10 ++-- .../reference/unspecializedConstraints.js | 10 ++-- ...untypedFunctionCallsWithTypeParameters1.js | 10 ++-- .../reference/unusedClassesinNamespace4.js | 10 ++-- .../unusedIdentifiersConsolidated1.js | 10 ++-- .../reference/validUseOfThisInSuper.js | 10 ++-- .../reference/varArgsOnConstructorTypes.js | 10 ++-- 660 files changed, 3350 insertions(+), 3350 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index fff52a8705e..72770307400 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3337,12 +3337,12 @@ namespace ts { scoped: false, priority: 0, text: ` + var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };` diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index fb158c687ba..e244964048a 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -21,12 +21,12 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index ec67e66bd3f..9df25d0ba4c 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -25,12 +25,12 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index 8e16f9ccc29..f2b1a7e5007 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -8,12 +8,12 @@ //// [abstractClassInLocalScope.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 40eae697b44..612d1b47230 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -8,12 +8,12 @@ //// [abstractClassInLocalScopeIsAbstract.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index 900f7aebcdd..f559b3c6123 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -22,12 +22,12 @@ class C extends B { } //// [abstractProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index fa137057be4..73ae1427571 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -44,12 +44,12 @@ abstract class AbstractAccessorMismatch { //// [abstractPropertyNegative.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index b468f1307df..5fdaacd464c 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -16,12 +16,12 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index aacadd6589f..024c25a909f 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -25,12 +25,12 @@ class LanguageSpec_section_4_5_inference { } //// [accessors_spec_section-4.5_inference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index df8662ac8cf..d84a03277eb 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -37,12 +37,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index a8606050394..031be503cff 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -31,12 +31,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 2ce51261eaa..f0207e82c86 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -30,12 +30,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 8e69665b03c..20b2028bbb1 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -34,12 +34,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index cf96549def6..a8b77a8e6cb 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -36,12 +36,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index d660bf2db67..00b7a231897 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -31,12 +31,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index e81917ed8a3..fe73404e8b4 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -34,12 +34,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index ee4a62008b1..17b73079f00 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -34,12 +34,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -54,12 +54,12 @@ var VisualizationModel = (function (_super) { exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 83c9bf080be..9a88c68421f 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -30,12 +30,12 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 319d3a75d01..3af1905dc03 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -9,12 +9,12 @@ var x: B; var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 8cc81a46cd7..2f5a3f8147e 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -24,12 +24,12 @@ class Derived2 extends Base2 { // error because of the prototy //// [apparentTypeSubtyping.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index ba5d63e3579..dfc3414aef1 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -14,12 +14,12 @@ class Derived extends Base { // error //// [apparentTypeSupertype.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index ac8ada2d86f..f2254fea530 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -86,12 +86,12 @@ arr_any = c3; // should be an error - is arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a112a5a7a90..90aa6740f4b 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -60,12 +60,12 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index 9ce41a2563a..8d2fe2376a3 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -108,12 +108,12 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index a14277c795b..37d0d1084f7 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -52,12 +52,12 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 1e5dcd2e45e..d43db0f6376 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -38,12 +38,12 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index e6e097c8b44..939878aa086 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -26,12 +26,12 @@ var myDerivedList: DerivedList; var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 701811e33de..352e31d0851 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -20,12 +20,12 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index e425ebf9337..b5e2cde6760 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -97,12 +97,12 @@ var asserted2: any; //// [arrowFunctionContexts.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index f241b28597d..fcc7e402296 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -101,12 +101,12 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index eade43f4dc8..066f2e5ead2 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -100,12 +100,12 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 36a024cbd3f..2d1d545bb42 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -67,12 +67,12 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index eb727863c77..83f28340210 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -44,12 +44,12 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index bff2b84f273..d0349f1734f 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -101,12 +101,12 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 8aefc846d9b..b5d1804c1da 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -100,12 +100,12 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index b21074b8ff3..ecec65f380f 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -67,12 +67,12 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index 95f585e8929..610d893c369 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -44,12 +44,12 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 05dce80507d..5380e982fea 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -45,12 +45,12 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 7785aa2b01f..e2346a74055 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -42,12 +42,12 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index dbc0612153f..39faa9a62c4 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -93,12 +93,12 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index fcbea350773..2fb80642d9e 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -90,12 +90,12 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 91f212c9fd9..82a90a3c4de 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -92,12 +92,12 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality2.js] // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index a0fb08df8d2..b59fa359b8e 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -55,12 +55,12 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index e4fa0fcc6b7..84dbed907d7 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -71,12 +71,12 @@ foo() = value; (foo()) = value; //// [assignmentLHSIsValue.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index a90d4254c61..55bff7302db 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -11,12 +11,12 @@ class Test { //// [task.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index d516e1e9b7b..9d7dcaefd29 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -24,12 +24,12 @@ class Point3D extends Point { //// [autolift4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 9684189d565..29e4c9fdc4d 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -30,12 +30,12 @@ function f() { //// [baseCheck.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index b1cb7c05ffc..8ccd2e5f335 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -25,12 +25,12 @@ var z: Derived = b.foo(); */ //// [baseIndexSignatureResolution.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index 5f7f6550ab9..e408805edb8 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -37,12 +37,12 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index 822c9584e1f..bb55cc0f9a4 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -28,12 +28,12 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index e45b934f1ad..1962e4d8244 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -21,12 +21,12 @@ new C().y; //// [bases.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index c5e124e638a..c43bfc7177f 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -29,12 +29,12 @@ function foo5(t: T, u: U): Object { //// [bestCommonTypeOfConditionalExpressions.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 1390eeb5a5d..0df9198a447 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -27,12 +27,12 @@ function foo3(t: T, u: U) { //// [bestCommonTypeOfConditionalExpressions2.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 17c9242e6aa..18b903bea70 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -23,12 +23,12 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 3d7d1167db5..1bf31ad9028 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -71,12 +71,12 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 8674a9def64..704ddfe5adf 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -116,12 +116,12 @@ module Errors { //// [callSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 3173b6bd661..db8c0fa0b52 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -51,12 +51,12 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index b1c387fb3e7..eca44c3c59f 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -51,12 +51,12 @@ interface I extends B { //// [callSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 1b7688262cb..c17b84f8594 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -54,12 +54,12 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index c5d6bbf2401..00bf93a092d 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -59,12 +59,12 @@ class D extends C { //// [callWithSpread.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 062d50e8ad9..43f8e8964df 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -9,12 +9,12 @@ class B extends A { } //// [captureThisInSuperCall.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 4b45f444f54..b4916cdbd65 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -33,12 +33,12 @@ t4[2] = 10; //// [castingTuple.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 6c8453c2348..cb313122a9a 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -23,12 +23,12 @@ a = b = new A(); //// [chainedAssignment3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 769f74d39ae..b56e5a93206 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -20,12 +20,12 @@ class C extends B { (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index cd65885b152..243022a81c2 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -32,12 +32,12 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index fece927ea9c..d1dc6839b8f 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -11,12 +11,12 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 143514be551..6fe42a69934 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -11,12 +11,12 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index a080d62434f..642ded30216 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -16,12 +16,12 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 2309600b2b8..1b9b1fd2b03 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -20,12 +20,12 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index cc3838fd40d..76853f4a210 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -8,12 +8,12 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index e6183330d97..4c2e04c46df 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -11,12 +11,12 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index 3040a118a75..d67fb3451f0 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -10,12 +10,12 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing7.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index 899128b6836..9bcf0ba1668 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -11,12 +11,12 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing8.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 6f2d3213aeb..154b0c8c68d 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -21,12 +21,12 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index 92403f0cb6b..357ce10188c 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -14,12 +14,12 @@ namespace maker { //// [circularTypeofWithFunctionModule.js] // Repro from #6072 +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 704ff554a00..915055bc991 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -15,12 +15,12 @@ new BB; new CC; //// [classAbstractConstructorAssignability.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index 107d8274369..e9a60f8c713 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -11,12 +11,12 @@ class bar extends foo { var x = new bar(); //// [classAbstractCrashedOnce.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index f9fa0ba2b32..1d5967b96a9 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -17,12 +17,12 @@ class E extends B { } //// [classAbstractExtends.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index addb71da717..c07390da7dd 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -18,12 +18,12 @@ NewB(A); NewB(B); //// [classAbstractFactoryFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index 486fe97f838..46406731e59 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -26,12 +26,12 @@ class G extends A { } //// [classAbstractGeneric.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 4681a422c8d..1c76bd43fb5 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -8,12 +8,12 @@ new M.A; new M.B; //// [classAbstractInAModule.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index ebaef77181a..dbf585c86d2 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -22,12 +22,12 @@ class FF extends CC {} abstract class GG extends CC {} //// [classAbstractInheritance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 96a0c1207be..22732bdc2b4 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -28,12 +28,12 @@ c = new B; // // Calling new with (non)abstract classes. // +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 3b93e78aebd..13dd7957aeb 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -52,12 +52,12 @@ class H { // error -- not declared abstract } //// [classAbstractInstantiations2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index 59cd1186ef9..c8b1d61aa9e 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -24,12 +24,12 @@ class DD extends BB { } //// [classAbstractOverrideWithAbstract.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index c63b2673713..9d46086bc70 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -28,12 +28,12 @@ abstract class BB extends AA { //// [classAbstractSuperCalls.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 421f3278489..56644d06a79 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -18,12 +18,12 @@ a = new C; // error, cannot instantiate abstract class. a.foo(); //// [classAbstractUsingAbstractMethod1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 397d5a3a411..011df09e258 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -28,12 +28,12 @@ class DD extends AA { } //// [classAbstractUsingAbstractMethods2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index 6cbf33cddff..c4e4b15bf3c 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -47,12 +47,12 @@ var dc = new DerivedC(1); //// [classConstructorAccessibility2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 61ce64ef19b..3946dcb82de 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -31,12 +31,12 @@ class D { } //// [classConstructorAccessibility4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index 8d0f9ad4069..6226c80750e 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -12,12 +12,12 @@ class Unrelated { //// [classConstructorAccessibility5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index 2433a6d3934..26fc8fcfe3d 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -27,12 +27,12 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index b29e3f06503..6d480641484 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -27,12 +27,12 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index 10031b9c74e..898b475f5ff 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -14,12 +14,12 @@ var d: Derived; d.p; // public, OK //// [classConstructorParametersAccessibility3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index 1521745f951..e9208d7d783 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -12,12 +12,12 @@ module M { } //// [classDeclarationMergedInModuleWithContinuation.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index 24df98a089f..ca548e2ecd7 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -8,12 +8,12 @@ function makeBaseClass() { //// [classDeclaredBeforeClassFactory.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index 88a1ab19d14..b154c47f70c 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -13,12 +13,12 @@ class StringTreeCollectionBase { class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 86d4509310d..1243b967219 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -3,12 +3,12 @@ class D { } var v = class C extends D {}; //// [classExpression2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 0d999b57a1a..7564c6274b3 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -7,12 +7,12 @@ c.c; //// [classExpression3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index 3c9db5e28ac..b44fb0a1dc8 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -9,12 +9,12 @@ var C = class extends A { // no error reported! //// [classExpressionExtendingAbstractClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index d2be7a12da2..b492f64c680 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -12,12 +12,12 @@ class C10 extends Array { } //// [classExtendingBuiltinType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index a81efb38bd0..c00c6ead988 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -32,12 +32,12 @@ var r7 = d2.thing(''); var r8 = D2.other(1); //// [classExtendingClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index 7760490a244..e1f08388848 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -59,12 +59,12 @@ class D5 extends getBadBase() { //// [classExtendingClassLikeType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index d14663b4edc..5cdf91d1b20 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -15,12 +15,12 @@ class C7 extends foo { } //// [classExtendingNonConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 9ce3714c1bd..087a16b3525 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -4,12 +4,12 @@ class C2 extends (null) { } //// [classExtendingNull.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 9e1a855379c..642ab4671af 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -16,12 +16,12 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index ff7f19fc68d..6b56f16547f 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -6,12 +6,12 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index 9a7d4551cf3..f144f13c5b8 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -8,12 +8,12 @@ module M { } //// [classExtendingQualifiedName.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index adf590b6804..6c07a405804 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -8,12 +8,12 @@ module M { } //// [classExtendingQualifiedName2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index 45598142549..b3584f42511 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -21,12 +21,12 @@ export const b = { //// [b.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -50,12 +50,12 @@ exports.b = { }; //// [a.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 187108fcf54..56d13af039d 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -14,12 +14,12 @@ module Foo { } //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 4d63c45f2c9..7f529967cda 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -7,12 +7,12 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index e5b5651153c..6babd7fb0b3 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -17,12 +17,12 @@ class C5 extends foo { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 9e935e789e4..9777735d4a9 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -4,12 +4,12 @@ class C2 extends { foo: string; } { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index 68167082021..b4329897528 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -9,12 +9,12 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index fa433e139c7..2d6b25bea37 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -9,12 +9,12 @@ class C extends factory(A) {} //// [classExtendsInterfaceInExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 933c5162477..89ed5042964 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -16,12 +16,12 @@ class D extends Mod.Nested.I {} //// [classExtendsInterfaceInModule.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index e13cd6dee6e..29f029bd626 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -6,12 +6,12 @@ class D extends D { } // error class E extends E { } // error //// [classExtendsItself.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index bef7ca9f8cf..a12b90dce44 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -12,12 +12,12 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index e9df1ddf908..1a073528bad 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -23,12 +23,12 @@ module O { } //// [classExtendsItselfIndirectly2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index a324fa1ce72..c42b937a85c 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -19,12 +19,12 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -36,12 +36,12 @@ var C = (function (_super) { return C; }(E)); // error //// [classExtendsItselfIndirectly_file2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -53,12 +53,12 @@ var D = (function (_super) { return D; }(C)); //// [classExtendsItselfIndirectly_file3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -70,12 +70,12 @@ var E = (function (_super) { return E; }(D)); //// [classExtendsItselfIndirectly_file4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -87,12 +87,12 @@ var C2 = (function (_super) { return C2; }(E2)); // error //// [classExtendsItselfIndirectly_file5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -104,12 +104,12 @@ var D2 = (function (_super) { return D2; }(C2)); //// [classExtendsItselfIndirectly_file6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 7cef2b247cc..7028383c349 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -4,12 +4,12 @@ class B { } class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index 5171dbc0085..d68d39a1acb 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -13,12 +13,12 @@ class D extends null { } //// [classExtendsNull.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index ad16e0aacaa..9dd314f8c1d 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -9,12 +9,12 @@ module M { } //// [classExtendsShadowedConstructorFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index 4e284b0c64c..603fd5d6997 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -6,12 +6,12 @@ var x = new foo(); // can be used as a constructor function class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 3314583f338..087696113d4 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -4,12 +4,12 @@ class D extends C, { } //// [classHeritageWithTrailingSeparator.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 0aeda35463f..756e5df939a 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -14,12 +14,12 @@ c = c2; c2 = c; //// [classImplementsClass2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 40fd20005e1..c6e50df32b0 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -15,12 +15,12 @@ c = c2; c2 = c; //// [classImplementsClass3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 631b5b38560..0b19e3d3aa7 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -17,12 +17,12 @@ c = c2; c2 = c; //// [classImplementsClass4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index a54c02f4b6b..941fc02a1ce 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -18,12 +18,12 @@ c = c2; c2 = c; //// [classImplementsClass5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index c2987ac066e..1e2eb13419a 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -22,12 +22,12 @@ c.bar(); // error c2.bar(); // should error //// [classImplementsClass6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 8bce9236899..5c65f63cc03 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -11,12 +11,12 @@ class D123 extends C123 { } //// [classIndexer3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index 23506947e9b..509433205e9 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -3,12 +3,12 @@ class B extends A { } class A extends A { } //// [classInheritence.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index df822eff312..861d84ebbac 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -16,12 +16,12 @@ class Derived2 extends Base<{ bar: string; }> { } //// [classIsSubtypeOfBaseType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index d05dd72e245..a80e58fe3cd 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -20,12 +20,12 @@ a.foo(); //// [classOrder2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index 22596246d64..a872fe3165f 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -16,12 +16,12 @@ class foo extends baz {} //// [classOrderBug.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index bdaaec468f8..09bddc4b22b 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -16,12 +16,12 @@ A.bar(); // valid C2.bar(); // valid //// [classSideInheritance1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index 34c7467a864..49ddf4daa72 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -21,12 +21,12 @@ class TextBase implements IText { } //// [classSideInheritance2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index a9fb0919930..55f5b6863aa 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -19,12 +19,12 @@ var r2: new (x: string) => A = B; // error var r3: typeof A = C; // ok //// [classSideInheritance3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 89dd0bded24..1cb5c51e963 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -114,12 +114,12 @@ class R { } //// [classUpdateTests.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index b23e0a13ba1..9bc92274b47 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -41,12 +41,12 @@ var d5 = new D(); // error var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index c3609f99b86..96dc9dea8c5 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -50,12 +50,12 @@ module Generics { } //// [classWithConstructors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 4a1b09ff350..aee0b38fef8 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -29,12 +29,12 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 5563e859c6a..e327c76afcf 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -20,12 +20,12 @@ var r2 = r.x; var r3 = r.foo; //// [classWithStaticMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index c88b0ccae0e..57ab3282526 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -94,12 +94,12 @@ class e { } //// [classdecl.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index 1bb3fc7b705..88a39a07003 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -23,12 +23,12 @@ module Path.Utils { //// [clodulesDerivedClasses.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index 2242c6667a6..d7bf933004d 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -40,12 +40,12 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInAccessors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index e761534649e..c725285a368 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -25,12 +25,12 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 70a9b22ddbd..b9bbd23c538 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -29,12 +29,12 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 258ad86c096..69beacb953b 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -19,12 +19,12 @@ class b extends Foo { } //// [collisionSuperAndLocalFunctionInProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 81ef63068e6..adf4a62a9b8 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -33,12 +33,12 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInAccessors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index 355bf0af8af..d6909c50783 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -21,12 +21,12 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 33512c60658..e63bf4d9ac5 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -19,12 +19,12 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index ee582bddbc5..48b1298a545 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -18,12 +18,12 @@ class b extends Foo { } //// [collisionSuperAndLocalVarInProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index e36a2a3cbad..6c8f5a8fe34 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -12,12 +12,12 @@ class Foo extends base { } //// [collisionSuperAndNameResolution.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index 7413002635d..ccc2d90f5f3 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -63,12 +63,12 @@ class Foo4 extends Foo { } //// [collisionSuperAndParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 0a7e21e8ca2..554148becf8 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -10,12 +10,12 @@ class Foo2 extends Foo { } //// [collisionSuperAndParameter1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index 5b12a0f9a9d..211602b2c14 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -31,12 +31,12 @@ class b4 extends a { } //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index d3270d4db57..e80dc2b8ebb 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -19,12 +19,12 @@ class b2 extends a { } //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 691854bffb0..cba27b5f2e8 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -152,12 +152,12 @@ i2_i = i3_i; //// [commentsInheritance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 3053f86f345..afaf71ca9b2 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -195,12 +195,12 @@ var r8b6 = b5 !== a5; var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index bf522a88367..236804898c3 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -169,12 +169,12 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 50e31f1d79c..0408116f8cf 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -169,12 +169,12 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index 8e4e7e7840d..44fceec0004 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -112,12 +112,12 @@ var r8b3 = b3 !== a3; var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index f208bd500cd..641b75e8688 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -150,12 +150,12 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index 4cff1bf0584..cc75533ef97 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -150,12 +150,12 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index 0a7cbce0c32..5fa26a64469 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -260,12 +260,12 @@ var r8b11 = b11 !== a11; //var r8b12 = b12 !== a12; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index bf8a6024faa..0a9a731428d 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -222,12 +222,12 @@ var r8b9 = b9 !== a9; //var r8b10 = b10 !== a10; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index f1e06f733e4..669202334b8 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -108,12 +108,12 @@ var r8b1 = b3 !== a3; var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 78a7b456924..983d756c8c0 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -165,12 +165,12 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index d08b7fbf11b..f7cc1cd02c7 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -165,12 +165,12 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index d1f29b650c6..f39f869018b 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -79,12 +79,12 @@ var rh3 = b1 !== a1; var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index 34cc2754746..fb481259bd3 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -48,12 +48,12 @@ class FooBase { } //// [complexClassRelationships.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 0e3dc9f3d31..c63df9b0c9b 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -6,12 +6,12 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index 8d17fcbfe10..b918701f5a1 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -124,12 +124,12 @@ foo() += value; (foo()) += value; //// [compoundAssignmentLHSIsValue.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index e7d1bef436e..a4812a00cc6 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -86,12 +86,12 @@ foo() **= value; (foo()) **= value; //// [compoundExponentiationAssignmentLHSIsValue.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 426b7cbaa65..8ac5c5be0b8 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -9,12 +9,12 @@ class C extends Base { } //// [computedPropertyNames24_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 239a5cada1a..12f3c1e301d 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -14,12 +14,12 @@ class C extends Base { } //// [computedPropertyNames25_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 89e8dd39169..f4a9d79af0f 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -11,12 +11,12 @@ class C extends Base { } //// [computedPropertyNames26_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index 7438ea49fd2..88319039ee6 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -6,12 +6,12 @@ class C extends Base { } //// [computedPropertyNames27_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 132f811b49e..696da70eb93 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -11,12 +11,12 @@ class C extends Base { } //// [computedPropertyNames28_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 63e448df3c1..3b4c663602d 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -16,12 +16,12 @@ class C extends Base { } //// [computedPropertyNames30_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index e3145b8c0a1..a727f478603 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -16,12 +16,12 @@ class C extends Base { } //// [computedPropertyNames31_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index 383da77c550..d2bde183b8b 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -13,12 +13,12 @@ class D extends C { } //// [computedPropertyNames43_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index 43bf2849333..b39e2375cb5 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -12,12 +12,12 @@ class D extends C { } //// [computedPropertyNames44_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 933e6ea66ff..a74e87bbfd5 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -13,12 +13,12 @@ class D extends C { } //// [computedPropertyNames45_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index c3a197e2a64..aa8b62c16e7 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -48,12 +48,12 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 0a1e2be65e9..8f4f4b20a56 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -24,12 +24,12 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 05cb517f9e0..170f5ba5dae 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -14,12 +14,12 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 754abfd106e..e104a1f8e89 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -15,12 +15,12 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index c1747ba54ff..fddad137136 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -20,12 +20,12 @@ class Container { } //// [constraintCheckInGenericBaseTypeReference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 9b6d7599516..06b273e9801 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -71,12 +71,12 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index c7b62f9521f..6ca8645ee9e 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -114,12 +114,12 @@ module Errors { //// [constructSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index c328a70455f..41ad9ead849 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -61,12 +61,12 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 4f2addd338b..cb5e254d6b2 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -51,12 +51,12 @@ interface I extends B { //// [constructSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index a8bac464ac3..b9389d26fc8 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -54,12 +54,12 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 001a0656c91..5f5a3d7b565 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -16,12 +16,12 @@ class Sub extends Super { //// [constructorArgs.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 4132399c970..13e2317bb6f 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -20,12 +20,12 @@ class Derived2 extends Base { } //// [constructorFunctionTypeIsAssignableToBaseType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index 339edd29823..e8c04ace7ef 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -34,12 +34,12 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index 551b2644518..76d260f780d 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -32,12 +32,12 @@ module Generic { } //// [constructorHasPrototypeProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index 5aca4c6583a..a3302dc70f9 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -26,12 +26,12 @@ f1.bar1(); //// [constructorOverloads2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index 063f4c72443..e202486ecec 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -23,12 +23,12 @@ f1.bar1(); //// [constructorOverloads3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithCapturedSuper.js b/tests/baselines/reference/constructorWithCapturedSuper.js index 706d2522cfb..be129d5f1ec 100644 --- a/tests/baselines/reference/constructorWithCapturedSuper.js +++ b/tests/baselines/reference/constructorWithCapturedSuper.js @@ -53,12 +53,12 @@ class D extends A { } //// [constructorWithCapturedSuper.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 6c670b245c5..2f481a58bea 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -281,12 +281,12 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 9a172c202b2..39cbbe78c00 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -15,12 +15,12 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index c573962825b..0a6794472a1 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -15,12 +15,12 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index 9ee11aeb985..7788ee44382 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -13,12 +13,12 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 2d7ca989a81..2e2bdd009d2 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -11,12 +11,12 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index 483c1ca4481..d362a5f04d9 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -4,12 +4,12 @@ class ExtendsNull extends null { } //// [declFileClassExtendsNull.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index f7465149b92..f0805f9617f 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -10,12 +10,12 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index 8d0e10f73f9..c1be3af34e1 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -13,12 +13,12 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index f579968df06..402b19c0ff3 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -41,12 +41,12 @@ export var j = C.F6; //// [declFileGenericType.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index 4f01f058b19..2d0bb3ce500 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -43,12 +43,12 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 8f38d09160f..65fee8c91e4 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -21,12 +21,12 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index cacaa587609..0a79b9be3bc 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -19,12 +19,12 @@ module A.B.C { } //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index acda2589195..4fb5b585c99 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -15,12 +15,12 @@ var q: B; q.s; //// [declarationEmitExpressionInExtends.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 8f0c53f66ac..e059e44f140 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -13,12 +13,12 @@ class MyClass extends getClass(2) { } //// [declarationEmitExpressionInExtends2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index 902ddc08bc0..19d59529486 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -45,12 +45,12 @@ export class MyClass4 extends getExportedClass(undefined)>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 31c8c3f722c..f92b9ab7c99 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -34,12 +34,12 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index b948302a2d5..2fa9323295a 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -15,12 +15,12 @@ class Derived extends Base { } //// [derivedClassFunctionOverridesBaseClassAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index cf5454d704f..3fe81a587af 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -41,12 +41,12 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index 0d483a3eff6..da2abf23166 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -18,12 +18,12 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index 8306e702cb1..14549e8d9c4 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -16,12 +16,12 @@ class DerivedClass extends BaseClass { new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index c32560eca59..b88ce8d37ee 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -16,12 +16,12 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesPrivates.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index 03addf8ace5..d44fc6a483d 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -37,12 +37,12 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 0cfe6f3dd9d..8f8e913c82b 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -64,12 +64,12 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d18fd9d1a30..2825524d224 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -72,12 +72,12 @@ class Derived10 extends Base { } //// [derivedClassOverridesProtectedMembers3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index 2d89040ff13..9d4c76a8384 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -15,12 +15,12 @@ class Derived2 extends Derived1 { } //// [derivedClassOverridesProtectedMembers4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 2ef057082bd..6390636e09f 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -63,12 +63,12 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index 4a1f7c0cbeb..3ce6c5d1966 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -24,12 +24,12 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesWithoutSubtype.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index cdf1ab4cbbd..340aa0f5709 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -96,12 +96,12 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index c7a90e31dfe..7238b7d1af3 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -33,12 +33,12 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 3d3aacdf55b..6a79fd2d2a2 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -29,12 +29,12 @@ class Derived4 extends Base { } //// [derivedClassSuperCallsWithThisArg.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index c5ea3722feb..b6cd5a284e4 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -22,12 +22,12 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index bf9f1dbb574..05648a00507 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -22,12 +22,12 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index d149d9f5aa9..a280316b639 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -22,12 +22,12 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 2d48cf28728..2d32ece1375 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -22,12 +22,12 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index b376364e542..64b6a1c995a 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -60,12 +60,12 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index e5fe6eb2560..6c9ff2f36e7 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -23,12 +23,12 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 5ac36e99b57..924526923f8 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -33,12 +33,12 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 9994c1bfb05..9705b1e8d03 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -22,12 +22,12 @@ class Derived extends Base { } //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 4183017f378..dd15ec7e66d 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -34,12 +34,12 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index d21cb14bcc4..7a145b763c0 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -26,12 +26,12 @@ var d = new D(); // error var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 0acf65cd177..29cb878de46 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -34,12 +34,12 @@ var d3 = new D(new Date(), new Date()); var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index 696ebcc1f9e..79d26767df6 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -48,12 +48,12 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index 36f1dcc799b..38af357d6c3 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -31,12 +31,12 @@ b.hue(); //// [derivedClasses.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index afba93ccac6..6644fefcac4 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -43,12 +43,12 @@ c = e; var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index c33bd3713fc..91224f98a5d 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -18,12 +18,12 @@ class Derived extends Base { } //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index 3e28aece101..926ca09274d 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -21,12 +21,12 @@ b = d2; var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index 0c27e9b7f85..831cf209995 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -52,12 +52,12 @@ d3({ y: "world" }); //// [destructuringParameterDeclaration5.js] // Parameter Declaration with generic +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index 80613c66be8..79babde83e2 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -14,12 +14,12 @@ class B extends A { //// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index c0478a993c4..d7988562315 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -16,12 +16,12 @@ class B extends A { } //// [emitSuperCallBeforeEmitPropertyDeclaration1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index 5d63f4f32af..fdec4c4e7be 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -14,12 +14,12 @@ class B extends A { } //// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 22d641e3414..c87ad7d4189 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -28,12 +28,12 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index f6f4ea759a6..e4ad120250f 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -5,12 +5,12 @@ class B extends A { //// [emptyModuleName.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 3320b144f11..851a97663de 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -12,12 +12,12 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 69691a62bb7..43d89076ade 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -75,12 +75,12 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index ed9ac2d8dd5..42a2acf4317 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -129,12 +129,12 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index e63005bfe1a..64227abe6b2 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -73,12 +73,12 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index af87c3db821..68fa43fd64b 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -15,12 +15,12 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index a20d939a794..e433f19ece3 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -85,12 +85,12 @@ declare module AmbientMod { //// [es6ClassTest.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 11d494c6291..491bec40e74 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -159,12 +159,12 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 9cd21f44685..d8f7f688ec0 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -9,12 +9,12 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index e5d43bfaa9e..76485e8d91e 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -24,12 +24,12 @@ define(["require", "exports"], function (require, exports) { return T; }); //// [exportAssignmentOfGenericType1_1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index 934b3bb6ef0..e83c10b59fd 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -19,12 +19,12 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index 4603ff26320..f144fbdbca8 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -20,12 +20,12 @@ module N { //// [extBaseClass1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index 285c96551b5..f453255379b 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -11,12 +11,12 @@ module M { //// [extBaseClass2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index b3150a12bde..5242430513a 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -14,12 +14,12 @@ d.baz(); d.foo; //// [extendAndImplementTheSameBaseType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index 1ecd77668d3..d670758f324 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -17,12 +17,12 @@ var r3: string = d.bar(); var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 73c19b72565..a2e55deaa26 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -4,12 +4,12 @@ class derived extends base { } class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index bd3e01a7b29..08ad33d619b 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -21,12 +21,12 @@ var x = (function () { module.exports = x; //// [foo2.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index 28c5108f238..dc721dc343a 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -11,12 +11,12 @@ var e: E = new E(1); //// [extendConstructSignatureInInterface.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index 8a6da5f4fa7..f52b0382827 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -4,12 +4,12 @@ var x = A; class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 60f7a46a14f..57695fb5fcf 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -6,12 +6,12 @@ var x = new Foo(); // legal, considered a constructor function class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 983c7220397..6578c4c9ce3 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -10,12 +10,12 @@ class C extends abc.XYZ { //// [extendPrivateConstructorClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index af5f78dfcec..f979a820f63 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -42,12 +42,12 @@ var Model = (function () { exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -62,12 +62,12 @@ var VisualizationModel = (function (_super) { exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index 06326b54282..1e9681a0d3c 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -7,12 +7,12 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 71555248556..502618d78ce 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -7,12 +7,12 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index 360c7775d35..887cb9c1feb 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -19,12 +19,12 @@ var z = c.foo().bar().baz(); // Fluent pattern //// [fluentClasses.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 90ab9a3f96b..d03972b9f17 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -81,12 +81,12 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 2ba55110f2e..938ab4daf87 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -64,12 +64,12 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 31398cb2af9..5bb0709c13c 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -55,12 +55,12 @@ for(var m: typeof M;;){} for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index a91b1b78f07..94335364ec8 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -75,12 +75,12 @@ var f13 = () => { //// [functionImplementationErrors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 4854d715c32..2a19b4b841f 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -158,12 +158,12 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC } //// [functionImplementations.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 4cd1f1096f3..01a6a130823 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -15,12 +15,12 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index fc3562ca339..a1aaf35748a 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -15,12 +15,12 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 0cf8767aa58..1551b671b62 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -356,12 +356,12 @@ var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; retur var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); //// [generatedContextualTyping.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index 753aa2f0733..c0ef8541ad7 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -13,12 +13,12 @@ class SubClass extends BaseClass { } //// [genericBaseClassLiteralProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 131fc2d36ab..53fb2472d05 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -16,12 +16,12 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index 055ef9d2f86..318f5aa1494 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -109,12 +109,12 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index e4399d19037..dc5bf22658d 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -33,12 +33,12 @@ var i: I; var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index f86cc2da293..ce39f51d49c 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -41,12 +41,12 @@ var r7 = f3(null, x => x); // any //// [genericCallWithObjectTypeArgsAndConstraints2.js] // Generic call with constraints infering type parameter from object member properties // No errors expected +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index 01a11c7f90b..76d0f0854ea 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -39,12 +39,12 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index d4303fa2037..645929e2c14 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -24,12 +24,12 @@ module M { } //// [genericCallbacksAndClassHierarchy.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index ab826e2916d..8d7098ba4f2 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -32,12 +32,12 @@ s.genericVar = 12; //// [genericClassExpressionInFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index dbd654576ec..8219bf91c38 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -6,12 +6,12 @@ class C { } //// [genericClassInheritsConstructorFromNonGenericClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index fa64843f29f..8563581f953 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -76,12 +76,12 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 8345b3d93a7..85b09999c6a 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -11,12 +11,12 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 2f8d09eae03..0097132b1e4 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -18,12 +18,12 @@ var z = v2.b; //// [genericClasses3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index 73fed8b3ea2..a956f444aec 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -27,12 +27,12 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index 8ec4552b70d..b51acfd80b4 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -26,12 +26,12 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 9da46a15ef7..d17f3992c46 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -13,12 +13,12 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index df9c113ceb5..3387beda5c4 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -13,12 +13,12 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index f287a5f934c..f9d4979fb2a 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -11,12 +11,12 @@ var c:Constructor> = B; // shouldn't error here //// [genericInheritedDefaultConstructors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index 892e6cc0217..f07c1f30594 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -16,12 +16,12 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index 03755b28683..a594644df6a 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -15,12 +15,12 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index f5c12bacce8..d60d4c960bd 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -27,12 +27,12 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index 3c680337351..6ecbdcf8dae 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -31,12 +31,12 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index d13e06a8ddd..df70516ad34 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -14,12 +14,12 @@ var r4: A = >new A(); var r5: A = >[]; // error //// [genericTypeAssertions2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index e1c4cab059c..f65447822c9 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -26,12 +26,12 @@ function foo2(x: T) { } //// [genericTypeAssertions4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 20a13d5718e..36262513319 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -25,12 +25,12 @@ var b: B; var c: A = >b; //// [genericTypeAssertions6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index b2332451507..fae7f381616 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -14,12 +14,12 @@ class BarExtended extends Bar { } //// [genericTypeConstraints.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 267666439b1..3d0e940eaa9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -40,12 +40,12 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument.js] // it is an error to use a generic type without type arguments // all of these are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 7fce4984d9c..552edc1f134 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -40,12 +40,12 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument2.js] // it is an error to use a generic type without type arguments // all of these are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index 444043fbeac..c12bec69ba6 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -15,12 +15,12 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index 6a9f8ae1453..afb3477111f 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -133,12 +133,12 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index fea4eee36fa..909b52ad0d6 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -164,12 +164,12 @@ do { }while(fn) //// [ifDoWhileStatements.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 3de32da45c0..1ddb27788d8 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -21,12 +21,12 @@ class Derived extends Base { } //// [illegalSuperCallsInConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index 5d717358863..6aa751d7b54 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -3,12 +3,12 @@ class C { foo: number } class D implements C extends C { } //// [implementClausePrecedingExtends.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 87b22c74f6b..4ab1c3add23 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -86,12 +86,12 @@ module M2 { } //// [implementingAnInterfaceExtendingClassWithPrivates2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 68ecf9ede2b..21e99dfa07b 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -42,12 +42,12 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index ea7c757e035..0f95c2d3dbb 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -21,12 +21,12 @@ var Greeter = (function () { exports.Greeter = Greeter; //// [importAsBaseClass_1.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index 0a9dcd4a780..06360b221b6 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -68,12 +68,12 @@ C = tslib_1.__decorate([ tslib_1.__metadata("design:paramtypes", []) ], C); //// [script.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index c7c575f5402..e48e51de44b 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -70,12 +70,12 @@ var o = { a: 1 }; var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); //// [script.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 212bc7a54f7..9d655f401c7 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -60,12 +60,12 @@ C = tslib_1.__decorate([ tslib_1.__metadata("design:paramtypes", []) ], C); //// [script.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 8431a87ce03..61f715a2194 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -21,12 +21,12 @@ define(["require", "exports"], function (require, exports) { return Foo; }); //// [Bar.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index f44a0fcfce4..b4bc18ddb7f 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -21,12 +21,12 @@ var Super = (function () { exports.Super = Super; //// [importUsedInExtendsList1_1.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index 45980beb09c..2fdfe55d22d 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -29,12 +29,12 @@ class K extends J { } //// [indexerConstraints2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index 931525d4b6b..9a3c5e3cfeb 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -3,12 +3,12 @@ class a extends b{ } class b extends a{ } //// [indirectSelfReference.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index e7d2bdf2a2b..f9ba7ccc940 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -3,12 +3,12 @@ class a extends b { } class b extends a { } //// [indirectSelfReferenceGeneric.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index 96a8e84ff60..bbcedbfa6b8 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -25,12 +25,12 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index d95150bbccc..b8ffd010380 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -3,12 +3,12 @@ class C extends T { } interface I extends T { } //// [inheritFromGenericTypeParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index b1224117ede..b63252a4449 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -11,12 +11,12 @@ interface A extends C, C2 { // ok } //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index b9a7c5a336f..7cb4b76c740 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -35,12 +35,12 @@ class Baad extends Good { //// [inheritance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index 0e5bff48a3b..4ad5c55dc62 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -62,12 +62,12 @@ l1 = sc; l1 = c; //// [inheritance1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index bd4b70f7938..2fd7aa913d0 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -11,12 +11,12 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index d72f85cf599..8f436ffd353 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -11,12 +11,12 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index c6b32f6bc5d..e13c592eccb 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -11,12 +11,12 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index fdc53cc7e9c..b593654036b 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -18,12 +18,12 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 13e624a9d57..84c1f0d3a4c 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -15,12 +15,12 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index 243992d5bd3..b8cec2486d7 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -13,12 +13,12 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 001f7b888e3..158c89d092e 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -15,12 +15,12 @@ class b extends a { } //// [inheritanceMemberFuncOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index 33a35428b8e..a2c8a6b690e 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -12,12 +12,12 @@ class b extends a { } //// [inheritanceMemberFuncOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 0675aead222..bd0a9e55ba1 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceMemberFuncOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index ec3e8519e62..2c7ae4fb6b6 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -14,12 +14,12 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index e2e1d734001..0b604adae2a 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 50d6b108588..71a9731e828 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -8,12 +8,12 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 871acd1d624..4c243028296 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -8,12 +8,12 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 72f12c8f81f..1bf2fd4eed7 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -15,12 +15,12 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index c58a0643a06..e35b3f24a5d 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -18,12 +18,12 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index beba3dbdf5e..d1035ae3d48 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -15,12 +15,12 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index d3f4b177e95..c51f321020d 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -13,12 +13,12 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index d86d08e7add..778e7987f27 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -15,12 +15,12 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index 1decf45e015..a6afadefb3a 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -12,12 +12,12 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index e9ea5d2f6a1..37b3113b855 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -12,12 +12,12 @@ class b extends a { } //// [inheritanceStaticFuncOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index dd2260ecf31..0d328df7c53 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceStaticFuncOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 9a555ce218f..541cda8e1b2 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index e357eb6e01f..4ec01a1dc36 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceStaticFunctionOverridingInstanceProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 044db517290..74a86c64f8c 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -8,12 +8,12 @@ class b extends a { } //// [inheritanceStaticMembersCompatible.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index 0c21f4a1af5..e1ac5204119 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -8,12 +8,12 @@ class b extends a { } //// [inheritanceStaticMembersIncompatible.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index de05071c116..48cb36812a2 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -13,12 +13,12 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index 4c1ca7e00cb..f5130abe8bd 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -10,12 +10,12 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index a351a84d98b..e60108ca25b 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -8,12 +8,12 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index e9f362ead42..9abc3a38497 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -15,12 +15,12 @@ new Derived("", 3); new Derived(3); //// [inheritedConstructorWithRestParams.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 3d89d237ad5..925f5124753 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -35,12 +35,12 @@ new Derived("", 3, "", 3); new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 512d8bbca57..f919c354e5e 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -22,12 +22,12 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index 4f7b0bead56..d6581fbfd09 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -90,12 +90,12 @@ function fn8(x: Alpha|Beta|Gamma) { //// [instanceOfAssignability.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 57c7e5161b2..bf304bc0aab 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -43,12 +43,12 @@ module Generic { } //// [instancePropertiesInheritedIntoClassType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index 7f4b0803382..791e72a6b4e 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -8,12 +8,12 @@ class C2 extends C1 { } //// [instanceSubtypeCheck2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 59ea1270155..938bf26dc44 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -72,12 +72,12 @@ function goo(x: A) { //// [instanceofWithStructurallyIdenticalTypes.js] // Repro from #7271 +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 338a60610a0..62de511b4c8 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -31,12 +31,12 @@ return null; //// [instantiatedReturnTypeContravariance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 36e4719549a..d3d7b257465 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -41,12 +41,12 @@ obj = bar; //// [interfaceClassMerging.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index f230544e492..9f7037048bd 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -37,12 +37,12 @@ foo = bar; //// [interfaceClassMerging2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 0afae83d4b9..7b0865b0018 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -19,12 +19,12 @@ class Location { //// [interfaceExtendsClass1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index 0b493aded80..a560df25986 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -28,12 +28,12 @@ c = d; d = c; // error //// [interfaceExtendsClassWithPrivate1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index 699b924a854..3aa5f800d9c 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -24,12 +24,12 @@ class D2 extends C implements I { // error } //// [interfaceExtendsClassWithPrivate2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index 04f341d1f06..c8a739a3a1f 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -41,12 +41,12 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 8fa200638e4..9ed7be8e0f2 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -80,12 +80,12 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 3380d5847a9..788b91f13c5 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -54,12 +54,12 @@ var m: typeof M; var m = M.A; //// [invalidMultipleVariableDeclarations.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 01982b322bb..ca25cdc9870 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -21,12 +21,12 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index 747e69d7c59..dddc8d56339 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -15,12 +15,12 @@ export var z = x; //// [file1.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 61e196daaa4..110cbba1ef6 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -25,12 +25,12 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 319875eef2c..58092783f6e 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -294,12 +294,12 @@ var hashOfEmpty1 = on({ test: () => {} }); // {} var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } //// [keyofAndIndexedAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index c4343a67452..8fbe9a40728 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -35,12 +35,12 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 44932a3ad14..a9f3b4b17ac 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -18,12 +18,12 @@ class C extends B { //// [lift.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index 2a3510860ef..503a34c528c 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -142,12 +142,12 @@ function f6() { //// [localTypes1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index 0ae1f77a62a..b48fb3bbb3e 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -27,12 +27,12 @@ var y3: C1 = {}; //// [m7Bugs.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index d8426a5ce28..e3273fd8115 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -19,12 +19,12 @@ var A = (function () { return A; }()); //// [b.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index c573190dc8b..d4f013e4ecc 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -37,12 +37,12 @@ define(["require", "exports"], function (require, exports) { exports.A = A; }); //// [b.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index ec1b72bf5d7..4b6457fe1dd 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -47,12 +47,12 @@ grandchild.method2(); //// [mergedInheritedClassInterface.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index ac82060f270..3207ae8f8c5 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -32,12 +32,12 @@ var r = a.x; // error var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index 31c3deff6d1..6a01a6cdd78 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -39,12 +39,12 @@ module M { } //// [mergedInterfacesWithInheritedPrivates3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index aa832f39416..54016af34af 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -7,12 +7,12 @@ class George extends class { reset() { return this.y; } } { //// [missingPropertiesOfClassExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 00a4f417804..5a421d7d3f4 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -5,12 +5,12 @@ interface I extends M { } class C2 implements M { } //// [moduleAsBaseType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index a12c2af9439..c57f7af6579 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -16,12 +16,12 @@ define(["require", "exports"], function (require, exports) { "use strict"; }); //// [moduleImportedForTypeArgumentPosition_1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index 7a36ad10376..6fda8588f43 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -59,12 +59,12 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 4122bcb40ee..2036f81bf92 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -39,12 +39,12 @@ class Baad extends Good { //// [multipleInheritance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 1ac0e7db55d..0f86ca802a6 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -11,12 +11,12 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index e08985796c3..1253860daa6 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -13,12 +13,12 @@ class Child extends Parent { } //// [noImplicitAnyMissingGetAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index 45cf29fd567..76011cee442 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -12,12 +12,12 @@ class Child extends Parent { } //// [noImplicitAnyMissingSetAccessor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 270ea7f3bfc..1dab2ae6fb8 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -6,12 +6,12 @@ class Foo { class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 2f2be923f17..b571573c18f 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -47,12 +47,12 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 85556b4c83d..0dbcc5308c8 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -13,12 +13,12 @@ class C { } //// [numericIndexerConstraint3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 8958392fe78..0b4f1be5361 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -13,12 +13,12 @@ var x: { //// [numericIndexerConstraint4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index 5ce85e4c5eb..d4e12eddd27 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -13,12 +13,12 @@ var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexere //// [numericIndexerTyping2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index 3f251e47029..0d6589f09e3 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -56,12 +56,12 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 05dfd4bc818..8f9acd3615c 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -55,12 +55,12 @@ var b: { var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index 9518317f230..e995999e04b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -124,12 +124,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index a5b93a32853..81521fccedf 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -127,12 +127,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index 14a70059adc..c66084b049f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -124,12 +124,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index 0d3ebae0bb8..e0cfd4b3be1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -122,12 +122,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 4fa90889d81..97f8179bfb1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -40,12 +40,12 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 6ca413637f5..740c9af666b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -26,12 +26,12 @@ var c3: C3; c3; // Should fail (private x originates in the same declaration, but different types) //// [objectTypesIdentityWithPrivates3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index 6758afd5cb3..fe72b6d409a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -124,12 +124,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 370c71533fb..9cd95ea9629 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -127,12 +127,12 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index e13ea6a702d..927fbd25854 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -11,12 +11,12 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index b0af91c92f8..4d89325803d 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -58,12 +58,12 @@ class Derived extends Base { //// [optionalMethods.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 91507916a55..7f606887baa 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -125,12 +125,12 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index bc60d2507b0..cfa9364bb68 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -8,12 +8,12 @@ class Y extends Z { //// [optionalParamInOverride.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index 62058c1ecb3..5a7bb5441dd 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -12,12 +12,12 @@ class D extends C { //// [optionalParameterProperty.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 8a28677dbbf..867360fc49e 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -9,12 +9,12 @@ import {A} from "./ref/a"; export class B extends A { } //// [all.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index 75af3bb54ac..ef5e9e9dcab 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -8,12 +8,12 @@ sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- +>>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index 4a7552bcde8..db9191cedf7 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -9,12 +9,12 @@ import {A} from "./ref/a"; export class B extends A { } //// [all.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index e5a439aea1a..fa08e14d135 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -8,12 +8,12 @@ sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- +>>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index c5f6da0fdf5..d8b543ef727 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -31,12 +31,12 @@ export class B extends A { } //// [all.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index c3e619a4c2d..f035719a690 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -8,12 +8,12 @@ sources: tests/cases/compiler/ref/b.ts,tests/cases/compiler/ref/a.ts,tests/cases emittedFile:all.js sourceFile:tests/cases/compiler/ref/b.ts ------------------------------------------------------------------- +>>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index 8377a62f2c7..c4f19ef0ed7 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -40,12 +40,12 @@ var v=x.g; //// [overload1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index ae8e1178be5..0888083df42 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -23,12 +23,12 @@ class D implements MyDoc { } //// [overloadOnConstConstraintChecks1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index 43468e15fd8..ab91c99f6ff 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -12,12 +12,12 @@ function foo(name: any): A { } //// [overloadOnConstConstraintChecks2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 5e8d70d3d6e..d6d4ce137e6 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -13,12 +13,12 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index c4ac235a671..53b6b904997 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -14,12 +14,12 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index 58807808f5c..0400ee2bb88 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -12,12 +12,12 @@ function foo(name: "DIV"): Derived2 { foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index bb1fce13a0a..4b026d8c062 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -95,12 +95,12 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 16bdd16eaa2..dcacbc4f9ec 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -102,12 +102,12 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 4b7e487466c..89953cb378a 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -103,12 +103,12 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index d52d97cefc7..981ad6358a0 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -26,12 +26,12 @@ var htmlDivElement2: Derived1 = d2.createElement("div"); var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 3b666b2351b..4afdf483f2a 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -28,12 +28,12 @@ var e: E = bar("bye", []); // E var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index f1cc4b05a40..8372f54c40c 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -8,12 +8,12 @@ class Derived2 extends Base2 { } //// [overridingPrivateStaticMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index a82e4eb8ea7..7a29c55629a 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -3,12 +3,12 @@ class C extends A # { } //// [parseErrorInHeritageClause1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index 3c80c2bfd16..d95819d1e45 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -7,12 +7,12 @@ class Any extends Type { //// [parser509630.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index 5ba4ba4d96d..de26b5b2b3b 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -220,12 +220,12 @@ class c6 extends c5 { } //// [parserAstSpans1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 4ce80bdec21..47c15c9f6bf 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -3,12 +3,12 @@ class C extends A extends B { } //// [parserClassDeclaration1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index ac58fb23342..4dd54e974cb 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -3,12 +3,12 @@ class C implements A extends B { } //// [parserClassDeclaration3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index fa85ee2659c..4e3c3e84243 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -3,12 +3,12 @@ class C extends A implements B extends C { } //// [parserClassDeclaration4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index a77e0867d59..e5ae42ec1eb 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -3,12 +3,12 @@ class C extends A implements B implements C { } //// [parserClassDeclaration5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 23820f706df..eb698fd236f 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -3,12 +3,12 @@ class C extends A, B { } //// [parserClassDeclaration6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index d81e0e7cf65..d45ef8894b0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -3,12 +3,12 @@ class C extends A, { } //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 34f0bce2d1c..f69ce2ad600 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -3,12 +3,12 @@ class C extends A implements { } //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 9eb5a995637..ec6a0479169 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -3,12 +3,12 @@ class C extends A, implements B, { } //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index 99cfeb0c61f..69e53b2974d 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -18,12 +18,12 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index b34364d5b9e..ac24d025b84 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -18,12 +18,12 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 25112efe231..ea095e52c69 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -458,12 +458,12 @@ module TypeScript { //// [parserRealSource10.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 23ea8da3d5c..9f4f4fc2f70 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2367,12 +2367,12 @@ module TypeScript { //// [parserRealSource11.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index ac60a5b18ad..16fe9508c2a 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2096,12 +2096,12 @@ module Harness { // See the License for the specific language governing permissions and // limitations under the License. // +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index b57b3a8bff6..1c666d92c9d 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -16,12 +16,12 @@ testError((t1, t2, t3: D) => {}) //// [partiallyAnnotatedFunctionInferenceError.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index f8bd04cde38..b43a5a5a2c9 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -35,12 +35,12 @@ testRest((t2, ...t3: D[]) => {}) //// [partiallyAnnotatedFunctionInferenceWithTypeParameter.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 2aa2efbba10..4c00a4fb3ea 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -32,12 +32,12 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index c310bf6e77d..be90775cf0b 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -129,12 +129,12 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo //// [privacyClass.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index 68feed955d3..1802f61717c 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -99,12 +99,12 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -289,12 +289,12 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { }(privateModule.publicClassInPrivateModule)); exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index 4824da462ad..d74a59d5ac2 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -61,12 +61,12 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 63e8172576a..bbdcd5a4338 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -10,12 +10,12 @@ class D extends Base { } //// [privateAccessInSubclass1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 3df2708569c..d1efc894fc3 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -14,12 +14,12 @@ class Derived extends Base { } //// [privateInstanceMemberAccessibility.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index 239d0a4281b..6f9b717888d 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -22,12 +22,12 @@ let { priv: a, prot: b, privateMethod: f } = k; // error //// [privateProtectedMembersAreNotAccessibleDestructuring.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index d21d13070d8..319f4fac001 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -9,12 +9,12 @@ class Derived extends Base { } //// [privateStaticMemberAccessibility.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index e7e1e468aed..974dcb477f5 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -16,12 +16,12 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 93d8685224b..3ab7685aec4 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,9 +1,9 @@ +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 93d8685224b..3ab7685aec4 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,9 +1,9 @@ +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index f80f316d3c8..08697664279 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,9 +1,9 @@ +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index f80f316d3c8..08697664279 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,9 +1,9 @@ +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index 65483bd492a..dd192c40863 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,10 +1,10 @@ /// +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index 65483bd492a..dd192c40863 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,10 +1,10 @@ /// +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 9d65b48702e..87f12dd7242 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -52,12 +52,12 @@ var c: { }; //// [propertiesAndIndexers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 3da9b5cc647..89c6ed0efe9 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -151,12 +151,12 @@ var x3: A; //// [propertyAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index cc874197c3c..346024cf470 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -83,12 +83,12 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index bcaa1458325..c4d0a8e8ac4 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -58,12 +58,12 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 8cc85faa100..4d677b85396 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -45,12 +45,12 @@ var b = { var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't matter //// [propertyAccessOnTypeParameterWithConstraints5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index babef969a10..e0a051b3096 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -39,12 +39,12 @@ class E extends C { } //// [protectedClassPropertyAccessibleWithinNestedSubclass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index 3a3013d6704..26d42b7b658 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -115,12 +115,12 @@ d3.x; // Error, neither within their declaring class nor class d4.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 3c59a316d71..af3440f9fb8 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -21,12 +21,12 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index fb818c42c7e..ba4c9f079f8 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -95,12 +95,12 @@ d3.x; // Error, neither within their declaring class nor class d4.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedClassPropertyAccessibleWithinSubclass2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 20984b107b9..8b45c46ec83 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -14,12 +14,12 @@ class Derived extends Base { } //// [protectedClassPropertyAccessibleWithinSubclass3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index c906f456d67..682ff897e52 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -45,12 +45,12 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index d2e8bfe47ce..f0553d72184 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -116,12 +116,12 @@ class B3 extends A3 { //// [protectedMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index e0ad17934c3..76bb5d10455 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -44,12 +44,12 @@ Derived2.x; // Error, neither within their declaring class nor classes deriv Derived3.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index 37ddb2b0d2c..f694c9f301d 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -22,12 +22,12 @@ class Derived2 extends Derived1 { } //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index 3fc3b29ff45..11c49dbb28d 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -7,12 +7,12 @@ class Beta extends Alpha.x { } //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index a3a46c4e14f..eb268d9aafe 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -41,12 +41,12 @@ class E extends D { //// [readonlyConstructorAssignment.js] // Tests that readonly parameter properties behave like regular readonly properties +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index bd89b8c6574..435f87a6b1a 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -5,12 +5,12 @@ class C extends A { } (new C).blah; //// [recursiveBaseCheck3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index f89b52e719f..5790cabf7d8 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -3,12 +3,12 @@ class M extends M { } (new M).blah; //// [recursiveBaseCheck4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index 05a72e11213..c9a7d685322 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -3,12 +3,12 @@ class S18 extends S18<{ S19: A; }>{ } (new S18()).blah; //// [recursiveBaseCheck6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index b0a11841dd8..b62f9f6622f 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -7,12 +7,12 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index bfd014a3fe1..5c5d01c453d 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -10,12 +10,12 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 11eb4f8ba8f..e03965b23ea 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -105,12 +105,12 @@ module Sample.Thing.Languages.PlainText { //// [recursiveClassReferenceTest.js] // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 5bb43de1b9f..d8a6d74f0a8 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -26,12 +26,12 @@ sourceFile:recursiveClassReferenceTest.ts 1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- +>>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index c9b3dfb6d7a..9544c60b9f5 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -25,12 +25,12 @@ class TypeSymbol extends InferenceSymbol { } //// [recursiveComplicatedClasses.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index e7ce63794fd..e7c3ce7a3ce 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -30,12 +30,12 @@ declare module MsPortal.Controls.Base.ItemList { */ //// [recursivelySpecializedConstructorDeclaration.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index 37ba6aab5d4..db5486b1af7 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -33,12 +33,12 @@ module.exports = { }; //// [foo3.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index d81c9a0e2a7..bdea9b287bb 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1020,12 +1020,12 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index 2f2c4a3fdb5..625028055b4 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -67,12 +67,12 @@ class I extends G { //// [returnInConstructor1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 3488ebd8ac0..b62ef87dadc 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -25,12 +25,12 @@ function fn13(): C { return null; } //// [returnStatements.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 67013c3922e..3fdc1795c32 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -9,12 +9,12 @@ class D extends C { } //// [scopeCheckExtendedClassInsidePublicMethod2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 7bb90a136ba..237faa00fe3 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -9,12 +9,12 @@ class D extends C { } //// [scopeCheckExtendedClassInsideStaticMethod1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index d2061241cac..6090536a099 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -12,12 +12,12 @@ class D extends C { } //// [scopeTests.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 251622f1308..d842185b47c 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -4,12 +4,12 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index 07be6489141..b5216c1c168 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -8,12 +8,12 @@ class Greeter extends AbstractGreeter { } //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index cb083f766e8..2ca29e33e91 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -8,12 +8,12 @@ sources: sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- +>>>var __extendStatics = (this && this.__extendStatics) || +>>> Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>>var __extends = (this && this.__extends) || function (d, b) { ->>> if (typeof Object.setPrototypeOf === "function") { ->>> Object.setPrototypeOf(d, b); ->>> } else { ->>> d.__proto__ = b; ->>> } +>>> __extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>>}; diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 2560437b43d..76d6da2d5d2 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -18,12 +18,12 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index 0ea23b1b850..d1bf0a0d636 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -13,12 +13,12 @@ function g(tagName: any): Base { } //// [specializedOverloadWithRestParameters.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index e9e4a286eb6..63ea3a01253 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -14,12 +14,12 @@ var d = Derived.create(); d.foo(); //// [staticFactory1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index 181c8aa9659..91fa33abd51 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -12,12 +12,12 @@ doThing(B); //OK //// [staticInheritance.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index 6634d3c3519..ee1f12df69e 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -10,12 +10,12 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index 10519dace00..241ebc529fb 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -36,12 +36,12 @@ class E extends A { } //// [staticPropSuper.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 0598932c4bb..71165d41360 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -61,12 +61,12 @@ class Ds extends A { } //// [strictModeInConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index f15efc6e765..ec075461129 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -28,12 +28,12 @@ function foo() { //// [strictModeReservedWord.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index 6f13aac7608..fdf72090f2f 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -29,12 +29,12 @@ class G extends package { } class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index adcc83a1841..dd9341b4a42 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -41,12 +41,12 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 2d42c1e4d79..8abd40b7eb5 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -107,12 +107,12 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index a3b5ecaeb26..034b55ee1fc 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -169,12 +169,12 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index 1aa94ba7c99..b2f4f3eca49 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -80,12 +80,12 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 05cc496f25a..413f915a618 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -159,12 +159,12 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 5c06121d5a2..23c51619c80 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -20,12 +20,12 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 6b82e0d4841..0e16d43f216 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -174,12 +174,12 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index 49405cbd070..f17007cba42 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -121,12 +121,12 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithCallSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index 2e526d41fba..e6030bdb12d 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -113,12 +113,12 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 867beb93596..24914baf2ed 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -174,12 +174,12 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index f13a56664ce..f1153675c91 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -123,12 +123,12 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithConstructSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 32f9b33fc71..10246582f12 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -113,12 +113,12 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 2c177201732..7d3f9516c29 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -51,12 +51,12 @@ interface I extends B { //// [subtypingWithConstructSignatures5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 065d312c086..39f4e91f011 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -54,12 +54,12 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index 1c1ade16a08..994c5597569 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -41,12 +41,12 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 2c0da66f8c9..25963e70449 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -45,12 +45,12 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 1881825eb24..304dbee9e61 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -29,12 +29,12 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 263bb117d34..0733679a120 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -68,12 +68,12 @@ module TwoLevels { } //// [subtypingWithObjectMembers.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 03d7228b2f9..4b41ee1aaa7 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -35,12 +35,12 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 0eb506d3210..976a7e1b8cd 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -35,12 +35,12 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index f171736911b..9c2e2257112 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -63,12 +63,12 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index bffca920982..042684e0c04 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -42,12 +42,12 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 0ff4b73c848..23e7dbe37b6 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -45,12 +45,12 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index 347df7c1720..e17f0308609 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -29,12 +29,12 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index bbf1862bd0f..a801d126895 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -38,12 +38,12 @@ s.foo() + ss.foo(); //// [super.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index d437c923fe6..bc1160411ae 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -67,12 +67,12 @@ module Base4 { //// [super1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index b8a679c4c8d..cac924a6b69 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -51,12 +51,12 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index f2f6ccbaf4a..1c37353813c 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -14,12 +14,12 @@ class MyDerived extends MyBase { } //// [superAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index 021589c1e79..b1476e5c8e6 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -25,12 +25,12 @@ class Q extends P { } //// [superAccess2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index e62db8c823b..c9208194e37 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -16,12 +16,12 @@ module test { } //// [superAccessInFatArrow1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index ec83550a9f0..a37a07439be 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -26,12 +26,12 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index f1407cac107..6fa77382691 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -11,12 +11,12 @@ class H extends E { } //// [superCallAssignResult.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index 151e9da2f15..9990b5e7e1a 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -17,12 +17,12 @@ class D extends Base { //// [superCallBeforeThisAccessing1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index 7655b2df83b..a7ef99d67cc 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -11,12 +11,12 @@ class D extends Base { //// [superCallBeforeThisAccessing2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 34555c677ba..90156d199d5 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -14,12 +14,12 @@ class D extends Base { //// [superCallBeforeThisAccessing3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 9fc2987e96e..e42decf54e8 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -16,12 +16,12 @@ class E extends null { } //// [superCallBeforeThisAccessing4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 1f3b0040e49..8477c576c77 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -8,12 +8,12 @@ class D extends null { //// [superCallBeforeThisAccessing5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index 740f90d2e2b..a5e291b9543 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -11,12 +11,12 @@ class D extends Base { //// [superCallBeforeThisAccessing6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index 65d95769c40..69a54894cc4 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -14,12 +14,12 @@ class D extends Base { //// [superCallBeforeThisAccessing7.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index b5e454139c0..51c4c727769 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -14,12 +14,12 @@ class D extends Base { //// [superCallBeforeThisAccessing8.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index 464c879212e..1b17766faf6 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -12,12 +12,12 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 6ebe47532c8..159fa8786b3 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -11,12 +11,12 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index 19e480378a4..ccf1bf3746a 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -11,12 +11,12 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index 48855cb0d11..f109d657654 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -11,12 +11,12 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index abfe5294a93..76fd322d519 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -11,12 +11,12 @@ class B extends A { } //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index dbea09ebced..737f51d9e27 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -51,12 +51,12 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index 104f8821dca..cbd8398a20a 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -47,12 +47,12 @@ class Other extends Doing { //// [superCallInStaticMethod.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 4f7a0087ab1..71ef0041452 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -17,12 +17,12 @@ class B extends A { } //// [superCallInsideClassDeclaration.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index 01bce40d204..1d6b849ae5e 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -17,12 +17,12 @@ class B extends A { } //// [superCallInsideClassExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index 613997e789f..e479206f9c5 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -13,12 +13,12 @@ class B extends A { } //// [superCallInsideObjectLiteralExpression.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index 0e1f3fbd837..9e4b98997c9 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -23,12 +23,12 @@ var d = new D(); //// [superCallOutsideConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index 132cb003921..f71add3806a 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -13,12 +13,12 @@ class B extends A { //// [superCallParameterContextualTyping1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index bbb0871d385..5363dedff60 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -12,12 +12,12 @@ class C extends A { } //// [superCallParameterContextualTyping2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index 4469c918b31..c074252a692 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -32,12 +32,12 @@ class C extends CBase { } //// [superCallParameterContextualTyping3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithCommentEmit01.js b/tests/baselines/reference/superCallWithCommentEmit01.js index ae7f053e5d4..5cd354a24b4 100644 --- a/tests/baselines/reference/superCallWithCommentEmit01.js +++ b/tests/baselines/reference/superCallWithCommentEmit01.js @@ -11,12 +11,12 @@ class B extends A { } //// [superCallWithCommentEmit01.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 766c121d42b..27ecd48bf68 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -10,12 +10,12 @@ class Foo extends Bar { } //// [superCallWithMissingBaseClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index 47292405faf..e974d75176b 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -31,12 +31,12 @@ class OtherDerived extends OtherBase { //// [superCalls.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 707757b37b6..1b02c20b7a5 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -21,12 +21,12 @@ class Derived extends Base { } //// [superCallsInConstructor.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 9b9681b2dee..86c1dae1a1c 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -52,12 +52,12 @@ class RegisteredUser extends User { } //// [superErrors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index bf8f9bd5e02..30d3494689a 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -14,12 +14,12 @@ class B extends A { //// [superInCatchBlock1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 869dfde8e51..a98e1fdb089 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -11,12 +11,12 @@ class C extends B { } //// [superInConstructorParam1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 1e040f627c8..384b83c7239 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -68,12 +68,12 @@ class RegisteredUser4 extends User { } //// [superInLambdas.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 77f55772b69..32369a7fc85 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -60,12 +60,12 @@ class B extends A { } //// [superInObjectLiterals_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index c532b4556c8..eee25fd2acc 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -13,12 +13,12 @@ class B extends A { } //// [superNewCall1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index eb92e66a131..39e8098407c 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -37,12 +37,12 @@ class MyDerived extends MyBase { } //// [superPropertyAccess.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index f15bdde29e2..77d6a4b1c12 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -28,12 +28,12 @@ class D extends C { } //// [superPropertyAccess1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index 98f1d0a190c..1b9c056d3b2 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -28,12 +28,12 @@ class D extends C { } //// [superPropertyAccess2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index d60310be5e7..5506bedbcb6 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -15,12 +15,12 @@ class B extends A { } //// [superPropertyAccessInComputedPropertiesOfNestedType_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index d2829eba561..e91603f20d8 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -77,12 +77,12 @@ instance.returnThis().fn(); //super.publicInstanceMemberFunction in lambda in member function //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index e8f4dd3f872..4e67455900a 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -30,12 +30,12 @@ class B extends A { } //// [superPropertyAccess_ES5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index 3c5aaf9b843..c933334a506 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -14,12 +14,12 @@ class Bar extends Foo { } //// [superSymbolIndexedAccess5.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index ff11a4c1b65..61f98885443 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -14,12 +14,12 @@ class Bar extends Foo { } //// [superSymbolIndexedAccess6.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index 8e23bfb25c4..645007e5a09 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -15,12 +15,12 @@ var r: string = d.x; var r2: number = d.y; //// [superWithGenericSpecialization.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index 5e83df296d2..f0e9cacf8aa 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -12,12 +12,12 @@ class D extends B { //// [superWithGenerics.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 51a4f93a4e4..8b7c07a27a5 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -10,12 +10,12 @@ class D extends C { } //// [superWithTypeArgument.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index 3744e797615..349ead6b381 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -10,12 +10,12 @@ class D extends C { } //// [superWithTypeArgument2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 9f76cc1ecff..6e09952749c 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -14,12 +14,12 @@ class D extends C { } //// [superWithTypeArgument3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 077affd0eda..d7bab4380b4 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -28,12 +28,12 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 05a7fafb046..d2754225e5b 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -56,12 +56,12 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index e31370d0acd..c146e495c80 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -32,12 +32,12 @@ System.register([], function (exports_1, context_1) { //// [bar.js] System.register(["./foo"], function (exports_1, context_1) { "use strict"; + var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index d359aa91628..a0faadf78a6 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -19,12 +19,12 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 6b16742cca2..1b969e26547 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -49,12 +49,12 @@ enum SomeEnum { //// [thisInInvalidContexts.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 68579bb2368..ee517c6e36f 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -50,12 +50,12 @@ export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index b8120fe732c..80795c91e67 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -23,12 +23,12 @@ class Foo3 extends Base { } //// [thisInSuperCall.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index 3adc1c2a5b3..f5e4e131cfc 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -11,12 +11,12 @@ class Foo extends Base { //// [thisInSuperCall1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index f310654acae..663826999d3 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -20,12 +20,12 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index b0f4d62c746..abba0499608 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -13,12 +13,12 @@ class Foo extends Base { //// [thisInSuperCall3.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index ae95aac22b5..27aae06ccf8 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -195,12 +195,12 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } //// [thisTypeInFunctions.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index 2591f9fe019..ca9eeb60fee 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -177,12 +177,12 @@ c.explicitProperty = (this, m) => m + this.n; //// [thisTypeInFunctionsNegative.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index b6c5295b482..9c5c848b781 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -21,12 +21,12 @@ export class ShortDetails extends React.Component<{ id: number }, {}> { //// [tsxCorrectlyParseLessThanComparison1.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index 3a1ac6d2246..a895c2ec4dd 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -21,12 +21,12 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index f584dbf960a..845eb400818 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -21,12 +21,12 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index bf3ab5d4a69..7e1511af79a 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -21,12 +21,12 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index fefa118d704..7867bea3873 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -21,12 +21,12 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 29f4e78100e..5f594b4d1d5 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -33,12 +33,12 @@ export class Button extends React.Component { //// [button.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -56,12 +56,12 @@ var Button = (function (_super) { exports.Button = Button; //// [app.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index 75284a28702..c3ed400f65c 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -40,12 +40,12 @@ let i =
x.propertyNotOnHtmlDivElement} />; //// [file.jsx] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 215046ba2b6..93b810483b6 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -26,12 +26,12 @@ class MyButtonComponent extends React.Component<{},{}> { //// [file.js] "use strict"; +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index e3cf89b0800..e9ab0f69449 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -52,12 +52,12 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index f16b6d1ce5a..b38de5abcd2 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -84,12 +84,12 @@ let union2: C | B; let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 3e9b8f08cd4..4a1f85e3e71 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -146,12 +146,12 @@ if (hasMissingParameter()) { } //// [typeGuardFunctionErrors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index ffe263f9985..ce30137e322 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -34,12 +34,12 @@ if (funD(isC, a)) { let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index a1d1b7842d4..c3e2d851db2 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -142,12 +142,12 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index 7ec705bdc2d..753a41b8e42 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -60,12 +60,12 @@ else { } //// [typeGuardFunctionOfFormThisErrors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 67d216d0f58..55d28ea2a58 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -73,12 +73,12 @@ else { // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x, or // - when false, has no effect on the type of x. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index 88d0ac11a09..f9b90888a92 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -38,12 +38,12 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1 var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 6dc97fb0152..1e96d089f1b 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -83,12 +83,12 @@ namespace Test { //// [typeGuardOfFormThisMember.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index fbc2f23e547..0212d05c523 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -33,12 +33,12 @@ namespace Test { } //// [typeGuardOfFormThisMemberErrors.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index e4c7925a90b..9a75ed6616d 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -45,12 +45,12 @@ function f4() { //// [typeMatch2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 9ac69544460..f02a7c7de79 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -9,12 +9,12 @@ class D extends C { } //// [typeOfSuperCall.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 062ac61fd51..8b40f439ba2 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -3,12 +3,12 @@ class C extends T {} class C2 implements T {} //// [typeParameterAsBaseClass.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index e77c3b6e0d4..97627b41f10 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -13,12 +13,12 @@ interface I2 extends U { } //// [typeParameterAsBaseType.js] // type parameters cannot be used as base types // these are all errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 5d15b09720f..6a189dc0ace 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -13,12 +13,12 @@ function f(a: T) { } //// [typeParameterExtendingUnion1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index d274169391f..bf929f42c6a 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -13,12 +13,12 @@ function f(a: T) { } //// [typeParameterExtendingUnion2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 745e2dffe00..2bdb91818a2 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -41,12 +41,12 @@ class D extends C { //// [typeRelationships.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index c66ed5fbfd4..467781c8c26 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -12,12 +12,12 @@ module M2 { //// [typeValueConflict1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index c72115d0dfc..0220bda6f9b 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -19,12 +19,12 @@ module M3 { //// [typeValueConflict2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index 46f9d7dc7f9..929472aefee 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -22,12 +22,12 @@ var r1: typeof D; var r2: typeof d; //// [typeofClass2.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index d011126edeb..3403dc447a6 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -43,12 +43,12 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index 79cd99f249d..29c7eb186fa 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -41,12 +41,12 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index a96a892e9a2..60fa6a01f63 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -4,12 +4,12 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index aa4fac8d6eb..fbfe9f3b466 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -123,12 +123,12 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index 4f3990b7b57..760cc6a1ba7 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -49,12 +49,12 @@ class MyView extends View { //// [underscoreMapFirst.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index 439c33df0ec..2828c8dc287 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -25,12 +25,12 @@ class D extends C { //// [underscoreThisInDerivedClass01.js] // @target es5 +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index 26f2796e4b0..4d7a69b60c5 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -19,12 +19,12 @@ class D extends C { //// [underscoreThisInDerivedClass02.js] // @target es5 +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index 1cafbc8d65c..9de5ad9d470 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -20,12 +20,12 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index 12d524f8616..f6c1489ceee 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -28,12 +28,12 @@ var arr9 = [e, f]; // (E|F)[] // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index bf5c69f93e9..8fc5f1e8f71 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -74,12 +74,12 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index 3768213892a..c64cc7224ba 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -33,12 +33,12 @@ class C5 { } //// [unknownSymbols1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index fbb4c157665..ddc7d6e7598 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -154,12 +154,12 @@ module ts { //// [unspecializedConstraints.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 67e3d579dc4..c46afba6440 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -44,12 +44,12 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index af2c9d96f52..e3af0dd8567 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -15,12 +15,12 @@ namespace Validation { } //// [unusedClassesinNamespace4.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 7bea43688ad..37317f9fbe9 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -103,12 +103,12 @@ namespace Greeter { } //// [unusedIdentifiersConsolidated1.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index b32d9413bdf..a80a72f434a 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -10,12 +10,12 @@ class Super extends Base { } //// [validUseOfThisInSuper.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index f9674ceb328..9cb0dc77811 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -25,12 +25,12 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - if (typeof Object.setPrototypeOf === "function") { - Object.setPrototypeOf(d, b); - } else { - d.__proto__ = b; - } + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; From fee777dd9c6d794f84b24ca9254a5f20ba73542e Mon Sep 17 00:00:00 2001 From: Benjamin Bock Date: Mon, 5 Dec 2016 11:35:38 +0100 Subject: [PATCH 097/289] fixes #9123 like https://github.com/otbe/TypeScript/blob/1f43720026c824151217e6ea9991b19e449c85cc/src/compiler/commandLineParser.ts but without removing the open-curly of the function --- src/compiler/commandLineParser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e9f9ff210a9..b577b7671d4 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -850,6 +850,7 @@ namespace ts { */ export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine { const errors: Diagnostic[] = []; + basePath = normalizeSlashes(basePath); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { From 8434fdef2d83d4c51ec31de842ba385c2597ccb1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 5 Dec 2016 12:30:14 -0800 Subject: [PATCH 098/289] Improve SourceMap emit for down-level async functions --- src/compiler/emitter.ts | 40 ++++++--- src/compiler/transformers/generators.ts | 114 +++++++++++++++--------- 2 files changed, 96 insertions(+), 58 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 90738d828be..2f19c9b3d32 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1305,28 +1305,28 @@ namespace ts { writeToken(SyntaxKind.OpenParenToken, openParenPos, node); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(SyntaxKind.ElseKeyword, node.thenStatement.end, node); if (node.elseStatement.kind === SyntaxKind.IfStatement) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node: DoStatement) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); @@ -1338,7 +1338,7 @@ namespace ts { write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node: ForStatement) { @@ -1351,7 +1351,7 @@ namespace ts { write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node: ForInStatement) { @@ -1362,7 +1362,7 @@ namespace ts { write(" in "); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node: ForOfStatement) { @@ -1373,7 +1373,7 @@ namespace ts { write(" of "); emitExpression(node.expression); writeToken(SyntaxKind.CloseParenToken, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node: VariableDeclarationList | Expression) { @@ -1409,7 +1409,7 @@ namespace ts { write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node: SwitchStatement) { @@ -1437,9 +1437,12 @@ namespace ts { function emitTryStatement(node: TryStatement) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -2125,8 +2128,8 @@ namespace ts { } } - function emitEmbeddedStatement(node: Statement) { - if (isBlock(node)) { + function emitEmbeddedStatement(parent: Node, node: Statement) { + if (isBlock(node) || getEmitFlags(parent) & EmitFlags.SingleLine) { write(" "); emit(node); } @@ -2291,6 +2294,15 @@ namespace ts { } } + function writeLineOrSpace(node: Node) { + if (getEmitFlags(node) & EmitFlags.SingleLine) { + write(" "); + } + else { + writeLine(); + } + } + function writeIfAny(nodes: NodeArray, text: string) { if (nodes && nodes.length > 0) { write(text); diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index c383902d495..1b909da4f6a 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -938,7 +938,7 @@ namespace ts { } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** @@ -1234,7 +1234,9 @@ namespace ts { function transformAndEmitVariableDeclarationList(node: VariableDeclarationList): VariableDeclarationList { for (const variable of node.declarations) { - hoistVariableDeclaration(variable.name); + const name = getSynthesizedClone(variable.name); + setCommentRange(name, variable.name); + hoistVariableDeclaration(name); } const variables = getInitializedVariables(node); @@ -1287,7 +1289,7 @@ namespace ts { if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { const endLabel = defineLabel(); const elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, visitNode(node.expression, visitor, isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, visitNode(node.expression, visitor, isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -2965,12 +2967,15 @@ namespace ts { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; writeStatement( - createReturn( - createArrayLiteral(expression - ? [createInstruction(Instruction.Return), expression] - : [createInstruction(Instruction.Return)] + setEmitFlags( + createReturn( + createArrayLiteral(expression + ? [createInstruction(Instruction.Return), expression] + : [createInstruction(Instruction.Return)] + ), + operationLocation ), - operationLocation + EmitFlags.NoTokenSourceMaps ) ); } @@ -2984,12 +2989,15 @@ namespace ts { function writeBreak(label: Label, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps ) ); } @@ -3003,15 +3011,21 @@ namespace ts { */ function writeBreakWhenTrue(label: Label, condition: Expression, operationLocation: TextRange): void { writeStatement( - createIf( - condition, - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation - ) + setEmitFlags( + createIf( + condition, + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps + ) + ), + EmitFlags.SingleLine ) ); } @@ -3025,15 +3039,21 @@ namespace ts { */ function writeBreakWhenFalse(label: Label, condition: Expression, operationLocation: TextRange): void { writeStatement( - createIf( - createLogicalNot(condition), - createReturn( - createArrayLiteral([ - createInstruction(Instruction.Break), - createLabel(label) - ]), - operationLocation - ) + setEmitFlags( + createIf( + createLogicalNot(condition), + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.Break), + createLabel(label) + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps + ) + ), + EmitFlags.SingleLine ) ); } @@ -3047,13 +3067,16 @@ namespace ts { function writeYield(expression: Expression, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral( - expression - ? [createInstruction(Instruction.Yield), expression] - : [createInstruction(Instruction.Yield)] + setEmitFlags( + createReturn( + createArrayLiteral( + expression + ? [createInstruction(Instruction.Yield), expression] + : [createInstruction(Instruction.Yield)] + ), + operationLocation ), - operationLocation + EmitFlags.NoTokenSourceMaps ) ); } @@ -3067,12 +3090,15 @@ namespace ts { function writeYieldStar(expression: Expression, operationLocation: TextRange): void { lastOperationWasAbrupt = true; writeStatement( - createReturn( - createArrayLiteral([ - createInstruction(Instruction.YieldStar), - expression - ]), - operationLocation + setEmitFlags( + createReturn( + createArrayLiteral([ + createInstruction(Instruction.YieldStar), + expression + ]), + operationLocation + ), + EmitFlags.NoTokenSourceMaps ) ); } From b195ef8ec57ec8ebd9611df2626854fdd4b77a8d Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 5 Dec 2016 13:13:50 -0800 Subject: [PATCH 099/289] Updated baselines --- .../asyncAwaitWithCapturedBlockScopeVar.js | 12 ++-- .../es5-asyncFunctionBinaryExpressions.js | 3 +- .../es5-asyncFunctionConditionals.js | 6 +- .../es5-asyncFunctionDoStatements.js | 42 +++++--------- .../es5-asyncFunctionForInStatements.js | 21 +++---- .../es5-asyncFunctionForOfStatements.js | 57 +++++++------------ .../es5-asyncFunctionForStatements.js | 12 ++-- .../es5-asyncFunctionIfStatements.js | 6 +- .../reference/es5-asyncFunctionNestedLoops.js | 3 +- .../es5-asyncFunctionWhileStatements.js | 42 +++++--------- .../reference/exportStarForValues10.js | 3 +- .../reference/generatorTransformFinalLabel.js | 3 +- .../sourceMapValidationStatements.js.map | 2 +- ...ourceMapValidationStatements.sourcemap.txt | 12 ++-- .../sourceMapValidationTryCatchFinally.js.map | 2 +- ...MapValidationTryCatchFinally.sourcemap.txt | 14 ++--- tests/baselines/reference/systemModule11.js | 12 ++-- tests/baselines/reference/systemModule16.js | 3 +- tests/baselines/reference/systemModule9.js | 3 +- 19 files changed, 91 insertions(+), 167 deletions(-) diff --git a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js index 49566904ae1..6d167a00089 100644 --- a/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js +++ b/tests/baselines/reference/asyncAwaitWithCapturedBlockScopeVar.js @@ -57,8 +57,7 @@ function fn1() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_1(i)]; case 2: _a.sent(); @@ -92,8 +91,7 @@ function fn2() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_2(i)]; case 2: state_1 = _a.sent(); @@ -129,8 +127,7 @@ function fn3() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_3(i)]; case 2: _a.sent(); @@ -164,8 +161,7 @@ function fn4() { i = 0; _a.label = 1; case 1: - if (!(i < 1)) - return [3 /*break*/, 4]; + if (!(i < 1)) return [3 /*break*/, 4]; return [5 /*yield**/, _loop_4(i)]; case 2: state_2 = _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js index a7aff630256..23a79cef343 100644 --- a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js @@ -169,8 +169,7 @@ function binaryLogicalAnd1() { switch (_b.label) { case 0: _a = x; - if (!_a) - return [3 /*break*/, 2]; + if (!_a) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a = (_b.sent()); diff --git a/tests/baselines/reference/es5-asyncFunctionConditionals.js b/tests/baselines/reference/es5-asyncFunctionConditionals.js index b42b0c07b0a..e9fc995fc2d 100644 --- a/tests/baselines/reference/es5-asyncFunctionConditionals.js +++ b/tests/baselines/reference/es5-asyncFunctionConditionals.js @@ -32,8 +32,7 @@ function conditional1() { return __generator(this, function (_b) { switch (_b.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a = _b.sent(); @@ -54,8 +53,7 @@ function conditional2() { return __generator(this, function (_b) { switch (_b.label) { case 0: - if (!x) - return [3 /*break*/, 1]; + if (!x) return [3 /*break*/, 1]; _a = y; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, z]; diff --git a/tests/baselines/reference/es5-asyncFunctionDoStatements.js b/tests/baselines/reference/es5-asyncFunctionDoStatements.js index 7151446dddf..32a7e9b0435 100644 --- a/tests/baselines/reference/es5-asyncFunctionDoStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionDoStatements.js @@ -97,8 +97,7 @@ function doStatement1() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -114,8 +113,7 @@ function doStatement2() { _a.label = 1; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -141,8 +139,7 @@ function doStatement4() { _a.sent(); return [3 /*break*/, 2]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -161,8 +158,7 @@ function doStatement5() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -176,8 +172,7 @@ function doStatement6() { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -203,8 +198,7 @@ function doStatement8() { _a.sent(); return [3 /*break*/, 2]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -223,8 +217,7 @@ function doStatement9() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -238,8 +231,7 @@ function doStatement10() { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -265,8 +257,7 @@ function doStatement12() { _a.sent(); return [3 /*break*/, 3]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -285,8 +276,7 @@ function doStatement13() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -300,8 +290,7 @@ function doStatement14() { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -327,8 +316,7 @@ function doStatement16() { _a.sent(); return [3 /*break*/, 3]; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -347,8 +335,7 @@ function doStatement17() { _a.sent(); _a.label = 2; case 2: - if (y) - return [3 /*break*/, 0]; + if (y) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } @@ -362,8 +349,7 @@ function doStatement18() { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; case 2: - if (_a.sent()) - return [3 /*break*/, 0]; + if (_a.sent()) return [3 /*break*/, 0]; _a.label = 3; case 3: return [2 /*return*/]; } diff --git a/tests/baselines/reference/es5-asyncFunctionForInStatements.js b/tests/baselines/reference/es5-asyncFunctionForInStatements.js index 30946fca56d..ec6bfbb97e1 100644 --- a/tests/baselines/reference/es5-asyncFunctionForInStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForInStatements.js @@ -62,8 +62,7 @@ function forInStatement1() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; z; _c.label = 3; @@ -87,8 +86,7 @@ function forInStatement2() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; return [4 /*yield*/, z]; case 2: @@ -114,8 +112,7 @@ function forInStatement3() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; return [4 /*yield*/, x]; case 2: (_c.sent()).a = _a[_i]; @@ -143,8 +140,7 @@ function forInStatement4() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; z; _c.label = 3; @@ -168,8 +164,7 @@ function forInStatement5() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; return [4 /*yield*/, z]; case 2: @@ -208,8 +203,7 @@ function forInStatement7() { _i = 0; _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; b = _a[_i]; z; _c.label = 3; @@ -233,8 +227,7 @@ function forInStatement8() { _i = 0; _c.label = 1; case 1: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; c = _a[_i]; return [4 /*yield*/, z]; case 2: diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index e12f1e18d44..9cf1d0098b2 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -102,8 +102,7 @@ function forOfStatement1() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i]; z; _b.label = 3; @@ -124,8 +123,7 @@ function forOfStatement2() { _i = 0, y_2 = y; _a.label = 1; case 1: - if (!(_i < y_2.length)) - return [3 /*break*/, 4]; + if (!(_i < y_2.length)) return [3 /*break*/, 4]; x = y_2[_i]; return [4 /*yield*/, z]; case 2: @@ -148,8 +146,7 @@ function forOfStatement3() { _i = 0, y_3 = y; _a.label = 1; case 1: - if (!(_i < y_3.length)) - return [3 /*break*/, 4]; + if (!(_i < y_3.length)) return [3 /*break*/, 4]; return [4 /*yield*/, x]; case 2: (_a.sent()).a = y_3[_i]; @@ -175,8 +172,7 @@ function forOfStatement4() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x.a = _a[_i]; z; _b.label = 3; @@ -197,8 +193,7 @@ function forOfStatement5() { _i = 0, y_4 = y; _a.label = 1; case 1: - if (!(_i < y_4.length)) - return [3 /*break*/, 4]; + if (!(_i < y_4.length)) return [3 /*break*/, 4]; x.a = y_4[_i]; return [4 /*yield*/, z]; case 2: @@ -236,8 +231,7 @@ function forOfStatement7() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; c = _a[_i]; z; _b.label = 3; @@ -258,8 +252,7 @@ function forOfStatement8() { _i = 0, y_6 = y; _a.label = 1; case 1: - if (!(_i < y_6.length)) - return [3 /*break*/, 4]; + if (!(_i < y_6.length)) return [3 /*break*/, 4]; d = y_6[_i]; return [4 /*yield*/, z]; case 2: @@ -285,8 +278,7 @@ function forOfStatement9() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i][0]; z; _b.label = 3; @@ -307,8 +299,7 @@ function forOfStatement10() { _i = 0, y_7 = y; _a.label = 1; case 1: - if (!(_i < y_7.length)) - return [3 /*break*/, 4]; + if (!(_i < y_7.length)) return [3 /*break*/, 4]; x = y_7[_i][0]; return [4 /*yield*/, z]; case 2: @@ -331,11 +322,9 @@ function forOfStatement11() { _i = 0, y_8 = y; _c.label = 1; case 1: - if (!(_i < y_8.length)) - return [3 /*break*/, 6]; + if (!(_i < y_8.length)) return [3 /*break*/, 6]; _b = y_8[_i][0]; - if (!(_b === void 0)) - return [3 /*break*/, 3]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: _a = _c.sent(); @@ -367,8 +356,7 @@ function forOfStatement12() { _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; _b = _a[_i][0], x = _b === void 0 ? a : _b; z; _c.label = 3; @@ -389,8 +377,7 @@ function forOfStatement13() { _i = 0, y_9 = y; _b.label = 1; case 1: - if (!(_i < y_9.length)) - return [3 /*break*/, 4]; + if (!(_i < y_9.length)) return [3 /*break*/, 4]; _a = y_9[_i][0], x = _a === void 0 ? a : _a; return [4 /*yield*/, z]; case 2: @@ -416,8 +403,7 @@ function forOfStatement14() { _a = _b.sent(); _b.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; x = _a[_i].x; z; _b.label = 3; @@ -438,8 +424,7 @@ function forOfStatement15() { _i = 0, y_10 = y; _a.label = 1; case 1: - if (!(_i < y_10.length)) - return [3 /*break*/, 4]; + if (!(_i < y_10.length)) return [3 /*break*/, 4]; x = y_10[_i].x; return [4 /*yield*/, z]; case 2: @@ -462,11 +447,9 @@ function forOfStatement16() { _i = 0, y_11 = y; _c.label = 1; case 1: - if (!(_i < y_11.length)) - return [3 /*break*/, 6]; + if (!(_i < y_11.length)) return [3 /*break*/, 6]; _b = y_11[_i].x; - if (!(_b === void 0)) - return [3 /*break*/, 3]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: _a = _c.sent(); @@ -498,8 +481,7 @@ function forOfStatement17() { _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _a.length)) - return [3 /*break*/, 4]; + if (!(_i < _a.length)) return [3 /*break*/, 4]; _b = _a[_i].x, x = _b === void 0 ? a : _b; z; _c.label = 3; @@ -520,8 +502,7 @@ function forOfStatement18() { _i = 0, y_12 = y; _b.label = 1; case 1: - if (!(_i < y_12.length)) - return [3 /*break*/, 4]; + if (!(_i < y_12.length)) return [3 /*break*/, 4]; _a = y_12[_i].x, x = _a === void 0 ? a : _a; return [4 /*yield*/, z]; case 2: diff --git a/tests/baselines/reference/es5-asyncFunctionForStatements.js b/tests/baselines/reference/es5-asyncFunctionForStatements.js index e02d20c7864..aad8a1f46ef 100644 --- a/tests/baselines/reference/es5-asyncFunctionForStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForStatements.js @@ -49,8 +49,7 @@ function forStatement1() { _a.sent(); _a.label = 2; case 2: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; a; _a.label = 3; case 3: @@ -70,8 +69,7 @@ function forStatement2() { _a.label = 1; case 1: return [4 /*yield*/, y]; case 2: - if (!_a.sent()) - return [3 /*break*/, 4]; + if (!_a.sent()) return [3 /*break*/, 4]; a; _a.label = 3; case 3: @@ -90,8 +88,7 @@ function forStatement3() { x; _a.label = 1; case 1: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; a; _a.label = 2; case 2: return [4 /*yield*/, z]; @@ -111,8 +108,7 @@ function forStatement4() { x; _a.label = 1; case 1: - if (!y) - return [3 /*break*/, 4]; + if (!y) return [3 /*break*/, 4]; return [4 /*yield*/, a]; case 2: _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionIfStatements.js b/tests/baselines/reference/es5-asyncFunctionIfStatements.js index 7ac35c995e7..39fc2ade726 100644 --- a/tests/baselines/reference/es5-asyncFunctionIfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionIfStatements.js @@ -36,8 +36,7 @@ function ifStatement2() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -55,8 +54,7 @@ function ifStatement3() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 1]; + if (!x) return [3 /*break*/, 1]; y; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, z]; diff --git a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js index 28ccc288b7e..36408e241a0 100644 --- a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js +++ b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js @@ -19,8 +19,7 @@ function nestedLoops() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); diff --git a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js index c85aabb01e3..750673fb6c4 100644 --- a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js @@ -94,8 +94,7 @@ function whileStatement1() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; y; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; @@ -108,8 +107,7 @@ function whileStatement2() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -135,8 +133,7 @@ function whileStatement4() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; } @@ -148,8 +145,7 @@ function whileStatement5() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -164,8 +160,7 @@ function whileStatement6() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 0]; return [4 /*yield*/, y]; @@ -193,8 +188,7 @@ function whileStatement8() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 0]; case 2: return [2 /*return*/]; } @@ -206,8 +200,7 @@ function whileStatement9() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -222,8 +215,7 @@ function whileStatement10() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 0]; return [4 /*yield*/, y]; @@ -251,8 +243,7 @@ function whileStatement12() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 2]; case 2: return [2 /*return*/]; } @@ -264,8 +255,7 @@ function whileStatement13() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -280,8 +270,7 @@ function whileStatement14() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 2]; return [4 /*yield*/, y]; @@ -309,8 +298,7 @@ function whileStatement16() { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: - if (!_a.sent()) - return [3 /*break*/, 2]; + if (!_a.sent()) return [3 /*break*/, 2]; return [3 /*break*/, 2]; case 2: return [2 /*return*/]; } @@ -322,8 +310,7 @@ function whileStatement17() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; return [4 /*yield*/, y]; case 1: _a.sent(); @@ -338,8 +325,7 @@ function whileStatement18() { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!x) - return [3 /*break*/, 2]; + if (!x) return [3 /*break*/, 2]; if (1) return [3 /*break*/, 2]; return [4 /*yield*/, y]; diff --git a/tests/baselines/reference/exportStarForValues10.js b/tests/baselines/reference/exportStarForValues10.js index 3da80002780..f7dd6e94ce5 100644 --- a/tests/baselines/reference/exportStarForValues10.js +++ b/tests/baselines/reference/exportStarForValues10.js @@ -42,8 +42,7 @@ System.register(["file0"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default") - exports[n] = m[n]; + if (n !== "default") exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/generatorTransformFinalLabel.js b/tests/baselines/reference/generatorTransformFinalLabel.js index 32272ae0748..58cffc80bee 100644 --- a/tests/baselines/reference/generatorTransformFinalLabel.js +++ b/tests/baselines/reference/generatorTransformFinalLabel.js @@ -14,8 +14,7 @@ function test(skip) { return __generator(this, function (_a) { switch (_a.label) { case 0: - if (!!skip) - return [3 /*break*/, 2]; + if (!!skip) return [3 /*break*/, 2]; return [4 /*yield*/, 1]; case 1: _a.sent(); diff --git a/tests/baselines/reference/sourceMapValidationStatements.js.map b/tests/baselines/reference/sourceMapValidationStatements.js.map index 464ab4dc002..5841f329e5e 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.js.map +++ b/tests/baselines/reference/sourceMapValidationStatements.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationStatements.js.map] -{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAE;IAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAE;IAAA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationStatements.js","sourceRoot":"","sources":["sourceMapValidationStatements.ts"],"names":[],"mappings":"AAAA;IACI,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1B,CAAC,IAAI,CAAC,CAAC;QACP,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IACD,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACT,CAAC,IAAI,CAAC,CAAC;IACX,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,CAAC,IAAI,EAAE,CAAC;QACR,CAAC,EAAE,CAAC;IACR,CAAC;IACD,IAAI,CAAC,GAAG;QACJ,CAAC;QACD,CAAC;QACD,CAAC;KACJ,CAAC;IACF,IAAI,GAAG,GAAG;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,OAAO;KACb,CAAC;IACF,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;IACnB,CAAC;IAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACT,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACb,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACf,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IACD,IAAI,CAAC;QACD,MAAM,IAAI,KAAK,EAAE,CAAC;IACtB,CAAC;IAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;YAAS,CAAC;QACP,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;QACR,CAAC,GAAG,CAAC,CAAC;QACN,CAAC,GAAG,EAAE,CAAC;IACX,CAAC;IACD,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,KAAK,CAAC,EAAE,CAAC;YACL,CAAC,EAAE,CAAC;YACJ,KAAK,CAAC;QAEV,CAAC;QACD,SAAS,CAAC;YACN,CAAC,IAAI,CAAC,CAAC;YACP,CAAC,GAAG,EAAE,CAAC;YACP,KAAK,CAAC;QAEV,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACZ,CAAC,EAAE,CAAC;IACR,CAAC;IACD,GAAG,CAAC;QACA,CAAC,EAAE,CAAC;IACR,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;IACf,CAAC,GAAG,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,KAAK,CAAC,CAAC;IACR,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC;AACX,CAAC;AACD,IAAI,CAAC,GAAG;IACJ,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC,CAAC;AACF,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt index ed7c9395d2f..7c5c5bfcfeb 100644 --- a/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationStatements.sourcemap.txt @@ -525,9 +525,9 @@ sourceFile:sourceMapValidationStatements.ts 3 > ^^^^^^^^^^^-> 1 > > -2 > } +2 > } 1 >Emitted(30, 5) Source(29, 5) + SourceIndex(0) -2 >Emitted(30, 6) Source(29, 7) + SourceIndex(0) +2 >Emitted(30, 6) Source(29, 6) + SourceIndex(0) --- >>> catch (e) { 1->^^^^ @@ -539,7 +539,7 @@ sourceFile:sourceMapValidationStatements.ts 7 > ^ 8 > ^ 9 > ^^^^^^^^^^^-> -1-> +1-> 2 > catch 3 > 4 > ( @@ -727,9 +727,9 @@ sourceFile:sourceMapValidationStatements.ts 3 > ^^^^^^^^^^^^-> 1 > > -2 > } +2 > } 1 >Emitted(41, 5) Source(38, 5) + SourceIndex(0) -2 >Emitted(41, 6) Source(38, 7) + SourceIndex(0) +2 >Emitted(41, 6) Source(38, 6) + SourceIndex(0) --- >>> catch (e1) { 1->^^^^ @@ -741,7 +741,7 @@ sourceFile:sourceMapValidationStatements.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> 2 > catch 3 > 4 > ( diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map index 46506410856..8b8690b470d 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationTryCatchFinally.js.map] -{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAI,CAAC;IACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAE;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAS,CAAC;IACP,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IACA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CACA;AAAA,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAED,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationTryCatchFinally.js","sourceRoot":"","sources":["sourceMapValidationTryCatchFinally.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,EAAE,CAAC;AACX,IAAI,CAAC;IACD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAAS,CAAC;IACP,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AACD,IACA,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,IAAI,KAAK,EAAE,CAAC;AACtB,CAAC;AACD,KAAK,CAAC,CAAC,CAAC,CAAC,CACT,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;QAED,CAAC;IACG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt index d625e74c262..845ec5eeb27 100644 --- a/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationTryCatchFinally.sourcemap.txt @@ -71,9 +71,9 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 3 > ^^^^^^^^^^^-> 1 > > -2 >} +2 >} 1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(4, 2) Source(4, 3) + SourceIndex(0) +2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) --- >>>catch (e) { 1-> @@ -85,7 +85,7 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> 2 >catch 3 > 4 > ( @@ -245,10 +245,9 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 3 > ^^^^^^^^^^^-> 1 > > -2 >} - > +2 >} 1 >Emitted(14, 1) Source(13, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(14, 1) + SourceIndex(0) +2 >Emitted(14, 2) Source(13, 2) + SourceIndex(0) --- >>>catch (e) { 1-> @@ -260,7 +259,8 @@ sourceFile:sourceMapValidationTryCatchFinally.ts 7 > ^ 8 > ^ 9 > ^^^^-> -1-> +1-> + > 2 >catch 3 > 4 > ( diff --git a/tests/baselines/reference/systemModule11.js b/tests/baselines/reference/systemModule11.js index 41574af1d9a..212a24b5e20 100644 --- a/tests/baselines/reference/systemModule11.js +++ b/tests/baselines/reference/systemModule11.js @@ -55,8 +55,7 @@ System.register(["bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -83,8 +82,7 @@ System.register(["bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -111,8 +109,7 @@ System.register(["a", "bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } @@ -162,8 +159,7 @@ System.register(["a"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default") - exports[n] = m[n]; + if (n !== "default") exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/systemModule16.js b/tests/baselines/reference/systemModule16.js index 8058e0f2ea1..86b6a448215 100644 --- a/tests/baselines/reference/systemModule16.js +++ b/tests/baselines/reference/systemModule16.js @@ -27,8 +27,7 @@ System.register(["foo", "bar"], function (exports_1, context_1) { function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } diff --git a/tests/baselines/reference/systemModule9.js b/tests/baselines/reference/systemModule9.js index 9e497140083..fce3aa1bdf4 100644 --- a/tests/baselines/reference/systemModule9.js +++ b/tests/baselines/reference/systemModule9.js @@ -33,8 +33,7 @@ System.register(["file1", "file2", "file3", "file4", "file5", "file6", "file7"], function exportStar_1(m) { var exports = {}; for (var n in m) { - if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) - exports[n] = m[n]; + if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; } exports_1(exports); } From f0c771303d4979959d0fdc476b40a91f59e98b55 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Mon, 5 Dec 2016 14:52:08 -0800 Subject: [PATCH 100/289] implement getters/setters as property --- src/services/codefixes/helpers.ts | 13 ++--- .../codeFixClassExtendsAbstractGetter.ts | 11 ++++ ...codeFixClassExtendsAbstractGetterSetter.ts | 17 ++++++ .../codeFixClassExtendsAbstractSetter.ts | 11 ++++ ...edClassMissingAbstractGettersAndSetters.ts | 52 +++++-------------- 5 files changed, 57 insertions(+), 47 deletions(-) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 3c06ae6288f..f4d50b57dbf 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -28,8 +28,9 @@ namespace ts.codefix { } const node = declarations[0]; const visibility = getVisibilityPrefix(getModifierFlags(node)); - let getOrSetPrefix: string = undefined; switch (node.kind) { + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: case SyntaxKind.PropertySignature: case SyntaxKind.PropertyDeclaration: const typeString = checker.typeToString(type, enclosingDeclaration, TypeFormatFlags.None); @@ -45,19 +46,13 @@ namespace ts.codefix { const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; - case SyntaxKind.GetAccessor: - getOrSetPrefix = "get"; - case SyntaxKind.SetAccessor: - getOrSetPrefix = getOrSetPrefix ? getOrSetPrefix : "set"; - - throw new Error('Not implemented, getter and setter.'); case SyntaxKind.ComputedPropertyName: if (hasDynamicName(node)) { return ""; } - throw new Error('Not implemented, computed property name.'); + throw new Error("Not implemented, computed property name."); case SyntaxKind.IndexSignature: - throw new Error('Not implemented.'); + throw new Error("Not implemented."); default: return ""; diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts new file mode 100644 index 00000000000..8d79cce710e --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// abstract get b(): number; +//// } +//// +//// class C extends A {[| |]} + +verify.rangeAfterCodeFix(` + b: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts new file mode 100644 index 00000000000..fc0ac400623 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts @@ -0,0 +1,17 @@ +/// + +//// abstract class A { +//// private _a: string; +//// +//// abstract get a(): string; +//// abstract set a(newName: string); +//// } +//// +//// // Don't need to add anything in this case. +//// abstract class B extends A {} +//// +//// class C extends A {[| |]} + +verify.rangeAfterCodeFix(` + a: string; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts new file mode 100644 index 00000000000..e8cb55fa660 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// abstract set c(arg: number | string); +//// } +//// +//// class C extends A {[| |]} + +verify.rangeAfterCodeFix(` + c: string | number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts index 5540b20cfb9..df78803c588 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts @@ -1,44 +1,20 @@ /// -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); +//// abstract class A { +//// private _a: string; +//// +//// abstract get a(): string; +//// abstract set a(newName: string); +//// +//// abstract get b(): number; +//// +//// abstract set c(arg: number | string); //// } //// -//// class C1 implements N1.I1 {[| -//// |]} +//// class C implements A {[| |]} -let passcode = "secret passcode"; - -abstract class A { - private _a: string; - - abstract get a(): string; - abstract set a(newName: string); -} - -class B extends A { +verify.rangeAfterCodeFix(` a: string; -} - - -abstract class AA { - private _a: string; - - abstract get a(): string { - return this._a; - } - - abstract set a(newName: string) { - this._a = newName; - } -} - -verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not implemented.'); -} -`); + b: number; + c: string | number; +`); \ No newline at end of file From 7a9c11c72beec980b19bc9962ecbdde3208e37b0 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 5 Dec 2016 16:27:59 -0800 Subject: [PATCH 101/289] Test:destructuring array initialisers refer to previous elements --- .../destructuringArrayBindingPatternAndAssignment3.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts new file mode 100644 index 00000000000..f0537456891 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts @@ -0,0 +1,4 @@ +const [a, b = a] = [1]; // ok +const [a, b = a, c = c] = [1]; // error for c +const [a, b = a, c = d, d = a] = [1]; // error for c + From 92f2721b4619bfe956c64acace0130dc4ffa0bf1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 11:48:14 -0800 Subject: [PATCH 102/289] Binding initialisers can refer to previous elements --- src/compiler/checker.ts | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 903c8cfda1c..7ea84d093ec 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -638,11 +638,24 @@ namespace ts { if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== SyntaxKind.VariableDeclaration || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === SyntaxKind.BindingElement) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + const errorBindingElement = getAncestor(usage, SyntaxKind.BindingElement) as BindingElement; + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, SyntaxKind.VariableDeclaration) as Declaration, usage); + } + else if (declaration.kind === SyntaxKind.VariableDeclaration) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration as VariableDeclaration, usage); + } + return true; } + // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) const container = getEnclosingBlockScopeContainer(declaration); @@ -699,6 +712,16 @@ namespace ts { } return false; } + + function getAncestorBindingPattern(node: Node): BindingPattern { + while (node) { + if (isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and @@ -1065,7 +1088,7 @@ namespace ts { Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, SyntaxKind.VariableDeclaration), errorLocation)) { + if (!isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); } } From 72a1e85cd7f1b189b509a723ed8473ae265573ca Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:04:45 -0800 Subject: [PATCH 103/289] Check binding initialisers in parameters as well --- 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 7ea84d093ec..61ccbff9bb0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17041,7 +17041,8 @@ namespace ts { // so we need to do a bit of extra work to check if reference is legal const enclosingContainer = getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === SyntaxKind.Parameter) { + if (symbol.valueDeclaration.kind === SyntaxKind.Parameter || + symbol.valueDeclaration.kind === SyntaxKind.BindingElement) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { From 4efa61cf80aa66512a892f8db40bfa1aee1c0fe7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:05:52 -0800 Subject: [PATCH 104/289] More tests for binding elements referencing previous elements --- .../destructuringArrayBindingPatternAndAssignment3.ts | 10 ++++++++-- .../destructuringObjectBindingPatternAndAssignment4.ts | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts diff --git a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts index f0537456891..243a297ed43 100644 --- a/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts +++ b/tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts @@ -1,4 +1,10 @@ const [a, b = a] = [1]; // ok -const [a, b = a, c = c] = [1]; // error for c -const [a, b = a, c = d, d = a] = [1]; // error for c +const [c, d = c, e = e] = [1]; // error for e = e +const [f, g = f, h = i, i = f] = [1]; // error for h = i +(function ([a, b = a]) { // ok +})([1]); +(function ([c, d = c, e = e]) { // error for e = e +})([1]); +(function ([f, g = f, h = i, i = f]) { // error for h = i +})([1]) diff --git a/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts b/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts new file mode 100644 index 00000000000..d138c14db7a --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts @@ -0,0 +1,8 @@ +const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + f = f // error +} = { } as any; From 77b6482936c44062d26eeb2099079049d278a1ef Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 6 Dec 2016 13:06:26 -0800 Subject: [PATCH 105/289] Add baselines for new tests --- ...rayBindingPatternAndAssignment3.errors.txt | 26 +++++++++++++++++++ ...turingArrayBindingPatternAndAssignment3.js | 26 +++++++++++++++++++ ...ectBindingPatternAndAssignment4.errors.txt | 18 +++++++++++++ ...uringObjectBindingPatternAndAssignment4.js | 21 +++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt create mode 100644 tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js create mode 100644 tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt create mode 100644 tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt new file mode 100644 index 00000000000..a68affcf73d --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(2,22): error TS2448: Block-scoped variable 'e' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(3,22): error TS2448: Block-scoped variable 'i' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(7,27): error TS2372: Parameter 'e' cannot be referenced in its initializer. +tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts(9,27): error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it. + + +==== tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts (4 errors) ==== + const [a, b = a] = [1]; // ok + const [c, d = c, e = e] = [1]; // error for e = e + ~ +!!! error TS2448: Block-scoped variable 'e' used before its declaration. + const [f, g = f, h = i, i = f] = [1]; // error for h = i + ~ +!!! error TS2448: Block-scoped variable 'i' used before its declaration. + + (function ([a, b = a]) { // ok + })([1]); + (function ([c, d = c, e = e]) { // error for e = e + ~ +!!! error TS2372: Parameter 'e' cannot be referenced in its initializer. + })([1]); + (function ([f, g = f, h = i, i = f]) { // error for h = i + ~ +!!! error TS2373: Initializer of parameter 'h' cannot reference identifier 'i' declared after it. + })([1]) + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js new file mode 100644 index 00000000000..7073061dec6 --- /dev/null +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.js @@ -0,0 +1,26 @@ +//// [destructuringArrayBindingPatternAndAssignment3.ts] +const [a, b = a] = [1]; // ok +const [c, d = c, e = e] = [1]; // error for e = e +const [f, g = f, h = i, i = f] = [1]; // error for h = i + +(function ([a, b = a]) { // ok +})([1]); +(function ([c, d = c, e = e]) { // error for e = e +})([1]); +(function ([f, g = f, h = i, i = f]) { // error for h = i +})([1]) + + +//// [destructuringArrayBindingPatternAndAssignment3.js] +var _a = [1], a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b; // ok +var _c = [1], c = _c[0], _d = _c[1], d = _d === void 0 ? c : _d, _e = _c[2], e = _e === void 0 ? e : _e; // error for e = e +var _f = [1], f = _f[0], _g = _f[1], g = _g === void 0 ? f : _g, _h = _f[2], h = _h === void 0 ? i : _h, _j = _f[3], i = _j === void 0 ? f : _j; // error for h = i +(function (_a) { + var a = _a[0], _b = _a[1], b = _b === void 0 ? a : _b; +})([1]); +(function (_a) { + var c = _a[0], _b = _a[1], d = _b === void 0 ? c : _b, _c = _a[2], e = _c === void 0 ? e : _c; +})([1]); +(function (_a) { + var f = _a[0], _b = _a[1], g = _b === void 0 ? f : _b, _c = _a[2], h = _c === void 0 ? i : _c, _d = _a[3], i = _d === void 0 ? f : _d; +})([1]); diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt new file mode 100644 index 00000000000..6a3f0f2b457 --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(6,9): error TS2448: Block-scoped variable 'f' used before its declaration. +tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts(7,9): error TS2448: Block-scoped variable 'f' used before its declaration. + + +==== tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts (2 errors) ==== + const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + ~ +!!! error TS2448: Block-scoped variable 'f' used before its declaration. + f = f // error + ~ +!!! error TS2448: Block-scoped variable 'f' used before its declaration. + } = { } as any; + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js new file mode 100644 index 00000000000..c34cbb62c1c --- /dev/null +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.js @@ -0,0 +1,21 @@ +//// [destructuringObjectBindingPatternAndAssignment4.ts] +const { + a = 1, + b = 2, + c = b, // ok + d = a, // ok + e = f, // error + f = f // error +} = { } as any; + + +//// [destructuringObjectBindingPatternAndAssignment4.js] +var _a = {}, _b = _a.a, a = _b === void 0 ? 1 : _b, _c = _a.b, b = _c === void 0 ? 2 : _c, _d = _a.c, c = _d === void 0 ? b : _d, // ok +_e = _a.d, // ok +d = _e === void 0 ? a : _e, // ok +_f = _a.e, // ok +e = _f === void 0 ? f : _f, // error +_g = _a.f // error +, // error +f = _g === void 0 ? f : _g // error +; From c511aea58179c96b8b0e7dd0d58b4631b0d3094d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 6 Dec 2016 19:46:08 -0800 Subject: [PATCH 106/289] Add Support for multiple signatures --- src/compiler/checker.ts | 1 + src/compiler/types.ts | 9 +- src/services/codefixes/helpers.ts | 101 +++++++++++++++++- .../codeFixClassExtendsAbstractMethod.ts | 19 ++-- ...ixUnImplementedClassMultipleSignatures1.ts | 14 +++ ...ixUnImplementedClassMultipleSignatures2.ts | 18 ++++ ...nImplementedInterfaceMultipleSignatures.ts | 16 +-- 7 files changed, 149 insertions(+), 29 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6f1a1783c45..0834322ff48 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -88,6 +88,7 @@ namespace ts { getReturnTypeOfSignature, getNonNullableType, getSymbolsInScope, + createSymbol, getSymbolAtLocation, getShorthandAssignmentValueSymbol, getExportSpecifierLocalTargetSymbol, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 65ac6460f5c..4adf4f7ac95 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -640,9 +640,9 @@ namespace ts { export interface ParameterDeclaration extends Declaration { kind: SyntaxKind.Parameter; - dotDotDotToken?: DotDotDotToken; // Present on rest parameter + dotDotDotToken?: DotDotDotToken; // Present on rest parameter name: BindingName; // Declared parameter name - questionToken?: QuestionToken; // Present on optional parameter + questionToken?: QuestionToken; // Present on optional parameter type?: TypeNode; // Optional type annotation initializer?: Expression; // Optional initializer } @@ -658,14 +658,14 @@ namespace ts { export interface PropertySignature extends TypeElement { kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember; name: PropertyName; // Declared property name - questionToken?: QuestionToken; // Present on optional property + questionToken?: QuestionToken; // Present on optional property type?: TypeNode; // Optional type annotation initializer?: Expression; // Optional initializer } export interface PropertyDeclaration extends ClassElement { kind: SyntaxKind.PropertyDeclaration; - questionToken?: QuestionToken; // Present for use with reporting a grammar error + questionToken?: QuestionToken; // Present for use with reporting a grammar error name: PropertyName; type?: TypeNode; initializer?: Expression; // Optional initializer @@ -2354,6 +2354,7 @@ namespace ts { signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + createSymbol(flags: SymbolFlags, name: string): Symbol; getSymbolDisplayBuilder(): SymbolDisplayBuilder; getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index f4d50b57dbf..7e4cf36f1f0 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -38,14 +38,42 @@ namespace ts.codefix { case SyntaxKind.MethodSignature: case SyntaxKind.MethodDeclaration: + // The signature for the implementation appears as an entry in `signatures` iff + // there is only one signature. + // If there are overloads and an implementation signature, it appears as an + // extra declaration that isn't a signature for `type`. + // If there is more than one overload but no implementation signature + // (eg: an abstract method or interface declaration), there is a 1-1 + // correspondence of declarations and signatures. const signatures = checker.getSignaturesOfType(type, SignatureKind.Call); if (!(signatures && signatures.length > 0)) { return ""; } - // TODO: (arozga) Deal with multiple signatures. - const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); + if (declarations.length === 1) { + Debug.assert(signatures.length === 1); + const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); + return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + } - return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + let result = ""; + for (let i = 0; i < signatures.length; i++) { + const sigString = checker.signatureToString(signatures[i], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); + result += `${visibility}${name}${sigString};${newlineChar}`; + } + + // If there is a declaration with a body, it is the last declaration, + // and it isn't caught by `getSignaturesOfType`. + let bodySig: Signature | undefined = undefined; + if (declarations.length > signatures.length) { + bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration); + } + else { + bodySig = createBodyDeclarationSignatureWithAnyTypes(declarations as SignatureDeclaration[], signatures, enclosingDeclaration, checker); + } + const sigString = checker.signatureToString(bodySig, enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); + result += `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; + + return result; case SyntaxKind.ComputedPropertyName: if (hasDynamicName(node)) { return ""; @@ -59,8 +87,73 @@ namespace ts.codefix { } } + function createBodyDeclarationSignatureWithAnyTypes(signatureDecls: SignatureDeclaration[], signatures: Signature[], enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker): Signature { + Debug.assert(signatureDecls.length === signatures.length); + + const newSignatureDeclaration = createNode(SyntaxKind.CallSignature) as SignatureDeclaration; + newSignatureDeclaration.parent = enclosingDeclaration; + newSignatureDeclaration.name = signatureDecls[0].name; + + let maxArgs = -1, maxArgsIndex = 0; + let minArgumentCount = signatures[0].minArgumentCount; + let hasRestParameter = false; + for (let i = 0; i < signatures.length; i++) { + const sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + if (sig.parameters.length > maxArgs) { + maxArgs = sig.parameters.length; + maxArgsIndex = i; + } + hasRestParameter = hasRestParameter || sig.hasRestParameter; + } + + const anyTypeNode: TypeNode = createNode(SyntaxKind.AnyKeyword) as TypeNode; + const optionalToken = createToken(SyntaxKind.QuestionToken); + + newSignatureDeclaration.parameters = createNodeArray(); + for (let i = 0; i < maxArgs - 1; i++) { + const newParameter = createParameterDeclaration(i, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + + const lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, newSignatureDeclaration); + if (hasRestParameter) { + lastParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); + + let allMaxArgsAreRest = true; + for (const sig of signatures) { + allMaxArgsAreRest = allMaxArgsAreRest && sig.parameters[maxArgs - 1] && sig.hasRestParameter; + } + if (!allMaxArgsAreRest) { + const newParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + } + + newSignatureDeclaration.parameters.push(lastParameter); + + newSignatureDeclaration.type = anyTypeNode; + newSignatureDeclaration.type.parent = newSignatureDeclaration; + + return checker.getSignatureFromDeclaration(newSignatureDeclaration); + + function createParameterDeclaration(index: number, minArgCount: number, enclosingSignature: SignatureDeclaration): ParameterDeclaration { + const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; + newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, "arg" + index); + newParameter.symbol.valueDeclaration = newParameter; + newParameter.symbol.declarations = [newParameter]; + newParameter.type = anyTypeNode; + newParameter.parent = enclosingSignature; + if (index >= minArgCount) { + newParameter.questionToken = optionalToken; + } + + return newParameter; + } + } + function getMethodBodyStub(newLineChar: string) { - return `{${newLineChar}throw new Error('Method not implemented.');${newLineChar}}${newLineChar}`; + return ` {${newLineChar}throw new Error('Method not implemented.');${newLineChar}}${newLineChar}`; } function getVisibilityPrefix(flags: ModifierFlags): string { diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts index cf1322ff8b3..bf9eba11c8e 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts @@ -1,13 +1,18 @@ /// //// abstract class A { -//// abstract f(); +//// abstract f(a: number, b: string): boolean; +//// abstract f(a: string, b: number): Function; +//// abstract f(a: string): Function; //// } //// -//// class C extends A {[| -//// |]} +//// class C extends A {[| |]} -verify.rangeAfterCodeFix(`f(){ - throw new Error('Method not implemented.'); -} -`); \ No newline at end of file +verify.rangeAfterCodeFix(` + f(a: number, b: string): boolean; + f(a: string, b: number): Function; + f(a: string): Function; + f(arg0: any, arg1? any) { + throw new Error("Method not implemented"); + } +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts b/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts new file mode 100644 index 00000000000..82ecde6c418 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts @@ -0,0 +1,14 @@ +/// + +//// class A { +//// method(a: number, b: string): boolean; +//// method(a: string | number, b?: string | number): boolean | Function { return true; } +//// +//// class C implements A {[| |]} + +verify.rangeAfterCodeFix(` + method(a: number, b: string): boolean; + method(a: string | number, b?: string | number): boolean | Function { + throw new Error('Method not implemented.'); + } +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts b/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts new file mode 100644 index 00000000000..f187e0ca0f1 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts @@ -0,0 +1,18 @@ +/// + +//// class A { +//// method(a: any, b: string): boolean; +//// method(a: string, b: number): Function; +//// method(a: string): Function; +//// method(a: string | number, b?: string | number): boolean | Function { return true; } +//// +//// class C implements A {[| |]} + +verify.rangeAfterCodeFix(` + method(a: any, b: string): boolean; + method(a: string, b: number): Function; + method(a: string): Function; + method(a: string | number, b?: string | number): boolean | Function { + throw new Error('Method not implemented.'); + } +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts index a7142931eed..ce777567e1e 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts @@ -1,17 +1,5 @@ /// -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - //// interface I { //// method(a: number, b: string): boolean; //// method(a: string, b: number): Function; @@ -24,7 +12,7 @@ verify.rangeAfterCodeFix(` method(a: number, b: string): boolean; method(a: string, b: number): Function; method(a: string): Function; - method(a: number | string, b?: string | number): boolean | Function { - throw new Error("Method not implemented"); + method(arg0: any, arg1?: any) { + throw new Error('Method not implemented.'); } `); From 06b3ea98386a3650faf96f196c2081ae40e43bf7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 7 Dec 2016 13:14:00 -0800 Subject: [PATCH 107/289] instanceof RHS must be any, callable/constructable or Function subtype Also includes a fast-path for null and undefined even though they are technically Function subtypes. --- src/compiler/checker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cdef31ee400..650279ad52f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14380,14 +14380,18 @@ namespace ts { } // 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, a subtype of the 'Function' interface type, or have a call or construct signature. // 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 (isTypeOfKind(leftType, TypeFlags.Primitive)) { error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported - if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(isTypeAny(rightType) || + rightType.flags & TypeFlags.Nullable || + getSignaturesOfType(rightType, SignatureKind.Call).length || + getSignaturesOfType(rightType, SignatureKind.Construct).length || + isTypeSubtypeOf(rightType, globalFunctionType))) { error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); } return booleanType; From f15a7a3bacb765b100062fb9c261116ef12ed2af Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 7 Dec 2016 13:16:23 -0800 Subject: [PATCH 108/289] Test:instanceof allows callable/constructable RHS --- ...anceofOperatorWithInvalidStaticToString.js | 34 ++++++++++++ ...fOperatorWithInvalidStaticToString.symbols | 50 +++++++++++++++++ ...eofOperatorWithInvalidStaticToString.types | 53 +++++++++++++++++++ ...anceofOperatorWithInvalidStaticToString.ts | 21 ++++++++ 4 files changed, 158 insertions(+) create mode 100644 tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.js create mode 100644 tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.symbols create mode 100644 tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.types create mode 100644 tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts diff --git a/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.js b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.js new file mode 100644 index 00000000000..bf5a6f7bce1 --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.js @@ -0,0 +1,34 @@ +//// [instanceofOperatorWithInvalidStaticToString.ts] +declare class StaticToString { + static toString(): void; +} + +function foo(staticToString: StaticToString) { + return staticToString instanceof StaticToString; +} + +declare class StaticToNumber { + static toNumber(): void; +} +function bar(staticToNumber: StaticToNumber) { + return staticToNumber instanceof StaticToNumber; +} + +declare class NormalToString { + toString(): void; +} +function baz(normal: NormalToString) { + return normal instanceof NormalToString; +} + + +//// [instanceofOperatorWithInvalidStaticToString.js] +function foo(staticToString) { + return staticToString instanceof StaticToString; +} +function bar(staticToNumber) { + return staticToNumber instanceof StaticToNumber; +} +function baz(normal) { + return normal instanceof NormalToString; +} diff --git a/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.symbols b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.symbols new file mode 100644 index 00000000000..4f4dbda611a --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.symbols @@ -0,0 +1,50 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts === +declare class StaticToString { +>StaticToString : Symbol(StaticToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 0, 0)) + + static toString(): void; +>toString : Symbol(StaticToString.toString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 0, 30)) +} + +function foo(staticToString: StaticToString) { +>foo : Symbol(foo, Decl(instanceofOperatorWithInvalidStaticToString.ts, 2, 1)) +>staticToString : Symbol(staticToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 4, 13)) +>StaticToString : Symbol(StaticToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 0, 0)) + + return staticToString instanceof StaticToString; +>staticToString : Symbol(staticToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 4, 13)) +>StaticToString : Symbol(StaticToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 0, 0)) +} + +declare class StaticToNumber { +>StaticToNumber : Symbol(StaticToNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 6, 1)) + + static toNumber(): void; +>toNumber : Symbol(StaticToNumber.toNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 8, 30)) +} +function bar(staticToNumber: StaticToNumber) { +>bar : Symbol(bar, Decl(instanceofOperatorWithInvalidStaticToString.ts, 10, 1)) +>staticToNumber : Symbol(staticToNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 11, 13)) +>StaticToNumber : Symbol(StaticToNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 6, 1)) + + return staticToNumber instanceof StaticToNumber; +>staticToNumber : Symbol(staticToNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 11, 13)) +>StaticToNumber : Symbol(StaticToNumber, Decl(instanceofOperatorWithInvalidStaticToString.ts, 6, 1)) +} + +declare class NormalToString { +>NormalToString : Symbol(NormalToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 13, 1)) + + toString(): void; +>toString : Symbol(NormalToString.toString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 15, 30)) +} +function baz(normal: NormalToString) { +>baz : Symbol(baz, Decl(instanceofOperatorWithInvalidStaticToString.ts, 17, 1)) +>normal : Symbol(normal, Decl(instanceofOperatorWithInvalidStaticToString.ts, 18, 13)) +>NormalToString : Symbol(NormalToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 13, 1)) + + return normal instanceof NormalToString; +>normal : Symbol(normal, Decl(instanceofOperatorWithInvalidStaticToString.ts, 18, 13)) +>NormalToString : Symbol(NormalToString, Decl(instanceofOperatorWithInvalidStaticToString.ts, 13, 1)) +} + diff --git a/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.types b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.types new file mode 100644 index 00000000000..11efa0cffc3 --- /dev/null +++ b/tests/baselines/reference/instanceofOperatorWithInvalidStaticToString.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts === +declare class StaticToString { +>StaticToString : StaticToString + + static toString(): void; +>toString : () => void +} + +function foo(staticToString: StaticToString) { +>foo : (staticToString: StaticToString) => boolean +>staticToString : StaticToString +>StaticToString : StaticToString + + return staticToString instanceof StaticToString; +>staticToString instanceof StaticToString : boolean +>staticToString : StaticToString +>StaticToString : typeof StaticToString +} + +declare class StaticToNumber { +>StaticToNumber : StaticToNumber + + static toNumber(): void; +>toNumber : () => void +} +function bar(staticToNumber: StaticToNumber) { +>bar : (staticToNumber: StaticToNumber) => boolean +>staticToNumber : StaticToNumber +>StaticToNumber : StaticToNumber + + return staticToNumber instanceof StaticToNumber; +>staticToNumber instanceof StaticToNumber : boolean +>staticToNumber : StaticToNumber +>StaticToNumber : typeof StaticToNumber +} + +declare class NormalToString { +>NormalToString : NormalToString + + toString(): void; +>toString : () => void +} +function baz(normal: NormalToString) { +>baz : (normal: NormalToString) => boolean +>normal : NormalToString +>NormalToString : NormalToString + + return normal instanceof NormalToString; +>normal instanceof NormalToString : boolean +>normal : NormalToString +>NormalToString : typeof NormalToString +} + diff --git a/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts new file mode 100644 index 00000000000..b99f8d71141 --- /dev/null +++ b/tests/cases/conformance/expressions/binaryOperators/instanceofOperator/instanceofOperatorWithInvalidStaticToString.ts @@ -0,0 +1,21 @@ +declare class StaticToString { + static toString(): void; +} + +function foo(staticToString: StaticToString) { + return staticToString instanceof StaticToString; +} + +declare class StaticToNumber { + static toNumber(): void; +} +function bar(staticToNumber: StaticToNumber) { + return staticToNumber instanceof StaticToNumber; +} + +declare class NormalToString { + toString(): void; +} +function baz(normal: NormalToString) { + return normal instanceof NormalToString; +} From 5cd0ea3741cc0fdbf5842d4bc6e30b837527f145 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 7 Dec 2016 17:00:20 -0800 Subject: [PATCH 109/289] handle well-known computed property/method names --- src/services/codefixes/helpers.ts | 36 +++++++------ .../codeFixClassExtendsAbstractMethod.ts | 4 +- ...eFixUnImplementedInterface39 - Copy (3).ts | 18 ------- ...eFixUnImplementedInterface39 - Copy (4).ts | 18 ------- ...eFixUnImplementedInterface39 - Copy (5).ts | 18 ------- ...eFixUnImplementedInterface39 - Copy (6).ts | 18 ------- ...aceComputedPropertyNameWellKnownSymbols.ts | 53 +++++++++++++++++++ 7 files changed, 74 insertions(+), 91 deletions(-) delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 7e4cf36f1f0..ef0ca1a9a57 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -20,15 +20,17 @@ namespace ts.codefix { } function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { - const name = symbol.getName(); + // const name = symbol.getName(); const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); const declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { return ""; } - const node = declarations[0]; - const visibility = getVisibilityPrefix(getModifierFlags(node)); - switch (node.kind) { + + const declaration = declarations[0] as Declaration; + const name = declaration.name.getText(); + const visibility = getVisibilityPrefix(getModifierFlags(declaration)); + switch (declaration.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.PropertySignature: @@ -68,14 +70,15 @@ namespace ts.codefix { bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration); } else { - bodySig = createBodyDeclarationSignatureWithAnyTypes(declarations as SignatureDeclaration[], signatures, enclosingDeclaration, checker); + Debug.assert(declarations.length === signatures.length); + bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } const sigString = checker.signatureToString(bodySig, enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call); result += `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; return result; case SyntaxKind.ComputedPropertyName: - if (hasDynamicName(node)) { + if (hasDynamicName(declaration)) { return ""; } throw new Error("Not implemented, computed property name."); @@ -87,22 +90,25 @@ namespace ts.codefix { } } - function createBodyDeclarationSignatureWithAnyTypes(signatureDecls: SignatureDeclaration[], signatures: Signature[], enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker): Signature { - Debug.assert(signatureDecls.length === signatures.length); + function createBodySignatureWithAnyTypes(signatures: Signature[], enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker): Signature { const newSignatureDeclaration = createNode(SyntaxKind.CallSignature) as SignatureDeclaration; newSignatureDeclaration.parent = enclosingDeclaration; - newSignatureDeclaration.name = signatureDecls[0].name; + newSignatureDeclaration.name = signatures[0].getDeclaration().name; - let maxArgs = -1, maxArgsIndex = 0; + let maxArgs = -1; let minArgumentCount = signatures[0].minArgumentCount; let hasRestParameter = false; + let allMaxArgsAreRest = true; for (let i = 0; i < signatures.length; i++) { const sig = signatures[i]; minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); if (sig.parameters.length > maxArgs) { maxArgs = sig.parameters.length; - maxArgsIndex = i; + allMaxArgsAreRest = sig.hasRestParameter; + } + else if (sig.parameters.length === maxArgs) { + allMaxArgsAreRest = allMaxArgsAreRest && sig.hasRestParameter; } hasRestParameter = hasRestParameter || sig.hasRestParameter; } @@ -120,10 +126,6 @@ namespace ts.codefix { if (hasRestParameter) { lastParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); - let allMaxArgsAreRest = true; - for (const sig of signatures) { - allMaxArgsAreRest = allMaxArgsAreRest && sig.parameters[maxArgs - 1] && sig.hasRestParameter; - } if (!allMaxArgsAreRest) { const newParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, newSignatureDeclaration); newSignatureDeclaration.parameters.push(newParameter); @@ -137,13 +139,13 @@ namespace ts.codefix { return checker.getSignatureFromDeclaration(newSignatureDeclaration); - function createParameterDeclaration(index: number, minArgCount: number, enclosingSignature: SignatureDeclaration): ParameterDeclaration { + function createParameterDeclaration(index: number, minArgCount: number, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, "arg" + index); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; newParameter.type = anyTypeNode; - newParameter.parent = enclosingSignature; + newParameter.parent = enclosingSignatureDeclaration; if (index >= minArgCount) { newParameter.questionToken = optionalToken; } diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts index bf9eba11c8e..587b5d9b2b7 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts @@ -12,7 +12,7 @@ verify.rangeAfterCodeFix(` f(a: number, b: string): boolean; f(a: string, b: number): Function; f(a: string): Function; - f(arg0: any, arg1? any) { - throw new Error("Method not implemented"); + f(arg0: any, arg1?: any) { + throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts deleted file mode 100644 index f81dea49782..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts deleted file mode 100644 index f81dea49782..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts deleted file mode 100644 index f81dea49782..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts deleted file mode 100644 index f81dea49782..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -//// namespace N1 { -//// export interface I1 { -//// f1():string; -//// } -//// } -//// interface I1 { -//// f1(); -//// } -//// -//// class C1 implements N1.I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(): string{ - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts new file mode 100644 index 00000000000..ffad13e74de --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts @@ -0,0 +1,53 @@ +/// + +// @lib: es2017 + +//// interface I { +//// [Symbol.hasInstance](o: any): boolean; +//// [Symbol.isConcatSpreadable]: boolean; +//// [Symbol.iterator](): Iterator; +//// [Symbol.match]: boolean; +//// [Symbol.replace](...args); +//// [Symbol.search](str: string): number; +//// [Symbol.species](): Species; +//// [Symbol.split](str: string, limit?: number): string[]; +//// [Symbol.toPrimitive](hint: "number"): number; +//// [Symbol.toPrimitive](hint: "default"): number; +//// [Symbol.toPrimitive](hint: "string"): string; +//// [Symbol.toStringTag]: string; +//// [Symbol.unscopables]: any; +//// } +//// +//// class C implements I {[| |]} + + +verify.rangeAfterCodeFix(` + [Symbol.hasInstance](o: any): boolean { + throw new Error('Method not implemented.'); + } + [Symbol.isConcatSpreadable]: boolean; + [Symbol.iterator]() { + throw new Error('Method not implemented.'); + } + [Symbol.match]: boolean; + [Symbol.replace](...args: {}) { + throw new Error('Method not implemented.'); + } + [Symbol.search](str: string): number { + throw new Error('Method not implemented.'); + } + [Symbol.species](): number { + throw new Error('Method not implemented.'); + } + [Symbol.split](str: string, limit?: number): {} { + throw new Error('Method not implemented.'); + } + [Symbol.toPrimitive](hint: "number"): number; + [Symbol.toPrimitive](hint: "default"): number; + [Symbol.toPrimitive](hint: "string"): string; + [Symbol.toPrimitive](arg0: any) { + throw new Error('Method not implemented.'); + } + [Symbol.toStringTag]: string; + [Symbol.unscopables]: any; +`); From c22e47d26d65b92bbed9371466de8da4c9d8ce8b Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 7 Dec 2016 17:12:42 -0800 Subject: [PATCH 110/289] add test for computed literals --- ...mentedInterfaceComputedPropertyLiterals.ts | 21 +++++++++++++++++++ ...aceComputedPropertyNameWellKnownSymbols.ts | 3 +-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts new file mode 100644 index 00000000000..98f9c978c3d --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts @@ -0,0 +1,21 @@ +/// + +//// interface I { +//// ["foo"](o: any): boolean; +//// ["x"]: boolean; +//// [1](): string; +//// [2]: boolean; +//// } + +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + [1](): string { + throw new Error('Method not implemented.'); + } + [2]: boolean; + ["foo"](o: any): boolean { + throw new Error('Method not implemented.'); + } + ["x"]: boolean; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts index ffad13e74de..8a6e7e8f2d8 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts @@ -5,7 +5,7 @@ //// interface I { //// [Symbol.hasInstance](o: any): boolean; //// [Symbol.isConcatSpreadable]: boolean; -//// [Symbol.iterator](): Iterator; +//// [Symbol.iterator](): any; //// [Symbol.match]: boolean; //// [Symbol.replace](...args); //// [Symbol.search](str: string): number; @@ -20,7 +20,6 @@ //// //// class C implements I {[| |]} - verify.rangeAfterCodeFix(` [Symbol.hasInstance](o: any): boolean { throw new Error('Method not implemented.'); From 074f2b7636102003acfaa54cdc9a4b86dbf5e50c Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 8 Dec 2016 23:02:59 +0900 Subject: [PATCH 111/289] catch up --- .../reference/superPropertyInConstructorBeforeSuperCall.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 15bc0c40f37..1686be4e2e9 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -16,8 +16,12 @@ class C2 extends B { } //// [superPropertyInConstructorBeforeSuperCall.js] +var __extendStatics = (this && this.__extendStatics) || + Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + __extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; From c09a8c91a29bd5788c732b7f8c486b39eb17f342 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 8 Dec 2016 23:33:06 +0900 Subject: [PATCH 112/289] address review comment --- src/compiler/transformers/es2015.ts | 19 +- ...sClassHeritageListMemberTypeAnnotations.js | 19 +- ...accessibleTypeInTypeParameterConstraint.js | 19 +- .../reference/abstractClassInLocalScope.js | 19 +- .../abstractClassInLocalScopeIsAbstract.js | 19 +- tests/baselines/reference/abstractProperty.js | 19 +- .../reference/abstractPropertyNegative.js | 19 +- .../accessOverriddenBaseClassMember1.js | 19 +- .../accessors_spec_section-4.5_inference.js | 19 +- .../reference/aliasUsageInAccessorsOfClass.js | 19 +- .../baselines/reference/aliasUsageInArray.js | 19 +- .../aliasUsageInFunctionExpression.js | 19 +- .../reference/aliasUsageInGenericFunction.js | 19 +- .../reference/aliasUsageInIndexerOfClass.js | 19 +- .../reference/aliasUsageInObjectLiteral.js | 19 +- .../reference/aliasUsageInOrExpression.js | 19 +- ...aliasUsageInTypeArgumentOfExtendsClause.js | 38 +- .../reference/aliasUsageInVarAssignment.js | 19 +- .../reference/ambiguousOverloadResolution.js | 19 +- .../reference/apparentTypeSubtyping.js | 19 +- .../reference/apparentTypeSupertype.js | 19 +- .../reference/arrayAssignmentTest1.js | 19 +- .../reference/arrayAssignmentTest2.js | 19 +- .../reference/arrayBestCommonTypes.js | 19 +- .../reference/arrayLiteralTypeInference.js | 19 +- tests/baselines/reference/arrayLiterals.js | 19 +- .../arrayLiteralsWithRecursiveGenerics.js | 19 +- ...rayOfSubtypeIsAssignableToReadonlyArray.js | 19 +- .../reference/arrowFunctionContexts.js | 19 +- .../assignmentCompatWithCallSignatures3.js | 19 +- .../assignmentCompatWithCallSignatures4.js | 19 +- .../assignmentCompatWithCallSignatures5.js | 19 +- .../assignmentCompatWithCallSignatures6.js | 19 +- ...ssignmentCompatWithConstructSignatures3.js | 19 +- ...ssignmentCompatWithConstructSignatures4.js | 19 +- ...ssignmentCompatWithConstructSignatures5.js | 19 +- ...ssignmentCompatWithConstructSignatures6.js | 19 +- .../assignmentCompatWithNumericIndexer.js | 19 +- .../assignmentCompatWithNumericIndexer3.js | 19 +- .../assignmentCompatWithObjectMembers4.js | 19 +- ...nmentCompatWithObjectMembersOptionality.js | 19 +- ...mentCompatWithObjectMembersOptionality2.js | 19 +- .../assignmentCompatWithStringIndexer.js | 19 +- .../reference/assignmentLHSIsValue.js | 19 +- .../reference/asyncImportedPromise_es5.js | 19 +- tests/baselines/reference/autolift4.js | 19 +- tests/baselines/reference/baseCheck.js | 19 +- .../reference/baseIndexSignatureResolution.js | 19 +- .../reference/baseTypeOrderChecking.js | 19 +- .../baseTypeWrappingInstantiationChain.js | 19 +- tests/baselines/reference/bases.js | 19 +- .../bestCommonTypeOfConditionalExpressions.js | 19 +- ...bestCommonTypeOfConditionalExpressions2.js | 19 +- .../reference/bestCommonTypeOfTuple2.js | 19 +- ...allSignatureAssignabilityInInheritance2.js | 19 +- ...allSignatureAssignabilityInInheritance3.js | 19 +- ...allSignatureAssignabilityInInheritance4.js | 19 +- ...allSignatureAssignabilityInInheritance5.js | 19 +- ...allSignatureAssignabilityInInheritance6.js | 19 +- tests/baselines/reference/callWithSpread.js | 19 +- .../reference/captureThisInSuperCall.js | 19 +- tests/baselines/reference/castingTuple.js | 19 +- .../baselines/reference/chainedAssignment3.js | 19 +- ...arameterConstrainedToOtherTypeParameter.js | 19 +- .../reference/checkForObjectTooStrict.js | 19 +- .../checkSuperCallBeforeThisAccessing1.js | 19 +- .../checkSuperCallBeforeThisAccessing2.js | 19 +- .../checkSuperCallBeforeThisAccessing3.js | 19 +- .../checkSuperCallBeforeThisAccessing4.js | 19 +- .../checkSuperCallBeforeThisAccessing5.js | 19 +- .../checkSuperCallBeforeThisAccessing6.js | 19 +- .../checkSuperCallBeforeThisAccessing7.js | 19 +- .../checkSuperCallBeforeThisAccessing8.js | 19 +- .../reference/circularImportAlias.js | 19 +- .../circularTypeofWithFunctionModule.js | 19 +- .../classAbstractConstructorAssignability.js | 19 +- .../reference/classAbstractCrashedOnce.js | 19 +- .../reference/classAbstractExtends.js | 19 +- .../reference/classAbstractFactoryFunction.js | 19 +- .../reference/classAbstractGeneric.js | 19 +- .../reference/classAbstractInAModule.js | 19 +- .../reference/classAbstractInheritance.js | 19 +- .../reference/classAbstractInstantiations1.js | 19 +- .../reference/classAbstractInstantiations2.js | 19 +- .../classAbstractOverrideWithAbstract.js | 19 +- .../reference/classAbstractSuperCalls.js | 19 +- .../classAbstractUsingAbstractMethod1.js | 19 +- .../classAbstractUsingAbstractMethods2.js | 19 +- .../classConstructorAccessibility2.js | 19 +- .../classConstructorAccessibility4.js | 19 +- .../classConstructorAccessibility5.js | 19 +- ...classConstructorParametersAccessibility.js | 19 +- ...lassConstructorParametersAccessibility2.js | 19 +- ...lassConstructorParametersAccessibility3.js | 19 +- ...clarationMergedInModuleWithContinuation.js | 19 +- .../classDeclaredBeforeClassFactory.js | 19 +- .../classDoesNotDependOnBaseTypes.js | 19 +- tests/baselines/reference/classExpression2.js | 19 +- tests/baselines/reference/classExpression3.js | 19 +- .../classExpressionExtendingAbstractClass.js | 19 +- .../reference/classExtendingBuiltinType.js | 19 +- .../reference/classExtendingClass.js | 19 +- .../reference/classExtendingClassLikeType.js | 19 +- .../reference/classExtendingNonConstructor.js | 19 +- .../baselines/reference/classExtendingNull.js | 19 +- .../reference/classExtendingPrimitive.js | 19 +- .../reference/classExtendingPrimitive2.js | 19 +- .../reference/classExtendingQualifiedName.js | 19 +- .../reference/classExtendingQualifiedName2.js | 19 +- .../reference/classExtendsAcrossFiles.js | 38 +- ...sMergedWithModuleNotReferingConstructor.js | 19 +- ...tendsClauseClassNotReferringConstructor.js | 19 +- .../reference/classExtendsEveryObjectType.js | 19 +- .../reference/classExtendsEveryObjectType2.js | 19 +- .../reference/classExtendsInterface.js | 19 +- .../classExtendsInterfaceInExpression.js | 19 +- .../classExtendsInterfaceInModule.js | 19 +- .../baselines/reference/classExtendsItself.js | 19 +- .../reference/classExtendsItselfIndirectly.js | 19 +- .../classExtendsItselfIndirectly2.js | 19 +- .../classExtendsItselfIndirectly3.js | 114 +-- .../classExtendsMultipleBaseClasses.js | 19 +- tests/baselines/reference/classExtendsNull.js | 19 +- ...classExtendsShadowedConstructorFunction.js | 19 +- .../classExtendsValidConstructorFunction.js | 19 +- .../classHeritageWithTrailingSeparator.js | 19 +- .../reference/classImplementsClass2.js | 19 +- .../reference/classImplementsClass3.js | 19 +- .../reference/classImplementsClass4.js | 19 +- .../reference/classImplementsClass5.js | 19 +- .../reference/classImplementsClass6.js | 19 +- tests/baselines/reference/classIndexer3.js | 19 +- tests/baselines/reference/classInheritence.js | 19 +- .../reference/classIsSubtypeOfBaseType.js | 19 +- tests/baselines/reference/classOrder2.js | 19 +- tests/baselines/reference/classOrderBug.js | 19 +- .../reference/classSideInheritance1.js | 19 +- .../reference/classSideInheritance2.js | 19 +- .../reference/classSideInheritance3.js | 19 +- tests/baselines/reference/classUpdateTests.js | 19 +- .../classWithBaseClassButNoConstructor.js | 19 +- .../reference/classWithConstructors.js | 19 +- .../reference/classWithProtectedProperty.js | 19 +- .../reference/classWithStaticMembers.js | 19 +- tests/baselines/reference/classdecl.js | 19 +- .../reference/clodulesDerivedClasses.js | 19 +- ...llisionSuperAndLocalFunctionInAccessors.js | 19 +- ...isionSuperAndLocalFunctionInConstructor.js | 19 +- .../collisionSuperAndLocalFunctionInMethod.js | 19 +- ...ollisionSuperAndLocalFunctionInProperty.js | 19 +- .../collisionSuperAndLocalVarInAccessors.js | 19 +- .../collisionSuperAndLocalVarInConstructor.js | 19 +- .../collisionSuperAndLocalVarInMethod.js | 19 +- .../collisionSuperAndLocalVarInProperty.js | 19 +- .../collisionSuperAndNameResolution.js | 19 +- .../reference/collisionSuperAndParameter.js | 19 +- .../reference/collisionSuperAndParameter1.js | 19 +- ...perAndPropertyNameAsConstuctorParameter.js | 19 +- ...xpressionAndLocalVarWithSuperExperssion.js | 19 +- .../reference/commentsInheritance.js | 19 +- .../comparisonOperatorWithIdenticalObjects.js | 19 +- ...ithNoRelationshipObjectsOnCallSignature.js | 19 +- ...lationshipObjectsOnConstructorSignature.js | 19 +- ...thNoRelationshipObjectsOnIndexSignature.js | 19 +- ...nshipObjectsOnInstantiatedCallSignature.js | 19 +- ...jectsOnInstantiatedConstructorSignature.js | 19 +- ...peratorWithSubtypeObjectOnCallSignature.js | 19 +- ...WithSubtypeObjectOnConstructorSignature.js | 19 +- ...eratorWithSubtypeObjectOnIndexSignature.js | 19 +- ...ubtypeObjectOnInstantiatedCallSignature.js | 19 +- ...bjectOnInstantiatedConstructorSignature.js | 19 +- ...isonOperatorWithSubtypeObjectOnProperty.js | 19 +- .../reference/complexClassRelationships.js | 19 +- ...catedGenericRecursiveBaseClassReference.js | 19 +- .../reference/compoundAssignmentLHSIsValue.js | 19 +- ...poundExponentiationAssignmentLHSIsValue.js | 19 +- .../reference/computedPropertyNames24_ES5.js | 19 +- .../reference/computedPropertyNames25_ES5.js | 19 +- .../reference/computedPropertyNames26_ES5.js | 19 +- .../reference/computedPropertyNames27_ES5.js | 19 +- .../reference/computedPropertyNames28_ES5.js | 19 +- .../reference/computedPropertyNames30_ES5.js | 19 +- .../reference/computedPropertyNames31_ES5.js | 19 +- .../reference/computedPropertyNames43_ES5.js | 19 +- .../reference/computedPropertyNames44_ES5.js | 19 +- .../reference/computedPropertyNames45_ES5.js | 19 +- .../conditionalOperatorWithIdenticalBCT.js | 19 +- .../conditionalOperatorWithoutIdenticalBCT.js | 19 +- .../reference/constantOverloadFunction.js | 19 +- .../constantOverloadFunctionNoSubtypeError.js | 19 +- ...nstraintCheckInGenericBaseTypeReference.js | 19 +- ...uctSignatureAssignabilityInInheritance2.js | 19 +- ...uctSignatureAssignabilityInInheritance3.js | 19 +- ...uctSignatureAssignabilityInInheritance4.js | 19 +- ...uctSignatureAssignabilityInInheritance5.js | 19 +- ...uctSignatureAssignabilityInInheritance6.js | 19 +- tests/baselines/reference/constructorArgs.js | 19 +- ...uctorFunctionTypeIsAssignableToBaseType.js | 19 +- ...ctorFunctionTypeIsAssignableToBaseType2.js | 19 +- .../constructorHasPrototypeProperty.js | 19 +- .../reference/constructorOverloads2.js | 19 +- .../reference/constructorOverloads3.js | 19 +- .../reference/constructorWithCapturedSuper.js | 19 +- ...constructorWithIncompleteTypeAnnotation.js | 19 +- .../contextualTypingArrayOfLambdas.js | 19 +- ...contextualTypingOfConditionalExpression.js | 19 +- ...ontextualTypingOfConditionalExpression2.js | 19 +- ...urcePropertyIsRelatableToTargetProperty.js | 19 +- .../reference/declFileClassExtendsNull.js | 19 +- .../declFileForFunctionTypeAsTypeParameter.js | 19 +- ...ileGenericClassWithGenericExtendedClass.js | 19 +- .../reference/declFileGenericType.js | 19 +- .../reference/declFileGenericType2.js | 19 +- ...lictingWithClassReferredByExtendsClause.js | 19 +- ...dsClauseThatHasItsContainerNameConflict.js | 19 +- .../declarationEmitExpressionInExtends.js | 19 +- .../declarationEmitExpressionInExtends2.js | 19 +- .../declarationEmitExpressionInExtends3.js | 19 +- .../declarationEmitExpressionInExtends4.js | 19 +- .../declarationEmitNameConflicts3.js | 19 +- .../declarationEmitProtectedMembers.js | 19 +- .../declarationEmitThisPredicates01.js | 19 +- ...tionEmitThisPredicatesWithPrivateName01.js | 19 +- .../reference/declareDottedExtend.js | 19 +- .../reference/decoratorOnClassConstructor2.js | 19 +- .../reference/decoratorOnClassConstructor3.js | 19 +- .../reference/decoratorOnClassMethod12.js | 19 +- ...edClassConstructorWithExplicitReturns01.js | 19 +- ...assConstructorWithExplicitReturns01.js.map | 2 +- ...tructorWithExplicitReturns01.sourcemap.txt | 281 +++---- ...derivedClassConstructorWithoutSuperCall.js | 19 +- ...ClassFunctionOverridesBaseClassAccessor.js | 19 +- .../derivedClassIncludesInheritedMembers.js | 19 +- ...idesIndexersWithAssignmentCompatibility.js | 19 +- .../derivedClassOverridesPrivateFunction1.js | 19 +- .../derivedClassOverridesPrivates.js | 19 +- .../derivedClassOverridesProtectedMembers.js | 19 +- .../derivedClassOverridesProtectedMembers2.js | 19 +- .../derivedClassOverridesProtectedMembers3.js | 19 +- .../derivedClassOverridesProtectedMembers4.js | 19 +- .../derivedClassOverridesPublicMembers.js | 19 +- .../derivedClassOverridesWithoutSubtype.js | 19 +- .../derivedClassParameterProperties.js | 19 +- ...dClassSuperCallsInNonConstructorMembers.js | 19 +- .../derivedClassSuperCallsWithThisArg.js | 19 +- .../reference/derivedClassTransitivity.js | 19 +- .../reference/derivedClassTransitivity2.js | 19 +- .../reference/derivedClassTransitivity3.js | 19 +- .../reference/derivedClassTransitivity4.js | 19 +- .../reference/derivedClassWithAny.js | 19 +- ...ivateInstanceShadowingProtectedInstance.js | 19 +- ...hPrivateInstanceShadowingPublicInstance.js | 19 +- ...thPrivateStaticShadowingProtectedStatic.js | 19 +- ...sWithPrivateStaticShadowingPublicStatic.js | 19 +- .../derivedClassWithoutExplicitConstructor.js | 19 +- ...derivedClassWithoutExplicitConstructor2.js | 19 +- ...derivedClassWithoutExplicitConstructor3.js | 19 +- tests/baselines/reference/derivedClasses.js | 19 +- .../reference/derivedGenericClassWithAny.js | 19 +- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 19 +- .../derivedTypeDoesNotRequireExtendsClause.js | 19 +- .../destructuringParameterDeclaration5.js | 19 +- ...BeforeEmitParameterPropertyDeclaration1.js | 19 +- ...SuperCallBeforeEmitPropertyDeclaration1.js | 19 +- ...arationAndParameterPropertyDeclaration1.js | 19 +- .../reference/emitThisInSuperMethodCall.js | 19 +- tests/baselines/reference/emptyModuleName.js | 19 +- ...rorForwardReferenceForwadingConstructor.js | 19 +- tests/baselines/reference/errorSuperCalls.js | 19 +- .../reference/errorSuperPropertyAccess.js | 19 +- .../reference/errorsInGenericTypeReference.js | 19 +- .../reference/es6ClassSuperCodegenBug.js | 19 +- tests/baselines/reference/es6ClassTest.js | 19 +- tests/baselines/reference/es6ClassTest2.js | 19 +- tests/baselines/reference/es6ClassTest7.js | 19 +- .../exportAssignmentOfGenericType1.js | 19 +- .../exportDeclarationInInternalModule.js | 19 +- tests/baselines/reference/extBaseClass1.js | 19 +- tests/baselines/reference/extBaseClass2.js | 19 +- .../extendAndImplementTheSameBaseType.js | 19 +- .../extendAndImplementTheSameBaseType2.js | 19 +- .../extendBaseClassBeforeItsDeclared.js | 19 +- .../extendClassExpressionFromModule.js | 19 +- .../extendConstructSignatureInInterface.js | 19 +- .../reference/extendNonClassSymbol1.js | 19 +- .../reference/extendNonClassSymbol2.js | 19 +- .../extendPrivateConstructorClass.js | 19 +- ...xtendingClassFromAliasAndUsageInIndexer.js | 38 +- .../reference/extendsClauseAlreadySeen.js | 19 +- .../reference/extendsClauseAlreadySeen2.js | 19 +- tests/baselines/reference/fluentClasses.js | 19 +- tests/baselines/reference/for-inStatements.js | 19 +- .../reference/for-inStatementsInvalid.js | 19 +- .../forStatementsMultipleInvalidDecl.js | 19 +- .../reference/functionImplementationErrors.js | 19 +- .../reference/functionImplementations.js | 19 +- .../reference/functionSubtypingOfVarArgs.js | 19 +- .../reference/functionSubtypingOfVarArgs2.js | 19 +- .../reference/generatedContextualTyping.js | 19 +- .../genericBaseClassLiteralProperty.js | 19 +- .../genericBaseClassLiteralProperty2.js | 19 +- ...allWithConstraintsTypeArgumentInference.js | 19 +- .../genericCallWithObjectTypeArgs2.js | 19 +- ...icCallWithObjectTypeArgsAndConstraints2.js | 19 +- ...icCallWithObjectTypeArgsAndConstraints3.js | 19 +- .../genericCallbacksAndClassHierarchy.js | 19 +- .../genericClassExpressionInFunction.js | 19 +- ...sInheritsConstructorFromNonGenericClass.js | 19 +- ...cClassPropertyInheritanceSpecialization.js | 19 +- .../reference/genericClassStaticMethod.js | 19 +- tests/baselines/reference/genericClasses3.js | 19 +- ...genericConstraintOnExtendedBuiltinTypes.js | 19 +- ...enericConstraintOnExtendedBuiltinTypes2.js | 19 +- .../genericDerivedTypeWithSpecializedBase.js | 19 +- .../genericDerivedTypeWithSpecializedBase2.js | 19 +- .../genericInheritedDefaultConstructors.js | 19 +- .../reference/genericPrototypeProperty2.js | 19 +- .../reference/genericPrototypeProperty3.js | 19 +- ...ericRecursiveImplicitConstructorErrors2.js | 19 +- ...ericRecursiveImplicitConstructorErrors3.js | 19 +- .../reference/genericTypeAssertions2.js | 19 +- .../reference/genericTypeAssertions4.js | 19 +- .../reference/genericTypeAssertions6.js | 19 +- .../reference/genericTypeConstraints.js | 19 +- ...genericTypeReferenceWithoutTypeArgument.js | 19 +- ...enericTypeReferenceWithoutTypeArgument2.js | 19 +- .../genericWithIndexerOfTypeParameterType2.js | 19 +- .../reference/heterogeneousArrayLiterals.js | 19 +- .../reference/ifDoWhileStatements.js | 19 +- .../illegalSuperCallsInConstructor.js | 19 +- .../implementClausePrecedingExtends.js | 19 +- ...gAnInterfaceExtendingClassWithPrivates2.js | 19 +- ...AnInterfaceExtendingClassWithProtecteds.js | 19 +- .../baselines/reference/importAsBaseClass.js | 19 +- tests/baselines/reference/importHelpers.js | 19 +- .../reference/importHelpersNoHelpers.js | 19 +- .../reference/importHelpersNoModule.js | 19 +- .../reference/importShadowsGlobalName.js | 19 +- .../reference/importUsedInExtendsList1.js | 19 +- .../reference/indexerConstraints2.js | 19 +- .../reference/indirectSelfReference.js | 19 +- .../reference/indirectSelfReferenceGeneric.js | 19 +- .../infinitelyExpandingTypesNonGenericBase.js | 19 +- .../inheritFromGenericTypeParameter.js | 19 +- ...SameNamePrivatePropertiesFromSameOrigin.js | 19 +- tests/baselines/reference/inheritance.js | 19 +- tests/baselines/reference/inheritance1.js | 19 +- ...itanceGrandParentPrivateMemberCollision.js | 19 +- ...tPrivateMemberCollisionWithPublicMember.js | 19 +- ...tPublicMemberCollisionWithPrivateMember.js | 19 +- ...ritanceMemberAccessorOverridingAccessor.js | 19 +- ...heritanceMemberAccessorOverridingMethod.js | 19 +- ...ritanceMemberAccessorOverridingProperty.js | 19 +- ...inheritanceMemberFuncOverridingAccessor.js | 19 +- .../inheritanceMemberFuncOverridingMethod.js | 19 +- ...inheritanceMemberFuncOverridingProperty.js | 19 +- ...ritanceMemberPropertyOverridingAccessor.js | 19 +- ...heritanceMemberPropertyOverridingMethod.js | 19 +- ...ritanceMemberPropertyOverridingProperty.js | 19 +- .../inheritanceOfGenericConstructorMethod1.js | 19 +- .../inheritanceOfGenericConstructorMethod2.js | 19 +- ...ritanceStaticAccessorOverridingAccessor.js | 19 +- ...heritanceStaticAccessorOverridingMethod.js | 19 +- ...ritanceStaticAccessorOverridingProperty.js | 19 +- ...inheritanceStaticFuncOverridingAccessor.js | 19 +- ...eStaticFuncOverridingAccessorOfFuncType.js | 19 +- .../inheritanceStaticFuncOverridingMethod.js | 19 +- ...inheritanceStaticFuncOverridingProperty.js | 19 +- ...eStaticFuncOverridingPropertyOfFuncType.js | 19 +- ...taticFunctionOverridingInstanceProperty.js | 19 +- .../inheritanceStaticMembersCompatible.js | 19 +- .../inheritanceStaticMembersIncompatible.js | 19 +- ...ritanceStaticPropertyOverridingAccessor.js | 19 +- ...heritanceStaticPropertyOverridingMethod.js | 19 +- ...ritanceStaticPropertyOverridingProperty.js | 19 +- .../inheritedConstructorWithRestParams.js | 19 +- .../inheritedConstructorWithRestParams2.js | 19 +- .../inheritedModuleMembersForClodule.js | 19 +- .../reference/instanceOfAssignability.js | 19 +- ...nstancePropertiesInheritedIntoClassType.js | 19 +- .../reference/instanceSubtypeCheck2.js | 19 +- ...nstanceofWithStructurallyIdenticalTypes.js | 19 +- .../instantiatedReturnTypeContravariance.js | 19 +- .../reference/interfaceClassMerging.js | 19 +- .../reference/interfaceClassMerging2.js | 19 +- .../reference/interfaceExtendsClass1.js | 19 +- .../interfaceExtendsClassWithPrivate1.js | 19 +- .../interfaceExtendsClassWithPrivate2.js | 19 +- .../reference/interfaceImplementation8.js | 19 +- .../invalidModuleWithStatementsOfEveryKind.js | 19 +- .../invalidMultipleVariableDeclarations.js | 19 +- .../reference/invalidReturnStatements.js | 19 +- .../isolatedModulesImportExportElision.js | 19 +- tests/baselines/reference/jsxViaImport.js | 19 +- .../reference/keyofAndIndexedAccess.js | 19 +- tests/baselines/reference/lambdaArgCrash.js | 19 +- tests/baselines/reference/lift.js | 19 +- tests/baselines/reference/localTypes1.js | 19 +- tests/baselines/reference/m7Bugs.js | 19 +- .../reference/mergedDeclarations5.js | 19 +- .../reference/mergedDeclarations6.js | 19 +- .../mergedInheritedClassInterface.js | 19 +- .../mergedInterfacesWithInheritedPrivates2.js | 19 +- .../mergedInterfacesWithInheritedPrivates3.js | 19 +- .../missingPropertiesOfClassExpression.js | 19 +- tests/baselines/reference/moduleAsBaseType.js | 19 +- .../moduleImportedForTypeArgumentPosition.js | 19 +- .../moduleWithStatementsOfEveryKind.js | 19 +- .../reference/multipleInheritance.js | 19 +- .../mutuallyRecursiveGenericBaseTypes2.js | 19 +- .../noImplicitAnyMissingGetAccessor.js | 19 +- .../noImplicitAnyMissingSetAccessor.js | 19 +- ...enericClassExtendingGenericClassWithAny.js | 19 +- ...cIndexerConstrainsPropertyDeclarations2.js | 19 +- .../reference/numericIndexerConstraint3.js | 19 +- .../reference/numericIndexerConstraint4.js | 19 +- .../reference/numericIndexerTyping2.js | 19 +- ...objectCreationOfElementAccessExpression.js | 19 +- ...objectTypeHidingMembersOfExtendedObject.js | 19 +- ...objectTypesIdentityWithNumericIndexers1.js | 19 +- ...objectTypesIdentityWithNumericIndexers2.js | 19 +- ...objectTypesIdentityWithNumericIndexers3.js | 19 +- .../objectTypesIdentityWithPrivates.js | 19 +- .../objectTypesIdentityWithPrivates2.js | 19 +- .../objectTypesIdentityWithPrivates3.js | 19 +- .../objectTypesIdentityWithStringIndexers.js | 19 +- .../objectTypesIdentityWithStringIndexers2.js | 19 +- .../optionalConstructorArgInSuper.js | 19 +- tests/baselines/reference/optionalMethods.js | 19 +- .../reference/optionalParamArgsTest.js | 19 +- .../reference/optionalParamInOverride.js | 19 +- .../reference/optionalParameterProperty.js | 19 +- .../baselines/reference/outModuleConcatAmd.js | 19 +- .../reference/outModuleConcatAmd.js.map | 2 +- .../outModuleConcatAmd.sourcemap.txt | 75 +- .../reference/outModuleConcatSystem.js | 19 +- .../reference/outModuleConcatSystem.js.map | 2 +- .../outModuleConcatSystem.sourcemap.txt | 75 +- .../reference/outModuleTripleSlashRefs.js | 19 +- .../reference/outModuleTripleSlashRefs.js.map | 2 +- .../outModuleTripleSlashRefs.sourcemap.txt | 103 +-- tests/baselines/reference/overload1.js | 19 +- .../overloadOnConstConstraintChecks1.js | 19 +- .../overloadOnConstConstraintChecks2.js | 19 +- .../overloadOnConstConstraintChecks3.js | 19 +- .../overloadOnConstConstraintChecks4.js | 19 +- .../overloadOnConstantsInvalidOverload1.js | 19 +- .../baselines/reference/overloadResolution.js | 19 +- .../overloadResolutionClassConstructors.js | 19 +- .../overloadResolutionConstructors.js | 19 +- .../reference/overloadingOnConstants1.js | 19 +- .../reference/overloadingOnConstants2.js | 19 +- .../overridingPrivateStaticMembers.js | 19 +- .../reference/parseErrorInHeritageClause1.js | 19 +- tests/baselines/reference/parser509630.js | 19 +- tests/baselines/reference/parserAstSpans1.js | 19 +- .../reference/parserClassDeclaration1.js | 19 +- .../reference/parserClassDeclaration3.js | 19 +- .../reference/parserClassDeclaration4.js | 19 +- .../reference/parserClassDeclaration5.js | 19 +- .../reference/parserClassDeclaration6.js | 19 +- ...rrorRecovery_ExtendsOrImplementsClause2.js | 19 +- ...rrorRecovery_ExtendsOrImplementsClause4.js | 19 +- ...rrorRecovery_ExtendsOrImplementsClause5.js | 19 +- .../parserGenericsInTypeContexts1.js | 19 +- .../parserGenericsInTypeContexts2.js | 19 +- .../baselines/reference/parserRealSource10.js | 19 +- .../baselines/reference/parserRealSource11.js | 19 +- tests/baselines/reference/parserharness.js | 19 +- ...artiallyAnnotatedFunctionInferenceError.js | 19 +- ...tatedFunctionInferenceWithTypeParameter.js | 19 +- tests/baselines/reference/primitiveMembers.js | 19 +- tests/baselines/reference/privacyClass.js | 19 +- .../privacyClassExtendsClauseDeclFile.js | 38 +- tests/baselines/reference/privacyGloClass.js | 19 +- .../reference/privateAccessInSubclass1.js | 19 +- .../privateInstanceMemberAccessibility.js | 19 +- ...tedMembersAreNotAccessibleDestructuring.js | 19 +- .../privateStaticMemberAccessibility.js | 19 +- .../privateStaticNotAccessibleInClodule2.js | 19 +- .../amd/testGlo.js | 19 +- .../node/testGlo.js | 19 +- .../reference/project/prologueEmit/amd/out.js | 19 +- .../project/prologueEmit/node/out.js | 19 +- .../amd/m'ain.js | 19 +- .../node/m'ain.js | 19 +- .../reference/propertiesAndIndexers.js | 19 +- tests/baselines/reference/propertyAccess.js | 19 +- ...tyAccessOnTypeParameterWithConstraints2.js | 19 +- ...tyAccessOnTypeParameterWithConstraints3.js | 19 +- ...tyAccessOnTypeParameterWithConstraints5.js | 19 +- ...sPropertyAccessibleWithinNestedSubclass.js | 19 +- ...PropertyAccessibleWithinNestedSubclass1.js | 19 +- ...edClassPropertyAccessibleWithinSubclass.js | 19 +- ...dClassPropertyAccessibleWithinSubclass2.js | 19 +- ...dClassPropertyAccessibleWithinSubclass3.js | 19 +- .../protectedInstanceMemberAccessibility.js | 19 +- tests/baselines/reference/protectedMembers.js | 19 +- ...icClassPropertyAccessibleWithinSubclass.js | 19 +- ...cClassPropertyAccessibleWithinSubclass2.js | 19 +- ...solution-does-not-affect-class-heritage.js | 19 +- .../readonlyConstructorAssignment.js | 19 +- .../reference/recursiveBaseCheck3.js | 19 +- .../reference/recursiveBaseCheck4.js | 19 +- .../reference/recursiveBaseCheck6.js | 19 +- .../recursiveBaseConstructorCreation1.js | 19 +- ...ssInstantiationsWithDefaultConstructors.js | 19 +- .../reference/recursiveClassReferenceTest.js | 19 +- .../recursiveClassReferenceTest.js.map | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 789 +++++++++--------- .../reference/recursiveComplicatedClasses.js | 19 +- ...sivelySpecializedConstructorDeclaration.js | 19 +- .../reference/reexportClassDefinition.js | 19 +- ...lassDeclarationWhenInBaseTypeResolution.js | 19 +- .../reference/returnInConstructor1.js | 19 +- tests/baselines/reference/returnStatements.js | 19 +- ...peCheckExtendedClassInsidePublicMethod2.js | 19 +- ...peCheckExtendedClassInsideStaticMethod1.js | 19 +- tests/baselines/reference/scopeTests.js | 19 +- .../reference/shadowPrivateMembers.js | 19 +- ...sWithDefaultConstructorAndExtendsClause.js | 19 +- ...hDefaultConstructorAndExtendsClause.js.map | 2 +- ...tConstructorAndExtendsClause.sourcemap.txt | 91 +- .../specializedInheritedConstructors1.js | 19 +- .../specializedOverloadWithRestParameters.js | 19 +- tests/baselines/reference/staticFactory1.js | 19 +- .../baselines/reference/staticInheritance.js | 19 +- .../staticMemberAccessOffDerivedType1.js | 19 +- tests/baselines/reference/staticPropSuper.js | 19 +- .../reference/strictModeInConstructor.js | 19 +- .../reference/strictModeReservedWord.js | 19 +- ...trictModeReservedWordInClassDeclaration.js | 19 +- ...gIndexerConstrainsPropertyDeclarations2.js | 19 +- .../reference/subtypesOfTypeParameter.js | 19 +- .../subtypesOfTypeParameterWithConstraints.js | 19 +- ...subtypesOfTypeParameterWithConstraints4.js | 19 +- ...OfTypeParameterWithRecursiveConstraints.js | 19 +- .../reference/subtypingTransitivity.js | 19 +- .../reference/subtypingWithCallSignatures2.js | 19 +- .../reference/subtypingWithCallSignatures3.js | 19 +- .../reference/subtypingWithCallSignatures4.js | 19 +- .../subtypingWithConstructSignatures2.js | 19 +- .../subtypingWithConstructSignatures3.js | 19 +- .../subtypingWithConstructSignatures4.js | 19 +- .../subtypingWithConstructSignatures5.js | 19 +- .../subtypingWithConstructSignatures6.js | 19 +- .../reference/subtypingWithNumericIndexer.js | 19 +- .../reference/subtypingWithNumericIndexer3.js | 19 +- .../reference/subtypingWithNumericIndexer4.js | 19 +- .../reference/subtypingWithObjectMembers.js | 19 +- .../reference/subtypingWithObjectMembers4.js | 19 +- ...subtypingWithObjectMembersAccessibility.js | 19 +- ...ubtypingWithObjectMembersAccessibility2.js | 19 +- .../reference/subtypingWithStringIndexer.js | 19 +- .../reference/subtypingWithStringIndexer3.js | 19 +- .../reference/subtypingWithStringIndexer4.js | 19 +- tests/baselines/reference/super.js | 19 +- tests/baselines/reference/super1.js | 19 +- tests/baselines/reference/super2.js | 19 +- tests/baselines/reference/superAccess.js | 19 +- tests/baselines/reference/superAccess2.js | 19 +- .../reference/superAccessInFatArrow1.js | 19 +- .../reference/superCallArgsMustMatch.js | 19 +- .../reference/superCallAssignResult.js | 19 +- .../superCallBeforeThisAccessing1.js | 19 +- .../superCallBeforeThisAccessing2.js | 19 +- .../superCallBeforeThisAccessing3.js | 19 +- .../superCallBeforeThisAccessing4.js | 19 +- .../superCallBeforeThisAccessing5.js | 19 +- .../superCallBeforeThisAccessing6.js | 19 +- .../superCallBeforeThisAccessing7.js | 19 +- .../superCallBeforeThisAccessing8.js | 19 +- ...allFromClassThatDerivesFromGenericType1.js | 19 +- ...allFromClassThatDerivesFromGenericType2.js | 19 +- ...eButWithIncorrectNumberOfTypeArguments1.js | 19 +- ...sFromGenericTypeButWithNoTypeArguments1.js | 19 +- ...ivesNonGenericTypeButWithTypeArguments1.js | 19 +- .../reference/superCallInNonStaticMethod.js | 19 +- .../reference/superCallInStaticMethod.js | 19 +- .../superCallInsideClassDeclaration.js | 19 +- .../superCallInsideClassExpression.js | 19 +- .../superCallInsideObjectLiteralExpression.js | 19 +- .../reference/superCallOutsideConstructor.js | 19 +- .../superCallParameterContextualTyping1.js | 19 +- .../superCallParameterContextualTyping2.js | 19 +- .../superCallParameterContextualTyping3.js | 19 +- .../reference/superCallWithCommentEmit01.js | 19 +- .../superCallWithMissingBaseClass.js | 19 +- tests/baselines/reference/superCalls.js | 19 +- .../reference/superCallsInConstructor.js | 19 +- tests/baselines/reference/superErrors.js | 19 +- .../baselines/reference/superInCatchBlock1.js | 19 +- .../reference/superInConstructorParam1.js | 19 +- tests/baselines/reference/superInLambdas.js | 19 +- .../reference/superInObjectLiterals_ES5.js | 19 +- tests/baselines/reference/superNewCall1.js | 19 +- .../reference/superPropertyAccess.js | 19 +- .../reference/superPropertyAccess1.js | 19 +- .../reference/superPropertyAccess2.js | 19 +- ...essInComputedPropertiesOfNestedType_ES5.js | 19 +- .../reference/superPropertyAccessNoError.js | 19 +- .../reference/superPropertyAccess_ES5.js | 19 +- ...perPropertyInConstructorBeforeSuperCall.js | 19 +- .../reference/superSymbolIndexedAccess5.js | 19 +- .../reference/superSymbolIndexedAccess6.js | 19 +- .../superWithGenericSpecialization.js | 19 +- .../baselines/reference/superWithGenerics.js | 19 +- .../reference/superWithTypeArgument.js | 19 +- .../reference/superWithTypeArgument2.js | 19 +- .../reference/superWithTypeArgument3.js | 19 +- ...side-object-literal-getters-and-setters.js | 19 +- tests/baselines/reference/switchStatements.js | 19 +- .../reference/systemModuleWithSuperClass.js | 19 +- .../reference/targetTypeBaseCalls.js | 19 +- .../reference/thisInInvalidContexts.js | 19 +- .../thisInInvalidContextsExternalModule.js | 19 +- tests/baselines/reference/thisInSuperCall.js | 19 +- tests/baselines/reference/thisInSuperCall1.js | 19 +- tests/baselines/reference/thisInSuperCall2.js | 19 +- tests/baselines/reference/thisInSuperCall3.js | 19 +- .../reference/thisTypeInFunctions.js | 19 +- .../reference/thisTypeInFunctionsNegative.js | 19 +- .../tsxCorrectlyParseLessThanComparison1.js | 19 +- .../baselines/reference/tsxDynamicTagName5.js | 19 +- .../baselines/reference/tsxDynamicTagName7.js | 19 +- .../baselines/reference/tsxDynamicTagName8.js | 19 +- .../baselines/reference/tsxDynamicTagName9.js | 19 +- .../reference/tsxExternalModuleEmit1.js | 38 +- .../tsxStatelessFunctionComponents2.js | 19 +- .../reference/tsxUnionTypeComponent1.js | 19 +- tests/baselines/reference/typeAssertions.js | 19 +- .../baselines/reference/typeGuardFunction.js | 19 +- .../reference/typeGuardFunctionErrors.js | 19 +- .../reference/typeGuardFunctionGenerics.js | 19 +- .../reference/typeGuardFunctionOfFormThis.js | 19 +- .../typeGuardFunctionOfFormThisErrors.js | 19 +- .../reference/typeGuardOfFormInstanceOf.js | 19 +- .../reference/typeGuardOfFormIsType.js | 19 +- .../reference/typeGuardOfFormThisMember.js | 19 +- .../typeGuardOfFormThisMemberErrors.js | 19 +- tests/baselines/reference/typeMatch2.js | 19 +- tests/baselines/reference/typeOfSuperCall.js | 19 +- .../reference/typeParameterAsBaseClass.js | 19 +- .../reference/typeParameterAsBaseType.js | 19 +- .../reference/typeParameterExtendingUnion1.js | 19 +- .../reference/typeParameterExtendingUnion2.js | 19 +- .../baselines/reference/typeRelationships.js | 19 +- .../baselines/reference/typeValueConflict1.js | 19 +- .../baselines/reference/typeValueConflict2.js | 19 +- tests/baselines/reference/typeofClass2.js | 19 +- .../typesWithSpecializedCallSignatures.js | 19 +- ...typesWithSpecializedConstructSignatures.js | 19 +- tests/baselines/reference/undeclaredBase.js | 19 +- .../undefinedIsSubtypeOfEverything.js | 19 +- .../baselines/reference/underscoreMapFirst.js | 19 +- .../underscoreThisInDerivedClass01.js | 19 +- .../underscoreThisInDerivedClass02.js | 19 +- .../reference/unionTypeEquivalence.js | 19 +- .../reference/unionTypeFromArrayLiteral.js | 19 +- .../reference/unionTypesAssignability.js | 19 +- tests/baselines/reference/unknownSymbols1.js | 19 +- .../reference/unspecializedConstraints.js | 19 +- ...untypedFunctionCallsWithTypeParameters1.js | 19 +- .../reference/unusedClassesinNamespace4.js | 19 +- .../unusedIdentifiersConsolidated1.js | 19 +- .../reference/validUseOfThisInSuper.js | 19 +- .../reference/varArgsOnConstructorTypes.js | 19 +- 667 files changed, 7366 insertions(+), 6695 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index dd7b8fe7f47..1fb777e11f3 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3336,14 +3336,15 @@ namespace ts { scoped: false, priority: 0, text: ` - var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - };` + var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })();` }; } diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index e244964048a..13af9d45322 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -21,15 +21,16 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A; (function (A) { var Point = (function () { diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 9df25d0ba4c..b3ff0c58e11 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -25,15 +25,16 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A; (function (A) { var Point = (function () { diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index f2b1a7e5007..501743c1ad7 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -8,15 +8,16 @@ //// [abstractClassInLocalScope.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); (function () { var A = (function () { function A() { diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 612d1b47230..c63088fcbbe 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -8,15 +8,16 @@ //// [abstractClassInLocalScopeIsAbstract.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); (function () { var A = (function () { function A() { diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index f559b3c6123..87c67d18205 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -22,15 +22,16 @@ class C extends B { } //// [abstractProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index 73ae1427571..9728e047bf1 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -44,15 +44,16 @@ abstract class AbstractAccessorMismatch { //// [abstractPropertyNegative.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 5fdaacd464c..9afff0a8ff9 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -16,15 +16,16 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Point = (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 024c25a909f..eec92837d95 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -25,15 +25,16 @@ class LanguageSpec_section_4_5_inference { } //// [accessors_spec_section-4.5_inference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index d84a03277eb..9ccd5c16666 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -37,15 +37,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsage1_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index 031be503cff..f08236bbf41 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -31,15 +31,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInArray_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index f0207e82c86..c0f537ac0dd 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -30,15 +30,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInFunctionExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 20b2028bbb1..222c8a78643 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -34,15 +34,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInGenericFunction_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index a8b77a8e6cb..c2ed9f345a0 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -36,15 +36,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index 00b7a231897..d5ad53a981c 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -31,15 +31,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInObjectLiteral_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index fe73404e8b4..2864b71595f 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -34,15 +34,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInOrExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 17b73079f00..8fc0815fcff 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -34,15 +34,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); @@ -54,15 +55,16 @@ var VisualizationModel = (function (_super) { exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var moduleA = require("./aliasUsageInTypeArgumentOfExtendsClause_moduleA"); var C = (function () { function C() { diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 9a88c68421f..0b42447701b 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -30,15 +30,16 @@ var Model = (function () { exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./aliasUsageInVarAssignment_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 3af1905dc03..7adda16b65f 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -9,15 +9,16 @@ var x: B; var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 2f5a3f8147e..2c4b343c813 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -24,15 +24,16 @@ class Derived2 extends Base2 { // error because of the prototy //// [apparentTypeSubtyping.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index dfc3414aef1..028935c28c1 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -14,15 +14,16 @@ class Derived extends Base { // error //// [apparentTypeSupertype.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index f2254fea530..ad1c748be75 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -86,15 +86,16 @@ arr_any = c3; // should be an error - is arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 90aa6740f4b..34c5c921bd3 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -60,15 +60,16 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index 8d2fe2376a3..f232b44ce28 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -108,15 +108,16 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EmptyTypes; (function (EmptyTypes) { var base = (function () { diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 37d0d1084f7..95e4d98574d 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -52,15 +52,16 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Action = (function () { function Action() { } diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index d43db0f6376..001e0ff525f 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -38,15 +38,16 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var arr1 = [[], [1], ['']]; var arr2 = [[null], [1], ['']]; // Array literal with elements of only EveryType E has type E[] diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index 939878aa086..b092fe4da32 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -26,15 +26,16 @@ var myDerivedList: DerivedList; var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var List = (function () { function List() { } diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 352e31d0851..fcc3ab99d3c 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -20,15 +20,16 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index b5e2cde6760..5b1daa5b594 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -97,15 +97,16 @@ var asserted2: any; //// [arrowFunctionContexts.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; // Arrow function used in with statement with (window) { diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index fcc7e402296..a748ec873ae 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -101,15 +101,16 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 066f2e5ead2..409a7f5ceae 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -100,15 +100,16 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 2d1d545bb42..00acd326ba8 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -67,15 +67,16 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 83f28340210..f8fbe3b0b84 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -44,15 +44,16 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index d0349f1734f..fb991a85f05 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -101,15 +101,16 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index b5d1804c1da..eb406898854 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -100,15 +100,16 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index ecec65f380f..d246aec2509 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -67,15 +67,16 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index 610d893c369..f3149664bc6 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -44,15 +44,16 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 5380e982fea..127f21bbfd7 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -45,15 +45,16 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index e2346a74055..704cf67ec83 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -42,15 +42,16 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 39faa9a62c4..88c77f2fb35 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -93,15 +93,16 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var OnlyDerived; (function (OnlyDerived) { var Base = (function () { diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 2fb80642d9e..328b5192d96 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -90,15 +90,16 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 82a90a3c4de..730fd15be7a 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -92,15 +92,16 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality2.js] // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index b59fa359b8e..7b871a20b3a 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -55,15 +55,16 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 84dbed907d7..1cf7c2ac317 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -71,15 +71,16 @@ foo() = value; (foo()) = value; //// [assignmentLHSIsValue.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // expected error for all the LHS of assignments var value; // this diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 55bff7302db..9a6ef70582a 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -11,15 +11,16 @@ class Test { //// [task.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Task = (function (_super) { __extends(Task, _super); function Task() { diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 9d7dcaefd29..aff1ce9986f 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -24,15 +24,16 @@ class Point3D extends Point { //// [autolift4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Point = (function () { function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 29e4c9fdc4d..c8145c170b6 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -30,15 +30,16 @@ function f() { //// [baseCheck.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C(x, y) { } diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 8ccd2e5f335..7389e2afe8b 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -25,15 +25,16 @@ var z: Derived = b.foo(); */ //// [baseIndexSignatureResolution.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index e408805edb8..c2eb77a3b9e 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -37,15 +37,16 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var someVariable; var Class1 = (function () { function Class1() { diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index bb55cc0f9a4..308637b576c 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -28,15 +28,16 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var CBaseBase = (function () { function CBaseBase(x) { } diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 1962e4d8244..201d0e7ac27 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -21,15 +21,16 @@ new C().y; //// [bases.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { this.y; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index c43bfc7177f..af0c24ca5d5 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -29,15 +29,16 @@ function foo5(t: T, u: U): Object { //// [bestCommonTypeOfConditionalExpressions.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a; var b; var Base = (function () { diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 0df9198a447..bf3c8b830aa 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -27,15 +27,16 @@ function foo3(t: T, u: U) { //// [bestCommonTypeOfConditionalExpressions2.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 18b903bea70..3bac937c8ae 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -23,15 +23,16 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 1bf31ad9028..662bfa931fb 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -71,15 +71,16 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 704ddfe5adf..e27e4729cd4 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -116,15 +116,16 @@ module Errors { //// [callSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index db8c0fa0b52..687cc9aa0e1 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -51,15 +51,16 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index eca44c3c59f..16e50218cd9 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -51,15 +51,16 @@ interface I extends B { //// [callSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index c17b84f8594..717fe64da4e 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -54,15 +54,16 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 00bf93a092d..06ca3e91d02 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -59,15 +59,16 @@ class D extends C { //// [callWithSpread.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function foo(x, y) { var z = []; for (var _i = 2; _i < arguments.length; _i++) { diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 43f8e8964df..c218c8b1687 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -9,15 +9,16 @@ class B extends A { } //// [captureThisInSuperCall.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(p) { } diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index b4916cdbd65..04965748c0d 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -33,15 +33,16 @@ t4[2] = 10; //// [castingTuple.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.a = 10; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index cb313122a9a..2ddd0f7577e 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -23,15 +23,16 @@ a = b = new A(); //// [chainedAssignment3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index b56e5a93206..f820e6c39a3 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -20,15 +20,16 @@ class C extends B { (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Chain = (function () { function Chain(value) { this.value = value; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index 243022a81c2..dbf1a34b465 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -32,15 +32,16 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo; (function (Foo) { var Object = (function () { diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index d1dc6839b8f..8322bb81783 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -11,15 +11,16 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Based = (function () { function Based() { } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 6fe42a69934..6d787a70b8c 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -11,15 +11,16 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Based = (function () { function Based() { } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 642ded30216..41092fcd984 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -16,15 +16,16 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Based = (function () { function Based() { } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 1b9b1fd2b03..9bc5cc6f82b 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -20,15 +20,16 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Based = (function () { function Based() { } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index 76853f4a210..c178a78e84e 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -8,15 +8,16 @@ class Derived extends Based { } //// [checkSuperCallBeforeThisAccessing5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Based = (function () { function Based() { var arg = []; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 4c2e04c46df..14cbda775d5 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -11,15 +11,16 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { var arg = []; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index d67fb3451f0..ad85fa1736c 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -10,15 +10,16 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing7.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(func) { } diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index 9bcf0ba1668..3f824a00c96 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -11,15 +11,16 @@ class Super extends Base { } //// [checkSuperCallBeforeThisAccessing8.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { var arg = []; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 154b0c8c68d..2ca47382b32 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -21,15 +21,16 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B; (function (B) { B.a = A; diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index 357ce10188c..e1e3c1efe58 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -14,15 +14,16 @@ namespace maker { //// [circularTypeofWithFunctionModule.js] // Repro from #6072 -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 915055bc991..e9beaced63d 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -15,15 +15,16 @@ new BB; new CC; //// [classAbstractConstructorAssignability.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index e9a60f8c713..319c6c237dc 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -11,15 +11,16 @@ class bar extends foo { var x = new bar(); //// [classAbstractCrashedOnce.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var foo = (function () { function foo() { } diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index 1d5967b96a9..9b4faff67c3 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -17,15 +17,16 @@ class E extends B { } //// [classAbstractExtends.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index c07390da7dd..e7ddb867d28 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -18,15 +18,16 @@ NewB(A); NewB(B); //// [classAbstractFactoryFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index 46406731e59..5063d7fcdd6 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -26,15 +26,16 @@ class G extends A { } //// [classAbstractGeneric.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 1c76bd43fb5..73ff32d3d5e 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -8,15 +8,16 @@ new M.A; new M.B; //// [classAbstractInAModule.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var A = (function () { diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index dbf585c86d2..8a173bb1bf4 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -22,15 +22,16 @@ class FF extends CC {} abstract class GG extends CC {} //// [classAbstractInheritance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 22732bdc2b4..094bc755559 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -28,15 +28,16 @@ c = new B; // // Calling new with (non)abstract classes. // -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 13dd7957aeb..01277eb034a 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -52,15 +52,16 @@ class H { // error -- not declared abstract } //// [classAbstractInstantiations2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index c8b1d61aa9e..8f304c709cf 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -24,15 +24,16 @@ class DD extends BB { } //// [classAbstractOverrideWithAbstract.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index 9d46086bc70..ba9ed10795b 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -28,15 +28,16 @@ abstract class BB extends AA { //// [classAbstractSuperCalls.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 56644d06a79..8e23906e149 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -18,15 +18,16 @@ a = new C; // error, cannot instantiate abstract class. a.foo(); //// [classAbstractUsingAbstractMethod1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 011df09e258..3d09949c0ae 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -28,15 +28,16 @@ class DD extends AA { } //// [classAbstractUsingAbstractMethods2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index c4e4b15bf3c..e16a623ef43 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -47,15 +47,16 @@ var dc = new DerivedC(1); //// [classConstructorAccessibility2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseA = (function () { function BaseA(x) { this.x = x; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 3946dcb82de..0680f590ef4 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -31,15 +31,16 @@ class D { } //// [classConstructorAccessibility4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index 6226c80750e..671530694e7 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -12,15 +12,16 @@ class Unrelated { //// [classConstructorAccessibility5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index 26fc8fcfe3d..4c3d3747157 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -27,15 +27,16 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1(x) { this.x = x; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 6d480641484..14f7a33a6b3 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -27,15 +27,16 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1(x) { this.x = x; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index 898b475f5ff..1f02b7a75b5 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -14,15 +14,16 @@ var d: Derived; d.p; // public, OK //// [classConstructorParametersAccessibility3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(p) { this.p = p; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index e9208d7d783..bf15fcf8fad 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -12,15 +12,16 @@ module M { } //// [classDeclarationMergedInModuleWithContinuation.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var N = (function () { diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index ca548e2ecd7..8a49c6ca138 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -8,15 +8,16 @@ function makeBaseClass() { //// [classDeclaredBeforeClassFactory.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Should be OK due to hoisting var Derived = (function (_super) { __extends(Derived, _super); diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index b154c47f70c..17dc3850214 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -13,15 +13,16 @@ class StringTreeCollectionBase { class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; if (typeof x !== "string") { x[0] = ""; diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 1243b967219..01685865265 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -3,15 +3,16 @@ class D { } var v = class C extends D {}; //// [classExpression2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function () { function D() { } diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 7564c6274b3..3acbcef1ab8 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -7,15 +7,16 @@ c.c; //// [classExpression3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(class_1, _super); function class_1() { diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index b44fb0a1dc8..1d661cafb65 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -9,15 +9,16 @@ var C = class extends A { // no error reported! //// [classExpressionExtendingAbstractClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index b492f64c680..902b3327754 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -12,15 +12,16 @@ class C10 extends Array { } //// [classExtendingBuiltinType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function (_super) { __extends(C1, _super); function C1() { diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index c00c6ead988..f9085262904 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -32,15 +32,16 @@ var r7 = d2.thing(''); var r8 = D2.other(1); //// [classExtendingClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index e1f08388848..d793534bd18 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -59,15 +59,16 @@ class D5 extends getBadBase() { //// [classExtendingClassLikeType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Error, no Base constructor function var D0 = (function (_super) { __extends(D0, _super); diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index 5cdf91d1b20..43112c4076b 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -15,15 +15,16 @@ class C7 extends foo { } //// [classExtendingNonConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; function foo() { this.x = 1; diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 087a16b3525..44fd8a51a86 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -4,15 +4,16 @@ class C2 extends (null) { } //// [classExtendingNull.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function (_super) { __extends(C1, _super); function C1() { diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 642ab4671af..15f225a6dbe 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -16,15 +16,16 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 6b56f16547f..49fbce51aa2 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -6,15 +6,16 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C4a = (function () { function C4a() { } diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index f144f13c5b8..02346427ed3 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -8,15 +8,16 @@ module M { } //// [classExtendingQualifiedName.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var C = (function () { diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index 6c07a405804..8add3046013 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -8,15 +8,16 @@ module M { } //// [classExtendingQualifiedName2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var C = (function () { diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index b3584f42511..0f0fb5ba2d9 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -21,15 +21,16 @@ export const b = { //// [b.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a_1 = require("./a"); exports.b = { f: function () { @@ -50,15 +51,16 @@ exports.b = { }; //// [a.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var b_1 = require("./b"); exports.a = { f: function () { diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 56d13af039d..9bca40631f9 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -14,15 +14,16 @@ module Foo { } //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 7f529967cda..3d02e381da9 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -7,15 +7,16 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 6babd7fb0b3..91ccc496fcb 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -17,15 +17,16 @@ class C5 extends foo { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 9777735d4a9..a30b3d8c8d8 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -4,15 +4,16 @@ class C2 extends { foo: string; } { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C2 = (function (_super) { __extends(C2, _super); function C2() { diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index b4329897528..e5710190673 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -9,15 +9,16 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function (_super) { __extends(A, _super); function A() { diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index 2d6b25bea37..e017ebb8e06 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -9,15 +9,16 @@ class C extends factory(A) {} //// [classExtendsInterfaceInExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function factory(a) { return null; } diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 89ed5042964..3d100bcfb67 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -16,15 +16,16 @@ class D extends Mod.Nested.I {} //// [classExtendsInterfaceInModule.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function (_super) { __extends(C1, _super); function C1() { diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index 29f029bd626..2f32d827dcb 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -6,15 +6,16 @@ class D extends D { } // error class E extends E { } // error //// [classExtendsItself.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index a12b90dce44..d6ca939a910 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -12,15 +12,16 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 1a073528bad..6587c65a5fa 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -23,15 +23,16 @@ module O { } //// [classExtendsItselfIndirectly2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index c42b937a85c..d36545bafd3 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -19,15 +19,16 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { @@ -36,15 +37,16 @@ var C = (function (_super) { return C; }(E)); // error //// [classExtendsItselfIndirectly_file2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { @@ -53,15 +55,16 @@ var D = (function (_super) { return D; }(C)); //// [classExtendsItselfIndirectly_file3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var E = (function (_super) { __extends(E, _super); function E() { @@ -70,15 +73,16 @@ var E = (function (_super) { return E; }(D)); //// [classExtendsItselfIndirectly_file4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C2 = (function (_super) { __extends(C2, _super); function C2() { @@ -87,15 +91,16 @@ var C2 = (function (_super) { return C2; }(E2)); // error //// [classExtendsItselfIndirectly_file5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D2 = (function (_super) { __extends(D2, _super); function D2() { @@ -104,15 +109,16 @@ var D2 = (function (_super) { return D2; }(C2)); //// [classExtendsItselfIndirectly_file6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var E2 = (function (_super) { __extends(E2, _super); function E2() { diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 7028383c349..3b1fd2de5cf 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -4,15 +4,16 @@ class B { } class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index d68d39a1acb..d8cadbbe32b 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -13,15 +13,16 @@ class D extends null { } //// [classExtendsNull.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index 9dd314f8c1d..79ae0cf243f 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -9,15 +9,16 @@ module M { } //// [classExtendsShadowedConstructorFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index 603fd5d6997..b2a38318bab 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -6,15 +6,16 @@ var x = new foo(); // can be used as a constructor function class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function foo() { } var x = new foo(); // can be used as a constructor function var C = (function (_super) { diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 087696113d4..bd9f925b7d6 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -4,15 +4,16 @@ class D extends C, { } //// [classHeritageWithTrailingSeparator.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 756e5df939a..e564beda164 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -14,15 +14,16 @@ c = c2; c2 = c; //// [classImplementsClass2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index c6e50df32b0..707a9dbe6b9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -15,15 +15,16 @@ c = c2; c2 = c; //// [classImplementsClass3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 0b19e3d3aa7..5748fbb30f5 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -17,15 +17,16 @@ c = c2; c2 = c; //// [classImplementsClass4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.x = 1; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 941fc02a1ce..12388b65a17 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -18,15 +18,16 @@ c = c2; c2 = c; //// [classImplementsClass5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.x = 1; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 1e2eb13419a..52959ed351a 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -22,15 +22,16 @@ c.bar(); // error c2.bar(); // should error //// [classImplementsClass6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 5c65f63cc03..29dd552da9c 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -11,15 +11,16 @@ class D123 extends C123 { } //// [classIndexer3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C123 = (function () { function C123() { } diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index 509433205e9..d53bdbd8214 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -3,15 +3,16 @@ class B extends A { } class A extends A { } //// [classInheritence.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function (_super) { __extends(B, _super); function B() { diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index 861d84ebbac..f8a691ead9a 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -16,15 +16,16 @@ class Derived2 extends Base<{ bar: string; }> { } //// [classIsSubtypeOfBaseType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index a80e58fe3cd..c9859337efe 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -20,15 +20,16 @@ a.foo(); //// [classOrder2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function (_super) { __extends(A, _super); function A() { diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index a872fe3165f..14ab934d77c 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -16,15 +16,16 @@ class foo extends baz {} //// [classOrderBug.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var bar = (function () { function bar() { this.baz = new foo(); diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 09bddc4b22b..da6e44e42fe 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -16,15 +16,16 @@ A.bar(); // valid C2.bar(); // valid //// [classSideInheritance1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index 49ddf4daa72..a75bef9fbaf 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -21,15 +21,16 @@ class TextBase implements IText { } //// [classSideInheritance2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SubText = (function (_super) { __extends(SubText, _super); function SubText(text, span) { diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index 55f5b6863aa..1538ed6e07e 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -19,15 +19,16 @@ var r2: new (x: string) => A = B; // error var r3: typeof A = C; // ok //// [classSideInheritance3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(x) { this.x = x; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 1cb5c51e963..5e11c448307 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -114,15 +114,16 @@ class R { } //// [classUpdateTests.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // // test codegen for instance properties // diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index 9bc92274b47..d6638d88cec 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -41,15 +41,16 @@ var d5 = new D(); // error var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { } diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index 96dc9dea8c5..fde7ad2da32 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -50,15 +50,16 @@ module Generics { } //// [classWithConstructors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var NonGeneric; (function (NonGeneric) { var C = (function () { diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index aee0b38fef8..0188835fdac 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -29,15 +29,16 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.a = ''; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index e327c76afcf..1ed38d2fee8 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -20,15 +20,16 @@ var r2 = r.x; var r3 = r.foo; //// [classWithStaticMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C(a, b) { this.a = a; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index 57ab3282526..ef7490f572d 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -94,15 +94,16 @@ class e { } //// [classdecl.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a(ns) { } diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index 88a39a07003..3fd40d61762 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -23,15 +23,16 @@ module Path.Utils { //// [clodulesDerivedClasses.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Shape = (function () { function Shape() { } diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index d7bf933004d..77025b6aa0c 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -40,15 +40,16 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInAccessors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function _super() { } var Foo = (function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index c725285a368..02e88a60761 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -25,15 +25,16 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function _super() { } var Foo = (function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index b9bbd23c538..91f9f5617df 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -29,15 +29,16 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function _super() { } var Foo = (function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 69beacb953b..520367125fe 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -19,15 +19,16 @@ class b extends Foo { } //// [collisionSuperAndLocalFunctionInProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function _super() { } var Foo = (function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index adf4a62a9b8..e77c21c058e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -33,15 +33,16 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInAccessors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _super = 10; // No Error var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index d6909c50783..1a2f6b35800 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -21,15 +21,16 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _super = 10; // No Error var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index e63bf4d9ac5..028ce3ae4a9 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -19,15 +19,16 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _super = 10; // No Error var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index 48b1298a545..c8ed5fc9d8f 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -18,15 +18,16 @@ class b extends Foo { } //// [collisionSuperAndLocalVarInProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _super = 10; // No Error var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index 6c8f5a8fe34..2c0316dc66b 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -12,15 +12,16 @@ class Foo extends base { } //// [collisionSuperAndNameResolution.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var console; var _super = 10; // No error var base = (function () { diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index ccc2d90f5f3..ef86232c1f1 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -63,15 +63,16 @@ class Foo4 extends Foo { } //// [collisionSuperAndParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 554148becf8..d70f7da34e8 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -10,15 +10,16 @@ class Foo2 extends Foo { } //// [collisionSuperAndParameter1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index 211602b2c14..919265f587e 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -31,15 +31,16 @@ class b4 extends a { } //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index e80dc2b8ebb..f380d8dc4ba 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -19,15 +19,16 @@ class b2 extends a { } //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index cba27b5f2e8..e7feed00b6a 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -152,15 +152,16 @@ i2_i = i3_i; //// [commentsInheritance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var c1 = (function () { function c1() { } diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index afaf71ca9b2..15b82315972 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -195,15 +195,16 @@ var r8b6 = b5 !== a5; var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A1 = (function () { function A1() { } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 236804898c3..7b541b2c304 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -169,15 +169,16 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 0408116f8cf..9cf6be1f116 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -169,15 +169,16 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index 44fceec0004..f0fe513de27 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -112,15 +112,16 @@ var r8b3 = b3 !== a3; var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 641b75e8688..4b31f7403e1 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -150,15 +150,16 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index cc75533ef97..06472bc1527 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -150,15 +150,16 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index 5fa26a64469..91fa37507bf 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -260,15 +260,16 @@ var r8b11 = b11 !== a11; //var r8b12 = b12 !== a12; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index 0a9a731428d..2eb5c7de9e8 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -222,15 +222,16 @@ var r8b9 = b9 !== a9; //var r8b10 = b10 !== a10; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index 669202334b8..a5287dcb0af 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -108,15 +108,16 @@ var r8b1 = b3 !== a3; var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 983d756c8c0..c34ed06252f 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -165,15 +165,16 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index f7cc1cd02c7..0056917d60d 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -165,15 +165,16 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index f39f869018b..73c2b62cd3a 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -79,15 +79,16 @@ var rh3 = b1 !== a1; var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index fb481259bd3..bfbbbab2bc5 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -48,15 +48,16 @@ class FooBase { } //// [complexClassRelationships.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // There should be no errors in this file var Derived = (function (_super) { __extends(Derived, _super); diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index c63df9b0c9b..187a4389261 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -6,15 +6,16 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var S18 = (function (_super) { __extends(S18, _super); function S18() { diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index b918701f5a1..ec8610a1164 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -124,15 +124,16 @@ foo() += value; (foo()) += value; //// [compoundAssignmentLHSIsValue.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // expected error for all the LHS of compound assignments (arithmetic and addition) var value; // this diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index a4812a00cc6..c7060a5120d 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -86,15 +86,16 @@ foo() **= value; (foo()) **= value; //// [compoundExponentiationAssignmentLHSIsValue.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // expected error for all the LHS of compound assignments (arithmetic and addition) var value; // this diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 8ac5c5be0b8..75c032d7f91 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -9,15 +9,16 @@ class C extends Base { } //// [computedPropertyNames24_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 12f3c1e301d..a300b687f53 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -14,15 +14,16 @@ class C extends Base { } //// [computedPropertyNames25_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index f4a9d79af0f..16566ec14e7 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -11,15 +11,16 @@ class C extends Base { } //// [computedPropertyNames26_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index 88319039ee6..a7d16a4d18e 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -6,15 +6,16 @@ class C extends Base { } //// [computedPropertyNames27_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 696da70eb93..5eb7b307b62 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -11,15 +11,16 @@ class C extends Base { } //// [computedPropertyNames28_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 3b4c663602d..44b748a0af2 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -16,15 +16,16 @@ class C extends Base { } //// [computedPropertyNames30_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index a727f478603..97f03e71923 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -16,15 +16,16 @@ class C extends Base { } //// [computedPropertyNames31_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index d2bde183b8b..100258284ba 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -13,15 +13,16 @@ class D extends C { } //// [computedPropertyNames43_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index b39e2375cb5..6064411248d 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -12,15 +12,16 @@ class D extends C { } //// [computedPropertyNames44_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index a74e87bbfd5..d3b6ccc7552 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -13,15 +13,16 @@ class D extends C { } //// [computedPropertyNames45_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index aa8b62c16e7..609c81f173d 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -48,15 +48,16 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //Cond ? Expr1 : Expr2, Expr1 and Expr2 have identical best common type var X = (function () { function X() { diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 8f4f4b20a56..df5c7aac44f 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -24,15 +24,16 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //Cond ? Expr1 : Expr2, Expr1 and Expr2 have no identical best common type var X = (function () { function X() { diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 170f5ba5dae..70effecc498 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -14,15 +14,16 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index e104a1f8e89..74e70d97bd9 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -15,15 +15,16 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index fddad137136..49f93e2497e 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -20,15 +20,16 @@ class Container { } //// [constraintCheckInGenericBaseTypeReference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // No errors var Constraint = (function () { function Constraint() { diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 06b273e9801..e2a884c4589 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -71,15 +71,16 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index 6ca8645ee9e..87392413b1b 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -114,15 +114,16 @@ module Errors { //// [constructSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 41ad9ead849..fb09253688d 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -61,15 +61,16 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index cb5e254d6b2..6ad855c7d32 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -51,15 +51,16 @@ interface I extends B { //// [constructSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index b9389d26fc8..5e768b4a41b 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -54,15 +54,16 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 5f5a3d7b565..47c508cab06 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -16,15 +16,16 @@ class Sub extends Super { //// [constructorArgs.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Super = (function () { function Super(value) { } diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 13e2317bb6f..633a7a155c5 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -20,15 +20,16 @@ class Derived2 extends Base { } //// [constructorFunctionTypeIsAssignableToBaseType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index e8c04ace7ef..07e11b5c681 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -34,15 +34,16 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { } diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index 76d260f780d..f2b90a57161 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -32,15 +32,16 @@ module Generic { } //// [constructorHasPrototypeProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var NonGeneric; (function (NonGeneric) { var C = (function () { diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index a3302dc70f9..67df7fb4e22 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -26,15 +26,16 @@ f1.bar1(); //// [constructorOverloads2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var FooBase = (function () { function FooBase(x) { } diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index e202486ecec..79b648e0cbb 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -23,15 +23,16 @@ f1.bar1(); //// [constructorOverloads3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function (_super) { __extends(Foo, _super); function Foo(x, y) { diff --git a/tests/baselines/reference/constructorWithCapturedSuper.js b/tests/baselines/reference/constructorWithCapturedSuper.js index be129d5f1ec..2034ea11c4f 100644 --- a/tests/baselines/reference/constructorWithCapturedSuper.js +++ b/tests/baselines/reference/constructorWithCapturedSuper.js @@ -53,15 +53,16 @@ class D extends A { } //// [constructorWithCapturedSuper.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var oneA; var A = (function () { function A() { diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 2f481a58bea..dbeed3de1fd 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -281,15 +281,16 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var fs = module; ("fs"); var TypeScriptAllInOne; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 39cbbe78c00..60cc6d99771 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -15,15 +15,16 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index 0a6794472a1..063ae781b6f 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -15,15 +15,16 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x = true ? function (a) { return a.toExponential(); } : function (b) { return b.toFixed(); }; var A = (function () { function A() { diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index 7788ee44382..c2bf66b2973 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -13,15 +13,16 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 2e2bdd009d2..8c6de85ca93 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -11,15 +11,16 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.x = 1; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index d362a5f04d9..b5d473c86ce 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -4,15 +4,16 @@ class ExtendsNull extends null { } //// [declFileClassExtendsNull.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ExtendsNull = (function (_super) { __extends(ExtendsNull, _super); function ExtendsNull() { diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index f0805f9617f..3262454f72d 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -10,15 +10,16 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var X = (function () { function X() { } diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index c1be3af34e1..0333bf19d21 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -13,15 +13,16 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 402b19c0ff3..6946e840dbe 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -41,15 +41,16 @@ export var j = C.F6; //// [declFileGenericType.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C; (function (C) { var A = (function () { diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index 2d0bb3ce500..1b9a79e95cb 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -43,15 +43,16 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Module var templa; (function (templa) { diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 65fee8c91e4..5edd9c8c19d 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -21,15 +21,16 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var X; (function (X) { var Y; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index 0a79b9be3bc..07809bc8dec 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -19,15 +19,16 @@ module A.B.C { } //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A; (function (A) { var B; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index 4fb5b585c99..e3ebe2d0a42 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -15,15 +15,16 @@ var q: B; q.s; //// [declarationEmitExpressionInExtends.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var Q = (function () { function Q() { diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index e059e44f140..284b0ca83ce 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -13,15 +13,16 @@ class MyClass extends getClass(2) { } //// [declarationEmitExpressionInExtends2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index 19d59529486..41383d43d9e 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -45,15 +45,16 @@ export class MyClass4 extends getExportedClass(undefined)>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>var C = (function () { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(10, 1) Source(2, 1) + SourceIndex(0) +1 >Emitted(11, 1) Source(2, 1) + SourceIndex(0) --- >>> function C(value) { 1->^^^^ @@ -37,9 +38,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > constructor( 3 > value: number -1->Emitted(11, 5) Source(7, 5) + SourceIndex(0) -2 >Emitted(11, 16) Source(7, 17) + SourceIndex(0) -3 >Emitted(11, 21) Source(7, 30) + SourceIndex(0) +1->Emitted(12, 5) Source(7, 5) + SourceIndex(0) +2 >Emitted(12, 16) Source(7, 17) + SourceIndex(0) +3 >Emitted(12, 21) Source(7, 30) + SourceIndex(0) --- >>> this.cProp = 10; 1->^^^^^^^^ @@ -52,11 +53,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > = 4 > 10 5 > ; -1->Emitted(12, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(12, 19) Source(3, 10) + SourceIndex(0) -3 >Emitted(12, 22) Source(3, 13) + SourceIndex(0) -4 >Emitted(12, 24) Source(3, 15) + SourceIndex(0) -5 >Emitted(12, 25) Source(3, 16) + SourceIndex(0) +1->Emitted(13, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(13, 19) Source(3, 10) + SourceIndex(0) +3 >Emitted(13, 22) Source(3, 13) + SourceIndex(0) +4 >Emitted(13, 24) Source(3, 15) + SourceIndex(0) +5 >Emitted(13, 25) Source(3, 16) + SourceIndex(0) --- >>> return { 1 >^^^^^^^^ @@ -71,9 +72,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > return 3 > -1 >Emitted(13, 9) Source(8, 9) + SourceIndex(0) -2 >Emitted(13, 15) Source(8, 15) + SourceIndex(0) -3 >Emitted(13, 16) Source(8, 16) + SourceIndex(0) +1 >Emitted(14, 9) Source(8, 9) + SourceIndex(0) +2 >Emitted(14, 15) Source(8, 15) + SourceIndex(0) +3 >Emitted(14, 16) Source(8, 16) + SourceIndex(0) --- >>> cProp: value, 1->^^^^^^^^^^^^ @@ -86,10 +87,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > cProp 3 > : 4 > value -1->Emitted(14, 13) Source(9, 13) + SourceIndex(0) -2 >Emitted(14, 18) Source(9, 18) + SourceIndex(0) -3 >Emitted(14, 20) Source(9, 20) + SourceIndex(0) -4 >Emitted(14, 25) Source(9, 25) + SourceIndex(0) +1->Emitted(15, 13) Source(9, 13) + SourceIndex(0) +2 >Emitted(15, 18) Source(9, 18) + SourceIndex(0) +3 >Emitted(15, 20) Source(9, 20) + SourceIndex(0) +4 >Emitted(15, 25) Source(9, 25) + SourceIndex(0) --- >>> foo: function () { 1->^^^^^^^^^^^^ @@ -98,8 +99,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1->, > 2 > foo -1->Emitted(15, 13) Source(10, 13) + SourceIndex(0) -2 >Emitted(15, 16) Source(10, 16) + SourceIndex(0) +1->Emitted(16, 13) Source(10, 13) + SourceIndex(0) +2 >Emitted(16, 16) Source(10, 16) + SourceIndex(0) --- >>> return "well this looks kinda C-ish."; 1->^^^^^^^^^^^^^^^^ @@ -113,11 +114,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > 4 > "well this looks kinda C-ish." 5 > ; -1->Emitted(16, 17) Source(11, 17) + SourceIndex(0) -2 >Emitted(16, 23) Source(11, 23) + SourceIndex(0) -3 >Emitted(16, 24) Source(11, 24) + SourceIndex(0) -4 >Emitted(16, 54) Source(11, 54) + SourceIndex(0) -5 >Emitted(16, 55) Source(11, 55) + SourceIndex(0) +1->Emitted(17, 17) Source(11, 17) + SourceIndex(0) +2 >Emitted(17, 23) Source(11, 23) + SourceIndex(0) +3 >Emitted(17, 24) Source(11, 24) + SourceIndex(0) +4 >Emitted(17, 54) Source(11, 54) + SourceIndex(0) +5 >Emitted(17, 55) Source(11, 55) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^ @@ -125,8 +126,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(17, 13) Source(12, 13) + SourceIndex(0) -2 >Emitted(17, 14) Source(12, 14) + SourceIndex(0) +1 >Emitted(18, 13) Source(12, 13) + SourceIndex(0) +2 >Emitted(18, 14) Source(12, 14) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^ @@ -134,8 +135,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > } 2 > -1 >Emitted(18, 10) Source(13, 10) + SourceIndex(0) -2 >Emitted(18, 11) Source(13, 10) + SourceIndex(0) +1 >Emitted(19, 10) Source(13, 10) + SourceIndex(0) +2 >Emitted(19, 11) Source(13, 10) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -144,8 +145,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(19, 5) Source(14, 5) + SourceIndex(0) -2 >Emitted(19, 6) Source(14, 6) + SourceIndex(0) +1 >Emitted(20, 5) Source(14, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(14, 6) + SourceIndex(0) --- >>> C.prototype.foo = function () { return "this never gets used."; }; 1->^^^^ @@ -168,16 +169,16 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 8 > ; 9 > 10> } -1->Emitted(20, 5) Source(5, 5) + SourceIndex(0) -2 >Emitted(20, 20) Source(5, 8) + SourceIndex(0) -3 >Emitted(20, 23) Source(5, 5) + SourceIndex(0) -4 >Emitted(20, 37) Source(5, 13) + SourceIndex(0) -5 >Emitted(20, 43) Source(5, 19) + SourceIndex(0) -6 >Emitted(20, 44) Source(5, 20) + SourceIndex(0) -7 >Emitted(20, 67) Source(5, 43) + SourceIndex(0) -8 >Emitted(20, 68) Source(5, 44) + SourceIndex(0) -9 >Emitted(20, 69) Source(5, 45) + SourceIndex(0) -10>Emitted(20, 70) Source(5, 46) + SourceIndex(0) +1->Emitted(21, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(21, 20) Source(5, 8) + SourceIndex(0) +3 >Emitted(21, 23) Source(5, 5) + SourceIndex(0) +4 >Emitted(21, 37) Source(5, 13) + SourceIndex(0) +5 >Emitted(21, 43) Source(5, 19) + SourceIndex(0) +6 >Emitted(21, 44) Source(5, 20) + SourceIndex(0) +7 >Emitted(21, 67) Source(5, 43) + SourceIndex(0) +8 >Emitted(21, 68) Source(5, 44) + SourceIndex(0) +9 >Emitted(21, 69) Source(5, 45) + SourceIndex(0) +10>Emitted(21, 70) Source(5, 46) + SourceIndex(0) --- >>> return C; 1 >^^^^ @@ -194,8 +195,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > } > 2 > } -1 >Emitted(21, 5) Source(15, 1) + SourceIndex(0) -2 >Emitted(21, 13) Source(15, 2) + SourceIndex(0) +1 >Emitted(22, 5) Source(15, 1) + SourceIndex(0) +2 >Emitted(22, 13) Source(15, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -220,10 +221,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > } > } > } -1 >Emitted(22, 1) Source(15, 1) + SourceIndex(0) -2 >Emitted(22, 2) Source(15, 2) + SourceIndex(0) -3 >Emitted(22, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(22, 6) Source(15, 2) + SourceIndex(0) +1 >Emitted(23, 1) Source(15, 1) + SourceIndex(0) +2 >Emitted(23, 2) Source(15, 2) + SourceIndex(0) +3 >Emitted(23, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(23, 6) Source(15, 2) + SourceIndex(0) --- >>>var D = (function (_super) { 1-> @@ -231,15 +232,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > > -1->Emitted(23, 1) Source(17, 1) + SourceIndex(0) +1->Emitted(24, 1) Source(17, 1) + SourceIndex(0) --- >>> __extends(D, _super); 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->class D extends 2 > C -1->Emitted(24, 5) Source(17, 17) + SourceIndex(0) -2 >Emitted(24, 26) Source(17, 18) + SourceIndex(0) +1->Emitted(25, 5) Source(17, 17) + SourceIndex(0) +2 >Emitted(25, 26) Source(17, 18) + SourceIndex(0) --- >>> function D(a) { 1 >^^^^ @@ -252,9 +253,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > constructor( 3 > a = 100 -1 >Emitted(25, 5) Source(20, 5) + SourceIndex(0) -2 >Emitted(25, 16) Source(20, 17) + SourceIndex(0) -3 >Emitted(25, 17) Source(20, 24) + SourceIndex(0) +1 >Emitted(26, 5) Source(20, 5) + SourceIndex(0) +2 >Emitted(26, 16) Source(20, 17) + SourceIndex(0) +3 >Emitted(26, 17) Source(20, 24) + SourceIndex(0) --- >>> if (a === void 0) { a = 100; } 1->^^^^^^^^ @@ -266,10 +267,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > 3 > 4 > a = 100 -1->Emitted(26, 9) Source(20, 17) + SourceIndex(0) -2 >Emitted(26, 27) Source(20, 17) + SourceIndex(0) -3 >Emitted(26, 29) Source(20, 17) + SourceIndex(0) -4 >Emitted(26, 36) Source(20, 24) + SourceIndex(0) +1->Emitted(27, 9) Source(20, 17) + SourceIndex(0) +2 >Emitted(27, 27) Source(20, 17) + SourceIndex(0) +3 >Emitted(27, 29) Source(20, 17) + SourceIndex(0) +4 >Emitted(27, 36) Source(20, 24) + SourceIndex(0) --- >>> var _this = _super.call(this, a) || this; 1->^^^^^^^^ @@ -298,12 +299,12 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > else > return null; > } -1->Emitted(27, 9) Source(20, 5) + SourceIndex(0) -2 >Emitted(27, 21) Source(21, 9) + SourceIndex(0) -3 >Emitted(27, 39) Source(21, 15) + SourceIndex(0) -4 >Emitted(27, 40) Source(21, 16) + SourceIndex(0) -5 >Emitted(27, 41) Source(21, 17) + SourceIndex(0) -6 >Emitted(27, 50) Source(33, 6) + SourceIndex(0) +1->Emitted(28, 9) Source(20, 5) + SourceIndex(0) +2 >Emitted(28, 21) Source(21, 9) + SourceIndex(0) +3 >Emitted(28, 39) Source(21, 15) + SourceIndex(0) +4 >Emitted(28, 40) Source(21, 16) + SourceIndex(0) +5 >Emitted(28, 41) Source(21, 17) + SourceIndex(0) +6 >Emitted(28, 50) Source(33, 6) + SourceIndex(0) --- >>> _this.dProp = function () { return _this; }; 1->^^^^^^^^ @@ -324,15 +325,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 7 > 8 > this 9 > ; -1->Emitted(28, 9) Source(18, 5) + SourceIndex(0) -2 >Emitted(28, 20) Source(18, 10) + SourceIndex(0) -3 >Emitted(28, 23) Source(18, 13) + SourceIndex(0) -4 >Emitted(28, 37) Source(18, 19) + SourceIndex(0) -5 >Emitted(28, 44) Source(18, 19) + SourceIndex(0) -6 >Emitted(28, 49) Source(18, 23) + SourceIndex(0) -7 >Emitted(28, 51) Source(18, 19) + SourceIndex(0) -8 >Emitted(28, 52) Source(18, 23) + SourceIndex(0) -9 >Emitted(28, 53) Source(18, 24) + SourceIndex(0) +1->Emitted(29, 9) Source(18, 5) + SourceIndex(0) +2 >Emitted(29, 20) Source(18, 10) + SourceIndex(0) +3 >Emitted(29, 23) Source(18, 13) + SourceIndex(0) +4 >Emitted(29, 37) Source(18, 19) + SourceIndex(0) +5 >Emitted(29, 44) Source(18, 19) + SourceIndex(0) +6 >Emitted(29, 49) Source(18, 23) + SourceIndex(0) +7 >Emitted(29, 51) Source(18, 19) + SourceIndex(0) +8 >Emitted(29, 52) Source(18, 23) + SourceIndex(0) +9 >Emitted(29, 53) Source(18, 24) + SourceIndex(0) --- >>> if (Math.random() < 0.5) { 1 >^^^^^^^^ @@ -366,19 +367,19 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 11> ) 12> 13> { -1 >Emitted(29, 9) Source(23, 9) + SourceIndex(0) -2 >Emitted(29, 11) Source(23, 11) + SourceIndex(0) -3 >Emitted(29, 12) Source(23, 12) + SourceIndex(0) -4 >Emitted(29, 13) Source(23, 13) + SourceIndex(0) -5 >Emitted(29, 17) Source(23, 17) + SourceIndex(0) -6 >Emitted(29, 18) Source(23, 18) + SourceIndex(0) -7 >Emitted(29, 24) Source(23, 24) + SourceIndex(0) -8 >Emitted(29, 26) Source(23, 26) + SourceIndex(0) -9 >Emitted(29, 29) Source(23, 29) + SourceIndex(0) -10>Emitted(29, 32) Source(23, 32) + SourceIndex(0) -11>Emitted(29, 33) Source(23, 33) + SourceIndex(0) -12>Emitted(29, 34) Source(23, 34) + SourceIndex(0) -13>Emitted(29, 35) Source(23, 35) + SourceIndex(0) +1 >Emitted(30, 9) Source(23, 9) + SourceIndex(0) +2 >Emitted(30, 11) Source(23, 11) + SourceIndex(0) +3 >Emitted(30, 12) Source(23, 12) + SourceIndex(0) +4 >Emitted(30, 13) Source(23, 13) + SourceIndex(0) +5 >Emitted(30, 17) Source(23, 17) + SourceIndex(0) +6 >Emitted(30, 18) Source(23, 18) + SourceIndex(0) +7 >Emitted(30, 24) Source(23, 24) + SourceIndex(0) +8 >Emitted(30, 26) Source(23, 26) + SourceIndex(0) +9 >Emitted(30, 29) Source(23, 29) + SourceIndex(0) +10>Emitted(30, 32) Source(23, 32) + SourceIndex(0) +11>Emitted(30, 33) Source(23, 33) + SourceIndex(0) +12>Emitted(30, 34) Source(23, 34) + SourceIndex(0) +13>Emitted(30, 35) Source(23, 35) + SourceIndex(0) --- >>> "You win!"; 1 >^^^^^^^^^^^^ @@ -388,9 +389,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > "You win!" 3 > -1 >Emitted(30, 13) Source(24, 13) + SourceIndex(0) -2 >Emitted(30, 23) Source(24, 23) + SourceIndex(0) -3 >Emitted(30, 24) Source(24, 23) + SourceIndex(0) +1 >Emitted(31, 13) Source(24, 13) + SourceIndex(0) +2 >Emitted(31, 23) Source(24, 23) + SourceIndex(0) +3 >Emitted(31, 24) Source(24, 23) + SourceIndex(0) --- >>> return { 1 >^^^^^^^^^^^^ @@ -401,9 +402,9 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > 2 > return 3 > -1 >Emitted(31, 13) Source(25, 13) + SourceIndex(0) -2 >Emitted(31, 19) Source(25, 19) + SourceIndex(0) -3 >Emitted(31, 20) Source(25, 20) + SourceIndex(0) +1 >Emitted(32, 13) Source(25, 13) + SourceIndex(0) +2 >Emitted(32, 19) Source(25, 19) + SourceIndex(0) +3 >Emitted(32, 20) Source(25, 20) + SourceIndex(0) --- >>> cProp: 1, 1->^^^^^^^^^^^^^^^^ @@ -416,10 +417,10 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 2 > cProp 3 > : 4 > 1 -1->Emitted(32, 17) Source(26, 17) + SourceIndex(0) -2 >Emitted(32, 22) Source(26, 22) + SourceIndex(0) -3 >Emitted(32, 24) Source(26, 24) + SourceIndex(0) -4 >Emitted(32, 25) Source(26, 25) + SourceIndex(0) +1->Emitted(33, 17) Source(26, 17) + SourceIndex(0) +2 >Emitted(33, 22) Source(26, 22) + SourceIndex(0) +3 >Emitted(33, 24) Source(26, 24) + SourceIndex(0) +4 >Emitted(33, 25) Source(26, 25) + SourceIndex(0) --- >>> dProp: function () { return _this; }, 1->^^^^^^^^^^^^^^^^ @@ -440,14 +441,14 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 6 > this 7 > 8 > this -1->Emitted(33, 17) Source(27, 17) + SourceIndex(0) -2 >Emitted(33, 22) Source(27, 22) + SourceIndex(0) -3 >Emitted(33, 24) Source(27, 24) + SourceIndex(0) -4 >Emitted(33, 38) Source(27, 30) + SourceIndex(0) -5 >Emitted(33, 45) Source(27, 30) + SourceIndex(0) -6 >Emitted(33, 50) Source(27, 34) + SourceIndex(0) -7 >Emitted(33, 52) Source(27, 30) + SourceIndex(0) -8 >Emitted(33, 53) Source(27, 34) + SourceIndex(0) +1->Emitted(34, 17) Source(27, 17) + SourceIndex(0) +2 >Emitted(34, 22) Source(27, 22) + SourceIndex(0) +3 >Emitted(34, 24) Source(27, 24) + SourceIndex(0) +4 >Emitted(34, 38) Source(27, 30) + SourceIndex(0) +5 >Emitted(34, 45) Source(27, 30) + SourceIndex(0) +6 >Emitted(34, 50) Source(27, 34) + SourceIndex(0) +7 >Emitted(34, 52) Source(27, 30) + SourceIndex(0) +8 >Emitted(34, 53) Source(27, 34) + SourceIndex(0) --- >>> foo: function () { return "You win!!!!!"; } 1->^^^^^^^^^^^^^^^^ @@ -469,15 +470,15 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 7 > 8 > 9 > } -1->Emitted(34, 17) Source(28, 17) + SourceIndex(0) -2 >Emitted(34, 20) Source(28, 20) + SourceIndex(0) -3 >Emitted(34, 36) Source(28, 25) + SourceIndex(0) -4 >Emitted(34, 42) Source(28, 31) + SourceIndex(0) -5 >Emitted(34, 43) Source(28, 32) + SourceIndex(0) -6 >Emitted(34, 57) Source(28, 46) + SourceIndex(0) -7 >Emitted(34, 58) Source(28, 46) + SourceIndex(0) -8 >Emitted(34, 59) Source(28, 47) + SourceIndex(0) -9 >Emitted(34, 60) Source(28, 48) + SourceIndex(0) +1->Emitted(35, 17) Source(28, 17) + SourceIndex(0) +2 >Emitted(35, 20) Source(28, 20) + SourceIndex(0) +3 >Emitted(35, 36) Source(28, 25) + SourceIndex(0) +4 >Emitted(35, 42) Source(28, 31) + SourceIndex(0) +5 >Emitted(35, 43) Source(28, 32) + SourceIndex(0) +6 >Emitted(35, 57) Source(28, 46) + SourceIndex(0) +7 >Emitted(35, 58) Source(28, 46) + SourceIndex(0) +8 >Emitted(35, 59) Source(28, 47) + SourceIndex(0) +9 >Emitted(35, 60) Source(28, 48) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^ @@ -485,8 +486,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > } 2 > ; -1 >Emitted(35, 14) Source(29, 14) + SourceIndex(0) -2 >Emitted(35, 15) Source(29, 15) + SourceIndex(0) +1 >Emitted(36, 14) Source(29, 14) + SourceIndex(0) +2 >Emitted(36, 15) Source(29, 15) + SourceIndex(0) --- >>> } 1 >^^^^^^^^ @@ -495,8 +496,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(36, 9) Source(30, 9) + SourceIndex(0) -2 >Emitted(36, 10) Source(30, 10) + SourceIndex(0) +1 >Emitted(37, 9) Source(30, 9) + SourceIndex(0) +2 >Emitted(37, 10) Source(30, 10) + SourceIndex(0) --- >>> else 1->^^^^^^^^ @@ -505,8 +506,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > 2 > else -1->Emitted(37, 9) Source(31, 9) + SourceIndex(0) -2 >Emitted(37, 13) Source(31, 13) + SourceIndex(0) +1->Emitted(38, 9) Source(31, 9) + SourceIndex(0) +2 >Emitted(38, 13) Source(31, 13) + SourceIndex(0) --- >>> return null; 1->^^^^^^^^^^^^ @@ -520,11 +521,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 3 > 4 > null 5 > ; -1->Emitted(38, 13) Source(32, 13) + SourceIndex(0) -2 >Emitted(38, 19) Source(32, 19) + SourceIndex(0) -3 >Emitted(38, 20) Source(32, 20) + SourceIndex(0) -4 >Emitted(38, 24) Source(32, 24) + SourceIndex(0) -5 >Emitted(38, 25) Source(32, 25) + SourceIndex(0) +1->Emitted(39, 13) Source(32, 13) + SourceIndex(0) +2 >Emitted(39, 19) Source(32, 19) + SourceIndex(0) +3 >Emitted(39, 20) Source(32, 20) + SourceIndex(0) +4 >Emitted(39, 24) Source(32, 24) + SourceIndex(0) +5 >Emitted(39, 25) Source(32, 25) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -533,8 +534,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1 > > 2 > } -1 >Emitted(39, 5) Source(33, 5) + SourceIndex(0) -2 >Emitted(39, 6) Source(33, 6) + SourceIndex(0) +1 >Emitted(40, 5) Source(33, 5) + SourceIndex(0) +2 >Emitted(40, 6) Source(33, 6) + SourceIndex(0) --- >>> return D; 1->^^^^ @@ -542,8 +543,8 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts 1-> > 2 > } -1->Emitted(40, 5) Source(34, 1) + SourceIndex(0) -2 >Emitted(40, 13) Source(34, 2) + SourceIndex(0) +1->Emitted(41, 5) Source(34, 1) + SourceIndex(0) +2 >Emitted(41, 13) Source(34, 2) + SourceIndex(0) --- >>>}(C)); 1 > @@ -576,11 +577,11 @@ sourceFile:derivedClassConstructorWithExplicitReturns01.ts > return null; > } > } -1 >Emitted(41, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(41, 2) Source(34, 2) + SourceIndex(0) -3 >Emitted(41, 2) Source(17, 1) + SourceIndex(0) -4 >Emitted(41, 3) Source(17, 17) + SourceIndex(0) -5 >Emitted(41, 4) Source(17, 18) + SourceIndex(0) -6 >Emitted(41, 7) Source(34, 2) + SourceIndex(0) +1 >Emitted(42, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(42, 2) Source(34, 2) + SourceIndex(0) +3 >Emitted(42, 2) Source(17, 1) + SourceIndex(0) +4 >Emitted(42, 3) Source(17, 17) + SourceIndex(0) +5 >Emitted(42, 4) Source(17, 18) + SourceIndex(0) +6 >Emitted(42, 7) Source(34, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map \ No newline at end of file diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index f92b9ab7c99..9c295b584ad 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -34,15 +34,16 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index 2fa9323295a..bb9fcbc1952 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -15,15 +15,16 @@ class Derived extends Base { } //// [derivedClassFunctionOverridesBaseClassAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 3fe81a587af..10cad78a322 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -41,15 +41,16 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { } diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index da2abf23166..875270b57f3 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -18,15 +18,16 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index 14549e8d9c4..cd04b7ede37 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -16,15 +16,16 @@ class DerivedClass extends BaseClass { new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseClass = (function () { function BaseClass() { this._init(); diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index b88ce8d37ee..9dc81e9b5ad 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -16,15 +16,16 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesPrivates.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index d44fc6a483d..2ae532f0c84 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -37,15 +37,16 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var y; var Base = (function () { diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 8f8e913c82b..0f321c18241 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -64,15 +64,16 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var y; var Base = (function () { diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index 2825524d224..014cea9753e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -72,15 +72,16 @@ class Derived10 extends Base { } //// [derivedClassOverridesProtectedMembers3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var y; var Base = (function () { diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index 9d4c76a8384..5e4804b5bac 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -15,15 +15,16 @@ class Derived2 extends Derived1 { } //// [derivedClassOverridesProtectedMembers4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var y; var Base = (function () { diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 6390636e09f..73d620ce2f5 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -63,15 +63,16 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x; var y; var Base = (function () { diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index 3ce6c5d1966..81fda59ae78 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -24,15 +24,16 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesWithoutSubtype.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index 340aa0f5709..26bf27bd023 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -96,15 +96,16 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 7238b7d1af3..5c29ea9ed89 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -33,15 +33,16 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 6a79fd2d2a2..bce8697a7e8 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -29,15 +29,16 @@ class Derived4 extends Base { } //// [derivedClassSuperCallsWithThisArg.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(a) { } diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index b6cd5a284e4..997d25693a6 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -22,15 +22,16 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index 05648a00507..c1304ad5242 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -22,15 +22,16 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index a280316b639..264616cea7f 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -22,15 +22,16 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 2d32ece1375..63a78e3d3b6 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -22,15 +22,16 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 64b6a1c995a..01d7c130f94 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -60,15 +60,16 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 6c9ff2f36e7..1b8cca7a0a8 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -23,15 +23,16 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 924526923f8..e2ecad8be4b 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -33,15 +33,16 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 9705b1e8d03..26095ed6628 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -22,15 +22,16 @@ class Derived extends Base { } //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index dd15ec7e66d..f01edcc8a3a 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -34,15 +34,16 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index 7a145b763c0..d3ce1f3cdbf 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -26,15 +26,16 @@ var d = new D(); // error var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { this.a = 1; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 29cb878de46..c15ac71c573 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -34,15 +34,16 @@ var d3 = new D(new Date(), new Date()); var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { this.a = 1; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index 79d26767df6..fe02d135c24 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -48,15 +48,16 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { this.a = 1; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index 38af357d6c3..f310c0e5fd2 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -31,15 +31,16 @@ b.hue(); //// [derivedClasses.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Red = (function (_super) { __extends(Red, _super); function Red() { diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 6644fefcac4..abd8954fe22 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -43,15 +43,16 @@ c = e; var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index 91224f98a5d..b32d0a79d6b 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -18,15 +18,16 @@ class Derived extends Base { } //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index 926ca09274d..b5ef2f81099 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -21,15 +21,16 @@ b = d2; var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index 831cf209995..a00fc248939 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -52,15 +52,16 @@ d3({ y: "world" }); //// [destructuringParameterDeclaration5.js] // Parameter Declaration with generic -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Class = (function () { function Class() { } diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index 79babde83e2..325a15007c8 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -14,15 +14,16 @@ class B extends A { //// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.blub = 6; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index d7988562315..2d97d0a9865 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -16,15 +16,16 @@ class B extends A { } //// [emitSuperCallBeforeEmitPropertyDeclaration1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.blub = 6; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index fdec4c4e7be..63de121ed4d 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -14,15 +14,16 @@ class B extends A { } //// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.blub = 6; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index c87ad7d4189..5488e3aa005 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -28,15 +28,16 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var User = (function () { function User() { } diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index e4ad120250f..16493baae98 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -5,15 +5,16 @@ class B extends A { //// [emptyModuleName.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = require(""); var B = (function (_super) { __extends(B, _super); diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 851a97663de..98eb91ce417 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -12,15 +12,16 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function f() { var d1 = new derived(); var d2 = new derived(4); diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 43d89076ade..6c7a1441b05 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -75,15 +75,16 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //super call in class constructor with no base type var NoBase = (function () { function NoBase() { diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 42a2acf4317..70d777644c6 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -129,15 +129,16 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //super property access in constructor of class with no base type //super property access in instance member function of class with no base type //super property access in instance member accessor(get and set) of class with no base type diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 64227abe6b2..d7797d7e350 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -73,15 +73,16 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index 68fa43fd64b..c958470d077 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -15,15 +15,16 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(str1, str2) { } diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index e433f19ece3..6834e6139aa 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -85,15 +85,16 @@ declare module AmbientMod { //// [es6ClassTest.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Bar = (function () { function Bar(n) { } diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 491bec40e74..c456f270d6e 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -159,15 +159,16 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BasicMonster = (function () { function BasicMonster(name, health) { this.name = name; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index d8f7f688ec0..899ac4100eb 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -9,15 +9,16 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 76485e8d91e..4be64d67745 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -24,15 +24,16 @@ define(["require", "exports"], function (require, exports) { return T; }); //// [exportAssignmentOfGenericType1_1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports", "exportAssignmentOfGenericType1_0"], function (require, exports, q) { "use strict"; var M = (function (_super) { diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index e83c10b59fd..c9c59360621 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -19,15 +19,16 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Bbb = (function () { function Bbb() { } diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index f144fbdbca8..c05c43c1d27 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -20,15 +20,16 @@ module N { //// [extBaseClass1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var B = (function () { diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index f453255379b..d55b201a728 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -11,15 +11,16 @@ module M { //// [extBaseClass2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var N; (function (N) { var C4 = (function (_super) { diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index 5242430513a..1a690094925 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -14,15 +14,16 @@ d.baz(); d.foo; //// [extendAndImplementTheSameBaseType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index d670758f324..d262bcae95f 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -17,15 +17,16 @@ var r3: string = d.bar(); var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index a2e55deaa26..25be2160ecb 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -4,15 +4,16 @@ class derived extends base { } class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var derived = (function (_super) { __extends(derived, _super); function derived() { diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 08ad33d619b..746379cc73c 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -21,15 +21,16 @@ var x = (function () { module.exports = x; //// [foo2.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var foo1 = require("./foo1"); var x = foo1; var y = (function (_super) { diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index dc721dc343a..d8562243c66 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -11,15 +11,16 @@ var e: E = new E(1); //// [extendConstructSignatureInInterface.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var CStatic; var E = (function (_super) { __extends(E, _super); diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index f52b0382827..ac2f6c7ff93 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -4,15 +4,16 @@ var x = A; class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 57695fb5fcf..5b8800a553d 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -6,15 +6,16 @@ var x = new Foo(); // legal, considered a constructor function class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function Foo() { this.x = 1; } diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 6578c4c9ce3..96b1bf98538 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -10,15 +10,16 @@ class C extends abc.XYZ { //// [extendPrivateConstructorClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index f979a820f63..5e5f09622ee 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -42,15 +42,16 @@ var Model = (function () { exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); @@ -62,15 +63,16 @@ var VisualizationModel = (function (_super) { exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index 1e9681a0d3c..cf06895cb86 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -7,15 +7,16 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 502618d78ce..3dd977b657a 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -7,15 +7,16 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index 887cb9c1feb..34e8b10d70c 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -19,15 +19,16 @@ var z = c.foo().bar().baz(); // Fluent pattern //// [fluentClasses.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index d03972b9f17..b57d6383d96 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -81,15 +81,16 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var aString; for (aString in {}) { } var anAny; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 938ab4daf87..4670bf17807 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -64,15 +64,16 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var aNumber; for (aNumber in {}) { } var aBoolean; diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5bb0709c13c..5f400591741 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -55,15 +55,16 @@ for(var m: typeof M;;){} for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 94335364ec8..67f13db465e 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -75,15 +75,16 @@ var f13 = () => { //// [functionImplementationErrors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { return ''; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 2a19b4b841f..9fd603f16d3 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -158,15 +158,16 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC } //// [functionImplementations.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // FunctionExpression with no return type annotation and no return statement returns void var v = function () { }(); // FunctionExpression f with no return type annotation and directly references f in its body returns any diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 01a6a130823..f7365781a2c 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -15,15 +15,16 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EventBase = (function () { function EventBase() { this._listeners = []; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index a1aaf35748a..6f534e64e88 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -15,15 +15,16 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EventBase = (function () { function EventBase() { this._listeners = []; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 1551b671b62..43aa5dd6e9a 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -356,15 +356,16 @@ var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; retur var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); //// [generatedContextualTyping.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index c0ef8541ad7..73f5cb87bed 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -13,15 +13,16 @@ class SubClass extends BaseClass { } //// [genericBaseClassLiteralProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseClass = (function () { function BaseClass() { } diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 53fb2472d05..fb4f51749cd 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -16,15 +16,16 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var CollectionItem2 = (function () { function CollectionItem2() { } diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index 318f5aa1494..d625797ea53 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -109,15 +109,16 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index dc5bf22658d..ae844d043e6 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -33,15 +33,16 @@ var i: I; var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index ce39f51d49c..e3d80ebd572 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -41,15 +41,16 @@ var r7 = f3(null, x => x); // any //// [genericCallWithObjectTypeArgsAndConstraints2.js] // Generic call with constraints infering type parameter from object member properties // No errors expected -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index 76d0f0854ea..387c4526764 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -39,15 +39,16 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index 645929e2c14..d4d86fe5793 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -24,15 +24,16 @@ module M { } //// [genericCallbacksAndClassHierarchy.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var C1 = (function () { diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index 8d7098ba4f2..152237d458d 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -32,15 +32,16 @@ s.genericVar = 12; //// [genericClassExpressionInFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index 8219bf91c38..aa3e06cf57e 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -6,15 +6,16 @@ class C { } //// [genericClassInheritsConstructorFromNonGenericClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function (_super) { __extends(A, _super); function A() { diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 8563581f953..4efb95cdeba 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -76,15 +76,16 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Portal; (function (Portal) { var Controls; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 85b09999c6a..32b29319c12 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -11,15 +11,16 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 0097132b1e4..a8a3db2f3a0 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -18,15 +18,16 @@ var z = v2.b; //// [genericClasses3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index a956f444aec..97bc5d27ee0 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -27,15 +27,16 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EndGate; (function (EndGate) { var Tweening; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index b51acfd80b4..66df4074441 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -26,15 +26,16 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var EndGate; (function (EndGate) { var Tweening; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index d17f3992c46..edd74ea92e4 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -13,15 +13,16 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 3387beda5c4..9fb286b1c40 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -13,15 +13,16 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index f9d4979fb2a..7ed0c8179dd 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -11,15 +11,16 @@ var c:Constructor> = B; // shouldn't error here //// [genericInheritedDefaultConstructors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index f07c1f30594..73a64a65763 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -16,15 +16,16 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseEvent = (function () { function BaseEvent() { } diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index a594644df6a..48e8b367486 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -15,15 +15,16 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseEvent = (function () { function BaseEvent() { } diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index d60d4c960bd..a9ea14337f4 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -27,15 +27,16 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var TypeScript2; (function (TypeScript2) { ; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index 6ecbdcf8dae..60d214a1914 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -31,15 +31,16 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var TypeScript; (function (TypeScript) { var MemberName = (function () { diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index df70516ad34..416317ea9f6 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -14,15 +14,16 @@ var r4: A = >new A(); var r5: A = >[]; // error //// [genericTypeAssertions2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index f65447822c9..a857ae3ef8d 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -26,15 +26,16 @@ function foo2(x: T) { } //// [genericTypeAssertions4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 36262513319..8e69ccdbbc3 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -25,15 +25,16 @@ var b: B; var c: A = >b; //// [genericTypeAssertions6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(x) { var y = x; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index fae7f381616..48baec0e6f6 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -14,15 +14,16 @@ class BarExtended extends Bar { } //// [genericTypeConstraints.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 3d0e940eaa9..d123ce1bd2e 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -40,15 +40,16 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument.js] // it is an error to use a generic type without type arguments // all of these are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 552edc1f134..e03295d5086 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -40,15 +40,16 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument2.js] // it is an error to use a generic type without type arguments // all of these are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var c; var a; var b; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index c12bec69ba6..25f443c9bf4 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -15,15 +15,16 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports"], function (require, exports) { "use strict"; var Collection = (function () { diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index afb3477111f..828a2894ed0 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -133,15 +133,16 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = [1, '']; // {}[] var b = [1, null]; // number[] var c = [1, '', null]; // {}[] diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 909b52ad0d6..527e241c35c 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -164,15 +164,16 @@ do { }while(fn) //// [ifDoWhileStatements.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 1ddb27788d8..37fa76388f0 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -21,15 +21,16 @@ class Derived extends Base { } //// [illegalSuperCallsInConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index 6aa751d7b54..916bbaebf7a 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -3,15 +3,16 @@ class C { foo: number } class D implements C extends C { } //// [implementClausePrecedingExtends.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 4ab1c3add23..e6831db5f9c 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -86,15 +86,16 @@ module M2 { } //// [implementingAnInterfaceExtendingClassWithPrivates2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 21e99dfa07b..4e2dc2514d2 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -42,15 +42,16 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 0f95c2d3dbb..9f2461ebd42 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -21,15 +21,16 @@ var Greeter = (function () { exports.Greeter = Greeter; //// [importAsBaseClass_1.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Greeter = require("./importAsBaseClass_0"); var Hello = (function (_super) { __extends(Hello, _super); diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index 06360b221b6..7a28d808710 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -68,15 +68,16 @@ C = tslib_1.__decorate([ tslib_1.__metadata("design:paramtypes", []) ], C); //// [script.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index e48e51de44b..7fc3f22e1e2 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -70,15 +70,16 @@ var o = { a: 1 }; var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); //// [script.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 9d655f401c7..820913a0f94 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -60,15 +60,16 @@ C = tslib_1.__decorate([ tslib_1.__metadata("design:paramtypes", []) ], C); //// [script.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 61f715a2194..0c6a299ee5a 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -21,15 +21,16 @@ define(["require", "exports"], function (require, exports) { return Foo; }); //// [Bar.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports", "Foo"], function (require, exports, Error) { "use strict"; var Bar = (function (_super) { diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index b4bc18ddb7f..25c82b8cb7b 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -21,15 +21,16 @@ var Super = (function () { exports.Super = Super; //// [importUsedInExtendsList1_1.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var foo = require("./importUsedInExtendsList1_require"); var Sub = (function (_super) { diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index 2fdfe55d22d..8a9b10c34c7 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -29,15 +29,16 @@ class K extends J { } //// [indexerConstraints2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index 9a3c5e3cfeb..dbf484907e7 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -3,15 +3,16 @@ class a extends b{ } class b extends a{ } //// [indirectSelfReference.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function (_super) { __extends(a, _super); function a() { diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index f9ba7ccc940..6c73f2fa095 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -3,15 +3,16 @@ class a extends b { } class b extends a { } //// [indirectSelfReferenceGeneric.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function (_super) { __extends(a, _super); function a() { diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index bbcedbfa6b8..7fb9d286791 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -25,15 +25,16 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Functionality = (function () { function Functionality() { } diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index b8ffd010380..aadf2edb314 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -3,15 +3,16 @@ class C extends T { } interface I extends T { } //// [inheritFromGenericTypeParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index b63252a4449..81717bfec05 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -11,15 +11,16 @@ interface A extends C, C2 { // ok } //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 7cb4b76c740..b6195423128 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -35,15 +35,16 @@ class Baad extends Good { //// [inheritance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B1 = (function () { function B1() { } diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index 4ad5c55dc62..6f1e76e8925 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -62,15 +62,16 @@ l1 = sc; l1 = c; //// [inheritance1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Control = (function () { function Control() { } diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 2fd7aa913d0..3a79d28b51e 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -11,15 +11,16 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index 8f436ffd353..6b49c0fb9b5 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -11,15 +11,16 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index e13c592eccb..f801c6cdd0d 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -11,15 +11,16 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index b593654036b..b85a1f7d99e 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -18,15 +18,16 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 84c1f0d3a4c..ac0b0376749 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -15,15 +15,16 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index b8cec2486d7..eaae0a3c126 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -13,15 +13,16 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 158c89d092e..8ed9f07dbb6 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -15,15 +15,16 @@ class b extends a { } //// [inheritanceMemberFuncOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index a2c8a6b690e..a05acd4752f 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -12,15 +12,16 @@ class b extends a { } //// [inheritanceMemberFuncOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index bd0a9e55ba1..1b27447d3dc 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceMemberFuncOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index 2c7ae4fb6b6..c18e12d38cb 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -14,15 +14,16 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index 0b604adae2a..e9b333ddee1 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 71a9731e828..0ccfa544a7c 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -8,15 +8,16 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 4c243028296..c150ef6434d 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -8,15 +8,16 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 1bf2fd4eed7..8753fbe9b46 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -15,15 +15,16 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var C1 = (function () { diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index e35b3f24a5d..3abc4b6d453 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -18,15 +18,16 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index d1035ae3d48..8215f4fdf0e 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -15,15 +15,16 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index c51f321020d..3375597f114 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -13,15 +13,16 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index 778e7987f27..7f27718a1fb 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -15,15 +15,16 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index a6afadefb3a..03de6f62af4 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -12,15 +12,16 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index 37b3113b855..a1380343bee 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -12,15 +12,16 @@ class b extends a { } //// [inheritanceStaticFuncOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index 0d328df7c53..e28d0a026dd 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceStaticFuncOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 541cda8e1b2..d8155525444 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index 4ec01a1dc36..9b696526a44 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceStaticFunctionOverridingInstanceProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 74a86c64f8c..59dc7e5fff1 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -8,15 +8,16 @@ class b extends a { } //// [inheritanceStaticMembersCompatible.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index e1ac5204119..e6e2edf0d5b 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -8,15 +8,16 @@ class b extends a { } //// [inheritanceStaticMembersIncompatible.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index 48cb36812a2..7872f35ae90 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -13,15 +13,16 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index f5130abe8bd..24a6135b30c 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -10,15 +10,16 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index e60108ca25b..182fb27a970 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -8,15 +8,16 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = (function () { function a() { } diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index 9abc3a38497..a2538cf999d 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -15,15 +15,16 @@ new Derived("", 3); new Derived(3); //// [inheritedConstructorWithRestParams.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { var a = []; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 925f5124753..17cca41912d 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -35,15 +35,16 @@ new Derived("", 3, "", 3); new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var IBaseBase = (function () { function IBaseBase(x) { } diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index f919c354e5e..5e7f49be559 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -22,15 +22,16 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index d6581fbfd09..c85caf07e53 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -90,15 +90,16 @@ function fn8(x: Alpha|Beta|Gamma) { //// [instanceOfAssignability.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Derived1 is assignable to, but not a subtype of, Base var Derived1 = (function () { function Derived1() { diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index bf304bc0aab..8eb7e3321f9 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -43,15 +43,16 @@ module Generic { } //// [instancePropertiesInheritedIntoClassType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var NonGeneric; (function (NonGeneric) { var C = (function () { diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index 791e72a6b4e..58192144612 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -8,15 +8,16 @@ class C2 extends C1 { } //// [instanceSubtypeCheck2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 938bf26dc44..8eefac93223 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -72,15 +72,16 @@ function goo(x: A) { //// [instanceofWithStructurallyIdenticalTypes.js] // Repro from #7271 -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 62de511b4c8..01b8da419c4 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -31,15 +31,16 @@ return null; //// [instantiatedReturnTypeContravariance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var c = (function () { function c() { } diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index d3d7b257465..9b75b9e4d10 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -41,15 +41,16 @@ obj = bar; //// [interfaceClassMerging.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index 9f7037048bd..93c05759367 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -37,15 +37,16 @@ foo = bar; //// [interfaceClassMerging2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 7b0865b0018..5e8d36136a8 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -19,15 +19,16 @@ class Location { //// [interfaceExtendsClass1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Control = (function () { function Control() { } diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index a560df25986..d567d5661d9 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -28,15 +28,16 @@ c = d; d = c; // error //// [interfaceExtendsClassWithPrivate1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.x = 1; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index 3aa5f800d9c..b7e2fe715cb 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -24,15 +24,16 @@ class D2 extends C implements I { // error } //// [interfaceExtendsClassWithPrivate2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.x = 1; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index c8a739a3a1f..f90d58edd4f 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -41,15 +41,16 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 9ed7be8e0f2..4b88d58fd18 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -80,15 +80,16 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Y; (function (Y) { var A = (function () { diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 788b91f13c5..4e473a95bf5 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -54,15 +54,16 @@ var m: typeof M; var m = M.A; //// [invalidMultipleVariableDeclarations.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index ca25cdc9870..7dc01b18b5b 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -21,15 +21,16 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // all the following should be error function fn1() { } function fn2() { } diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index dddc8d56339..e430e1eda1b 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -15,15 +15,16 @@ export var z = x; //// [file1.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var module_1 = require("module"); var module_2 = require("module"); var ns = require("module"); diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 110cbba1ef6..7955a6e65b9 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -25,15 +25,16 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var BaseComponent = require("BaseComponent"); var TestComponent = (function (_super) { diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 6c3591344e3..e9d76ee4d7f 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -367,15 +367,16 @@ function f(p: K) { } //// [keyofAndIndexedAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Shape = (function () { function Shape() { } diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index 8fbe9a40728..cdc03b555ef 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -35,15 +35,16 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Event = (function () { function Event() { // TODO: remove diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index a9f3b4b17ac..d2f2ed8dc0d 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -18,15 +18,16 @@ class C extends B { //// [lift.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B(y) { this.y = y; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index 503a34c528c..27045613c81 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -142,15 +142,16 @@ function f6() { //// [localTypes1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function f1() { var E; (function (E) { diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index b48fb3bbb3e..86504bdf8f9 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -27,15 +27,16 @@ var y3: C1 = {}; //// [m7Bugs.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var s = ({}); var x = {}; var C1 = (function () { diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index e3273fd8115..886afebe358 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -19,15 +19,16 @@ var A = (function () { return A; }()); //// [b.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function (_super) { __extends(B, _super); function B() { diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index d4f013e4ecc..445fbac34b7 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -37,15 +37,16 @@ define(["require", "exports"], function (require, exports) { exports.A = A; }); //// [b.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports", "./a"], function (require, exports, a_1) { "use strict"; var B = (function (_super) { diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 4b6457fe1dd..1772d6139d8 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -47,15 +47,16 @@ grandchild.method2(); //// [mergedInheritedClassInterface.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var BaseClass = (function () { function BaseClass() { } diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index 3207ae8f8c5..65477941c0a 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -32,15 +32,16 @@ var r = a.x; // error var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index 6a01a6cdd78..c3d2cc0ea57 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -39,15 +39,16 @@ module M { } //// [mergedInterfacesWithInheritedPrivates3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index 54016af34af..a2d38f47c62 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -7,15 +7,16 @@ class George extends class { reset() { return this.y; } } { //// [missingPropertiesOfClassExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var George = (function (_super) { __extends(George, _super); function George() { diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 5a421d7d3f4..99553e04108 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -5,15 +5,16 @@ interface I extends M { } class C2 implements M { } //// [moduleAsBaseType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index c57f7af6579..6471abaf13d 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -16,15 +16,16 @@ define(["require", "exports"], function (require, exports) { "use strict"; }); //// [moduleImportedForTypeArgumentPosition_1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports"], function (require, exports) { "use strict"; var C1 = (function () { diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index 6fda8588f43..f7532442020 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -59,15 +59,16 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A; (function (A_1) { var A = (function () { diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 2036f81bf92..f0074664ad1 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -39,15 +39,16 @@ class Baad extends Good { //// [multipleInheritance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B1 = (function () { function B1() { } diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 0f86ca802a6..90ffbf5148f 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -11,15 +11,16 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var foo = (function () { function foo() { } diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index 1253860daa6..25815641e95 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -13,15 +13,16 @@ class Child extends Parent { } //// [noImplicitAnyMissingGetAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Parent = (function () { function Parent() { } diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index 76011cee442..cb37fafd9f9 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -12,15 +12,16 @@ class Child extends Parent { } //// [noImplicitAnyMissingSetAccessor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Parent = (function () { function Parent() { } diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 1dab2ae6fb8..49a3a7e05eb 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -6,15 +6,16 @@ class Foo { class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index b571573c18f..9c44df83757 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -47,15 +47,16 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 0dbcc5308c8..4a8c3caf12b 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -13,15 +13,16 @@ class C { } //// [numericIndexerConstraint3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 0b4f1be5361..4fe10b54ee4 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -13,15 +13,16 @@ var x: { //// [numericIndexerConstraint4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index d4e12eddd27..e6fce38d818 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -13,15 +13,16 @@ var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexere //// [numericIndexerTyping2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var I = (function () { function I() { } diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index 0d6589f09e3..7d192f7ee9a 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -56,15 +56,16 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Food = (function () { function Food(name) { this.name = name; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 8f9acd3615c..84caecad63a 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -55,15 +55,16 @@ var b: { var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index e995999e04b..a00f33b2a97 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -124,15 +124,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index 81521fccedf..fa176f483d7 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -127,15 +127,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index c66084b049f..a09e844b6c4 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -124,15 +124,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index e0cfd4b3be1..a187c353056 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -122,15 +122,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 97f8179bfb1..5d130734c7b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -40,15 +40,16 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 740c9af666b..f28147ba50d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -26,15 +26,16 @@ var c3: C3; c3; // Should fail (private x originates in the same declaration, but different types) //// [objectTypesIdentityWithPrivates3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index fe72b6d409a..a561df31753 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -124,15 +124,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 9cd95ea9629..282ec34ea5f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -127,15 +127,16 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index 927fbd25854..5033f9d1581 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -11,15 +11,16 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(opt) { } diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index 4d89325803d..3af46d7e41a 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -58,15 +58,16 @@ class Derived extends Base { //// [optionalMethods.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function test1(x) { x.a; x.b; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 7f606887baa..2bcfbd44da5 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -125,15 +125,16 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // test basic configurations var C1 = (function () { function C1(v, p) { diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index cfa9364bb68..52fa0a38517 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -8,15 +8,16 @@ class Y extends Z { //// [optionalParamInOverride.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Z = (function () { function Z() { } diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index 5a7bb5441dd..ed1b910241d 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -12,15 +12,16 @@ class D extends C { //// [optionalParameterProperty.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 867360fc49e..398978793c1 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -9,15 +9,16 @@ import {A} from "./ref/a"; export class B extends A { } //// [all.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define("ref/a", ["require", "exports"], function (require, exports) { "use strict"; var A = (function () { diff --git a/tests/baselines/reference/outModuleConcatAmd.js.map b/tests/baselines/reference/outModuleConcatAmd.js.map index 937bec93969..a95ca740a61 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js.map +++ b/tests/baselines/reference/outModuleConcatAmd.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAL,cAAC;;;;ICAd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;IACA;QAAA;QAAiB,CAAC;QAAD,QAAC;IAAD,CAAC,AAAlB,IAAkB;IAAL,cAAC;;;;ICAd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index ef5e9e9dcab..f220eb3e0ed 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -8,15 +8,16 @@ sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- ->>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>define("ref/a", ["require", "exports"], function (require, exports) { >>> "use strict"; >>> var A = (function () { @@ -24,13 +25,13 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(12, 5) Source(2, 1) + SourceIndex(0) +1 >Emitted(13, 5) Source(2, 1) + SourceIndex(0) --- >>> function A() { 1->^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(13, 9) Source(2, 1) + SourceIndex(0) +1->Emitted(14, 9) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^^^^^ @@ -38,16 +39,16 @@ sourceFile:tests/cases/compiler/ref/a.ts 3 > ^^^^^^^^^-> 1->export class A { 2 > } -1->Emitted(14, 9) Source(2, 18) + SourceIndex(0) -2 >Emitted(14, 10) Source(2, 19) + SourceIndex(0) +1->Emitted(15, 9) Source(2, 18) + SourceIndex(0) +2 >Emitted(15, 10) Source(2, 19) + SourceIndex(0) --- >>> return A; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(15, 9) Source(2, 18) + SourceIndex(0) -2 >Emitted(15, 17) Source(2, 19) + SourceIndex(0) +1->Emitted(16, 9) Source(2, 18) + SourceIndex(0) +2 >Emitted(16, 17) Source(2, 19) + SourceIndex(0) --- >>> }()); 1 >^^^^ @@ -59,18 +60,18 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > } 3 > 4 > export class A { } -1 >Emitted(16, 5) Source(2, 18) + SourceIndex(0) -2 >Emitted(16, 6) Source(2, 19) + SourceIndex(0) -3 >Emitted(16, 6) Source(2, 1) + SourceIndex(0) -4 >Emitted(16, 10) Source(2, 19) + SourceIndex(0) +1 >Emitted(17, 5) Source(2, 18) + SourceIndex(0) +2 >Emitted(17, 6) Source(2, 19) + SourceIndex(0) +3 >Emitted(17, 6) Source(2, 1) + SourceIndex(0) +4 >Emitted(17, 10) Source(2, 19) + SourceIndex(0) --- >>> exports.A = A; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > A -1->Emitted(17, 5) Source(2, 14) + SourceIndex(0) -2 >Emitted(17, 19) Source(2, 15) + SourceIndex(0) +1->Emitted(18, 5) Source(2, 14) + SourceIndex(0) +2 >Emitted(18, 19) Source(2, 15) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -84,21 +85,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(21, 5) Source(2, 1) + SourceIndex(1) +1 >Emitted(22, 5) Source(2, 1) + SourceIndex(1) --- >>> __extends(B, _super); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(22, 9) Source(2, 24) + SourceIndex(1) -2 >Emitted(22, 30) Source(2, 25) + SourceIndex(1) +1->Emitted(23, 9) Source(2, 24) + SourceIndex(1) +2 >Emitted(23, 30) Source(2, 25) + SourceIndex(1) --- >>> function B() { 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(23, 9) Source(2, 1) + SourceIndex(1) +1 >Emitted(24, 9) Source(2, 1) + SourceIndex(1) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -107,16 +108,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(25, 9) Source(2, 28) + SourceIndex(1) -2 >Emitted(25, 10) Source(2, 29) + SourceIndex(1) +1->Emitted(26, 9) Source(2, 28) + SourceIndex(1) +2 >Emitted(26, 10) Source(2, 29) + SourceIndex(1) --- >>> return B; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(26, 9) Source(2, 28) + SourceIndex(1) -2 >Emitted(26, 17) Source(2, 29) + SourceIndex(1) +1->Emitted(27, 9) Source(2, 28) + SourceIndex(1) +2 >Emitted(27, 17) Source(2, 29) + SourceIndex(1) --- >>> }(a_1.A)); 1 >^^^^ @@ -132,20 +133,20 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(27, 5) Source(2, 28) + SourceIndex(1) -2 >Emitted(27, 6) Source(2, 29) + SourceIndex(1) -3 >Emitted(27, 6) Source(2, 1) + SourceIndex(1) -4 >Emitted(27, 7) Source(2, 24) + SourceIndex(1) -5 >Emitted(27, 12) Source(2, 25) + SourceIndex(1) -6 >Emitted(27, 15) Source(2, 29) + SourceIndex(1) +1 >Emitted(28, 5) Source(2, 28) + SourceIndex(1) +2 >Emitted(28, 6) Source(2, 29) + SourceIndex(1) +3 >Emitted(28, 6) Source(2, 1) + SourceIndex(1) +4 >Emitted(28, 7) Source(2, 24) + SourceIndex(1) +5 >Emitted(28, 12) Source(2, 25) + SourceIndex(1) +6 >Emitted(28, 15) Source(2, 29) + SourceIndex(1) --- >>> exports.B = B; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > B -1->Emitted(28, 5) Source(2, 14) + SourceIndex(1) -2 >Emitted(28, 19) Source(2, 15) + SourceIndex(1) +1->Emitted(29, 5) Source(2, 14) + SourceIndex(1) +2 >Emitted(29, 19) Source(2, 15) + SourceIndex(1) --- >>>}); >>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index db9191cedf7..e5a1bd65cad 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -9,15 +9,16 @@ import {A} from "./ref/a"; export class B extends A { } //// [all.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); System.register("ref/a", [], function (exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; diff --git a/tests/baselines/reference/outModuleConcatSystem.js.map b/tests/baselines/reference/outModuleConcatSystem.js.map index 275b47b1363..25b706844e2 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js.map +++ b/tests/baselines/reference/outModuleConcatSystem.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;;gBAA2B,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;YACA;gBAAA;gBAAiB,CAAC;gBAAD,QAAC;YAAD,CAAC,AAAlB,IAAkB;;QAClB,CAAC;;;;;;;;;;;;;;YCDD;gBAAuB,qBAAC;gBAAxB;;gBAA2B,CAAC;gBAAD,QAAC;YAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;;QAAA,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index fa08e14d135..72b6bf09dd1 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -8,15 +8,16 @@ sources: tests/cases/compiler/ref/a.ts,tests/cases/compiler/b.ts emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- ->>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>System.register("ref/a", [], function (exports_1, context_1) { >>> "use strict"; >>> var __moduleName = context_1 && context_1.id; @@ -29,13 +30,13 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(17, 13) Source(2, 1) + SourceIndex(0) +1 >Emitted(18, 13) Source(2, 1) + SourceIndex(0) --- >>> function A() { 1->^^^^^^^^^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(18, 17) Source(2, 1) + SourceIndex(0) +1->Emitted(19, 17) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^^^^^^^^^^^^^ @@ -43,16 +44,16 @@ sourceFile:tests/cases/compiler/ref/a.ts 3 > ^^^^^^^^^-> 1->export class A { 2 > } -1->Emitted(19, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(19, 18) Source(2, 19) + SourceIndex(0) +1->Emitted(20, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(20, 18) Source(2, 19) + SourceIndex(0) --- >>> return A; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(20, 17) Source(2, 18) + SourceIndex(0) -2 >Emitted(20, 25) Source(2, 19) + SourceIndex(0) +1->Emitted(21, 17) Source(2, 18) + SourceIndex(0) +2 >Emitted(21, 25) Source(2, 19) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -64,10 +65,10 @@ sourceFile:tests/cases/compiler/ref/a.ts 2 > } 3 > 4 > export class A { } -1 >Emitted(21, 13) Source(2, 18) + SourceIndex(0) -2 >Emitted(21, 14) Source(2, 19) + SourceIndex(0) -3 >Emitted(21, 14) Source(2, 1) + SourceIndex(0) -4 >Emitted(21, 18) Source(2, 19) + SourceIndex(0) +1 >Emitted(22, 13) Source(2, 18) + SourceIndex(0) +2 >Emitted(22, 14) Source(2, 19) + SourceIndex(0) +3 >Emitted(22, 14) Source(2, 1) + SourceIndex(0) +4 >Emitted(22, 18) Source(2, 19) + SourceIndex(0) --- >>> exports_1("A", A); >>> } @@ -76,8 +77,8 @@ sourceFile:tests/cases/compiler/ref/a.ts 1-> > 2 > -1->Emitted(23, 9) Source(3, 1) + SourceIndex(0) -2 >Emitted(23, 10) Source(3, 2) + SourceIndex(0) +1->Emitted(24, 9) Source(3, 1) + SourceIndex(0) +2 >Emitted(24, 10) Source(3, 2) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -101,21 +102,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(37, 13) Source(2, 1) + SourceIndex(1) +1 >Emitted(38, 13) Source(2, 1) + SourceIndex(1) --- >>> __extends(B, _super); 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(38, 17) Source(2, 24) + SourceIndex(1) -2 >Emitted(38, 38) Source(2, 25) + SourceIndex(1) +1->Emitted(39, 17) Source(2, 24) + SourceIndex(1) +2 >Emitted(39, 38) Source(2, 25) + SourceIndex(1) --- >>> function B() { 1 >^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(39, 17) Source(2, 1) + SourceIndex(1) +1 >Emitted(40, 17) Source(2, 1) + SourceIndex(1) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -124,16 +125,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(41, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(41, 18) Source(2, 29) + SourceIndex(1) +1->Emitted(42, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(42, 18) Source(2, 29) + SourceIndex(1) --- >>> return B; 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(42, 17) Source(2, 28) + SourceIndex(1) -2 >Emitted(42, 25) Source(2, 29) + SourceIndex(1) +1->Emitted(43, 17) Source(2, 28) + SourceIndex(1) +2 >Emitted(43, 25) Source(2, 29) + SourceIndex(1) --- >>> }(a_1.A)); 1 >^^^^^^^^^^^^ @@ -149,12 +150,12 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(43, 13) Source(2, 28) + SourceIndex(1) -2 >Emitted(43, 14) Source(2, 29) + SourceIndex(1) -3 >Emitted(43, 14) Source(2, 1) + SourceIndex(1) -4 >Emitted(43, 15) Source(2, 24) + SourceIndex(1) -5 >Emitted(43, 20) Source(2, 25) + SourceIndex(1) -6 >Emitted(43, 23) Source(2, 29) + SourceIndex(1) +1 >Emitted(44, 13) Source(2, 28) + SourceIndex(1) +2 >Emitted(44, 14) Source(2, 29) + SourceIndex(1) +3 >Emitted(44, 14) Source(2, 1) + SourceIndex(1) +4 >Emitted(44, 15) Source(2, 24) + SourceIndex(1) +5 >Emitted(44, 20) Source(2, 25) + SourceIndex(1) +6 >Emitted(44, 23) Source(2, 29) + SourceIndex(1) --- >>> exports_2("B", B); >>> } @@ -162,8 +163,8 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^ 1-> 2 > -1->Emitted(45, 9) Source(2, 29) + SourceIndex(1) -2 >Emitted(45, 10) Source(2, 30) + SourceIndex(1) +1->Emitted(46, 9) Source(2, 29) + SourceIndex(1) +2 >Emitted(46, 10) Source(2, 30) + SourceIndex(1) --- >>> }; >>>}); diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index d8b543ef727..8308f58cc99 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -31,15 +31,16 @@ export class B extends A { } //// [all.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js.map b/tests/baselines/reference/outModuleTripleSlashRefs.js.map index cb10515edd2..e91088c249c 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js.map +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js.map @@ -1,2 +1,2 @@ //// [all.js.map] -{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFY,cAAC;;;;ICDd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file +{"version":3,"file":"all.js","sourceRoot":"","sources":["tests/cases/compiler/ref/b.ts","tests/cases/compiler/ref/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,iCAAiC;AACjC;IAAA;IAEA,CAAC;IAAD,UAAC;AAAD,CAAC,AAFD,IAEC;;;ICFD,+BAA+B;IAC/B;QAAA;QAEA,CAAC;QAAD,QAAC;IAAD,CAAC,AAFD,IAEC;IAFY,cAAC;;;;ICDd;QAAuB,qBAAC;QAAxB;;QAA2B,CAAC;QAAD,QAAC;IAAD,CAAC,AAA5B,CAAuB,KAAC,GAAI;IAAf,cAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index f035719a690..102664ea71a 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -8,35 +8,36 @@ sources: tests/cases/compiler/ref/b.ts,tests/cases/compiler/ref/a.ts,tests/cases emittedFile:all.js sourceFile:tests/cases/compiler/ref/b.ts ------------------------------------------------------------------- ->>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>/// 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > 2 >/// -1 >Emitted(10, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(10, 34) Source(1, 34) + SourceIndex(0) +1 >Emitted(11, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(0) --- >>>var Foo = (function () { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(11, 1) Source(2, 1) + SourceIndex(0) +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(0) --- >>> function Foo() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(12, 5) Source(2, 1) + SourceIndex(0) +1->Emitted(13, 5) Source(2, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -46,16 +47,16 @@ sourceFile:tests/cases/compiler/ref/b.ts > member: Bar; > 2 > } -1->Emitted(13, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(13, 6) Source(4, 2) + SourceIndex(0) +1->Emitted(14, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(14, 6) Source(4, 2) + SourceIndex(0) --- >>> return Foo; 1->^^^^ 2 > ^^^^^^^^^^ 1-> 2 > } -1->Emitted(14, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(14, 15) Source(4, 2) + SourceIndex(0) +1->Emitted(15, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(15, 15) Source(4, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -69,10 +70,10 @@ sourceFile:tests/cases/compiler/ref/b.ts 4 > class Foo { > member: Bar; > } -1 >Emitted(15, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(15, 2) Source(4, 2) + SourceIndex(0) -3 >Emitted(15, 2) Source(2, 1) + SourceIndex(0) -4 >Emitted(15, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(16, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(16, 2) Source(4, 2) + SourceIndex(0) +3 >Emitted(16, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(16, 6) Source(4, 2) + SourceIndex(0) --- ------------------------------------------------------------------- emittedFile:all.js @@ -86,21 +87,21 @@ sourceFile:tests/cases/compiler/ref/a.ts 1-> > 2 > /// -1->Emitted(18, 5) Source(2, 1) + SourceIndex(1) -2 >Emitted(18, 36) Source(2, 32) + SourceIndex(1) +1->Emitted(19, 5) Source(2, 1) + SourceIndex(1) +2 >Emitted(19, 36) Source(2, 32) + SourceIndex(1) --- >>> var A = (function () { 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(19, 5) Source(3, 1) + SourceIndex(1) +1 >Emitted(20, 5) Source(3, 1) + SourceIndex(1) --- >>> function A() { 1->^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(20, 9) Source(3, 1) + SourceIndex(1) +1->Emitted(21, 9) Source(3, 1) + SourceIndex(1) --- >>> } 1->^^^^^^^^ @@ -110,16 +111,16 @@ sourceFile:tests/cases/compiler/ref/a.ts > member: typeof GlobalFoo; > 2 > } -1->Emitted(21, 9) Source(5, 1) + SourceIndex(1) -2 >Emitted(21, 10) Source(5, 2) + SourceIndex(1) +1->Emitted(22, 9) Source(5, 1) + SourceIndex(1) +2 >Emitted(22, 10) Source(5, 2) + SourceIndex(1) --- >>> return A; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(22, 9) Source(5, 1) + SourceIndex(1) -2 >Emitted(22, 17) Source(5, 2) + SourceIndex(1) +1->Emitted(23, 9) Source(5, 1) + SourceIndex(1) +2 >Emitted(23, 17) Source(5, 2) + SourceIndex(1) --- >>> }()); 1 >^^^^ @@ -133,18 +134,18 @@ sourceFile:tests/cases/compiler/ref/a.ts 4 > export class A { > member: typeof GlobalFoo; > } -1 >Emitted(23, 5) Source(5, 1) + SourceIndex(1) -2 >Emitted(23, 6) Source(5, 2) + SourceIndex(1) -3 >Emitted(23, 6) Source(3, 1) + SourceIndex(1) -4 >Emitted(23, 10) Source(5, 2) + SourceIndex(1) +1 >Emitted(24, 5) Source(5, 1) + SourceIndex(1) +2 >Emitted(24, 6) Source(5, 2) + SourceIndex(1) +3 >Emitted(24, 6) Source(3, 1) + SourceIndex(1) +4 >Emitted(24, 10) Source(5, 2) + SourceIndex(1) --- >>> exports.A = A; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > A -1->Emitted(24, 5) Source(3, 14) + SourceIndex(1) -2 >Emitted(24, 19) Source(3, 15) + SourceIndex(1) +1->Emitted(25, 5) Source(3, 14) + SourceIndex(1) +2 >Emitted(25, 19) Source(3, 15) + SourceIndex(1) --- ------------------------------------------------------------------- emittedFile:all.js @@ -158,21 +159,21 @@ sourceFile:tests/cases/compiler/b.ts 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >import {A} from "./ref/a"; > -1 >Emitted(28, 5) Source(2, 1) + SourceIndex(2) +1 >Emitted(29, 5) Source(2, 1) + SourceIndex(2) --- >>> __extends(B, _super); 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^ 1->export class B extends 2 > A -1->Emitted(29, 9) Source(2, 24) + SourceIndex(2) -2 >Emitted(29, 30) Source(2, 25) + SourceIndex(2) +1->Emitted(30, 9) Source(2, 24) + SourceIndex(2) +2 >Emitted(30, 30) Source(2, 25) + SourceIndex(2) --- >>> function B() { 1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(30, 9) Source(2, 1) + SourceIndex(2) +1 >Emitted(31, 9) Source(2, 1) + SourceIndex(2) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -181,16 +182,16 @@ sourceFile:tests/cases/compiler/b.ts 3 > ^^^^^^^^^-> 1->export class B extends A { 2 > } -1->Emitted(32, 9) Source(2, 28) + SourceIndex(2) -2 >Emitted(32, 10) Source(2, 29) + SourceIndex(2) +1->Emitted(33, 9) Source(2, 28) + SourceIndex(2) +2 >Emitted(33, 10) Source(2, 29) + SourceIndex(2) --- >>> return B; 1->^^^^^^^^ 2 > ^^^^^^^^ 1-> 2 > } -1->Emitted(33, 9) Source(2, 28) + SourceIndex(2) -2 >Emitted(33, 17) Source(2, 29) + SourceIndex(2) +1->Emitted(34, 9) Source(2, 28) + SourceIndex(2) +2 >Emitted(34, 17) Source(2, 29) + SourceIndex(2) --- >>> }(a_1.A)); 1 >^^^^ @@ -206,20 +207,20 @@ sourceFile:tests/cases/compiler/b.ts 4 > export class B extends 5 > A 6 > { } -1 >Emitted(34, 5) Source(2, 28) + SourceIndex(2) -2 >Emitted(34, 6) Source(2, 29) + SourceIndex(2) -3 >Emitted(34, 6) Source(2, 1) + SourceIndex(2) -4 >Emitted(34, 7) Source(2, 24) + SourceIndex(2) -5 >Emitted(34, 12) Source(2, 25) + SourceIndex(2) -6 >Emitted(34, 15) Source(2, 29) + SourceIndex(2) +1 >Emitted(35, 5) Source(2, 28) + SourceIndex(2) +2 >Emitted(35, 6) Source(2, 29) + SourceIndex(2) +3 >Emitted(35, 6) Source(2, 1) + SourceIndex(2) +4 >Emitted(35, 7) Source(2, 24) + SourceIndex(2) +5 >Emitted(35, 12) Source(2, 25) + SourceIndex(2) +6 >Emitted(35, 15) Source(2, 29) + SourceIndex(2) --- >>> exports.B = B; 1->^^^^ 2 > ^^^^^^^^^^^^^^ 1-> 2 > B -1->Emitted(35, 5) Source(2, 14) + SourceIndex(2) -2 >Emitted(35, 19) Source(2, 15) + SourceIndex(2) +1->Emitted(36, 5) Source(2, 14) + SourceIndex(2) +2 >Emitted(36, 19) Source(2, 15) + SourceIndex(2) --- >>>}); >>>//# sourceMappingURL=all.js.map \ No newline at end of file diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index c4f19ef0ed7..e73c84abb14 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -40,15 +40,16 @@ var v=x.g; //// [overload1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var O; (function (O) { var A = (function () { diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index 0888083df42..18d16ef9913 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -23,15 +23,16 @@ class D implements MyDoc { } //// [overloadOnConstConstraintChecks1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index ab91c99f6ff..f78ed9a7d50 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -12,15 +12,16 @@ function foo(name: any): A { } //// [overloadOnConstConstraintChecks2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index d6d4ce137e6..b26d1067f55 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -13,15 +13,16 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { this.x = 1; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index 53b6b904997..db2d6e9adba 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -14,15 +14,16 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Z = (function () { function Z() { } diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index 0400ee2bb88..438c41fa8bd 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -12,15 +12,16 @@ function foo(name: "DIV"): Derived2 { foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 4b026d8c062..24de1599796 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -95,15 +95,16 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SomeBase = (function () { function SomeBase() { } diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index dcacbc4f9ec..5f81c47c9ff 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -102,15 +102,16 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SomeBase = (function () { function SomeBase() { } diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 89953cb378a..02cc668c64d 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -103,15 +103,16 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SomeBase = (function () { function SomeBase() { } diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index 981ad6358a0..606d4aa674c 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -26,15 +26,16 @@ var htmlDivElement2: Derived1 = d2.createElement("div"); var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 4afdf483f2a..7beb3662ff1 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -28,15 +28,16 @@ var e: E = bar("bye", []); // E var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.x = 1; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index 8372f54c40c..b5bfa6ac627 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -8,15 +8,16 @@ class Derived2 extends Base2 { } //// [overridingPrivateStaticMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base2 = (function () { function Base2() { } diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index 7a29c55629a..293309025fe 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -3,15 +3,16 @@ class C extends A # { } //// [parseErrorInHeritageClause1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index d95819d1e45..482a078f3d1 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -7,15 +7,16 @@ class Any extends Type { //// [parser509630.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Type = (function () { function Type() { this.examples = []; // typing here diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index de26b5b2b3b..fd9c5822dd8 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -220,15 +220,16 @@ class c6 extends c5 { } //// [parserAstSpans1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var c1 = (function () { function c1() { } diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 47c15c9f6bf..5b8ea6c183a 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -3,15 +3,16 @@ class C extends A extends B { } //// [parserClassDeclaration1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index 4dd54e974cb..a419598461f 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -3,15 +3,16 @@ class C implements A extends B { } //// [parserClassDeclaration3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index 4e3c3e84243..6ed902beed0 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -3,15 +3,16 @@ class C extends A implements B extends C { } //// [parserClassDeclaration4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index e5ae42ec1eb..a8e54191fee 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -3,15 +3,16 @@ class C extends A implements B implements C { } //// [parserClassDeclaration5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index eb698fd236f..648213d1516 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -3,15 +3,16 @@ class C extends A, B { } //// [parserClassDeclaration6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index d45ef8894b0..5cd993caf70 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -3,15 +3,16 @@ class C extends A, { } //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index f69ce2ad600..9d5b0393218 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -3,15 +3,16 @@ class C extends A implements { } //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index ec6a0479169..010eace1920 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -3,15 +3,16 @@ class C extends A, implements B, { } //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index 69e53b2974d..f85f5b6fd1a 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -18,15 +18,16 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index ac24d025b84..1491fd37b5f 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -18,15 +18,16 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index ea095e52c69..d2e8c5ff1f7 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -458,15 +458,16 @@ module TypeScript { //// [parserRealSource10.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var TypeScript; (function (TypeScript) { diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 9f4f4fc2f70..0e39573238c 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2367,15 +2367,16 @@ module TypeScript { //// [parserRealSource11.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var TypeScript; (function (TypeScript) { diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 16fe9508c2a..f173052a112 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2096,15 +2096,16 @@ module Harness { // See the License for the specific language governing permissions and // limitations under the License. // -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// /// /// diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index 1c666d92c9d..0d1097b4773 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -16,15 +16,16 @@ testError((t1, t2, t3: D) => {}) //// [partiallyAnnotatedFunctionInferenceError.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index b43a5a5a2c9..c55721cb647 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -35,15 +35,16 @@ testRest((t2, ...t3: D[]) => {}) //// [partiallyAnnotatedFunctionInferenceWithTypeParameter.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 4c00a4fb3ea..6ef048203ae 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -32,15 +32,16 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x = 5; var r = /yo/; r.source; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index be90775cf0b..07ea7691ac2 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -129,15 +129,16 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo //// [privacyClass.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var m1; (function (m1) { var m1_c_public = (function () { diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index 1802f61717c..c1b219a3eaf 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -99,15 +99,16 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var publicModule; (function (publicModule) { var publicClassInPublicModule = (function () { @@ -289,15 +290,16 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { }(privateModule.publicClassInPrivateModule)); exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var publicModuleInGlobal; (function (publicModuleInGlobal) { var publicClassInPublicModule = (function () { diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index d74a59d5ac2..9698b1a0977 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -61,15 +61,16 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var m1; (function (m1) { var m1_c_public = (function () { diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index bbdcd5a4338..0f02de4ad4d 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -10,15 +10,16 @@ class D extends Base { } //// [privateAccessInSubclass1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index d1efc894fc3..5f9a857269e 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -14,15 +14,16 @@ class Derived extends Base { } //// [privateInstanceMemberAccessibility.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index 6f9b717888d..f9d4fe56c39 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -22,15 +22,16 @@ let { priv: a, prot: b, privateMethod: f } = k; // error //// [privateProtectedMembersAreNotAccessibleDestructuring.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var K = (function () { function K() { } diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 319f4fac001..548b08b9b92 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -9,15 +9,16 @@ class Derived extends Base { } //// [privateStaticMemberAccessibility.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index 974dcb477f5..a4171441430 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -16,15 +16,16 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 3ab7685aec4..26700d01d59 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,12 +1,13 @@ -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var m2; (function (m2) { m2.c1 = new m2.mExported.me.class1; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 3ab7685aec4..26700d01d59 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,12 +1,13 @@ -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var m2; (function (m2) { m2.c1 = new m2.mExported.me.class1; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 08697664279..5d13ff191f0 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,12 +1,13 @@ -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; // Add a lambda to ensure global 'this' capture is triggered (function () { return _this.window; }); diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 08697664279..5d13ff191f0 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,12 +1,13 @@ -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; // Add a lambda to ensure global 'this' capture is triggered (function () { return _this.window; }); diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index dd192c40863..859117be880 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,13 +1,14 @@ /// -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index dd192c40863..859117be880 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,13 +1,14 @@ /// -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 87f12dd7242..9ea39c60dfb 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -52,15 +52,16 @@ var c: { }; //// [propertiesAndIndexers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var P = (function () { function P() { } diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 89c6ed0efe9..4a3910e8594 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -151,15 +151,16 @@ var x3: A; //// [propertyAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 346024cf470..665550081b3 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -83,15 +83,16 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index c4d0a8e8ac4..a79ba9ed75c 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -58,15 +58,16 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 4d677b85396..41de2d8c0e0 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -45,15 +45,16 @@ var b = { var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't matter //// [propertyAccessOnTypeParameterWithConstraints5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index e0a051b3096..a94af12901d 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -39,15 +39,16 @@ class E extends C { } //// [protectedClassPropertyAccessibleWithinNestedSubclass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index 26d42b7b658..d26f70b75bd 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -115,15 +115,16 @@ d3.x; // Error, neither within their declaring class nor class d4.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index af3440f9fb8..330f73bca19 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -21,15 +21,16 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index ba4c9f079f8..cbde651add9 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -95,15 +95,16 @@ d3.x; // Error, neither within their declaring class nor class d4.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedClassPropertyAccessibleWithinSubclass2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 8b45c46ec83..a2cb66b2997 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -14,15 +14,16 @@ class Derived extends Base { } //// [protectedClassPropertyAccessibleWithinSubclass3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index 682ff897e52..abe608b1ed4 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -45,15 +45,16 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index f0553d72184..689d11be3c3 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -116,15 +116,16 @@ class B3 extends A3 { //// [protectedMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Class with protected members var C1 = (function () { function C1() { diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index 76bb5d10455..f681073d629 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -44,15 +44,16 @@ Derived2.x; // Error, neither within their declaring class nor classes deriv Derived3.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index f694c9f301d..3096ea6aa3c 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -22,15 +22,16 @@ class Derived2 extends Derived1 { } //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index 11c49dbb28d..96df9d1d85b 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -7,15 +7,16 @@ class Beta extends Alpha.x { } //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Alpha; (function (Alpha) { Alpha.x = 100; diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index eb268d9aafe..42f88abcf54 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -41,15 +41,16 @@ class E extends D { //// [readonlyConstructorAssignment.js] // Tests that readonly parameter properties behave like regular readonly properties -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(x) { this.x = x; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index 435f87a6b1a..3e2cbcee520 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -5,15 +5,16 @@ class C extends A { } (new C).blah; //// [recursiveBaseCheck3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function (_super) { __extends(A, _super); function A() { diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index 5790cabf7d8..5bcf5bb63a7 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -3,15 +3,16 @@ class M extends M { } (new M).blah; //// [recursiveBaseCheck4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M = (function (_super) { __extends(M, _super); function M() { diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index c9a7d685322..7c5134c397c 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -3,15 +3,16 @@ class S18 extends S18<{ S19: A; }>{ } (new S18()).blah; //// [recursiveBaseCheck6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var S18 = (function (_super) { __extends(S18, _super); function S18() { diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index b62f9f6622f..0caeb0b3b67 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -7,15 +7,16 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 5c5d01c453d..2b0c30072dc 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -10,15 +10,16 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var a = new TypeScript2.MemberNameArray(); var TypeScript2; (function (TypeScript2) { diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index e03965b23ea..8469935d13b 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -105,15 +105,16 @@ module Sample.Thing.Languages.PlainText { //// [recursiveClassReferenceTest.js] // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Sample; (function (Sample) { var Actions; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index f322d6f0510..b27f18ddffa 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;;oBAQA,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAAC,IAAA,OAAO,CAUpB;IAVa,WAAA,OAAO;QAAC,IAAA,KAAK,CAU1B;QAVqB,WAAA,OAAK;YAAC,IAAA,IAAI,CAU/B;YAV2B,WAAA,IAAI;gBAC/B;oBAAA;oBAQA,CAAC;oBANO,+BAAK,GAAZ,cAAiB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAExB,6BAAG,GAAV,UAAW,KAA6B;wBAEvC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBACF,sBAAC;gBAAD,CAAC,AARD,IAQC;gBARY,oBAAe,kBAQ3B,CAAA;YACF,CAAC,EAV2B,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAU/B;QAAD,CAAC,EAVqB,KAAK,GAAL,aAAK,KAAL,aAAK,QAU1B;IAAD,CAAC,EAVa,OAAO,GAAP,cAAO,KAAP,cAAO,QAUpB;AAAD,CAAC,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,WAAO,MAAM;IAAC,IAAA,KAAK,CAoBlB;IApBa,WAAA,KAAK;QAAC,IAAA,OAAO,CAoB1B;QApBmB,WAAA,OAAO;YAC1B;gBAKC,oBAAoB,SAAkC;oBAAlC,cAAS,GAAT,SAAS,CAAyB;oBAD9C,YAAO,GAAO,IAAI,CAAC;oBAEvB,aAAa;oBACb,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBANM,wBAAG,GAAV,UAAW,MAAyC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAAA,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAAA,CAAC,CAAA,CAAC;gBAQlF,+BAAU,GAAjB;oBACC,MAAM,CAAC,OAAO,CAAC;gBAChB,CAAC;gBAEM,4BAAO,GAAd;gBAEA,CAAC;gBAEF,iBAAC;YAAD,CAAC,AAlBD,IAkBC;YAlBY,kBAAU,aAkBtB,CAAA;QACF,CAAC,EApBmB,OAAO,GAAP,aAAO,KAAP,aAAO,QAoB1B;IAAD,CAAC,EApBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAoBlB;AAAD,CAAC,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD;IAAA;IAAuF,CAAC;IAA3C,sCAAe,GAAtB,cAAmC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC;IAAC,mBAAC;AAAD,CAAC,AAAxF,IAAwF;AASxF,WAAO,MAAM;IAAC,IAAA,KAAK,CAwBlB;IAxBa,WAAA,KAAK;QAAC,IAAA,SAAS,CAwB5B;QAxBmB,WAAA,SAAS;YAAC,IAAA,SAAS,CAwBtC;YAxB6B,WAAA,SAAS;gBAEtC;oBACO,eAAoB,IAAW;wBAAX,SAAI,GAAJ,IAAI,CAAO;oBAAI,CAAC;oBACnC,qBAAK,GAAZ;wBACC,MAAM,CAAC,IAAI,CAAC;oBACb,CAAC;oBAEM,sBAAM,GAAb,UAAc,KAAY;wBACzB,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;oBACvB,CAAC;oBAEM,uBAAO,GAAd,cAA0B,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBACzC,YAAC;gBAAD,CAAC,AAXD,IAWC;gBAXY,eAAK,QAWjB,CAAA;gBAED;oBAA0B,wBAAY;oBAAtC;;oBAQA,CAAC;oBANA,aAAa;oBACN,8BAAe,GAAtB;wBACC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,CAAC;oBAGF,WAAC;gBAAD,CAAC,AARD,CAA0B,YAAY,GAQrC;gBARY,cAAI,OAQhB,CAAA;YACF,CAAC,EAxB6B,SAAS,GAAT,mBAAS,KAAT,mBAAS,QAwBtC;QAAD,CAAC,EAxBmB,SAAS,GAAT,eAAS,KAAT,eAAS,QAwB5B;IAAD,CAAC,EAxBa,KAAK,GAAL,YAAK,KAAL,YAAK,QAwBlB;AAAD,CAAC,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index d8a6d74f0a8..c1c48650241 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -26,15 +26,16 @@ sourceFile:recursiveClassReferenceTest.ts 1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- ->>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>var Sample; 1 > 2 >^^^^ @@ -85,10 +86,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(12, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(12, 5) Source(32, 8) + SourceIndex(0) -3 >Emitted(12, 11) Source(32, 14) + SourceIndex(0) -4 >Emitted(12, 12) Source(42, 2) + SourceIndex(0) +1 >Emitted(13, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(13, 5) Source(32, 8) + SourceIndex(0) +3 >Emitted(13, 11) Source(32, 14) + SourceIndex(0) +4 >Emitted(13, 12) Source(42, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -97,9 +98,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(13, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(13, 12) Source(32, 8) + SourceIndex(0) -3 >Emitted(13, 18) Source(32, 14) + SourceIndex(0) +1->Emitted(14, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(14, 12) Source(32, 8) + SourceIndex(0) +3 >Emitted(14, 18) Source(32, 14) + SourceIndex(0) --- >>> var Actions; 1 >^^^^ @@ -121,10 +122,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(14, 5) Source(32, 15) + SourceIndex(0) -2 >Emitted(14, 9) Source(32, 15) + SourceIndex(0) -3 >Emitted(14, 16) Source(32, 22) + SourceIndex(0) -4 >Emitted(14, 17) Source(42, 2) + SourceIndex(0) +1 >Emitted(15, 5) Source(32, 15) + SourceIndex(0) +2 >Emitted(15, 9) Source(32, 15) + SourceIndex(0) +3 >Emitted(15, 16) Source(32, 22) + SourceIndex(0) +4 >Emitted(15, 17) Source(42, 2) + SourceIndex(0) --- >>> (function (Actions) { 1->^^^^ @@ -133,9 +134,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Actions -1->Emitted(15, 5) Source(32, 15) + SourceIndex(0) -2 >Emitted(15, 16) Source(32, 15) + SourceIndex(0) -3 >Emitted(15, 23) Source(32, 22) + SourceIndex(0) +1->Emitted(16, 5) Source(32, 15) + SourceIndex(0) +2 >Emitted(16, 16) Source(32, 15) + SourceIndex(0) +3 >Emitted(16, 23) Source(32, 22) + SourceIndex(0) --- >>> var Thing; 1 >^^^^^^^^ @@ -157,10 +158,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(16, 9) Source(32, 23) + SourceIndex(0) -2 >Emitted(16, 13) Source(32, 23) + SourceIndex(0) -3 >Emitted(16, 18) Source(32, 28) + SourceIndex(0) -4 >Emitted(16, 19) Source(42, 2) + SourceIndex(0) +1 >Emitted(17, 9) Source(32, 23) + SourceIndex(0) +2 >Emitted(17, 13) Source(32, 23) + SourceIndex(0) +3 >Emitted(17, 18) Source(32, 28) + SourceIndex(0) +4 >Emitted(17, 19) Source(42, 2) + SourceIndex(0) --- >>> (function (Thing_1) { 1->^^^^^^^^ @@ -169,9 +170,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(17, 9) Source(32, 23) + SourceIndex(0) -2 >Emitted(17, 20) Source(32, 23) + SourceIndex(0) -3 >Emitted(17, 27) Source(32, 28) + SourceIndex(0) +1->Emitted(18, 9) Source(32, 23) + SourceIndex(0) +2 >Emitted(18, 20) Source(32, 23) + SourceIndex(0) +3 >Emitted(18, 27) Source(32, 28) + SourceIndex(0) --- >>> var Find; 1 >^^^^^^^^^^^^ @@ -193,10 +194,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(18, 13) Source(32, 29) + SourceIndex(0) -2 >Emitted(18, 17) Source(32, 29) + SourceIndex(0) -3 >Emitted(18, 21) Source(32, 33) + SourceIndex(0) -4 >Emitted(18, 22) Source(42, 2) + SourceIndex(0) +1 >Emitted(19, 13) Source(32, 29) + SourceIndex(0) +2 >Emitted(19, 17) Source(32, 29) + SourceIndex(0) +3 >Emitted(19, 21) Source(32, 33) + SourceIndex(0) +4 >Emitted(19, 22) Source(42, 2) + SourceIndex(0) --- >>> (function (Find) { 1->^^^^^^^^^^^^ @@ -206,22 +207,22 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Find -1->Emitted(19, 13) Source(32, 29) + SourceIndex(0) -2 >Emitted(19, 24) Source(32, 29) + SourceIndex(0) -3 >Emitted(19, 28) Source(32, 33) + SourceIndex(0) +1->Emitted(20, 13) Source(32, 29) + SourceIndex(0) +2 >Emitted(20, 24) Source(32, 29) + SourceIndex(0) +3 >Emitted(20, 28) Source(32, 33) + SourceIndex(0) --- >>> var StartFindAction = (function () { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > -1->Emitted(20, 17) Source(33, 2) + SourceIndex(0) +1->Emitted(21, 17) Source(33, 2) + SourceIndex(0) --- >>> function StartFindAction() { 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^-> 1-> -1->Emitted(21, 21) Source(33, 2) + SourceIndex(0) +1->Emitted(22, 21) Source(33, 2) + SourceIndex(0) --- >>> } 1->^^^^^^^^^^^^^^^^^^^^ @@ -237,8 +238,8 @@ sourceFile:recursiveClassReferenceTest.ts > } > 2 > } -1->Emitted(22, 21) Source(41, 2) + SourceIndex(0) -2 >Emitted(22, 22) Source(41, 3) + SourceIndex(0) +1->Emitted(23, 21) Source(41, 2) + SourceIndex(0) +2 >Emitted(23, 22) Source(41, 3) + SourceIndex(0) --- >>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ @@ -261,16 +262,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(23, 21) Source(35, 10) + SourceIndex(0) -2 >Emitted(23, 52) Source(35, 15) + SourceIndex(0) -3 >Emitted(23, 55) Source(35, 3) + SourceIndex(0) -4 >Emitted(23, 69) Source(35, 20) + SourceIndex(0) -5 >Emitted(23, 75) Source(35, 26) + SourceIndex(0) -6 >Emitted(23, 76) Source(35, 27) + SourceIndex(0) -7 >Emitted(23, 80) Source(35, 31) + SourceIndex(0) -8 >Emitted(23, 81) Source(35, 32) + SourceIndex(0) -9 >Emitted(23, 82) Source(35, 33) + SourceIndex(0) -10>Emitted(23, 83) Source(35, 34) + SourceIndex(0) +1->Emitted(24, 21) Source(35, 10) + SourceIndex(0) +2 >Emitted(24, 52) Source(35, 15) + SourceIndex(0) +3 >Emitted(24, 55) Source(35, 3) + SourceIndex(0) +4 >Emitted(24, 69) Source(35, 20) + SourceIndex(0) +5 >Emitted(24, 75) Source(35, 26) + SourceIndex(0) +6 >Emitted(24, 76) Source(35, 27) + SourceIndex(0) +7 >Emitted(24, 80) Source(35, 31) + SourceIndex(0) +8 >Emitted(24, 81) Source(35, 32) + SourceIndex(0) +9 >Emitted(24, 82) Source(35, 33) + SourceIndex(0) +10>Emitted(24, 83) Source(35, 34) + SourceIndex(0) --- >>> StartFindAction.prototype.run = function (Thing) { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -285,11 +286,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1 >Emitted(24, 21) Source(37, 10) + SourceIndex(0) -2 >Emitted(24, 50) Source(37, 13) + SourceIndex(0) -3 >Emitted(24, 53) Source(37, 3) + SourceIndex(0) -4 >Emitted(24, 63) Source(37, 14) + SourceIndex(0) -5 >Emitted(24, 68) Source(37, 43) + SourceIndex(0) +1 >Emitted(25, 21) Source(37, 10) + SourceIndex(0) +2 >Emitted(25, 50) Source(37, 13) + SourceIndex(0) +3 >Emitted(25, 53) Source(37, 3) + SourceIndex(0) +4 >Emitted(25, 63) Source(37, 14) + SourceIndex(0) +5 >Emitted(25, 68) Source(37, 43) + SourceIndex(0) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -304,11 +305,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(25, 25) Source(39, 4) + SourceIndex(0) -2 >Emitted(25, 31) Source(39, 10) + SourceIndex(0) -3 >Emitted(25, 32) Source(39, 11) + SourceIndex(0) -4 >Emitted(25, 36) Source(39, 15) + SourceIndex(0) -5 >Emitted(25, 37) Source(39, 16) + SourceIndex(0) +1 >Emitted(26, 25) Source(39, 4) + SourceIndex(0) +2 >Emitted(26, 31) Source(39, 10) + SourceIndex(0) +3 >Emitted(26, 32) Source(39, 11) + SourceIndex(0) +4 >Emitted(26, 36) Source(39, 15) + SourceIndex(0) +5 >Emitted(26, 37) Source(39, 16) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -317,8 +318,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(26, 21) Source(40, 3) + SourceIndex(0) -2 >Emitted(26, 22) Source(40, 4) + SourceIndex(0) +1 >Emitted(27, 21) Source(40, 3) + SourceIndex(0) +2 >Emitted(27, 22) Source(40, 4) + SourceIndex(0) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -326,8 +327,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(27, 21) Source(41, 2) + SourceIndex(0) -2 >Emitted(27, 43) Source(41, 3) + SourceIndex(0) +1->Emitted(28, 21) Source(41, 2) + SourceIndex(0) +2 >Emitted(28, 43) Source(41, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^^^^^ @@ -347,10 +348,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(28, 17) Source(41, 2) + SourceIndex(0) -2 >Emitted(28, 18) Source(41, 3) + SourceIndex(0) -3 >Emitted(28, 18) Source(33, 2) + SourceIndex(0) -4 >Emitted(28, 22) Source(41, 3) + SourceIndex(0) +1 >Emitted(29, 17) Source(41, 2) + SourceIndex(0) +2 >Emitted(29, 18) Source(41, 3) + SourceIndex(0) +3 >Emitted(29, 18) Source(33, 2) + SourceIndex(0) +4 >Emitted(29, 22) Source(41, 3) + SourceIndex(0) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -370,10 +371,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 4 > -1->Emitted(29, 17) Source(33, 15) + SourceIndex(0) -2 >Emitted(29, 37) Source(33, 30) + SourceIndex(0) -3 >Emitted(29, 55) Source(41, 3) + SourceIndex(0) -4 >Emitted(29, 56) Source(41, 3) + SourceIndex(0) +1->Emitted(30, 17) Source(33, 15) + SourceIndex(0) +2 >Emitted(30, 37) Source(33, 30) + SourceIndex(0) +3 >Emitted(30, 55) Source(41, 3) + SourceIndex(0) +4 >Emitted(30, 56) Source(41, 3) + SourceIndex(0) --- >>> })(Find = Thing_1.Find || (Thing_1.Find = {})); 1->^^^^^^^^^^^^ @@ -405,15 +406,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(30, 13) Source(42, 1) + SourceIndex(0) -2 >Emitted(30, 14) Source(42, 2) + SourceIndex(0) -3 >Emitted(30, 16) Source(32, 29) + SourceIndex(0) -4 >Emitted(30, 20) Source(32, 33) + SourceIndex(0) -5 >Emitted(30, 23) Source(32, 29) + SourceIndex(0) -6 >Emitted(30, 35) Source(32, 33) + SourceIndex(0) -7 >Emitted(30, 40) Source(32, 29) + SourceIndex(0) -8 >Emitted(30, 52) Source(32, 33) + SourceIndex(0) -9 >Emitted(30, 60) Source(42, 2) + SourceIndex(0) +1->Emitted(31, 13) Source(42, 1) + SourceIndex(0) +2 >Emitted(31, 14) Source(42, 2) + SourceIndex(0) +3 >Emitted(31, 16) Source(32, 29) + SourceIndex(0) +4 >Emitted(31, 20) Source(32, 33) + SourceIndex(0) +5 >Emitted(31, 23) Source(32, 29) + SourceIndex(0) +6 >Emitted(31, 35) Source(32, 33) + SourceIndex(0) +7 >Emitted(31, 40) Source(32, 29) + SourceIndex(0) +8 >Emitted(31, 52) Source(32, 33) + SourceIndex(0) +9 >Emitted(31, 60) Source(42, 2) + SourceIndex(0) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); 1 >^^^^^^^^ @@ -445,15 +446,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(31, 9) Source(42, 1) + SourceIndex(0) -2 >Emitted(31, 10) Source(42, 2) + SourceIndex(0) -3 >Emitted(31, 12) Source(32, 23) + SourceIndex(0) -4 >Emitted(31, 17) Source(32, 28) + SourceIndex(0) -5 >Emitted(31, 20) Source(32, 23) + SourceIndex(0) -6 >Emitted(31, 33) Source(32, 28) + SourceIndex(0) -7 >Emitted(31, 38) Source(32, 23) + SourceIndex(0) -8 >Emitted(31, 51) Source(32, 28) + SourceIndex(0) -9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) +1 >Emitted(32, 9) Source(42, 1) + SourceIndex(0) +2 >Emitted(32, 10) Source(42, 2) + SourceIndex(0) +3 >Emitted(32, 12) Source(32, 23) + SourceIndex(0) +4 >Emitted(32, 17) Source(32, 28) + SourceIndex(0) +5 >Emitted(32, 20) Source(32, 23) + SourceIndex(0) +6 >Emitted(32, 33) Source(32, 28) + SourceIndex(0) +7 >Emitted(32, 38) Source(32, 23) + SourceIndex(0) +8 >Emitted(32, 51) Source(32, 28) + SourceIndex(0) +9 >Emitted(32, 59) Source(42, 2) + SourceIndex(0) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -484,15 +485,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(32, 5) Source(42, 1) + SourceIndex(0) -2 >Emitted(32, 6) Source(42, 2) + SourceIndex(0) -3 >Emitted(32, 8) Source(32, 15) + SourceIndex(0) -4 >Emitted(32, 15) Source(32, 22) + SourceIndex(0) -5 >Emitted(32, 18) Source(32, 15) + SourceIndex(0) -6 >Emitted(32, 32) Source(32, 22) + SourceIndex(0) -7 >Emitted(32, 37) Source(32, 15) + SourceIndex(0) -8 >Emitted(32, 51) Source(32, 22) + SourceIndex(0) -9 >Emitted(32, 59) Source(42, 2) + SourceIndex(0) +1->Emitted(33, 5) Source(42, 1) + SourceIndex(0) +2 >Emitted(33, 6) Source(42, 2) + SourceIndex(0) +3 >Emitted(33, 8) Source(32, 15) + SourceIndex(0) +4 >Emitted(33, 15) Source(32, 22) + SourceIndex(0) +5 >Emitted(33, 18) Source(32, 15) + SourceIndex(0) +6 >Emitted(33, 32) Source(32, 22) + SourceIndex(0) +7 >Emitted(33, 37) Source(32, 15) + SourceIndex(0) +8 >Emitted(33, 51) Source(32, 22) + SourceIndex(0) +9 >Emitted(33, 59) Source(42, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -519,13 +520,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(33, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(33, 2) Source(42, 2) + SourceIndex(0) -3 >Emitted(33, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(33, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(33, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(33, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(33, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(34, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(34, 2) Source(42, 2) + SourceIndex(0) +3 >Emitted(34, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(34, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(34, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(34, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(34, 29) Source(42, 2) + SourceIndex(0) --- >>>(function (Sample) { 1 > @@ -536,9 +537,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >module 3 > Sample -1 >Emitted(34, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) +1 >Emitted(35, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(35, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(35, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -570,10 +571,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) -3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) -4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) +1 >Emitted(36, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(36, 9) Source(44, 15) + SourceIndex(0) +3 >Emitted(36, 14) Source(44, 20) + SourceIndex(0) +4 >Emitted(36, 15) Source(64, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -583,9 +584,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) -2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) -3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) +1->Emitted(37, 5) Source(44, 15) + SourceIndex(0) +2 >Emitted(37, 16) Source(44, 15) + SourceIndex(0) +3 >Emitted(37, 21) Source(44, 20) + SourceIndex(0) --- >>> var Widgets; 1->^^^^^^^^ @@ -617,10 +618,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) -3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) -4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) +1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(38, 13) Source(44, 21) + SourceIndex(0) +3 >Emitted(38, 20) Source(44, 28) + SourceIndex(0) +4 >Emitted(38, 21) Source(64, 2) + SourceIndex(0) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -630,16 +631,16 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Widgets -1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) -2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) -3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) +1->Emitted(39, 9) Source(44, 21) + SourceIndex(0) +2 >Emitted(39, 20) Source(44, 21) + SourceIndex(0) +3 >Emitted(39, 27) Source(44, 28) + SourceIndex(0) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > -1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) +1->Emitted(40, 13) Source(45, 2) + SourceIndex(0) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -654,9 +655,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > codeThing: Sample.Thing.ICodeThing -1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) -2 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) -3 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) +1->Emitted(41, 17) Source(50, 3) + SourceIndex(0) +2 >Emitted(41, 37) Source(50, 23) + SourceIndex(0) +3 >Emitted(41, 46) Source(50, 57) + SourceIndex(0) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -669,11 +670,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) -2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) -3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) -4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) -5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) +1->Emitted(42, 21) Source(50, 23) + SourceIndex(0) +2 >Emitted(42, 35) Source(50, 32) + SourceIndex(0) +3 >Emitted(42, 38) Source(50, 23) + SourceIndex(0) +4 >Emitted(42, 47) Source(50, 32) + SourceIndex(0) +5 >Emitted(42, 48) Source(50, 57) + SourceIndex(0) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -686,11 +687,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) -2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) -3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) -4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) -5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) +1 >Emitted(43, 21) Source(49, 11) + SourceIndex(0) +2 >Emitted(43, 33) Source(49, 18) + SourceIndex(0) +3 >Emitted(43, 36) Source(49, 25) + SourceIndex(0) +4 >Emitted(43, 40) Source(49, 29) + SourceIndex(0) +5 >Emitted(43, 41) Source(49, 30) + SourceIndex(0) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -700,8 +701,8 @@ sourceFile:recursiveClassReferenceTest.ts > constructor(private codeThing: Sample.Thing.ICodeThing) { > 2 > // scenario 1 -1 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) -2 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) +1 >Emitted(44, 21) Source(51, 7) + SourceIndex(0) +2 >Emitted(44, 34) Source(51, 20) + SourceIndex(0) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -725,16 +726,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) -2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) -3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) -4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) -5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) -6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) -7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) -8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) -9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) -10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) +1->Emitted(45, 21) Source(52, 7) + SourceIndex(0) +2 >Emitted(45, 30) Source(52, 16) + SourceIndex(0) +3 >Emitted(45, 31) Source(52, 17) + SourceIndex(0) +4 >Emitted(45, 40) Source(52, 26) + SourceIndex(0) +5 >Emitted(45, 41) Source(52, 27) + SourceIndex(0) +6 >Emitted(45, 52) Source(52, 38) + SourceIndex(0) +7 >Emitted(45, 54) Source(52, 40) + SourceIndex(0) +8 >Emitted(45, 58) Source(52, 44) + SourceIndex(0) +9 >Emitted(45, 59) Source(52, 45) + SourceIndex(0) +10>Emitted(45, 60) Source(52, 46) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^ @@ -743,8 +744,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) -2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) +1 >Emitted(46, 17) Source(53, 3) + SourceIndex(0) +2 >Emitted(46, 18) Source(53, 4) + SourceIndex(0) --- >>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ @@ -773,19 +774,19 @@ sourceFile:recursiveClassReferenceTest.ts 11> ) 12> 13> { -1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) -2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) -3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) -4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) -5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) -6 >Emitted(46, 64) Source(47, 59) + SourceIndex(0) -7 >Emitted(46, 66) Source(47, 61) + SourceIndex(0) -8 >Emitted(46, 67) Source(47, 62) + SourceIndex(0) -9 >Emitted(46, 68) Source(47, 63) + SourceIndex(0) -10>Emitted(46, 72) Source(47, 67) + SourceIndex(0) -11>Emitted(46, 73) Source(47, 68) + SourceIndex(0) -12>Emitted(46, 74) Source(47, 69) + SourceIndex(0) -13>Emitted(46, 75) Source(47, 70) + SourceIndex(0) +1->Emitted(47, 17) Source(47, 10) + SourceIndex(0) +2 >Emitted(47, 41) Source(47, 13) + SourceIndex(0) +3 >Emitted(47, 44) Source(47, 3) + SourceIndex(0) +4 >Emitted(47, 54) Source(47, 14) + SourceIndex(0) +5 >Emitted(47, 60) Source(47, 55) + SourceIndex(0) +6 >Emitted(47, 64) Source(47, 59) + SourceIndex(0) +7 >Emitted(47, 66) Source(47, 61) + SourceIndex(0) +8 >Emitted(47, 67) Source(47, 62) + SourceIndex(0) +9 >Emitted(47, 68) Source(47, 63) + SourceIndex(0) +10>Emitted(47, 72) Source(47, 67) + SourceIndex(0) +11>Emitted(47, 73) Source(47, 68) + SourceIndex(0) +12>Emitted(47, 74) Source(47, 69) + SourceIndex(0) +13>Emitted(47, 75) Source(47, 70) + SourceIndex(0) --- >>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ @@ -804,14 +805,14 @@ sourceFile:recursiveClassReferenceTest.ts 6 > this 7 > ) 8 > ; -1 >Emitted(47, 21) Source(47, 70) + SourceIndex(0) -2 >Emitted(47, 27) Source(47, 76) + SourceIndex(0) -3 >Emitted(47, 28) Source(47, 77) + SourceIndex(0) -4 >Emitted(47, 34) Source(47, 83) + SourceIndex(0) -5 >Emitted(47, 35) Source(47, 84) + SourceIndex(0) -6 >Emitted(47, 39) Source(47, 88) + SourceIndex(0) -7 >Emitted(47, 40) Source(47, 89) + SourceIndex(0) -8 >Emitted(47, 41) Source(47, 90) + SourceIndex(0) +1 >Emitted(48, 21) Source(47, 70) + SourceIndex(0) +2 >Emitted(48, 27) Source(47, 76) + SourceIndex(0) +3 >Emitted(48, 28) Source(47, 77) + SourceIndex(0) +4 >Emitted(48, 34) Source(47, 83) + SourceIndex(0) +5 >Emitted(48, 35) Source(47, 84) + SourceIndex(0) +6 >Emitted(48, 39) Source(47, 88) + SourceIndex(0) +7 >Emitted(48, 40) Source(47, 89) + SourceIndex(0) +8 >Emitted(48, 41) Source(47, 90) + SourceIndex(0) --- >>> } }; 1 >^^^^^^^^^^^^^^^^ @@ -823,10 +824,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > } 3 > 4 > } -1 >Emitted(48, 17) Source(47, 90) + SourceIndex(0) -2 >Emitted(48, 18) Source(47, 91) + SourceIndex(0) -3 >Emitted(48, 19) Source(47, 91) + SourceIndex(0) -4 >Emitted(48, 20) Source(47, 92) + SourceIndex(0) +1 >Emitted(49, 17) Source(47, 90) + SourceIndex(0) +2 >Emitted(49, 18) Source(47, 91) + SourceIndex(0) +3 >Emitted(49, 19) Source(47, 91) + SourceIndex(0) +4 >Emitted(49, 20) Source(47, 92) + SourceIndex(0) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -843,9 +844,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(49, 17) Source(55, 10) + SourceIndex(0) -2 >Emitted(49, 48) Source(55, 20) + SourceIndex(0) -3 >Emitted(49, 51) Source(55, 3) + SourceIndex(0) +1->Emitted(50, 17) Source(55, 10) + SourceIndex(0) +2 >Emitted(50, 48) Source(55, 20) + SourceIndex(0) +3 >Emitted(50, 51) Source(55, 3) + SourceIndex(0) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -859,11 +860,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(50, 21) Source(56, 4) + SourceIndex(0) -2 >Emitted(50, 27) Source(56, 10) + SourceIndex(0) -3 >Emitted(50, 28) Source(56, 11) + SourceIndex(0) -4 >Emitted(50, 35) Source(56, 18) + SourceIndex(0) -5 >Emitted(50, 36) Source(56, 19) + SourceIndex(0) +1 >Emitted(51, 21) Source(56, 4) + SourceIndex(0) +2 >Emitted(51, 27) Source(56, 10) + SourceIndex(0) +3 >Emitted(51, 28) Source(56, 11) + SourceIndex(0) +4 >Emitted(51, 35) Source(56, 18) + SourceIndex(0) +5 >Emitted(51, 36) Source(56, 19) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -872,8 +873,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(51, 17) Source(57, 3) + SourceIndex(0) -2 >Emitted(51, 18) Source(57, 4) + SourceIndex(0) +1 >Emitted(52, 17) Source(57, 3) + SourceIndex(0) +2 >Emitted(52, 18) Source(57, 4) + SourceIndex(0) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -884,9 +885,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(52, 17) Source(59, 10) + SourceIndex(0) -2 >Emitted(52, 45) Source(59, 17) + SourceIndex(0) -3 >Emitted(52, 48) Source(59, 3) + SourceIndex(0) +1->Emitted(53, 17) Source(59, 10) + SourceIndex(0) +2 >Emitted(53, 45) Source(59, 17) + SourceIndex(0) +3 >Emitted(53, 48) Source(59, 3) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -896,8 +897,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(53, 17) Source(61, 3) + SourceIndex(0) -2 >Emitted(53, 18) Source(61, 4) + SourceIndex(0) +1 >Emitted(54, 17) Source(61, 3) + SourceIndex(0) +2 >Emitted(54, 18) Source(61, 4) + SourceIndex(0) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -906,8 +907,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(54, 17) Source(63, 2) + SourceIndex(0) -2 >Emitted(54, 34) Source(63, 3) + SourceIndex(0) +1->Emitted(55, 17) Source(63, 2) + SourceIndex(0) +2 >Emitted(55, 34) Source(63, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^ @@ -937,10 +938,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(55, 13) Source(63, 2) + SourceIndex(0) -2 >Emitted(55, 14) Source(63, 3) + SourceIndex(0) -3 >Emitted(55, 14) Source(45, 2) + SourceIndex(0) -4 >Emitted(55, 18) Source(63, 3) + SourceIndex(0) +1 >Emitted(56, 13) Source(63, 2) + SourceIndex(0) +2 >Emitted(56, 14) Source(63, 3) + SourceIndex(0) +3 >Emitted(56, 14) Source(45, 2) + SourceIndex(0) +4 >Emitted(56, 18) Source(63, 3) + SourceIndex(0) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -970,10 +971,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(56, 13) Source(45, 15) + SourceIndex(0) -2 >Emitted(56, 31) Source(45, 25) + SourceIndex(0) -3 >Emitted(56, 44) Source(63, 3) + SourceIndex(0) -4 >Emitted(56, 45) Source(63, 3) + SourceIndex(0) +1->Emitted(57, 13) Source(45, 15) + SourceIndex(0) +2 >Emitted(57, 31) Source(45, 25) + SourceIndex(0) +3 >Emitted(57, 44) Source(63, 3) + SourceIndex(0) +4 >Emitted(57, 45) Source(63, 3) + SourceIndex(0) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1015,15 +1016,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(57, 9) Source(64, 1) + SourceIndex(0) -2 >Emitted(57, 10) Source(64, 2) + SourceIndex(0) -3 >Emitted(57, 12) Source(44, 21) + SourceIndex(0) -4 >Emitted(57, 19) Source(44, 28) + SourceIndex(0) -5 >Emitted(57, 22) Source(44, 21) + SourceIndex(0) -6 >Emitted(57, 35) Source(44, 28) + SourceIndex(0) -7 >Emitted(57, 40) Source(44, 21) + SourceIndex(0) -8 >Emitted(57, 53) Source(44, 28) + SourceIndex(0) -9 >Emitted(57, 61) Source(64, 2) + SourceIndex(0) +1->Emitted(58, 9) Source(64, 1) + SourceIndex(0) +2 >Emitted(58, 10) Source(64, 2) + SourceIndex(0) +3 >Emitted(58, 12) Source(44, 21) + SourceIndex(0) +4 >Emitted(58, 19) Source(44, 28) + SourceIndex(0) +5 >Emitted(58, 22) Source(44, 21) + SourceIndex(0) +6 >Emitted(58, 35) Source(44, 28) + SourceIndex(0) +7 >Emitted(58, 40) Source(44, 21) + SourceIndex(0) +8 >Emitted(58, 53) Source(44, 28) + SourceIndex(0) +9 >Emitted(58, 61) Source(64, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1064,15 +1065,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(58, 5) Source(64, 1) + SourceIndex(0) -2 >Emitted(58, 6) Source(64, 2) + SourceIndex(0) -3 >Emitted(58, 8) Source(44, 15) + SourceIndex(0) -4 >Emitted(58, 13) Source(44, 20) + SourceIndex(0) -5 >Emitted(58, 16) Source(44, 15) + SourceIndex(0) -6 >Emitted(58, 28) Source(44, 20) + SourceIndex(0) -7 >Emitted(58, 33) Source(44, 15) + SourceIndex(0) -8 >Emitted(58, 45) Source(44, 20) + SourceIndex(0) -9 >Emitted(58, 53) Source(64, 2) + SourceIndex(0) +1 >Emitted(59, 5) Source(64, 1) + SourceIndex(0) +2 >Emitted(59, 6) Source(64, 2) + SourceIndex(0) +3 >Emitted(59, 8) Source(44, 15) + SourceIndex(0) +4 >Emitted(59, 13) Source(44, 20) + SourceIndex(0) +5 >Emitted(59, 16) Source(44, 15) + SourceIndex(0) +6 >Emitted(59, 28) Source(44, 20) + SourceIndex(0) +7 >Emitted(59, 33) Source(44, 15) + SourceIndex(0) +8 >Emitted(59, 45) Source(44, 20) + SourceIndex(0) +9 >Emitted(59, 53) Source(64, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -1110,13 +1111,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(59, 1) Source(64, 1) + SourceIndex(0) -2 >Emitted(59, 2) Source(64, 2) + SourceIndex(0) -3 >Emitted(59, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(59, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(59, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(59, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(59, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(60, 1) Source(64, 1) + SourceIndex(0) +2 >Emitted(60, 2) Source(64, 2) + SourceIndex(0) +3 >Emitted(60, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(60, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(60, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(60, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(60, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1125,13 +1126,13 @@ sourceFile:recursiveClassReferenceTest.ts > >interface IMode { getInitialState(): IState;} > -1->Emitted(60, 1) Source(67, 1) + SourceIndex(0) +1->Emitted(61, 1) Source(67, 1) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(61, 5) Source(67, 1) + SourceIndex(0) +1->Emitted(62, 5) Source(67, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -1139,8 +1140,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->class AbstractMode implements IMode { public getInitialState(): IState { return null;} 2 > } -1->Emitted(62, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(62, 6) Source(67, 89) + SourceIndex(0) +1->Emitted(63, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(63, 6) Source(67, 89) + SourceIndex(0) --- >>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ @@ -1163,24 +1164,24 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(63, 5) Source(67, 46) + SourceIndex(0) -2 >Emitted(63, 43) Source(67, 61) + SourceIndex(0) -3 >Emitted(63, 46) Source(67, 39) + SourceIndex(0) -4 >Emitted(63, 60) Source(67, 74) + SourceIndex(0) -5 >Emitted(63, 66) Source(67, 80) + SourceIndex(0) -6 >Emitted(63, 67) Source(67, 81) + SourceIndex(0) -7 >Emitted(63, 71) Source(67, 85) + SourceIndex(0) -8 >Emitted(63, 72) Source(67, 86) + SourceIndex(0) -9 >Emitted(63, 73) Source(67, 86) + SourceIndex(0) -10>Emitted(63, 74) Source(67, 87) + SourceIndex(0) +1->Emitted(64, 5) Source(67, 46) + SourceIndex(0) +2 >Emitted(64, 43) Source(67, 61) + SourceIndex(0) +3 >Emitted(64, 46) Source(67, 39) + SourceIndex(0) +4 >Emitted(64, 60) Source(67, 74) + SourceIndex(0) +5 >Emitted(64, 66) Source(67, 80) + SourceIndex(0) +6 >Emitted(64, 67) Source(67, 81) + SourceIndex(0) +7 >Emitted(64, 71) Source(67, 85) + SourceIndex(0) +8 >Emitted(64, 72) Source(67, 86) + SourceIndex(0) +9 >Emitted(64, 73) Source(67, 86) + SourceIndex(0) +10>Emitted(64, 74) Source(67, 87) + SourceIndex(0) --- >>> return AbstractMode; 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ 1 > 2 > } -1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) -2 >Emitted(64, 24) Source(67, 89) + SourceIndex(0) +1 >Emitted(65, 5) Source(67, 88) + SourceIndex(0) +2 >Emitted(65, 24) Source(67, 89) + SourceIndex(0) --- >>>}()); 1 > @@ -1192,10 +1193,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(65, 1) Source(67, 88) + SourceIndex(0) -2 >Emitted(65, 2) Source(67, 89) + SourceIndex(0) -3 >Emitted(65, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(65, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(66, 1) Source(67, 88) + SourceIndex(0) +2 >Emitted(66, 2) Source(67, 89) + SourceIndex(0) +3 >Emitted(66, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(66, 6) Source(67, 89) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1213,9 +1214,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >module 3 > Sample -1->Emitted(66, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(66, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(66, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(67, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(67, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(67, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1251,10 +1252,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(67, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(67, 9) Source(76, 15) + SourceIndex(0) -3 >Emitted(67, 14) Source(76, 20) + SourceIndex(0) -4 >Emitted(67, 15) Source(100, 2) + SourceIndex(0) +1 >Emitted(68, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(68, 9) Source(76, 15) + SourceIndex(0) +3 >Emitted(68, 14) Source(76, 20) + SourceIndex(0) +4 >Emitted(68, 15) Source(100, 2) + SourceIndex(0) --- >>> (function (Thing) { 1->^^^^ @@ -1264,9 +1265,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(68, 5) Source(76, 15) + SourceIndex(0) -2 >Emitted(68, 16) Source(76, 15) + SourceIndex(0) -3 >Emitted(68, 21) Source(76, 20) + SourceIndex(0) +1->Emitted(69, 5) Source(76, 15) + SourceIndex(0) +2 >Emitted(69, 16) Source(76, 15) + SourceIndex(0) +3 >Emitted(69, 21) Source(76, 20) + SourceIndex(0) --- >>> var Languages; 1->^^^^^^^^ @@ -1302,10 +1303,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(69, 13) Source(76, 21) + SourceIndex(0) -3 >Emitted(69, 22) Source(76, 30) + SourceIndex(0) -4 >Emitted(69, 23) Source(100, 2) + SourceIndex(0) +1->Emitted(70, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(70, 13) Source(76, 21) + SourceIndex(0) +3 >Emitted(70, 22) Source(76, 30) + SourceIndex(0) +4 >Emitted(70, 23) Source(100, 2) + SourceIndex(0) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1314,9 +1315,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(70, 9) Source(76, 21) + SourceIndex(0) -2 >Emitted(70, 20) Source(76, 21) + SourceIndex(0) -3 >Emitted(70, 29) Source(76, 30) + SourceIndex(0) +1->Emitted(71, 9) Source(76, 21) + SourceIndex(0) +2 >Emitted(71, 20) Source(76, 21) + SourceIndex(0) +3 >Emitted(71, 29) Source(76, 30) + SourceIndex(0) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1352,10 +1353,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(71, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(71, 17) Source(76, 31) + SourceIndex(0) -3 >Emitted(71, 26) Source(76, 40) + SourceIndex(0) -4 >Emitted(71, 27) Source(100, 2) + SourceIndex(0) +1 >Emitted(72, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(72, 17) Source(76, 31) + SourceIndex(0) +3 >Emitted(72, 26) Source(76, 40) + SourceIndex(0) +4 >Emitted(72, 27) Source(100, 2) + SourceIndex(0) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1365,9 +1366,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > PlainText -1->Emitted(72, 13) Source(76, 31) + SourceIndex(0) -2 >Emitted(72, 24) Source(76, 31) + SourceIndex(0) -3 >Emitted(72, 33) Source(76, 40) + SourceIndex(0) +1->Emitted(73, 13) Source(76, 31) + SourceIndex(0) +2 >Emitted(73, 24) Source(76, 31) + SourceIndex(0) +3 >Emitted(73, 33) Source(76, 40) + SourceIndex(0) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1375,7 +1376,7 @@ sourceFile:recursiveClassReferenceTest.ts 1-> { > > -1->Emitted(73, 17) Source(78, 2) + SourceIndex(0) +1->Emitted(74, 17) Source(78, 2) + SourceIndex(0) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1386,9 +1387,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > constructor(private 3 > mode: IMode -1->Emitted(74, 21) Source(79, 9) + SourceIndex(0) -2 >Emitted(74, 36) Source(79, 29) + SourceIndex(0) -3 >Emitted(74, 40) Source(79, 40) + SourceIndex(0) +1->Emitted(75, 21) Source(79, 9) + SourceIndex(0) +2 >Emitted(75, 36) Source(79, 29) + SourceIndex(0) +3 >Emitted(75, 40) Source(79, 40) + SourceIndex(0) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1401,11 +1402,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(75, 25) Source(79, 29) + SourceIndex(0) -2 >Emitted(75, 34) Source(79, 33) + SourceIndex(0) -3 >Emitted(75, 37) Source(79, 29) + SourceIndex(0) -4 >Emitted(75, 41) Source(79, 33) + SourceIndex(0) -5 >Emitted(75, 42) Source(79, 40) + SourceIndex(0) +1->Emitted(76, 25) Source(79, 29) + SourceIndex(0) +2 >Emitted(76, 34) Source(79, 33) + SourceIndex(0) +3 >Emitted(76, 37) Source(79, 29) + SourceIndex(0) +4 >Emitted(76, 41) Source(79, 33) + SourceIndex(0) +5 >Emitted(76, 42) Source(79, 40) + SourceIndex(0) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1413,8 +1414,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(76, 21) Source(79, 44) + SourceIndex(0) -2 >Emitted(76, 22) Source(79, 45) + SourceIndex(0) +1 >Emitted(77, 21) Source(79, 44) + SourceIndex(0) +2 >Emitted(77, 22) Source(79, 45) + SourceIndex(0) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1424,9 +1425,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(77, 21) Source(80, 10) + SourceIndex(0) -2 >Emitted(77, 42) Source(80, 15) + SourceIndex(0) -3 >Emitted(77, 45) Source(80, 3) + SourceIndex(0) +1->Emitted(78, 21) Source(80, 10) + SourceIndex(0) +2 >Emitted(78, 42) Source(80, 15) + SourceIndex(0) +3 >Emitted(78, 45) Source(80, 3) + SourceIndex(0) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1440,11 +1441,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(78, 25) Source(81, 4) + SourceIndex(0) -2 >Emitted(78, 31) Source(81, 10) + SourceIndex(0) -3 >Emitted(78, 32) Source(81, 11) + SourceIndex(0) -4 >Emitted(78, 36) Source(81, 15) + SourceIndex(0) -5 >Emitted(78, 37) Source(81, 16) + SourceIndex(0) +1 >Emitted(79, 25) Source(81, 4) + SourceIndex(0) +2 >Emitted(79, 31) Source(81, 10) + SourceIndex(0) +3 >Emitted(79, 32) Source(81, 11) + SourceIndex(0) +4 >Emitted(79, 36) Source(81, 15) + SourceIndex(0) +5 >Emitted(79, 37) Source(81, 16) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1453,8 +1454,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(79, 21) Source(82, 3) + SourceIndex(0) -2 >Emitted(79, 22) Source(82, 4) + SourceIndex(0) +1 >Emitted(80, 21) Source(82, 3) + SourceIndex(0) +2 >Emitted(80, 22) Source(82, 4) + SourceIndex(0) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1469,11 +1470,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(80, 21) Source(84, 10) + SourceIndex(0) -2 >Emitted(80, 43) Source(84, 16) + SourceIndex(0) -3 >Emitted(80, 46) Source(84, 3) + SourceIndex(0) -4 >Emitted(80, 56) Source(84, 17) + SourceIndex(0) -5 >Emitted(80, 61) Source(84, 29) + SourceIndex(0) +1->Emitted(81, 21) Source(84, 10) + SourceIndex(0) +2 >Emitted(81, 43) Source(84, 16) + SourceIndex(0) +3 >Emitted(81, 46) Source(84, 3) + SourceIndex(0) +4 >Emitted(81, 56) Source(84, 17) + SourceIndex(0) +5 >Emitted(81, 61) Source(84, 29) + SourceIndex(0) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1491,13 +1492,13 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(81, 25) Source(85, 4) + SourceIndex(0) -2 >Emitted(81, 31) Source(85, 10) + SourceIndex(0) -3 >Emitted(81, 32) Source(85, 11) + SourceIndex(0) -4 >Emitted(81, 36) Source(85, 15) + SourceIndex(0) -5 >Emitted(81, 41) Source(85, 20) + SourceIndex(0) -6 >Emitted(81, 46) Source(85, 25) + SourceIndex(0) -7 >Emitted(81, 47) Source(85, 26) + SourceIndex(0) +1 >Emitted(82, 25) Source(85, 4) + SourceIndex(0) +2 >Emitted(82, 31) Source(85, 10) + SourceIndex(0) +3 >Emitted(82, 32) Source(85, 11) + SourceIndex(0) +4 >Emitted(82, 36) Source(85, 15) + SourceIndex(0) +5 >Emitted(82, 41) Source(85, 20) + SourceIndex(0) +6 >Emitted(82, 46) Source(85, 25) + SourceIndex(0) +7 >Emitted(82, 47) Source(85, 26) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1506,8 +1507,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(82, 21) Source(86, 3) + SourceIndex(0) -2 >Emitted(82, 22) Source(86, 4) + SourceIndex(0) +1 >Emitted(83, 21) Source(86, 3) + SourceIndex(0) +2 >Emitted(83, 22) Source(86, 4) + SourceIndex(0) --- >>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1532,16 +1533,16 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ; 9 > 10> } -1->Emitted(83, 21) Source(88, 10) + SourceIndex(0) -2 >Emitted(83, 44) Source(88, 17) + SourceIndex(0) -3 >Emitted(83, 47) Source(88, 3) + SourceIndex(0) -4 >Emitted(83, 61) Source(88, 29) + SourceIndex(0) -5 >Emitted(83, 67) Source(88, 35) + SourceIndex(0) -6 >Emitted(83, 68) Source(88, 36) + SourceIndex(0) -7 >Emitted(83, 72) Source(88, 40) + SourceIndex(0) -8 >Emitted(83, 73) Source(88, 41) + SourceIndex(0) -9 >Emitted(83, 74) Source(88, 42) + SourceIndex(0) -10>Emitted(83, 75) Source(88, 43) + SourceIndex(0) +1->Emitted(84, 21) Source(88, 10) + SourceIndex(0) +2 >Emitted(84, 44) Source(88, 17) + SourceIndex(0) +3 >Emitted(84, 47) Source(88, 3) + SourceIndex(0) +4 >Emitted(84, 61) Source(88, 29) + SourceIndex(0) +5 >Emitted(84, 67) Source(88, 35) + SourceIndex(0) +6 >Emitted(84, 68) Source(88, 36) + SourceIndex(0) +7 >Emitted(84, 72) Source(88, 40) + SourceIndex(0) +8 >Emitted(84, 73) Source(88, 41) + SourceIndex(0) +9 >Emitted(84, 74) Source(88, 42) + SourceIndex(0) +10>Emitted(84, 75) Source(88, 43) + SourceIndex(0) --- >>> return State; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1549,8 +1550,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(84, 21) Source(89, 2) + SourceIndex(0) -2 >Emitted(84, 33) Source(89, 3) + SourceIndex(0) +1 >Emitted(85, 21) Source(89, 2) + SourceIndex(0) +2 >Emitted(85, 33) Source(89, 3) + SourceIndex(0) --- >>> }()); 1 >^^^^^^^^^^^^^^^^ @@ -1573,10 +1574,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(85, 17) Source(89, 2) + SourceIndex(0) -2 >Emitted(85, 18) Source(89, 3) + SourceIndex(0) -3 >Emitted(85, 18) Source(78, 2) + SourceIndex(0) -4 >Emitted(85, 22) Source(89, 3) + SourceIndex(0) +1 >Emitted(86, 17) Source(89, 2) + SourceIndex(0) +2 >Emitted(86, 18) Source(89, 3) + SourceIndex(0) +3 >Emitted(86, 18) Source(78, 2) + SourceIndex(0) +4 >Emitted(86, 22) Source(89, 3) + SourceIndex(0) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1599,10 +1600,10 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 4 > -1->Emitted(86, 17) Source(78, 15) + SourceIndex(0) -2 >Emitted(86, 32) Source(78, 20) + SourceIndex(0) -3 >Emitted(86, 40) Source(89, 3) + SourceIndex(0) -4 >Emitted(86, 41) Source(89, 3) + SourceIndex(0) +1->Emitted(87, 17) Source(78, 15) + SourceIndex(0) +2 >Emitted(87, 32) Source(78, 20) + SourceIndex(0) +3 >Emitted(87, 40) Source(89, 3) + SourceIndex(0) +4 >Emitted(87, 41) Source(89, 3) + SourceIndex(0) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1610,21 +1611,21 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > > -1->Emitted(87, 17) Source(91, 2) + SourceIndex(0) +1->Emitted(88, 17) Source(91, 2) + SourceIndex(0) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 1->export class Mode extends 2 > AbstractMode -1->Emitted(88, 21) Source(91, 28) + SourceIndex(0) -2 >Emitted(88, 45) Source(91, 40) + SourceIndex(0) +1->Emitted(89, 21) Source(91, 28) + SourceIndex(0) +2 >Emitted(89, 45) Source(91, 40) + SourceIndex(0) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(89, 21) Source(91, 2) + SourceIndex(0) +1 >Emitted(90, 21) Source(91, 2) + SourceIndex(0) --- >>> return _super.apply(this, arguments) || this; >>> } @@ -1641,8 +1642,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(91, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(91, 22) Source(99, 3) + SourceIndex(0) +1->Emitted(92, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(92, 22) Source(99, 3) + SourceIndex(0) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1650,8 +1651,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(92, 21) Source(93, 3) + SourceIndex(0) -2 >Emitted(92, 34) Source(93, 16) + SourceIndex(0) +1->Emitted(93, 21) Source(93, 3) + SourceIndex(0) +2 >Emitted(93, 34) Source(93, 16) + SourceIndex(0) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1661,9 +1662,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(93, 21) Source(94, 10) + SourceIndex(0) -2 >Emitted(93, 51) Source(94, 25) + SourceIndex(0) -3 >Emitted(93, 54) Source(94, 3) + SourceIndex(0) +1->Emitted(94, 21) Source(94, 10) + SourceIndex(0) +2 >Emitted(94, 51) Source(94, 25) + SourceIndex(0) +3 >Emitted(94, 54) Source(94, 3) + SourceIndex(0) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1685,15 +1686,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(94, 25) Source(95, 4) + SourceIndex(0) -2 >Emitted(94, 31) Source(95, 10) + SourceIndex(0) -3 >Emitted(94, 32) Source(95, 11) + SourceIndex(0) -4 >Emitted(94, 36) Source(95, 15) + SourceIndex(0) -5 >Emitted(94, 41) Source(95, 20) + SourceIndex(0) -6 >Emitted(94, 42) Source(95, 21) + SourceIndex(0) -7 >Emitted(94, 46) Source(95, 25) + SourceIndex(0) -8 >Emitted(94, 47) Source(95, 26) + SourceIndex(0) -9 >Emitted(94, 48) Source(95, 27) + SourceIndex(0) +1 >Emitted(95, 25) Source(95, 4) + SourceIndex(0) +2 >Emitted(95, 31) Source(95, 10) + SourceIndex(0) +3 >Emitted(95, 32) Source(95, 11) + SourceIndex(0) +4 >Emitted(95, 36) Source(95, 15) + SourceIndex(0) +5 >Emitted(95, 41) Source(95, 20) + SourceIndex(0) +6 >Emitted(95, 42) Source(95, 21) + SourceIndex(0) +7 >Emitted(95, 46) Source(95, 25) + SourceIndex(0) +8 >Emitted(95, 47) Source(95, 26) + SourceIndex(0) +9 >Emitted(95, 48) Source(95, 27) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1702,8 +1703,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(95, 21) Source(96, 3) + SourceIndex(0) -2 >Emitted(95, 22) Source(96, 4) + SourceIndex(0) +1 >Emitted(96, 21) Source(96, 3) + SourceIndex(0) +2 >Emitted(96, 22) Source(96, 4) + SourceIndex(0) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1714,8 +1715,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(96, 21) Source(99, 2) + SourceIndex(0) -2 >Emitted(96, 32) Source(99, 3) + SourceIndex(0) +1->Emitted(97, 21) Source(99, 2) + SourceIndex(0) +2 >Emitted(97, 32) Source(99, 3) + SourceIndex(0) --- >>> }(AbstractMode)); 1->^^^^^^^^^^^^^^^^ @@ -1739,12 +1740,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(97, 17) Source(99, 2) + SourceIndex(0) -2 >Emitted(97, 18) Source(99, 3) + SourceIndex(0) -3 >Emitted(97, 18) Source(91, 2) + SourceIndex(0) -4 >Emitted(97, 19) Source(91, 28) + SourceIndex(0) -5 >Emitted(97, 31) Source(91, 40) + SourceIndex(0) -6 >Emitted(97, 34) Source(99, 3) + SourceIndex(0) +1->Emitted(98, 17) Source(99, 2) + SourceIndex(0) +2 >Emitted(98, 18) Source(99, 3) + SourceIndex(0) +3 >Emitted(98, 18) Source(91, 2) + SourceIndex(0) +4 >Emitted(98, 19) Source(91, 28) + SourceIndex(0) +5 >Emitted(98, 31) Source(91, 40) + SourceIndex(0) +6 >Emitted(98, 34) Source(99, 3) + SourceIndex(0) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1764,10 +1765,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } 4 > -1->Emitted(98, 17) Source(91, 15) + SourceIndex(0) -2 >Emitted(98, 31) Source(91, 19) + SourceIndex(0) -3 >Emitted(98, 38) Source(99, 3) + SourceIndex(0) -4 >Emitted(98, 39) Source(99, 3) + SourceIndex(0) +1->Emitted(99, 17) Source(91, 15) + SourceIndex(0) +2 >Emitted(99, 31) Source(91, 19) + SourceIndex(0) +3 >Emitted(99, 38) Source(99, 3) + SourceIndex(0) +4 >Emitted(99, 39) Source(99, 3) + SourceIndex(0) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -1813,15 +1814,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(99, 13) Source(100, 1) + SourceIndex(0) -2 >Emitted(99, 14) Source(100, 2) + SourceIndex(0) -3 >Emitted(99, 16) Source(76, 31) + SourceIndex(0) -4 >Emitted(99, 25) Source(76, 40) + SourceIndex(0) -5 >Emitted(99, 28) Source(76, 31) + SourceIndex(0) -6 >Emitted(99, 47) Source(76, 40) + SourceIndex(0) -7 >Emitted(99, 52) Source(76, 31) + SourceIndex(0) -8 >Emitted(99, 71) Source(76, 40) + SourceIndex(0) -9 >Emitted(99, 79) Source(100, 2) + SourceIndex(0) +1->Emitted(100, 13) Source(100, 1) + SourceIndex(0) +2 >Emitted(100, 14) Source(100, 2) + SourceIndex(0) +3 >Emitted(100, 16) Source(76, 31) + SourceIndex(0) +4 >Emitted(100, 25) Source(76, 40) + SourceIndex(0) +5 >Emitted(100, 28) Source(76, 31) + SourceIndex(0) +6 >Emitted(100, 47) Source(76, 40) + SourceIndex(0) +7 >Emitted(100, 52) Source(76, 31) + SourceIndex(0) +8 >Emitted(100, 71) Source(76, 40) + SourceIndex(0) +9 >Emitted(100, 79) Source(100, 2) + SourceIndex(0) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -1866,15 +1867,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(100, 9) Source(100, 1) + SourceIndex(0) -2 >Emitted(100, 10) Source(100, 2) + SourceIndex(0) -3 >Emitted(100, 12) Source(76, 21) + SourceIndex(0) -4 >Emitted(100, 21) Source(76, 30) + SourceIndex(0) -5 >Emitted(100, 24) Source(76, 21) + SourceIndex(0) -6 >Emitted(100, 39) Source(76, 30) + SourceIndex(0) -7 >Emitted(100, 44) Source(76, 21) + SourceIndex(0) -8 >Emitted(100, 59) Source(76, 30) + SourceIndex(0) -9 >Emitted(100, 67) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 9) Source(100, 1) + SourceIndex(0) +2 >Emitted(101, 10) Source(100, 2) + SourceIndex(0) +3 >Emitted(101, 12) Source(76, 21) + SourceIndex(0) +4 >Emitted(101, 21) Source(76, 30) + SourceIndex(0) +5 >Emitted(101, 24) Source(76, 21) + SourceIndex(0) +6 >Emitted(101, 39) Source(76, 30) + SourceIndex(0) +7 >Emitted(101, 44) Source(76, 21) + SourceIndex(0) +8 >Emitted(101, 59) Source(76, 30) + SourceIndex(0) +9 >Emitted(101, 67) Source(100, 2) + SourceIndex(0) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1919,15 +1920,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(101, 5) Source(100, 1) + SourceIndex(0) -2 >Emitted(101, 6) Source(100, 2) + SourceIndex(0) -3 >Emitted(101, 8) Source(76, 15) + SourceIndex(0) -4 >Emitted(101, 13) Source(76, 20) + SourceIndex(0) -5 >Emitted(101, 16) Source(76, 15) + SourceIndex(0) -6 >Emitted(101, 28) Source(76, 20) + SourceIndex(0) -7 >Emitted(101, 33) Source(76, 15) + SourceIndex(0) -8 >Emitted(101, 45) Source(76, 20) + SourceIndex(0) -9 >Emitted(101, 53) Source(100, 2) + SourceIndex(0) +1 >Emitted(102, 5) Source(100, 1) + SourceIndex(0) +2 >Emitted(102, 6) Source(100, 2) + SourceIndex(0) +3 >Emitted(102, 8) Source(76, 15) + SourceIndex(0) +4 >Emitted(102, 13) Source(76, 20) + SourceIndex(0) +5 >Emitted(102, 16) Source(76, 15) + SourceIndex(0) +6 >Emitted(102, 28) Source(76, 20) + SourceIndex(0) +7 >Emitted(102, 33) Source(76, 15) + SourceIndex(0) +8 >Emitted(102, 45) Source(76, 20) + SourceIndex(0) +9 >Emitted(102, 53) Source(100, 2) + SourceIndex(0) --- >>>})(Sample || (Sample = {})); 1 > @@ -1969,12 +1970,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(102, 1) Source(100, 1) + SourceIndex(0) -2 >Emitted(102, 2) Source(100, 2) + SourceIndex(0) -3 >Emitted(102, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(102, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(102, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(102, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(102, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(103, 1) Source(100, 1) + SourceIndex(0) +2 >Emitted(103, 2) Source(100, 2) + SourceIndex(0) +3 >Emitted(103, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(103, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(103, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(103, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(103, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index 9544c60b9f5..f1f34e272f1 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -25,15 +25,16 @@ class TypeSymbol extends InferenceSymbol { } //// [recursiveComplicatedClasses.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Signature = (function () { function Signature() { this.parameters = null; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index e7c3ce7a3ce..e2a2e8dccff 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -30,15 +30,16 @@ declare module MsPortal.Controls.Base.ItemList { */ //// [recursivelySpecializedConstructorDeclaration.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MsPortal; (function (MsPortal) { var Controls; diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index db5486b1af7..bbaf78a0283 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -33,15 +33,16 @@ module.exports = { }; //// [foo3.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var foo2 = require("./foo2"); var x = (function (_super) { __extends(x, _super); diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index bdea9b287bb..cf9592ab4b2 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1020,15 +1020,16 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var rionegrensis; (function (rionegrensis) { var caniventer = (function (_super) { diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index 625028055b4..0a71ab129a8 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -67,15 +67,16 @@ class I extends G { //// [returnInConstructor1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { return; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index b62ef87dadc..999d12f15f8 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -25,15 +25,16 @@ function fn13(): C { return null; } //// [returnStatements.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // all the following should be valid function fn1() { return 1; } function fn2() { return ''; } diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 3fdc1795c32..33723f36d6a 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -9,15 +9,16 @@ class D extends C { } //// [scopeCheckExtendedClassInsidePublicMethod2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 237faa00fe3..bac44a57ac0 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -9,15 +9,16 @@ class D extends C { } //// [scopeCheckExtendedClassInsideStaticMethod1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index 6090536a099..0086a0b08ce 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -12,15 +12,16 @@ class D extends C { } //// [scopeTests.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index d842185b47c..2c56c8ddada 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -4,15 +4,16 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var base = (function () { function base() { } diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index b5216c1c168..b07cc2e8d8e 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -8,15 +8,16 @@ class Greeter extends AbstractGreeter { } //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var AbstractGreeter = (function () { function AbstractGreeter() { } diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map index 27577a7e338..6de0ba822fa 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map] -{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 2ca29e33e91..00e15a91e19 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -8,26 +8,27 @@ sources: sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- ->>>var __extendStatics = (this && this.__extendStatics) || ->>> Object.setPrototypeOf || ->>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ->>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; ->>>var __extends = (this && this.__extends) || function (d, b) { ->>> __extendStatics(d, b); ->>> function __() { this.constructor = d; } ->>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); ->>>}; +>>>var __extends = (this && this.__extends) || (function () { +>>> var __extendStatics = Object.setPrototypeOf || +>>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || +>>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +>>> return function (d, b) { +>>> __extendStatics(d, b); +>>> function __() { this.constructor = d; } +>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +>>> }; +>>>})(); >>>var AbstractGreeter = (function () { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(10, 1) Source(1, 1) + SourceIndex(0) +1 >Emitted(11, 1) Source(1, 1) + SourceIndex(0) --- >>> function AbstractGreeter() { 1->^^^^ 2 > ^^-> 1-> -1->Emitted(11, 5) Source(1, 1) + SourceIndex(0) +1->Emitted(12, 5) Source(1, 1) + SourceIndex(0) --- >>> } 1->^^^^ @@ -36,16 +37,16 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1->class AbstractGreeter { > 2 > } -1->Emitted(12, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(12, 6) Source(2, 2) + SourceIndex(0) +1->Emitted(13, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(13, 6) Source(2, 2) + SourceIndex(0) --- >>> return AbstractGreeter; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(13, 5) Source(2, 1) + SourceIndex(0) -2 >Emitted(13, 27) Source(2, 2) + SourceIndex(0) +1->Emitted(14, 5) Source(2, 1) + SourceIndex(0) +2 >Emitted(14, 27) Source(2, 2) + SourceIndex(0) --- >>>}()); 1 > @@ -58,10 +59,10 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > 4 > class AbstractGreeter { > } -1 >Emitted(14, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(2, 2) + SourceIndex(0) -3 >Emitted(14, 2) Source(1, 1) + SourceIndex(0) -4 >Emitted(14, 6) Source(2, 2) + SourceIndex(0) +1 >Emitted(15, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(2, 2) + SourceIndex(0) +3 >Emitted(15, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(15, 6) Source(2, 2) + SourceIndex(0) --- >>>var Greeter = (function (_super) { 1-> @@ -69,21 +70,21 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1-> > > -1->Emitted(15, 1) Source(4, 1) + SourceIndex(0) +1->Emitted(16, 1) Source(4, 1) + SourceIndex(0) --- >>> __extends(Greeter, _super); 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->class Greeter extends 2 > AbstractGreeter -1->Emitted(16, 5) Source(4, 23) + SourceIndex(0) -2 >Emitted(16, 32) Source(4, 38) + SourceIndex(0) +1->Emitted(17, 5) Source(4, 23) + SourceIndex(0) +2 >Emitted(17, 32) Source(4, 38) + SourceIndex(0) --- >>> function Greeter() { 1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(17, 5) Source(4, 1) + SourceIndex(0) +1 >Emitted(18, 5) Source(4, 1) + SourceIndex(0) --- >>> var _this = _super.apply(this, arguments) || this; 1->^^^^^^^^ @@ -93,8 +94,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts > public a = 10; > public nameA = "Ten"; > } -1->Emitted(18, 9) Source(4, 1) + SourceIndex(0) -2 >Emitted(18, 59) Source(7, 2) + SourceIndex(0) +1->Emitted(19, 9) Source(4, 1) + SourceIndex(0) +2 >Emitted(19, 59) Source(7, 2) + SourceIndex(0) --- >>> _this.a = 10; 1 >^^^^^^^^ @@ -108,11 +109,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > = 4 > 10 5 > ; -1 >Emitted(19, 9) Source(5, 12) + SourceIndex(0) -2 >Emitted(19, 16) Source(5, 13) + SourceIndex(0) -3 >Emitted(19, 19) Source(5, 16) + SourceIndex(0) -4 >Emitted(19, 21) Source(5, 18) + SourceIndex(0) -5 >Emitted(19, 22) Source(5, 19) + SourceIndex(0) +1 >Emitted(20, 9) Source(5, 12) + SourceIndex(0) +2 >Emitted(20, 16) Source(5, 13) + SourceIndex(0) +3 >Emitted(20, 19) Source(5, 16) + SourceIndex(0) +4 >Emitted(20, 21) Source(5, 18) + SourceIndex(0) +5 >Emitted(20, 22) Source(5, 19) + SourceIndex(0) --- >>> _this.nameA = "Ten"; 1->^^^^^^^^ @@ -126,11 +127,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > = 4 > "Ten" 5 > ; -1->Emitted(20, 9) Source(6, 12) + SourceIndex(0) -2 >Emitted(20, 20) Source(6, 17) + SourceIndex(0) -3 >Emitted(20, 23) Source(6, 20) + SourceIndex(0) -4 >Emitted(20, 28) Source(6, 25) + SourceIndex(0) -5 >Emitted(20, 29) Source(6, 26) + SourceIndex(0) +1->Emitted(21, 9) Source(6, 12) + SourceIndex(0) +2 >Emitted(21, 20) Source(6, 17) + SourceIndex(0) +3 >Emitted(21, 23) Source(6, 20) + SourceIndex(0) +4 >Emitted(21, 28) Source(6, 25) + SourceIndex(0) +5 >Emitted(21, 29) Source(6, 26) + SourceIndex(0) --- >>> return _this; >>> } @@ -140,8 +141,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 1 > > 2 > } -1 >Emitted(22, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(22, 6) Source(7, 2) + SourceIndex(0) +1 >Emitted(23, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(23, 6) Source(7, 2) + SourceIndex(0) --- >>> return Greeter; 1->^^^^ @@ -149,8 +150,8 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts 3 > ^^^-> 1-> 2 > } -1->Emitted(23, 5) Source(7, 1) + SourceIndex(0) -2 >Emitted(23, 19) Source(7, 2) + SourceIndex(0) +1->Emitted(24, 5) Source(7, 1) + SourceIndex(0) +2 >Emitted(24, 19) Source(7, 2) + SourceIndex(0) --- >>>}(AbstractGreeter)); 1-> @@ -169,11 +170,11 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts > public a = 10; > public nameA = "Ten"; > } -1->Emitted(24, 1) Source(7, 1) + SourceIndex(0) -2 >Emitted(24, 2) Source(7, 2) + SourceIndex(0) -3 >Emitted(24, 2) Source(4, 1) + SourceIndex(0) -4 >Emitted(24, 3) Source(4, 23) + SourceIndex(0) -5 >Emitted(24, 18) Source(4, 38) + SourceIndex(0) -6 >Emitted(24, 21) Source(7, 2) + SourceIndex(0) +1->Emitted(25, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(25, 2) Source(7, 2) + SourceIndex(0) +3 >Emitted(25, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(25, 3) Source(4, 23) + SourceIndex(0) +5 >Emitted(25, 18) Source(4, 38) + SourceIndex(0) +6 >Emitted(25, 21) Source(7, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 76d6da2d5d2..3904422842f 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -18,15 +18,16 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var View = (function () { function View(options) { } diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index d1bf0a0d636..a40be7711c1 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -13,15 +13,16 @@ function g(tagName: any): Base { } //// [specializedOverloadWithRestParameters.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index 63ea3a01253..77ce4a3d8bc 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -14,15 +14,16 @@ var d = Derived.create(); d.foo(); //// [staticFactory1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index 91fa33abd51..a603fc607b9 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -12,15 +12,16 @@ doThing(B); //OK //// [staticInheritance.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function doThing(x) { } var A = (function () { function A() { diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index ee1f12df69e..f07c4e9ae0f 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -10,15 +10,16 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SomeBase = (function () { function SomeBase() { } diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index 241ebc529fb..dd36b0928f0 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -36,15 +36,16 @@ class E extends A { } //// [staticPropSuper.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 71165d41360..9c289a209b5 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -61,15 +61,16 @@ class Ds extends A { } //// [strictModeInConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index ec075461129..614f20eafd6 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -28,15 +28,16 @@ function foo() { //// [strictModeReservedWord.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var let = 10; function foo() { "use strict"; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index fdf72090f2f..344f4edb83d 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -29,15 +29,16 @@ class G extends package { } class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo(private, public, static) { private = public = static; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index dd9341b4a42..5fdc2444791 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -41,15 +41,16 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 8abd40b7eb5..d5d790c4d4f 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -107,15 +107,16 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C3 = (function () { function C3() { } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 034b55ee1fc..20685aaf52c 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -169,15 +169,16 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C3 = (function () { function C3() { } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index b2f4f3eca49..dbcdd47ba6d 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -80,15 +80,16 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 413f915a618..7b1a7738d99 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -159,15 +159,16 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 23c51619c80..82a814c9c41 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -20,15 +20,16 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 0e16d43f216..9e080909067 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -174,15 +174,16 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index f17007cba42..64b182872f6 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -121,15 +121,16 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithCallSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index e6030bdb12d..e5770b58dfc 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -113,15 +113,16 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 24914baf2ed..5961a930dca 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -174,15 +174,16 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index f1153675c91..62c46d8add9 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -123,15 +123,16 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithConstructSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Errors; (function (Errors) { var Base = (function () { diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 10246582f12..93415f6d2e6 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -113,15 +113,16 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 7d3f9516c29..64e9965cb85 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -51,15 +51,16 @@ interface I extends B { //// [subtypingWithConstructSignatures5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 39f4e91f011..247fcbbd1bc 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -54,15 +54,16 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index 994c5597569..835f82c72b9 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -41,15 +41,16 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 25963e70449..761739f547f 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -45,15 +45,16 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 304dbee9e61..3d8bac24a79 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -29,15 +29,16 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 0733679a120..7526548f24e 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -68,15 +68,16 @@ module TwoLevels { } //// [subtypingWithObjectMembers.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 4b41ee1aaa7..ae620141587 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -35,15 +35,16 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 976a7e1b8cd..54995020573 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -35,15 +35,16 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 9c2e2257112..a2aca0d13bd 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -63,15 +63,16 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index 042684e0c04..7418e3dcb40 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -42,15 +42,16 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 23e7dbe37b6..081219774e5 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -45,15 +45,16 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index e17f0308609..b0c55cf6398 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -29,15 +29,16 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index a801d126895..8984c5860ea 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -38,15 +38,16 @@ s.foo() + ss.foo(); //// [super.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { var x; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index bc1160411ae..49a057a7f49 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -67,15 +67,16 @@ module Base4 { //// [super1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Case 1 var Base1 = (function () { function Base1() { diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index cac924a6b69..451c569c907 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -51,15 +51,16 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Case 5 var Base5 = (function () { function Base5() { diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index 1c37353813c..a218ba0968a 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -14,15 +14,16 @@ class MyDerived extends MyBase { } //// [superAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MyBase = (function () { function MyBase() { this.S2 = "test"; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index b1476e5c8e6..d678ff22480 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -25,15 +25,16 @@ class Q extends P { } //// [superAccess2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var P = (function () { function P() { } diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index c9208194e37..a58b119c67f 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -16,15 +16,16 @@ module test { } //// [superAccessInFatArrow1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var test; (function (test) { var A = (function () { diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index a37a07439be..d488506e019 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -26,15 +26,16 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var T5 = (function () { function T5(bar) { this.bar = bar; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index 6fa77382691..50e1c20b6bc 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -11,15 +11,16 @@ class H extends E { } //// [superCallAssignResult.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var E = (function () { function E(arg) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index 9990b5e7e1a..71c9e05e7cb 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -17,15 +17,16 @@ class D extends Base { //// [superCallBeforeThisAccessing1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index a7ef99d67cc..a18505f8203 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -11,15 +11,16 @@ class D extends Base { //// [superCallBeforeThisAccessing2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 90156d199d5..61ed4fe5c4c 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -14,15 +14,16 @@ class D extends Base { //// [superCallBeforeThisAccessing3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index e42decf54e8..cf5e9e89eba 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -16,15 +16,16 @@ class E extends null { } //// [superCallBeforeThisAccessing4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 8477c576c77..31087b70094 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -8,15 +8,16 @@ class D extends null { //// [superCallBeforeThisAccessing5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index a5e291b9543..0c3d20c102f 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -11,15 +11,16 @@ class D extends Base { //// [superCallBeforeThisAccessing6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index 69a54894cc4..ba79e0b65ae 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -14,15 +14,16 @@ class D extends Base { //// [superCallBeforeThisAccessing7.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index 51c4c727769..4f6a383aadf 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -14,15 +14,16 @@ class D extends Base { //// [superCallBeforeThisAccessing8.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(c) { } diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index 1b17766faf6..e24d0b53c1f 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -12,15 +12,16 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 159fa8786b3..3413bc18467 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -11,15 +11,16 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index ccf1bf3746a..f31fd399b36 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -11,15 +11,16 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index f109d657654..4c99415f643 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -11,15 +11,16 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index 76fd322d519..bbea46b2783 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -11,15 +11,16 @@ class B extends A { } //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index 737f51d9e27..54c77157590 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -51,15 +51,16 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Doing = (function () { function Doing() { } diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index cbd8398a20a..15d46bc1577 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -47,15 +47,16 @@ class Other extends Doing { //// [superCallInStaticMethod.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Doing = (function () { function Doing() { } diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 71ef0041452..7f5913549cc 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -17,15 +17,16 @@ class B extends A { } //// [superCallInsideClassDeclaration.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index 1d6b849ae5e..0f1fa8dc549 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -17,15 +17,16 @@ class B extends A { } //// [superCallInsideClassExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index e479206f9c5..0130a6c2b48 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -13,15 +13,16 @@ class B extends A { } //// [superCallInsideObjectLiteralExpression.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index 9e4b98997c9..0251b19231e 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -23,15 +23,16 @@ var d = new D(); //// [superCallOutsideConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index f71add3806a..a3d5303efaa 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -13,15 +13,16 @@ class B extends A { //// [superCallParameterContextualTyping1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index 5363dedff60..e90755ffee8 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -12,15 +12,16 @@ class C extends A { } //// [superCallParameterContextualTyping2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index c074252a692..fe68db83a04 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -32,15 +32,16 @@ class C extends CBase { } //// [superCallParameterContextualTyping3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var CBase = (function () { function CBase(param) { } diff --git a/tests/baselines/reference/superCallWithCommentEmit01.js b/tests/baselines/reference/superCallWithCommentEmit01.js index 5cd354a24b4..3a2981b8466 100644 --- a/tests/baselines/reference/superCallWithCommentEmit01.js +++ b/tests/baselines/reference/superCallWithCommentEmit01.js @@ -11,15 +11,16 @@ class B extends A { } //// [superCallWithCommentEmit01.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(text) { this.text = text; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 27ecd48bf68..7ae8d5b3099 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -10,15 +10,16 @@ class Foo extends Bar { } //// [superCallWithMissingBaseClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function (_super) { __extends(Foo, _super); function Foo() { diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index e974d75176b..ac9b0878083 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -31,15 +31,16 @@ class OtherDerived extends OtherBase { //// [superCalls.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(n) { this.x = 43; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 1b02c20b7a5..d44ae6c11ec 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -21,15 +21,16 @@ class Derived extends Base { } //// [superCallsInConstructor.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 86c1dae1a1c..d7078f39c16 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -52,15 +52,16 @@ class RegisteredUser extends User { } //// [superErrors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function foo() { var _this = this; // super in a non class context diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index 30d3494689a..b9d7c910977 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -14,15 +14,16 @@ class B extends A { //// [superInCatchBlock1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index a98e1fdb089..0f6ec4e386f 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -11,15 +11,16 @@ class C extends B { } //// [superInConstructorParam1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B() { } diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 384b83c7239..9eeeaa0723c 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -68,15 +68,16 @@ class RegisteredUser4 extends User { } //// [superInLambdas.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var User = (function () { function User() { this.name = "Bob"; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 32369a7fc85..cfcd7a4de2a 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -60,15 +60,16 @@ class B extends A { } //// [superInObjectLiterals_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; var obj = { __proto__: { diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index eee25fd2acc..5a5a91cd8f7 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -13,15 +13,16 @@ class B extends A { } //// [superNewCall1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(map) { this.map = map; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 39e8098407c..f6c09ab9092 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -37,15 +37,16 @@ class MyDerived extends MyBase { } //// [superPropertyAccess.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MyBase = (function () { function MyBase() { this.m2 = function () { }; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index 77d6a4b1c12..3eef279e454 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -28,15 +28,16 @@ class D extends C { } //// [superPropertyAccess1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index 1b9c056d3b2..767b08dc2b9 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -28,15 +28,16 @@ class D extends C { } //// [superPropertyAccess2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index 5506bedbcb6..014110485e6 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -15,15 +15,16 @@ class B extends A { } //// [superPropertyAccessInComputedPropertiesOfNestedType_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index e91603f20d8..10e64d97a92 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -77,15 +77,16 @@ instance.returnThis().fn(); //super.publicInstanceMemberFunction in lambda in member function //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var SomeBaseClass = (function () { function SomeBaseClass() { } diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 4e67455900a..2a48bfbdba7 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -30,15 +30,16 @@ class B extends A { } //// [superPropertyAccess_ES5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MyBase = (function () { function MyBase() { } diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 1686be4e2e9..3188e79bd7e 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -16,15 +16,16 @@ class C2 extends B { } //// [superPropertyInConstructorBeforeSuperCall.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var B = (function () { function B(x) { } diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index c933334a506..ec26d7dd67f 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -14,15 +14,16 @@ class Bar extends Foo { } //// [superSymbolIndexedAccess5.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var symbol; var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 61f98885443..09bef412516 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -14,15 +14,16 @@ class Bar extends Foo { } //// [superSymbolIndexedAccess6.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var symbol; var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index 645007e5a09..afd049ed8a2 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -15,15 +15,16 @@ var r: string = d.x; var r2: number = d.y; //// [superWithGenericSpecialization.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index f0e9cacf8aa..148fac45a70 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -12,15 +12,16 @@ class D extends B { //// [superWithGenerics.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 8b7c07a27a5..22b802ec2df 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -10,15 +10,16 @@ class D extends C { } //// [superWithTypeArgument.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index 349ead6b381..ace1355c374 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -10,15 +10,16 @@ class D extends C { } //// [superWithTypeArgument2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 6e09952749c..318b45a9981 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -14,15 +14,16 @@ class D extends C { } //// [superWithTypeArgument3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index d7bab4380b4..2fca7ec7fe4 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -28,15 +28,16 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ObjectLiteral; (function (ObjectLiteral) { var ThisInObjectLiteral = { diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index d2754225e5b..5af42176dfc 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -56,15 +56,16 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { function fn(x) { diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index c146e495c80..c9adf13f48c 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -32,15 +32,16 @@ System.register([], function (exports_1, context_1) { //// [bar.js] System.register(["./foo"], function (exports_1, context_1) { "use strict"; - var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; + var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); var __moduleName = context_1 && context_1.id; var foo_1, Bar; return { diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index a0faadf78a6..92ad5afba94 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -19,15 +19,16 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function foo(x) { } var Foo = (function () { function Foo(x) { diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 1b969e26547..a2237177f84 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -49,15 +49,16 @@ enum SomeEnum { //// [thisInInvalidContexts.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //'this' in static member initializer var ErrClass1 = (function () { function ErrClass1() { diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index ee517c6e36f..ccb2a71080f 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -50,15 +50,16 @@ export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); //'this' in static member initializer var ErrClass1 = (function () { function ErrClass1() { diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index 80795c91e67..b537231f74b 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -23,15 +23,16 @@ class Foo3 extends Base { } //// [thisInSuperCall.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(x) { } diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index f5e4e131cfc..9f40814cc5f 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -11,15 +11,16 @@ class Foo extends Base { //// [thisInSuperCall1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(a) { } diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index 663826999d3..ebbb974f23f 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -20,15 +20,16 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(a) { } diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index abba0499608..5c9405534f4 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -13,15 +13,16 @@ class Foo extends Base { //// [thisInSuperCall3.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(a) { } diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index 27aae06ccf8..21714308cb1 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -195,15 +195,16 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } //// [thisTypeInFunctions.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; // body checking var B = (function () { diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index ca9eeb60fee..27bc47b84d2 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -177,15 +177,16 @@ c.explicitProperty = (this, m) => m + this.n; //// [thisTypeInFunctionsNegative.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var _this = this; var C = (function () { function C() { diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index 9c5c848b781..55d3ba54221 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -21,15 +21,16 @@ export class ShortDetails extends React.Component<{ id: number }, {}> { //// [tsxCorrectlyParseLessThanComparison1.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ShortDetails = (function (_super) { __extends(ShortDetails, _super); function ShortDetails() { diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index a895c2ec4dd..2b055cd5a5a 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -21,15 +21,16 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var Text = (function (_super) { __extends(Text, _super); diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index 845eb400818..3108566db85 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -21,15 +21,16 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var Text = (function (_super) { __extends(Text, _super); diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index 7e1511af79a..8859061b463 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -21,15 +21,16 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var Text = (function (_super) { __extends(Text, _super); diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index 7867bea3873..818e384fdf6 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -21,15 +21,16 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var Text = (function (_super) { __extends(Text, _super); diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 5f594b4d1d5..559306b800b 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -33,15 +33,16 @@ export class Button extends React.Component { //// [button.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var Button = (function (_super) { __extends(Button, _super); @@ -56,15 +57,16 @@ var Button = (function (_super) { exports.Button = Button; //// [app.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); // Should see var button_1 = require('./button') here var button_1 = require("./button"); diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index c3ed400f65c..12c2f1f9ab3 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -40,15 +40,16 @@ let i =
x.propertyNotOnHtmlDivElement} />; //// [file.jsx] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); function Greet(x) { return
Hello, {x}
; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 93b810483b6..2b1634555ef 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -26,15 +26,16 @@ class MyButtonComponent extends React.Component<{},{}> { //// [file.js] "use strict"; -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var React = require("react"); var MyComponent = (function (_super) { __extends(MyComponent, _super); diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index e9ab0f69449..3107a196f2a 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -52,15 +52,16 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Function call whose argument is a 1 arg generic function call with explicit type arguments function fn1(t) { } function fn2(t) { } diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index b38de5abcd2..0eb332af60e 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -84,15 +84,16 @@ let union2: C | B; let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 4a1f85e3e71..21d9dfeebf1 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -146,15 +146,16 @@ if (hasMissingParameter()) { } //// [typeGuardFunctionErrors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index ce30137e322..0344e168c53 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -34,15 +34,16 @@ if (funD(isC, a)) { let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { } diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index c3e2d851db2..54110ba24d8 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -142,15 +142,16 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var RoyalGuard = (function () { function RoyalGuard() { } diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index 753a41b8e42..a79efd94c8f 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -60,15 +60,16 @@ else { } //// [typeGuardFunctionOfFormThisErrors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var RoyalGuard = (function () { function RoyalGuard() { } diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 55d28ea2a58..fa99dbd87cf 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -73,15 +73,16 @@ else { // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x, or // - when false, has no effect on the type of x. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index f9b90888a92..f1a94c5167a 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -38,15 +38,16 @@ str = isD1(c2Ord1) && c2Ord1.p1; // D1 var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C1 = (function () { function C1() { } diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 1e96d089f1b..b7d442711d7 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -83,15 +83,16 @@ namespace Test { //// [typeGuardOfFormThisMember.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // There's a 'File' class in the stdlib, wrap with a namespace to avoid collision var Test; (function (Test) { diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index 0212d05c523..e2b8b8ec168 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -33,15 +33,16 @@ namespace Test { } //// [typeGuardOfFormThisMemberErrors.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // There's a 'File' class in the stdlib, wrap with a namespace to avoid collision var Test; (function (Test) { diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 9a75ed6616d..84ff8f72c5c 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -45,15 +45,16 @@ function f4() { //// [typeMatch2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function f1() { var a = { x: 1, y: 2 }; a = {}; // error diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index f02a7c7de79..eca6ad1bc0a 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -9,15 +9,16 @@ class D extends C { } //// [typeOfSuperCall.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { } diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 8b40f439ba2..dc579b7b62f 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -3,15 +3,16 @@ class C extends T {} class C2 implements T {} //// [typeParameterAsBaseClass.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 97627b41f10..80317823731 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -13,15 +13,16 @@ interface I2 extends U { } //// [typeParameterAsBaseType.js] // type parameters cannot be used as base types // these are all errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function (_super) { __extends(C, _super); function C() { diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 6a189dc0ace..80fd91c64b8 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -13,15 +13,16 @@ function f(a: T) { } //// [typeParameterExtendingUnion1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Animal = (function () { function Animal() { } diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index bf929f42c6a..8dc8db48ed8 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -13,15 +13,16 @@ function f(a: T) { } //// [typeParameterExtendingUnion2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Animal = (function () { function Animal() { } diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 2bdb91818a2..42ff32f9ab1 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -41,15 +41,16 @@ class D extends C { //// [typeRelationships.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C() { this.self = this; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index 467781c8c26..a84939d2e10 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -12,15 +12,16 @@ module M2 { //// [typeValueConflict1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M1; (function (M1) { var A = (function () { diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 0220bda6f9b..40bdb364218 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -19,15 +19,16 @@ module M3 { //// [typeValueConflict2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M1; (function (M1) { var A = (function () { diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index 929472aefee..d7e92bd6a8f 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -22,15 +22,16 @@ var r1: typeof D; var r2: typeof d; //// [typeofClass2.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var C = (function () { function C(x) { } diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index 3403dc447a6..24ea5d0ed64 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -43,15 +43,16 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index 29c7eb186fa..396f24805eb 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -41,15 +41,16 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index 60fa6a01f63..a280e90e75c 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -4,15 +4,16 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var M; (function (M) { var C = (function (_super) { diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index fbfe9f3b466..56ae1ae2447 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -123,15 +123,16 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { } diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index 760cc6a1ba7..dea8545ce6f 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -49,15 +49,16 @@ class MyView extends View { //// [underscoreMapFirst.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MyView = (function (_super) { __extends(MyView, _super); function MyView() { diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index 2828c8dc287..0528b292208 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -25,15 +25,16 @@ class D extends C { //// [underscoreThisInDerivedClass01.js] // @target es5 -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Original test intent: // When arrow functions capture 'this', the lexical 'this' owner // currently captures 'this' using a variable named '_this'. diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index 4d7a69b60c5..5901d6e2a7c 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -19,15 +19,16 @@ class D extends C { //// [underscoreThisInDerivedClass02.js] // @target es5 -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // Original test intent: // Errors on '_this' should be reported in derived constructors, // even if 'super()' is not called. diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index 9de5ad9d470..28401c6db6b 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -20,15 +20,16 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // A | B is equivalent to A if B is a subtype of A var C = (function () { function C() { diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index f6c1489ceee..bf882f163eb 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -28,15 +28,16 @@ var arr9 = [e, f]; // (E|F)[] // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var arr1 = [1, 2]; // number[] var arr2 = ["hello", true]; // (string | number)[] var arr3Tuple = [3, "three"]; // [number, string] diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index 8fc5f1e8f71..837116d719d 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -74,15 +74,16 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var unionNumberString; var C = (function () { function C() { diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index c64cc7224ba..540d8058331 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -33,15 +33,16 @@ class C5 { } //// [unknownSymbols1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var x = asdf; var y; function foo(x, y) { } diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index ddc7d6e7598..2094404dd0a 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -154,15 +154,16 @@ module ts { //// [unspecializedConstraints.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { var Symbol = (function () { diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index c46afba6440..12dd53ebea9 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -44,15 +44,16 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); // none of these function calls should be allowed var x = function () { return; }; var r1 = x(); diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index e3af0dd8567..7b97612fa61 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -15,15 +15,16 @@ namespace Validation { } //// [unusedClassesinNamespace4.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Validation; (function (Validation) { var c1 = (function () { diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 37317f9fbe9..2d89558f83d 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -103,15 +103,16 @@ namespace Greeter { } //// [unusedIdentifiersConsolidated1.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); function greeter(person) { var unused = 20; } diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index a80a72f434a..ad56ae8cdd3 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -10,15 +10,16 @@ class Super extends Base { } //// [validUseOfThisInSuper.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base(b) { this.b = b; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index 9cb0dc77811..0577bdb645a 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -25,15 +25,16 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] -var __extendStatics = (this && this.__extendStatics) || - Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; -var __extends = (this && this.__extends) || function (d, b) { - __extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var __extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + __extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); define(["require", "exports"], function (require, exports) { "use strict"; var A = (function () { From 6b1cc8972d3e59f12cbc895e53ce90e76977faff Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 5 Dec 2016 14:13:32 -0800 Subject: [PATCH 113/289] Use native maps when they're available --- scripts/processDiagnosticMessages.ts | 10 +- src/compiler/binder.ts | 24 +- src/compiler/checker.ts | 397 +++++++++--------- src/compiler/commandLineParser.ts | 75 ++-- src/compiler/core.ts | 327 +++++++++++---- src/compiler/declarationEmitter.ts | 12 +- src/compiler/emitter.ts | 15 +- src/compiler/factory.ts | 28 +- src/compiler/parser.ts | 2 +- src/compiler/performance.ts | 20 +- src/compiler/program.ts | 44 +- src/compiler/scanner.ts | 17 +- src/compiler/sourcemap.ts | 2 +- src/compiler/sys.ts | 19 +- src/compiler/transformer.ts | 18 +- src/compiler/transformers/es2015.ts | 17 +- src/compiler/transformers/generators.ts | 24 +- src/compiler/transformers/jsx.ts | 2 +- src/compiler/transformers/module/module.ts | 48 +-- src/compiler/transformers/module/system.ts | 48 +-- src/compiler/transformers/ts.ts | 14 +- src/compiler/tsc.ts | 25 +- src/compiler/types.ts | 20 +- src/compiler/utilities.ts | 45 +- src/compiler/visitor.ts | 54 +-- src/harness/fourslash.ts | 28 +- src/harness/harness.ts | 15 +- src/harness/harnessLanguageService.ts | 4 +- src/harness/projectsRunner.ts | 21 +- .../unittests/cachingInServerLSHost.ts | 17 +- src/harness/unittests/moduleResolution.ts | 40 +- .../unittests/reuseProgramStructure.ts | 9 +- src/harness/unittests/session.ts | 16 +- .../unittests/tsserverProjectSystem.ts | 38 +- src/harness/unittests/typingsInstaller.ts | 2 +- src/server/builder.ts | 12 +- src/server/client.ts | 6 +- src/server/editorServices.ts | 70 +-- src/server/lsHost.ts | 7 +- src/server/project.ts | 52 +-- src/server/scriptInfo.ts | 2 +- src/server/session.ts | 6 +- src/server/typingsCache.ts | 25 +- .../typingsInstaller/typingsInstaller.ts | 30 +- src/server/utilities.ts | 21 +- src/services/classifier.ts | 2 +- src/services/codefixes/codeFixProvider.ts | 8 +- src/services/codefixes/importFixes.ts | 24 +- src/services/completions.ts | 38 +- src/services/documentHighlights.ts | 4 +- src/services/documentRegistry.ts | 8 +- src/services/findAllReferences.ts | 21 +- src/services/formatting/rules.ts | 2 +- src/services/goToDefinition.ts | 2 +- src/services/jsTyping.ts | 40 +- src/services/navigateTo.ts | 18 +- src/services/navigationBar.ts | 16 +- src/services/patternMatcher.ts | 6 +- src/services/services.ts | 11 +- src/services/signatureHelp.ts | 2 +- src/services/transpile.ts | 4 +- .../computedPropertyNames10_ES5.types | 4 +- .../computedPropertyNames10_ES6.types | 4 +- .../computedPropertyNames11_ES5.types | 4 +- .../computedPropertyNames11_ES6.types | 4 +- .../computedPropertyNames4_ES5.types | 4 +- .../computedPropertyNames4_ES6.types | 4 +- ...utedPropertyNamesContextualType6_ES5.types | 2 +- ...utedPropertyNamesContextualType6_ES6.types | 2 +- ...ntiationAssignmentWithIndexingOnLHS3.types | 16 +- ...rConstrainsPropertyDeclarations.errors.txt | 4 +- ...ConstrainsPropertyDeclarations2.errors.txt | 4 +- .../numericIndexerConstraint5.errors.txt | 4 +- .../objectLiteralIndexerErrors.errors.txt | 8 +- .../reference/objectLiteralIndexers.types | 10 +- ...ctTypeWithStringNamedNumericProperty.types | 30 +- ...rConstrainsPropertyDeclarations.errors.txt | 8 +- tests/cases/fourslash/fourslash.ts | 12 +- tests/cases/fourslash/localGetReferences.ts | 5 +- tslint.json | 3 +- 80 files changed, 1117 insertions(+), 949 deletions(-) diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index e5eaa46c8e5..db7a9e0f1f2 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -27,7 +27,7 @@ function main(): void { var inputFilePath = sys.args[0].replace(/\\/g, "/"); var inputStr = sys.readFile(inputFilePath); - + var diagnosticMessages: InputDiagnosticMessageTable = JSON.parse(inputStr); var names = Utilities.getObjectKeys(diagnosticMessages); @@ -44,7 +44,7 @@ function main(): void { function checkForUniqueCodes(messages: string[], diagnosticTable: InputDiagnosticMessageTable) { const originalMessageForCode: string[] = []; let numConflicts = 0; - + for (const currentMessage of messages) { const code = diagnosticTable[currentMessage].code; @@ -74,7 +74,7 @@ function buildUniqueNameMap(names: string[]): ts.Map { var uniqueNames = NameGenerator.ensureUniqueness(names, /* isCaseSensitive */ false, /* isFixed */ undefined); for (var i = 0; i < names.length; i++) { - nameMap[names[i]] = uniqueNames[i]; + nameMap.set(names[i], uniqueNames[i]); } return nameMap; @@ -91,7 +91,7 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap: for (var i = 0; i < names.length; i++) { var name = names[i]; var diagnosticDetails = messageTable[name]; - var propName = convertPropertyName(nameMap[name]); + var propName = convertPropertyName(nameMap.get(name)); result += ' ' + propName + @@ -114,7 +114,7 @@ function buildDiagnosticMessageOutput(messageTable: InputDiagnosticMessageTable, for (var i = 0; i < names.length; i++) { var name = names[i]; var diagnosticDetails = messageTable[name]; - var propName = convertPropertyName(nameMap[name]); + var propName = convertPropertyName(nameMap.get(name)); result += '\r\n "' + createKey(propName, diagnosticDetails.code) + '"' + ' : "' + name.replace(/[\"]/g, '\\"') + '"'; if (i !== names.length - 1) { diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a6f5993f6c8..18a6d00e922 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -349,17 +349,17 @@ namespace ts { // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable[name] || (symbolTable[name] = createSymbol(SymbolFlags.None, name)); + symbol = symbolTable.get(name) || set(symbolTable, name, createSymbol(SymbolFlags.None, name)); if (name && (includes & SymbolFlags.Classifiable)) { - classifiableNames[name] = name; + classifiableNames.set(name, name); } if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = symbolTable[name] = createSymbol(SymbolFlags.None, name); + symbol = set(symbolTable, name, createSymbol(SymbolFlags.None, name)); } else { if (node.name) { @@ -1570,7 +1570,7 @@ namespace ts { const typeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, SymbolFlags.TypeLiteral); typeLiteralSymbol.members = createMap(); - typeLiteralSymbol.members[symbol.name] = symbol; + typeLiteralSymbol.members.set(symbol.name, symbol); } function bindObjectLiteralExpression(node: ObjectLiteralExpression) { @@ -1601,9 +1601,9 @@ namespace ts { ? ElementKind.Property : ElementKind.Accessor; - const existingKind = seen[identifier.text]; + const existingKind = seen.get(identifier.text); if (!existingKind) { - seen[identifier.text] = currentKind; + seen.set(identifier.text, currentKind); continue; } @@ -2208,7 +2208,7 @@ namespace ts { constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - const funcSymbol = container.locals[constructorFunction.text]; + const funcSymbol = container.locals.get(constructorFunction.text); if (!funcSymbol || !(funcSymbol.flags & SymbolFlags.Function || isDeclarationOfFunctionExpression(funcSymbol))) { return; } @@ -2239,7 +2239,7 @@ namespace ts { bindAnonymousDeclaration(node, SymbolFlags.Class, bindingName); // Add name of class expression into the map for semantic classifier if (node.name) { - classifiableNames[node.name.text] = node.name.text; + classifiableNames.set(node.name.text, node.name.text); } } @@ -2255,14 +2255,14 @@ namespace ts { // module might have an exported variable called 'prototype'. We can't allow that as // that would clash with the built-in 'prototype' for the class. const prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype"); - if (symbol.exports[prototypeSymbol.name]) { + const symbolExport = symbol.exports.get(prototypeSymbol.name); + if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], - Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(createDiagnosticForNode(symbolExport.declarations[0], Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } - symbol.exports[prototypeSymbol.name] = prototypeSymbol; + symbol.exports.set(prototypeSymbol.name, prototypeSymbol); prototypeSymbol.parent = symbol; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dc97d347e95..00a6ad2c366 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,4 +1,4 @@ -/// +/// /// /* @internal */ @@ -371,7 +371,7 @@ namespace ts { } const builtinGlobals = createMap(); - builtinGlobals[undefinedSymbol.name] = undefinedSymbol; + builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); initializeTypeChecker(); @@ -492,18 +492,19 @@ namespace ts { } function mergeSymbolTable(target: SymbolTable, source: SymbolTable) { - for (const id in source) { - let targetSymbol = target[id]; + source.forEach((sourceSymbol, id) => { + let targetSymbol = target.get(id); if (!targetSymbol) { - target[id] = source[id]; + target.set(id, sourceSymbol); } else { if (!(targetSymbol.flags & SymbolFlags.Merged)) { - target[id] = targetSymbol = cloneSymbol(targetSymbol); + targetSymbol = cloneSymbol(targetSymbol); + target.set(id, targetSymbol); } - mergeSymbol(targetSymbol, source[id]); + mergeSymbol(targetSymbol, sourceSymbol); } - } + }); } function mergeModuleAugmentation(moduleName: LiteralExpression): void { @@ -544,15 +545,16 @@ namespace ts { } function addToSymbolTable(target: SymbolTable, source: SymbolTable, message: DiagnosticMessage) { - for (const id in source) { - if (target[id]) { + source.forEach((sourceSymbol, id) => { + const targetSymbol = target.get(id); + if (targetSymbol) { // Error on redeclarations - forEach(target[id].declarations, addDeclarationDiagnostic(id, message)); + forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); } else { - target[id] = source[id]; + target.set(id, sourceSymbol); } - } + }); function addDeclarationDiagnostic(id: string, message: DiagnosticMessage) { return (declaration: Declaration) => diagnostics.add(createDiagnosticForNode(declaration, message, id)); @@ -580,7 +582,7 @@ namespace ts { function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol { if (meaning) { - const symbol = symbols[name]; + const symbol = symbols.get(name); if (symbol) { Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { @@ -765,7 +767,7 @@ namespace ts { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. - if (result = moduleExports["default"]) { + if (result = moduleExports.get("default")) { const localSymbol = getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { break loop; @@ -784,9 +786,10 @@ namespace ts { // 2. We check === SymbolFlags.Alias in order to check that the symbol is *purely* // an alias. If we used &, we'd be throwing out symbols that have non alias aspects, // which is not the desired behavior. - if (moduleExports[name] && - moduleExports[name].flags === SymbolFlags.Alias && - getDeclarationOfKind(moduleExports[name], SyntaxKind.ExportSpecifier)) { + const moduleExport = moduleExports.get(name); + if (moduleExport && + moduleExport.flags === SymbolFlags.Alias && + getDeclarationOfKind(moduleExport, SyntaxKind.ExportSpecifier)) { break; } } @@ -1114,11 +1117,16 @@ namespace ts { const moduleSymbol = resolveExternalModuleName(node, (node.parent).moduleSpecifier); if (moduleSymbol) { - const exportDefaultSymbol = isShorthandAmbientModuleSymbol(moduleSymbol) ? - moduleSymbol : - moduleSymbol.exports["export="] ? - getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : - resolveSymbol(moduleSymbol.exports["default"]); + let exportDefaultSymbol: Symbol; + if (isShorthandAmbientModuleSymbol(moduleSymbol)) { + exportDefaultSymbol = moduleSymbol; + } + else { + const exportValue = moduleSymbol.exports.get("export="); + exportDefaultSymbol = exportValue + ? getPropertyOfType(getTypeOfSymbol(exportValue), "default") + : resolveSymbol(moduleSymbol.exports.get("default")); + } if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); @@ -1168,7 +1176,7 @@ namespace ts { function getExportOfModule(symbol: Symbol, name: string): Symbol { if (symbol.flags & SymbolFlags.Module) { - const exportedSymbol = getExportsOfSymbol(symbol)[name]; + const exportedSymbol = getExportsOfSymbol(symbol).get(name); if (exportedSymbol) { return resolveSymbol(exportedSymbol); } @@ -1196,7 +1204,7 @@ namespace ts { let symbolFromVariable: Symbol; // First check if module was specified with "export=". If so, get the member from the resolved type - if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); } else { @@ -1475,7 +1483,7 @@ namespace ts { // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. function resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol { - return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports["export="])) || moduleSymbol; + return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export="))) || moduleSymbol; } // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export =' @@ -1491,7 +1499,7 @@ namespace ts { } function hasExportAssignmentSymbol(moduleSymbol: Symbol): boolean { - return moduleSymbol.exports["export="] !== undefined; + return moduleSymbol.exports.get("export=") !== undefined; } function getExportsOfModuleAsArray(moduleSymbol: Symbol): Symbol[] { @@ -1501,7 +1509,7 @@ namespace ts { function tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined { const symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { - return symbolTable[memberName]; + return symbolTable.get(memberName); } } @@ -1524,24 +1532,30 @@ namespace ts { * Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables */ function extendExportSymbols(target: SymbolTable, source: SymbolTable, lookupTable?: Map, exportNode?: ExportDeclaration) { - for (const id in source) { - if (id !== "default" && !target[id]) { - target[id] = source[id]; + if (!source) return; + + source.forEach((sourceSymbol, id) => { + if (id === "default") return; + + const targetSymbol = target.get(id); + if (!targetSymbol) { + target.set(id, sourceSymbol); if (lookupTable && exportNode) { - lookupTable[id] = { + lookupTable.set(id, { specifierText: getTextOfNode(exportNode.moduleSpecifier) - } as ExportCollisionTracker; + } as ExportCollisionTracker); } } - else if (lookupTable && exportNode && id !== "default" && target[id] && resolveSymbol(target[id]) !== resolveSymbol(source[id])) { - if (!lookupTable[id].exportsWithDuplicate) { - lookupTable[id].exportsWithDuplicate = [exportNode]; + else if (lookupTable && exportNode && targetSymbol && resolveSymbol(targetSymbol) !== resolveSymbol(sourceSymbol)) { + const collisionTracker = lookupTable.get(id); + if (!collisionTracker.exportsWithDuplicate) { + collisionTracker.exportsWithDuplicate = [exportNode]; } else { - lookupTable[id].exportsWithDuplicate.push(exportNode); + collisionTracker.exportsWithDuplicate.push(exportNode); } } - } + }); } function getExportsForModule(moduleSymbol: Symbol): SymbolTable { @@ -1561,7 +1575,7 @@ namespace ts { visitedSymbols.push(symbol); const symbols = cloneMap(symbol.exports); // All export * declarations are collected in an __export symbol by the binder - const exportStars = symbol.exports["__export"]; + const exportStars = symbol.exports.get("__export"); if (exportStars) { const nestedSymbols = createMap(); const lookupTable = createMap(); @@ -1575,21 +1589,20 @@ namespace ts { node as ExportDeclaration ); } - for (const id in lookupTable) { - const { exportsWithDuplicate } = lookupTable[id]; + lookupTable.forEach(({ exportsWithDuplicate }, id) => { // It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself - if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols[id]) { - continue; + if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || symbols.has(id)) { + return; } for (const node of exportsWithDuplicate) { diagnostics.add(createDiagnosticForNode( node, Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, - lookupTable[id].specifierText, + lookupTable.get(id).specifierText, id )); } - } + }); extendExportSymbols(symbols, nestedSymbols); } return symbols; @@ -1684,15 +1697,14 @@ namespace ts { function getNamedMembers(members: SymbolTable): Symbol[] { let result: Symbol[]; - for (const id in members) { + members.forEach((symbol, id) => { if (!isReservedMemberName(id)) { if (!result) result = []; - const symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } } - } + }); return result || emptyArray; } @@ -1765,12 +1777,12 @@ namespace ts { } // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { + if (isAccessible(symbols.get(symbol.name))) { return [symbol]; } // Check if symbol is any of the alias - return forEachProperty(symbols, symbolFromSymbolTable => { + return forEachInMap(symbols, symbolFromSymbolTable => { if (symbolFromSymbolTable.flags & SymbolFlags.Alias && symbolFromSymbolTable.name !== "export=" && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { @@ -1805,7 +1817,7 @@ namespace ts { let qualify = false; forEachSymbolTableInScope(enclosingDeclaration, symbolTable => { // If symbol of this name is not available in the symbol table we are ok - let symbolFromSymbolTable = symbolTable[symbol.name]; + let symbolFromSymbolTable = symbolTable.get(symbol.name); if (!symbolFromSymbolTable) { // Continue to the next symbol table return false; @@ -3068,15 +3080,15 @@ namespace ts { const members = createMap(); const names = createMap(); for (const name of properties) { - names[getTextOfPropertyName(name)] = true; + names.set(getTextOfPropertyName(name), true); } for (const prop of getPropertiesOfType(source)) { - const inNamesToRemove = prop.name in names; + const inNamesToRemove = names.has(prop.name); const isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (ModifierFlags.Private | ModifierFlags.Protected); const isMethod = prop.flags & SymbolFlags.Method; const isSetOnlyAccessor = prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor); if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { - members[prop.name] = prop; + members.set(prop.name, prop); } } const stringIndexInfo = getIndexInfoOfType(source, IndexKind.String); @@ -3338,7 +3350,7 @@ namespace ts { const symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members[symbol.name] = symbol; + members.set(symbol.name, symbol); }); const result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { @@ -3939,7 +3951,7 @@ namespace ts { type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; (type).instantiations = createMap(); - (type).instantiations[getTypeListId(type.typeParameters)] = type; + (type).instantiations.set(getTypeListId(type.typeParameters), type); (type).target = type; (type).typeArguments = type.typeParameters; type.thisType = createType(TypeFlags.TypeParameter); @@ -3982,7 +3994,7 @@ namespace ts { // an instantiation of the type alias with the type parameters supplied as type arguments. links.typeParameters = typeParameters; links.instantiations = createMap(); - links.instantiations[getTypeListId(typeParameters)] = type; + links.instantiations.set(getTypeListId(typeParameters), type); } } else { @@ -4002,7 +4014,7 @@ namespace ts { return expr.kind === SyntaxKind.NumericLiteral || expr.kind === SyntaxKind.PrefixUnaryExpression && (expr).operator === SyntaxKind.MinusToken && (expr).operand.kind === SyntaxKind.NumericLiteral || - expr.kind === SyntaxKind.Identifier && !!symbol.exports[(expr).text]; + expr.kind === SyntaxKind.Identifier && !!symbol.exports.get((expr).text); } function enumHasLiteralMembers(symbol: Symbol) { @@ -4040,8 +4052,8 @@ namespace ts { for (const member of (declaration).members) { const memberSymbol = getSymbolOfNode(member); const value = getEnumMemberValue(member); - if (!memberTypes[value]) { - const memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, "" + value); + if (!memberTypes.has(value)) { + const memberType = set(memberTypes, value, createEnumLiteralType(memberSymbol, enumType, "" + value)); memberTypeList.push(memberType); } } @@ -4051,7 +4063,7 @@ namespace ts { if (memberTypeList.length > 1) { enumType.flags |= TypeFlags.Union; (enumType).types = memberTypeList; - unionTypes[getTypeListId(memberTypeList)] = enumType; + unionTypes.set(getTypeListId(memberTypeList), enumType); } } } @@ -4063,7 +4075,7 @@ namespace ts { if (!links.declaredType) { const enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); links.declaredType = enumType.flags & TypeFlags.Union ? - enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] : + enumType.memberTypes.get(getEnumMemberValue(symbol.valueDeclaration)) : enumType; } return links.declaredType; @@ -4195,7 +4207,7 @@ namespace ts { function createSymbolTable(symbols: Symbol[]): SymbolTable { const result = createMap(); for (const symbol of symbols) { - result[symbol.name] = symbol; + result.set(symbol.name, symbol); } return result; } @@ -4205,15 +4217,15 @@ namespace ts { function createInstantiatedSymbolTable(symbols: Symbol[], mapper: TypeMapper, mappingThisOnly: boolean): SymbolTable { const result = createMap(); for (const symbol of symbols) { - result[symbol.name] = mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper); + result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols: SymbolTable, baseSymbols: Symbol[]) { for (const s of baseSymbols) { - if (!symbols[s.name]) { - symbols[s.name] = s; + if (!symbols.has(s.name)) { + symbols.set(s.name, s); } } } @@ -4222,8 +4234,8 @@ namespace ts { if (!(type).declaredProperties) { const symbol = type.symbol; (type).declaredProperties = getNamedMembers(symbol.members); - (type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); - (type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + (type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get("__call")); + (type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get("__new")); (type).declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); (type).declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number); } @@ -4468,8 +4480,8 @@ namespace ts { } else if (symbol.flags & SymbolFlags.TypeLiteral) { const members = symbol.members; - const callSignatures = getSignaturesOfSymbol(members["__call"]); - const constructSignatures = getSignaturesOfSymbol(members["__new"]); + const callSignatures = getSignaturesOfSymbol(members.get("__call")); + const constructSignatures = getSignaturesOfSymbol(members.get("__new")); const stringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); const numberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number); setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); @@ -4483,7 +4495,7 @@ namespace ts { } if (symbol.flags & SymbolFlags.Class) { const classType = getDeclaredTypeOfClassOrInterface(symbol); - constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + constructSignatures = getSignaturesOfSymbol(symbol.members.get("__constructor")); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); } @@ -4541,7 +4553,7 @@ namespace ts { const prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | (isOptional ? SymbolFlags.Optional : 0), propName); prop.type = propType; prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp); - members[propName] = prop; + members.set(propName, prop); } else if (t.flags & TypeFlags.String) { stringIndexInfo = createIndexInfo(propType, templateReadonly); @@ -4623,7 +4635,7 @@ namespace ts { function getPropertyOfObjectType(type: Type, name: string): Symbol { if (type.flags & TypeFlags.Object) { const resolved = resolveStructuredTypeMembers(type); - const symbol = resolved.members[name]; + const symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -4644,13 +4656,12 @@ namespace ts { const props = type.resolvedProperties; if (props) { const result: Symbol[] = []; - for (const key in props) { - const prop = props[key]; + props.forEach(prop => { // We need to filter out partial properties in union types if (!(prop.flags & SymbolFlags.SyntheticProperty && (prop).isPartial)) { result.push(prop); } - } + }); return result; } return emptyArray; @@ -4770,11 +4781,11 @@ namespace ts { // and do not appear to be present in the union type. function getUnionOrIntersectionProperty(type: UnionOrIntersectionType, name: string): Symbol { const properties = type.resolvedProperties || (type.resolvedProperties = createMap()); - let property = properties[name]; + let property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); if (property) { - properties[name] = property; + properties.set(name, property); } } return property; @@ -4798,7 +4809,7 @@ namespace ts { type = getApparentType(type); if (type.flags & TypeFlags.Object) { const resolved = resolveStructuredTypeMembers(type); - const symbol = resolved.members[name]; + const symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { return symbol; } @@ -4897,11 +4908,11 @@ namespace ts { function symbolsToArray(symbols: SymbolTable): Symbol[] { const result: Symbol[] = []; - for (const id in symbols) { + symbols.forEach((symbol, id) => { if (!isReservedMemberName(id)) { - result.push(symbols[id]); + result.push(symbol); } - } + }); return result; } @@ -5175,7 +5186,7 @@ namespace ts { function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { const instantiations = signature.instantiations || (signature.instantiations = createMap()); const id = getTypeListId(typeArguments); - return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + return instantiations.get(id) || set(instantiations, id, createSignatureInstantiation(signature, typeArguments)); } function createSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { @@ -5209,7 +5220,7 @@ namespace ts { } function getIndexSymbol(symbol: Symbol): Symbol { - return symbol.members["__index"]; + return symbol.members.get("__index"); } function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): SignatureDeclaration { @@ -5323,9 +5334,9 @@ namespace ts { function createTypeReference(target: GenericType, typeArguments: Type[]): TypeReference { const id = getTypeListId(typeArguments); - let type = target.instantiations[id]; + let type = target.instantiations.get(id); if (!type) { - type = target.instantiations[id] = createObjectType(ObjectFlags.Reference, target.symbol); + type = set(target.instantiations, id, createObjectType(ObjectFlags.Reference, target.symbol)); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -5372,7 +5383,7 @@ namespace ts { const links = getSymbolLinks(symbol); const typeParameters = links.typeParameters; const id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + return links.instantiations.get(id) || set(links.instantiations, id, instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include @@ -5613,7 +5624,7 @@ namespace ts { type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; type.instantiations = createMap(); - type.instantiations[getTypeListId(type.typeParameters)] = type; + type.instantiations.set(getTypeListId(type.typeParameters), type); type.target = type; type.typeArguments = type.typeParameters; type.thisType = createType(TypeFlags.TypeParameter); @@ -5818,10 +5829,10 @@ namespace ts { return types[0]; } const id = getTypeListId(types); - let type = unionTypes[id]; + let type = unionTypes.get(id); if (!type) { const propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); - type = unionTypes[id] = createType(TypeFlags.Union | propagatedFlags); + type = set(unionTypes, id, createType(TypeFlags.Union | propagatedFlags)); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -5892,10 +5903,10 @@ namespace ts { /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); } const id = getTypeListId(typeSet); - let type = intersectionTypes[id]; + let type = intersectionTypes.get(id); if (!type) { const propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); - type = intersectionTypes[id] = createType(TypeFlags.Intersection | propagatedFlags); + type = set(intersectionTypes, id, createType(TypeFlags.Intersection | propagatedFlags)); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -6054,7 +6065,7 @@ namespace ts { } // Otherwise we defer the operation by creating an indexed access type. const id = objectType.id + "," + indexType.id; - return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); + return indexedAccessTypes.get(id) || set(indexedAccessTypes, id, createIndexedAccessType(objectType, indexType)); } const apparentObjectType = getApparentType(objectType); if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) { @@ -6099,7 +6110,7 @@ namespace ts { if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers const aliasSymbol = getAliasSymbolForTypeNode(node); - if (isEmpty(node.symbol.members) && !aliasSymbol) { + if (mapIsEmpty(node.symbol.members) && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -6164,19 +6175,19 @@ namespace ts { const isOwnProperty = !(rightProp.flags & SymbolFlags.Method) || isFromObjectLiteral; const isSetterWithoutGetter = rightProp.flags & SymbolFlags.SetAccessor && !(rightProp.flags & SymbolFlags.GetAccessor); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (ModifierFlags.Private | ModifierFlags.Protected)) { - skippedPrivateMembers[rightProp.name] = true; + skippedPrivateMembers.set(rightProp.name, true); } else if (isOwnProperty && !isSetterWithoutGetter) { - members[rightProp.name] = rightProp; + members.set(rightProp.name, rightProp); } } for (const leftProp of getPropertiesOfType(left)) { if (leftProp.flags & SymbolFlags.SetAccessor && !(leftProp.flags & SymbolFlags.GetAccessor) - || leftProp.name in skippedPrivateMembers) { + || skippedPrivateMembers.has(leftProp.name)) { continue; } - if (leftProp.name in members) { - const rightProp = members[leftProp.name]; + if (members.has(leftProp.name)) { + const rightProp = members.get(leftProp.name); const rightType = getTypeOfSymbol(rightProp); if (maybeTypeOfKind(rightType, TypeFlags.Undefined) || rightProp.flags & SymbolFlags.Optional) { const declarations: Declaration[] = concatenate(leftProp.declarations, rightProp.declarations); @@ -6187,11 +6198,11 @@ namespace ts { result.rightSpread = rightProp; result.declarations = declarations; result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); - members[leftProp.name] = result; + members.set(leftProp.name, result); } } else { - members[leftProp.name] = leftProp; + members.set(leftProp.name, leftProp); } } return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); @@ -6221,7 +6232,7 @@ namespace ts { function getLiteralTypeForText(flags: TypeFlags, text: string) { const map = flags & TypeFlags.StringLiteral ? stringLiteralTypes : numericLiteralTypes; - return map[text] || (map[text] = createLiteralType(flags, text)); + return map.get(text) || set(map, text, createLiteralType(flags, text)); } function getTypeFromLiteralTypeNode(node: LiteralTypeNode): Type { @@ -7006,13 +7017,14 @@ namespace ts { return true; } const id = source.id + "," + target.id; - if (enumRelation[id] !== undefined) { - return enumRelation[id]; + const relation = enumRelation.get(id); + if (relation !== undefined) { + return relation; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & SymbolFlags.RegularEnum) || !(target.symbol.flags & SymbolFlags.RegularEnum) || (source.flags & TypeFlags.Union) !== (target.flags & TypeFlags.Union)) { - return enumRelation[id] = false; + return set(enumRelation, id, false); } const targetEnumType = getTypeOfSymbol(target.symbol); for (const property of getPropertiesOfType(getTypeOfSymbol(source.symbol))) { @@ -7023,11 +7035,11 @@ namespace ts { errorReporter(Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); } - return enumRelation[id] = false; + return set(enumRelation, id, false); } } } - return enumRelation[id] = true; + return set(enumRelation, id, true); } function isSimpleTypeRelatedTo(source: Type, target: Type, relation: Map, errorReporter?: ErrorReporter) { @@ -7070,7 +7082,7 @@ namespace ts { } if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) { const id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - const related = relation[id]; + const related = relation.get(id); if (related !== undefined) { return related === RelationComparisonResult.Succeeded; } @@ -7527,12 +7539,12 @@ namespace ts { return Ternary.False; } const id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - const related = relation[id]; + const related = relation.get(id); if (related !== undefined) { if (reportErrors && related === RelationComparisonResult.Failed) { // We are elaborating errors and the cached result is an unreported failure. Record the result as a reported // failure and continue computing the relation such that errors get reported. - relation[id] = RelationComparisonResult.FailedAndReported; + relation.set(id, RelationComparisonResult.FailedAndReported); } else { return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; @@ -7541,7 +7553,7 @@ namespace ts { if (depth > 0) { for (let i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions - if (maybeStack[i][id]) { + if (maybeStack[i].get(id)) { return Ternary.Maybe; } } @@ -7559,7 +7571,7 @@ namespace ts { sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = createMap(); - maybeStack[depth][id] = RelationComparisonResult.Succeeded; + maybeStack[depth].set(id, RelationComparisonResult.Succeeded); depth++; const saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1; @@ -7592,12 +7604,12 @@ namespace ts { const maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up const destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1]; - copyProperties(maybeCache, destinationCache); + copyMapEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed; + relation.set(id, reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed); } return result; } @@ -8266,7 +8278,7 @@ namespace ts { for (const property of getPropertiesOfObjectType(type)) { const original = getTypeOfSymbol(property); const updated = f(original); - members[property.name] = updated === original ? property : createTransientSymbol(property, updated); + members.set(property.name, updated === original ? property : createTransientSymbol(property, updated)); }; return members; } @@ -8508,7 +8520,7 @@ namespace ts { inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); - members[prop.name] = inferredProp; + members.set(prop.name, inferredProp); } if (indexInfo) { const inferredIndexType = inferTargetType(indexInfo.type); @@ -8683,10 +8695,10 @@ namespace ts { return; } const key = source.id + "," + target.id; - if (visited[key]) { + if (visited.get(key)) { return; } - visited[key] = true; + visited.set(key, true); if (depth === 0) { sourceStack = []; targetStack = []; @@ -9067,7 +9079,7 @@ namespace ts { // check. This gives us a quicker out in the common case where an object type is not a function. const resolved = resolveStructuredTypeMembers(type); return !!(resolved.callSignatures.length || resolved.constructSignatures.length || - resolved.members["bind"] && isTypeSubtypeOf(type, globalFunctionType)); + resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type: Type): TypeFacts { @@ -9687,8 +9699,9 @@ namespace ts { if (!key) { key = getFlowCacheKey(reference); } - if (cache[key]) { - return cache[key]; + const cached = cache.get(key); + if (cached) { + return cached; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. @@ -9722,8 +9735,9 @@ namespace ts { // If we see a value appear in the cache it is a sign that control flow analysis // was restarted and completed by checkExpressionCached. We can simply pick up // the resulting type and bail out. - if (cache[key]) { - return cache[key]; + const cached = cache.get(key); + if (cached) { + return cached; } if (!contains(antecedentTypes, type)) { antecedentTypes.push(type); @@ -9747,7 +9761,7 @@ namespace ts { if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return cache[key] = result; + return set(cache, key, result); } function isMatchingReferenceDiscriminant(expr: Expression) { @@ -9870,14 +9884,14 @@ namespace ts { // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. - const targetType = typeofTypesByName[literal.text]; + const targetType = typeofTypesByName.get(literal.text); if (targetType && isTypeSubtypeOf(targetType, type)) { return targetType; } } const facts = assumeTrue ? - typeofEQFacts[literal.text] || TypeFacts.TypeofEQHostObject : - typeofNEFacts[literal.text] || TypeFacts.TypeofNEHostObject; + typeofEQFacts.get(literal.text) || TypeFacts.TypeofEQHostObject : + typeofNEFacts.get(literal.text) || TypeFacts.TypeofNEHostObject; return getTypeWithFacts(type, facts); } @@ -11524,7 +11538,7 @@ namespace ts { } } else { - propertiesTable[member.name] = member; + propertiesTable.set(member.name, member); } propertiesArray.push(member); } @@ -11533,12 +11547,12 @@ namespace ts { // type with those properties for which the binding pattern specifies a default value. if (contextualTypeHasPattern) { for (const prop of getPropertiesOfType(contextualType)) { - if (!propertiesTable[prop.name]) { + if (!propertiesTable.get(prop.name)) { if (!(prop.flags & SymbolFlags.Optional)) { error(prop.valueDeclaration || (prop).bindingElement, Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable[prop.name] = prop; + propertiesTable.set(prop.name, prop); propertiesArray.push(prop); } } @@ -11676,7 +11690,7 @@ namespace ts { checkTypeAssignableTo(exprType, correspondingPropType, node); } - nameTable[node.name.text] = true; + nameTable.set(node.name.text, true); return exprType; } @@ -11689,24 +11703,25 @@ namespace ts { for (const prop of props) { // Is there a corresponding property in the element attributes type? Skip checking of properties // that have already been assigned to, as these are not actually pushed into the resulting type - if (!nameTable[prop.name]) { + if (!nameTable.get(prop.name)) { const targetPropSym = getPropertyOfType(elementAttributesType, prop.name); if (targetPropSym) { const msg = chainDiagnosticMessages(undefined, Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property, prop.name); checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(targetPropSym), node, undefined, msg); } - nameTable[prop.name] = true; + nameTable.set(prop.name, true); } } return type; } function getJsxType(name: string) { - if (jsxTypes[name] === undefined) { - return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType; + const jsxType = jsxTypes.get(name); + if (jsxType === undefined) { + return set(jsxTypes, name, getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } - return jsxTypes[name]; + return jsxType; } /** @@ -12039,11 +12054,9 @@ namespace ts { // was spreaded in, though, assume that it provided all required properties if (targetAttributesType && !sawSpreadedAny) { const targetProperties = getPropertiesOfType(targetAttributesType); - for (let i = 0; i < targetProperties.length; i++) { - if (!(targetProperties[i].flags & SymbolFlags.Optional) && - !nameTable[targetProperties[i].name]) { - - error(node, Diagnostics.Property_0_is_missing_in_type_1, targetProperties[i].name, typeToString(targetAttributesType)); + for (const targetProperty of targetProperties) { + if (!(targetProperty.flags & SymbolFlags.Optional) && !nameTable.get(targetProperty.name)) { + error(node, Diagnostics.Property_0_is_missing_in_type_1, targetProperty.name, typeToString(targetAttributesType)); } } } @@ -15462,17 +15475,17 @@ namespace ts { } function addName(names: Map, location: Node, name: string, meaning: Accessor) { - const prev = names[name]; + const prev = names.get(name); if (prev) { if (prev & meaning) { error(location, Diagnostics.Duplicate_identifier_0, getTextOfNode(location)); } else { - names[name] = prev | meaning; + names.set(name, prev | meaning); } } else { - names[name] = meaning; + names.set(name, meaning); } } } @@ -15492,12 +15505,12 @@ namespace ts { continue; } - if (names[memberName]) { + if (names.get(memberName)) { error(member.symbol.valueDeclaration.name, Diagnostics.Duplicate_identifier_0, memberName); error(member.name, Diagnostics.Duplicate_identifier_0, memberName); } else { - names[memberName] = true; + names.set(memberName, true); } } } @@ -16681,8 +16694,7 @@ namespace ts { function checkUnusedLocalsAndParameters(node: Node): void { if (node.parent.kind !== SyntaxKind.InterfaceDeclaration && noUnusedIdentifiers && !isInAmbientContext(node)) { - for (const key in node.locals) { - const local = node.locals[key]; + node.locals.forEach(local => { if (!local.isReferenced) { if (local.valueDeclaration && getRootDeclaration(local.valueDeclaration).kind === SyntaxKind.Parameter) { const parameter = getRootDeclaration(local.valueDeclaration); @@ -16697,7 +16709,7 @@ namespace ts { forEach(local.declarations, d => errorUnusedLocal(d.name || d, local.name)); } } - } + }); } } @@ -16763,8 +16775,7 @@ namespace ts { function checkUnusedModuleMembers(node: ModuleDeclaration | SourceFile): void { if (compilerOptions.noUnusedLocals && !isInAmbientContext(node)) { - for (const key in node.locals) { - const local = node.locals[key]; + node.locals.forEach(local => { if (!local.isReferenced && !local.exportSymbol) { for (const declaration of local.declarations) { if (!isAmbientModule(declaration)) { @@ -16772,7 +16783,7 @@ namespace ts { } } } - } + }); } } @@ -17801,12 +17812,12 @@ namespace ts { else { const blockLocals = catchClause.block.locals; if (blockLocals) { - for (const caughtName in catchClause.locals) { - const blockLocal = blockLocals[caughtName]; + forEachKeyInMap(catchClause.locals, caughtName => { + const blockLocal = blockLocals.get(caughtName); if (blockLocal && (blockLocal.flags & SymbolFlags.BlockScopedVariable) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); } - } + }); } } } @@ -18230,15 +18241,15 @@ namespace ts { } const seen = createMap<{ prop: Symbol; containingType: Type }>(); - forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; }); + forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen.set(p.name, { prop: p, containingType: type }); }); let ok = true; for (const base of baseTypes) { const properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); for (const prop of properties) { - const existing = seen[prop.name]; + const existing = seen.get(prop.name); if (!existing) { - seen[prop.name] = { prop: prop, containingType: base }; + seen.set(prop.name, { prop: prop, containingType: base }); } else { const isInheritedProperty = existing.containingType !== type; @@ -18980,19 +18991,14 @@ namespace ts { } function hasExportedMembers(moduleSymbol: Symbol) { - for (const id in moduleSymbol.exports) { - if (id !== "export=") { - return true; - } - } - return false; + return someKeyInMap(moduleSymbol.exports, id => id !== "export="); } function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) { const moduleSymbol = getSymbolOfNode(node); const links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - const exportEqualsSymbol = moduleSymbol.exports["export="]; + const exportEqualsSymbol = moduleSymbol.exports.get("export="); if (exportEqualsSymbol && hasExportedMembers(moduleSymbol)) { const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration; if (!isTopLevelInExternalModuleAugmentation(declaration)) { @@ -19001,21 +19007,20 @@ namespace ts { } // Checks for export * conflicts const exports = getExportsOfModule(moduleSymbol); - for (const id in exports) { + exports && exports.forEach(({ declarations, flags }, id) => { if (id === "__export") { - continue; + return; } - const { declarations, flags } = exports[id]; // ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. // (TS Exceptions: namespaces, function overloads, enums, and interfaces) if (flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) { - continue; + return; } const exportedDeclarationsCount = countWhere(declarations, isNotOverload); if (flags & SymbolFlags.TypeAlias && exportedDeclarationsCount <= 2) { // it is legal to merge type alias with other values // so count should be either 1 (just type alias) or 2 (type alias + merged value) - continue; + return; } if (exportedDeclarationsCount > 1) { for (const declaration of declarations) { @@ -19024,7 +19029,7 @@ namespace ts { } } } - } + }); links.exportsChecked = true; } @@ -19407,18 +19412,17 @@ namespace ts { // We will copy all symbol regardless of its reserved name because // symbolsToArray will check whether the key is a reserved name and // it will not copy symbol with reserved name to the array - if (!symbols[id]) { - symbols[id] = symbol; + if (!symbols.has(id)) { + symbols.set(id, symbol); } } } function copySymbols(source: SymbolTable, meaning: SymbolFlags): void { if (meaning) { - for (const id in source) { - const symbol = source[id]; + source.forEach(symbol => { copySymbol(symbol, meaning); - } + }); } } } @@ -19829,8 +19833,8 @@ namespace ts { const propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, SignatureKind.Call).length || getSignaturesOfType(type, SignatureKind.Construct).length) { forEach(getPropertiesOfType(globalFunctionType), p => { - if (!propsByName[p.name]) { - propsByName[p.name] = p; + if (!propsByName.has(p.name)) { + propsByName.set(p.name, p); } }); } @@ -19897,7 +19901,7 @@ namespace ts { // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & SymbolFlags.Value) - : forEachProperty(getExportsOfModule(moduleSymbol), isValue); + : someInMap(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; @@ -20247,7 +20251,7 @@ namespace ts { } function hasGlobalName(name: string): boolean { - return !!globals[name]; + return globals.has(name); } function getReferencedValueSymbol(reference: Identifier, startInDeclarationContainer?: boolean): Symbol { @@ -20304,14 +20308,13 @@ namespace ts { if (resolvedTypeReferenceDirectives) { // populate reverse mapping: file path -> type reference directive that was resolved to this file fileToDirective = createFileMap(); - for (const key in resolvedTypeReferenceDirectives) { - const resolvedDirective = resolvedTypeReferenceDirectives[key]; + resolvedTypeReferenceDirectives.forEach((resolvedDirective, key) => { if (!resolvedDirective) { - continue; + return; } const file = host.getSourceFile(resolvedDirective.resolvedFileName); fileToDirective.set(file.path, key); - } + }); } return { getReferencedExportContainer, @@ -20455,11 +20458,11 @@ namespace ts { if (file.symbol && file.symbol.globalExports) { // Merge in UMD exports with first-in-wins semantics (see #9771) const source = file.symbol.globalExports; - for (const id in source) { - if (!(id in globals)) { - globals[id] = source[id]; + source.forEach((sourceSymbol, id) => { + if (!globals.has(id)) { + globals.set(id, sourceSymbol); } - } + }); } } @@ -21211,17 +21214,17 @@ namespace ts { continue; } - if (!seen[effectiveName]) { - seen[effectiveName] = currentKind; + const existingKind = seen.get(effectiveName); + if (!existingKind) { + seen.set(effectiveName, currentKind); } else { - const existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { grammarErrorOnNode(name, Diagnostics.Duplicate_identifier_0, getTextOfNode(name)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[effectiveName] = currentKind | existingKind; + seen.set(effectiveName, currentKind | existingKind); } else { return grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); @@ -21243,8 +21246,8 @@ namespace ts { const jsxAttr = (attr); const name = jsxAttr.name; - if (!seen[name.text]) { - seen[name.text] = true; + if (!seen.get(name.text)) { + seen.set(name.text, true); } else { return grammarErrorOnNode(name, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); @@ -21741,11 +21744,11 @@ namespace ts { function getAmbientModules(): Symbol[] { const result: Symbol[] = []; - for (const sym in globals) { + globals.forEach((global, sym) => { if (ambientModuleSymbolRegex.test(sym)) { - result.push(globals[sym]); + result.push(global); } - } + }); return result; } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 025218e62fd..7571804b5f4 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -531,9 +531,9 @@ namespace ts { const optionNameMap = createMap(); const shortOptionNames = createMap(); forEach(optionDeclarations, option => { - optionNameMap[option.name.toLowerCase()] = option; + optionNameMap.set(option.name.toLowerCase(), option); if (option.shortName) { - shortOptionNames[option.shortName] = option.name; + shortOptionNames.set(option.shortName, option.name); } }); @@ -543,7 +543,7 @@ namespace ts { /* @internal */ export function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic { - const namesOfType = Object.keys(opt.type).map(key => `'${key}'`).join(", "); + const namesOfType = keysOfMap(opt.type).map(key => `'${key}'`).join(", "); return createCompilerDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, namesOfType); } @@ -598,13 +598,13 @@ namespace ts { s = s.slice(s.charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase(); // Try to translate short option names to their full equivalents. - if (s in shortOptionNames) { - s = shortOptionNames[s]; + const short = shortOptionNames.get(s); + if (short !== undefined) { + s = short; } - if (s in optionNameMap) { - const opt = optionNameMap[s]; - + const opt = optionNameMap.get(s); + if (opt) { if (opt.isTSConfigOnly) { errors.push(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); } @@ -727,7 +727,7 @@ namespace ts { * @param fileNames array of filenames to be generated into tsconfig.json */ /* @internal */ - export function generateTSConfig(options: CompilerOptions, fileNames: string[]): { compilerOptions: Map } { + export function generateTSConfig(options: CompilerOptions, fileNames: string[]): { compilerOptions: MapLike } { const compilerOptions = extend(options, defaultInitCompilerOptions); const configurations: any = { compilerOptions: serializeCompilerOptions(compilerOptions) @@ -752,18 +752,17 @@ namespace ts { } } - function getNameOfCompilerOptionValue(value: CompilerOptionsValue, customTypeMap: MapLike): string | undefined { + function getNameOfCompilerOptionValue(value: CompilerOptionsValue, customTypeMap: Map): string | undefined { // There is a typeMap associated with this command-line option so use it to map value back to its name - for (const key in customTypeMap) { - if (customTypeMap[key] === value) { + return forEachInMap(customTypeMap, (mapValue, key) => { + if (mapValue === value) { return key; } - } - return undefined; + }); } - function serializeCompilerOptions(options: CompilerOptions): Map { - const result = createMap(); + function serializeCompilerOptions(options: CompilerOptions): MapLike { + const result = createMapLike(); const optionsNameMap = getOptionNameMap().optionNameMap; for (const name in options) { @@ -779,7 +778,7 @@ namespace ts { break; default: const value = options[name]; - let optionDefinition = optionsNameMap[name.toLowerCase()]; + let optionDefinition = optionsNameMap.get(name.toLowerCase()); if (optionDefinition) { const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { @@ -1049,8 +1048,8 @@ namespace ts { const optionNameMap = arrayToMap(optionDeclarations, opt => opt.name); for (const id in jsonOptions) { - if (id in optionNameMap) { - const opt = optionNameMap[id]; + const opt = optionNameMap.get(id); + if (opt) { defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { @@ -1086,8 +1085,9 @@ namespace ts { function convertJsonOptionOfCustomType(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { const key = value.toLowerCase(); - if (key in opt.type) { - return opt.type[key]; + const val = opt.type.get(key); + if (val !== undefined) { + return val; } else { errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); @@ -1215,7 +1215,7 @@ namespace ts { // file map that marks whether it was a regular wildcard match (with a `*` or `?` token), // or a recursive directory. This information is used by filesystem watchers to monitor for // new entries in these paths. - const wildcardDirectories: Map = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); + const wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. @@ -1226,7 +1226,7 @@ namespace ts { if (fileNames) { for (const fileName of fileNames) { const file = combinePaths(basePath, fileName); - literalFileMap[keyMapper(file)] = file; + literalFileMap.set(keyMapper(file), file); } } @@ -1249,14 +1249,14 @@ namespace ts { removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); const key = keyMapper(file); - if (!(key in literalFileMap) && !(key in wildcardFileMap)) { - wildcardFileMap[key] = file; + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); } } } - const literalFiles = reduceProperties(literalFileMap, addFileToOutput, []); - const wildcardFiles = reduceProperties(wildcardFileMap, addFileToOutput, []); + const literalFiles = valuesOfMap(literalFileMap); + const wildcardFiles = valuesOfMap(wildcardFileMap); wildcardFiles.sort(host.useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); return { fileNames: literalFiles.concat(wildcardFiles), @@ -1287,7 +1287,7 @@ namespace ts { /** * Gets directories in a set of include patterns that should be watched for changes. */ - function getWildcardDirectories(include: string[], exclude: string[], path: string, useCaseSensitiveFileNames: boolean): Map { + function getWildcardDirectories(include: string[], exclude: string[], path: string, useCaseSensitiveFileNames: boolean): MapLike { // We watch a directory recursively if it contains a wildcard anywhere in a directory segment // of the pattern: // @@ -1302,7 +1302,7 @@ namespace ts { // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude"); const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - const wildcardDirectories = createMap(); + const wildcardDirectories = createMapLike(); if (include !== undefined) { const recursiveKeys: string[] = []; for (const file of include) { @@ -1331,7 +1331,7 @@ namespace ts { delete wildcardDirectories[key]; } } - } + }; } return wildcardDirectories; @@ -1365,7 +1365,7 @@ namespace ts { for (let i = ExtensionPriority.Highest; i < adjustedExtensionPriority; i++) { const higherPriorityExtension = extensions[i]; const higherPriorityPath = keyMapper(changeExtension(file, higherPriorityExtension)); - if (higherPriorityPath in literalFiles || higherPriorityPath in wildcardFiles) { + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { return true; } } @@ -1387,21 +1387,10 @@ namespace ts { for (let i = nextExtensionPriority; i < extensions.length; i++) { const lowerPriorityExtension = extensions[i]; const lowerPriorityPath = keyMapper(changeExtension(file, lowerPriorityExtension)); - delete wildcardFiles[lowerPriorityPath]; + wildcardFiles.delete(lowerPriorityPath); } } - /** - * Adds a file to an array of files. - * - * @param output The output array. - * @param file The file path. - */ - function addFileToOutput(output: string[], file: string) { - output.push(file); - return output; - } - /** * Gets a case sensitive key. * diff --git a/src/compiler/core.ts b/src/compiler/core.ts index dec6b7cc485..affd225b3a7 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -23,13 +23,13 @@ namespace ts { True = -1 } - const createObject = Object.create; - // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. export const collator: { compare(a: string, b: string): number } = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - export function createMap(template?: MapLike): Map { - const map: Map = createObject(null); // tslint:disable-line:no-null-keyword + const createObject = Object.create; + /** Create a MapLike with good performance. Prefer this over a literal `{}`. */ + export function createMapLike(): MapLike { + const map = createObject(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is @@ -37,17 +37,141 @@ namespace ts { map["__"] = undefined; delete map["__"]; + return map; + } + + /** Create a new map. If a template object is provided, the map will copy entries from it. */ + export function createMap(template?: MapLike): Map { + const map: Map = new MapCtr(); + // Copies keys/values from template. Note that for..in will not throw if // template is undefined, and instead will just exit the loop. for (const key in template) if (hasOwnProperty.call(template, key)) { - map[key] = template[key]; + map.set(key, template[key]); } return map; } + /** Create a map from [key, value] pairs. This avoids casting keys to strings. */ + export function createMapFromPairs(...pairs: [number, T][]): Map { + const map: Map = new MapCtr(); + + for (const [key, value] of pairs) { + map.set(key, value); + } + + return map; + } + + /** Methods on native maps but not on shim maps. Only used in this file. */ + interface ES6Map extends Map { + readonly size: number; + entries(): Iterator<[string, T]>; + keys(): Iterator; + } + + /** ES6 Iterator type. */ + interface Iterator { + next(): { value: T, done: false } | { value: never, done: true }; + } + + /** Shim maps support certain methods directly. For native maps we use a function. */ + interface ShimMap extends Map { + isEmpty(): boolean; + forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined; + forEachKey(callback: (key: string) => U | undefined): U | undefined; + some(predicate: (value: T, key: string) => boolean): boolean; + someKey(predicate: (key: string) => boolean): boolean; + } + + // The global Map object. This may not be available, so we must test for it. + declare const Map: { new(): Map } | undefined; + // Internet Explorer's Map doesn't support iteration, so don't use it. + // tslint:disable-next-line:no-in-operator + const usingNativeMaps = typeof Map !== "undefined" && "entries" in Map.prototype; + const MapCtr = usingNativeMaps ? Map : shimMap(); + + // Keep the class inside a function so it doesn't get compiled if it's not used. + function shimMap(): { new(): Map } { + return class implements ShimMap { + private data = createMapLike(); + + get(key: MapKey): T { + return this.data[key]; + } + + set(key: MapKey, value: T): this { + this.data[key] = value; + return this; + } + + has(key: MapKey): boolean { + // tslint:disable-next-line:no-in-operator + return key in this.data; + } + + delete(key: MapKey): boolean { + const had = this.has(key); + if (had) { + delete this.data[key]; + } + return had; + } + + clear(): void { + this.data = createMapLike(); + } + + forEach(action: (value: T, key: string) => void): void { + for (const key in this.data) { + action(this.data[key], key); + } + } + + isEmpty(): boolean { + return !this.someKey(() => true); + } + + forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined { + return this.forEachKey(key => callback(this.data[key], key)); + } + + forEachKey(callback: (key: string) => U | undefined): U | undefined { + for (const key in this.data) { + const result = callback(key); + if (result !== undefined) { + return result; + } + } + } + + some(predicate: (value: T, key: string) => boolean): boolean { + return this.someKey(key => predicate(this.data[key], key)); + } + + someKey(predicate: (key: string) => boolean): boolean { + for (const key in this.data) { + if (predicate(key)) { + return true; + } + } + return false; + } + } + } + + /** + * Unlike `map.set(key, value)`, this returns the value, making it useful as an expression. + * Prefer `map.set(key, value)` for statements. + */ + export function set(map: Map, key: MapKey, value: T): T { + map.set(key, value); + return value; + } + export function createFileMap(keyMapper?: (key: string) => string): FileMap { - let files = createMap(); + const files = createMap(); return { get, set, @@ -59,39 +183,34 @@ namespace ts { }; function forEachValueInMap(f: (key: Path, value: T) => void) { - for (const key in files) { - f(key, files[key]); - } + files.forEach((file, key) => { + f(key, file); + }); } function getKeys() { - const keys: Path[] = []; - for (const key in files) { - keys.push(key); - } - return keys; + return keysOfMap(files) as Path[]; } // path should already be well-formed so it does not need to be normalized function get(path: Path): T { - return files[toKey(path)]; + return files.get(toKey(path)); } function set(path: Path, value: T) { - files[toKey(path)] = value; + files.set(toKey(path), value); } function contains(path: Path) { - return toKey(path) in files; + return files.has(toKey(path)); } function remove(path: Path) { - const key = toKey(path); - delete files[key]; + files.delete(toKey(path)); } function clear() { - files = createMap(); + files.clear(); } function toKey(path: Path): string { @@ -748,9 +867,6 @@ namespace ts { /** * Indicates whether a map-like contains an own property with the specified key. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * the 'in' operator. - * * @param map A map-like. * @param key A property key. */ @@ -761,9 +877,6 @@ namespace ts { /** * Gets the value of an owned property in a map-like. * - * NOTE: This is intended for use only with MapLike objects. For Map objects, use - * an indexer. - * * @param map A map-like. * @param key A property key. */ @@ -788,49 +901,86 @@ namespace ts { } /** - * Enumerates the properties of a Map, invoking a callback and returning the first truthy result. - * - * @param map A map for which properties should be enumerated. - * @param callback A callback to invoke for each property. + * Array of every key in a map. + * May not actually return string[] if numbers were put into the map. */ - export function forEachProperty(map: Map, callback: (value: T, key: string) => U): U { - let result: U; - for (const key in map) { - if (result = callback(map[key], key)) break; - } - return result; + export function keysOfMap(map: Map): string[] { + const keys: string[] = []; + forEachKeyInMap(map, key => { + keys.push(key); + }); + return keys; + } + + /** Array of every value in a map. */ + export function valuesOfMap(map: Map): T[] { + const values: T[] = []; + map.forEach(value => { + values.push(value); + }); + return values; } /** - * Returns true if a Map has some matching property. - * - * @param map A map whose properties should be tested. - * @param predicate An optional callback used to test each property. + * Calls `callback` for each entry in the map, returning the first defined result. + * Use `map.forEach` instead for normal iteration. */ - export function someProperties(map: Map, predicate?: (value: T, key: string) => boolean) { - for (const key in map) { - if (!predicate || predicate(map[key], key)) return true; + export const forEachInMap: (map: Map, callback: (value: T, key: string) => U | undefined) => U | undefined = usingNativeMaps + ? (map: ES6Map, callback: (value: T, key: string) => U | undefined) => { + const iterator = map.entries(); + while (true) { + const { value: pair, done } = iterator.next(); + if (done) return undefined; + const [key, value] = pair; + const result = callback(value, key); + if (result !== undefined) return result; + } } - return false; - } + : (map: ShimMap, callback: (value: T, key: string) => U | undefined) => map.forEachInMap(callback); - /** - * Performs a shallow copy of the properties from a source Map to a target MapLike - * - * @param source A map from which properties should be copied. - * @param target A map to which properties should be copied. - */ - export function copyProperties(source: Map, target: MapLike): void { - for (const key in source) { - target[key] = source[key]; + /** `forEachInMap` for just keys. */ + export const forEachKeyInMap: (map: Map<{}>, callback: (key: string) => T | undefined) => T | undefined = usingNativeMaps + ? (map: ES6Map, callback: (key: string) => T | undefined) => { + const iterator = map.keys(); + while (true) { + const { value: key, done } = iterator.next(); + if (done) return undefined; + const result = callback(key); + if (result !== undefined) return result; + } } - } + : (map: ShimMap, callback: (key: string) => T | undefined) => map.forEachKey(callback); - export function appendProperty(map: Map, key: string | number, value: T): Map { - if (key === undefined || value === undefined) return map; - if (map === undefined) map = createMap(); - map[key] = value; - return map; + /** Whether `predicate` is true for some entry in the map. */ + export const someInMap: (map: Map, predicate: (value: T, key: string) => boolean) => boolean = usingNativeMaps + ? (map: ES6Map, predicate: (value: T, key: string) => boolean) => { + const iterator = map.entries(); + while (true) { + const { value: pair, done } = iterator.next(); + if (done) return false; + const [key, value] = pair; + if (predicate(value, key)) return true; + } + } + : (map: ShimMap, predicate: (value: T, key: string) => boolean) => map.some(predicate); + + /** Whether `predicate` is true for some key in the map. */ + export const someKeyInMap: (map: Map<{}>, predicate: (key: string) => boolean) => boolean = usingNativeMaps + ? (map: ES6Map<{}>, predicate: (key: string) => boolean) => { + const iterator = map.keys(); + while (true) { + const { value: key, done } = iterator.next(); + if (done) return false; + if (predicate(key)) return true; + } + } + : (map: ShimMap<{}>, predicate: (key: string) => boolean) => map.someKey(predicate); + + /** Copy entries from `source` to `target`. */ + export function copyMapEntries(source: Map, target: Map): void { + source.forEach((value, key) => { + target.set(key, value); + }); } export function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; @@ -845,24 +995,6 @@ namespace ts { return t; } - /** - * Reduce the properties of a map. - * - * NOTE: This is intended for use with Map objects. For MapLike objects, use - * reduceOwnProperties instead as it offers better runtime safety. - * - * @param map The map to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - export function reduceProperties(map: Map, callback: (aggregate: U, value: T, key: string) => U, initial: U): U { - let result = initial; - for (const key in map) { - result = callback(result, map[key], String(key)); - } - return result; - } - /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -882,6 +1014,20 @@ namespace ts { return true; } + /** True if the maps have the same keys and values. */ + export function mapsAreEqual(left: Map, right: Map, valuesAreEqual?: (left: T, right: T) => boolean): boolean { + if (left === right) return true; + if (!left || !right) return false; + const someInLeftHasNoMatch = someInMap(left, (leftValue, leftKey) => { + if (!right.has(leftKey)) return true; + const rightValue = right.get(leftKey); + return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue); + }); + if (someInLeftHasNoMatch) return false; + const someInRightHasNoMatch = someKeyInMap(right, rightKey => !left.has(rightKey)); + return !someInRightHasNoMatch; + } + /** * Creates a map from the elements of an array. * @@ -897,23 +1043,18 @@ namespace ts { export function arrayToMap(array: T[], makeKey: (value: T) => string, makeValue?: (value: T) => U): Map { const result = createMap(); for (const value of array) { - result[makeKey(value)] = makeValue ? makeValue(value) : value; + result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } - export function isEmpty(map: Map) { - for (const id in map) { - if (hasProperty(map, id)) { - return false; - } - } - return true; - } + export const mapIsEmpty: (map: Map<{}>) => boolean = usingNativeMaps + ? (map: ES6Map<{}>) => map.size === 0 + : (map: ShimMap<{}>) => map.isEmpty(); export function cloneMap(map: Map) { const clone = createMap(); - copyProperties(map, clone); + copyMapEntries(map, clone); return clone; } @@ -943,13 +1084,13 @@ namespace ts { * Creates the array if it does not already exist. */ export function multiMapAdd(map: Map, key: string | number, value: V): V[] { - const values = map[key]; + const values = map.get(key); if (values) { values.push(value); return values; } else { - return map[key] = [value]; + return set(map, key, [value]); } } @@ -959,11 +1100,11 @@ namespace ts { * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. */ export function multiMapRemove(map: Map, key: string, value: V): void { - const values = map[key]; + const values = map.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - delete map[key]; + map.delete(key); } } } @@ -1066,7 +1207,7 @@ namespace ts { return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]); } - export let localizedDiagnosticMessages: Map = undefined; + export let localizedDiagnosticMessages: MapLike = undefined; export function getLocaleSpecificMessage(message: DiagnosticMessage) { return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message; diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index cd98622e080..e010519d641 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -156,9 +156,9 @@ namespace ts { }); if (usedTypeDirectiveReferences) { - for (const directive in usedTypeDirectiveReferences) { + forEachKeyInMap(usedTypeDirectiveReferences, directive => { referencesOutput += `/// ${newLine}`; - } + }); } return { @@ -271,8 +271,8 @@ namespace ts { usedTypeDirectiveReferences = createMap(); } for (const directive of typeReferenceDirectives) { - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + if (!usedTypeDirectiveReferences.has(directive)) { + usedTypeDirectiveReferences.set(directive, directive); } } } @@ -581,14 +581,14 @@ namespace ts { // do not need to keep track of created temp names. function getExportDefaultTempVariableName(): string { const baseName = "_default"; - if (!(baseName in currentIdentifiers)) { + if (!currentIdentifiers.has(baseName)) { return baseName; } let count = 0; while (true) { count++; const name = baseName + "_" + count; - if (!(name in currentIdentifiers)) { + if (!currentIdentifiers.has(name)) { return name; } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 90738d828be..191a39a5797 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2031,11 +2031,11 @@ namespace ts { // Skip the helper if it can be bundled but hasn't already been emitted and we // are emitting a bundled module. if (shouldBundle) { - if (bundledHelpers[helper.name]) { + if (bundledHelpers.get(helper.name)) { continue; } - bundledHelpers[helper.name] = true; + bundledHelpers.set(helper.name, true); } } else if (isBundle) { @@ -2487,15 +2487,16 @@ namespace ts { function isUniqueName(name: string): boolean { return !resolver.hasGlobalName(name) && - !hasProperty(currentFileIdentifiers, name) && - !hasProperty(generatedNameSet, name); + !currentFileIdentifiers.has(name) && + !generatedNameSet.has(name); } function isUniqueLocalName(name: string, container: Node): boolean { for (let node = container; isNodeDescendantOf(node, container); node = node.nextContainer) { - if (node.locals && hasProperty(node.locals, name)) { + if (node.locals) { + const local = node.locals.get(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)) { + if (local && local.flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias)) { return false; } } @@ -2544,7 +2545,7 @@ namespace ts { while (true) { const generatedName = baseName + i; if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; + return set(generatedNameSet, generatedName, generatedName); } i++; } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index ebcea221f9e..2ef73dea727 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -2643,7 +2643,7 @@ namespace ts { function mergeTokenSourceMapRanges(sourceRanges: Map, destRanges: Map) { if (!destRanges) destRanges = createMap(); - copyProperties(sourceRanges, destRanges); + copyMapEntries(sourceRanges, destRanges); return destRanges; } @@ -2745,7 +2745,7 @@ namespace ts { export function getTokenSourceMapRange(node: Node, token: SyntaxKind) { const emitNode = node.emitNode; const tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; + return tokenSourceMapRanges && tokenSourceMapRanges.get(token); } /** @@ -2758,7 +2758,7 @@ namespace ts { export function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange) { const emitNode = getOrCreateEmitNode(node); const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = createMap()); - tokenSourceMapRanges[token] = range; + tokenSourceMapRanges.set(token, range); return node; } @@ -2969,10 +2969,8 @@ namespace ts { * Here we check if alternative name was provided for a given moduleName and return it if possible. */ function tryRenameExternalModule(moduleName: LiteralExpression, sourceFile: SourceFile) { - if (sourceFile.renamedDependencies && hasProperty(sourceFile.renamedDependencies, moduleName.text)) { - return createLiteral(sourceFile.renamedDependencies[moduleName.text]); - } - return undefined; + const rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && createLiteral(rename); } /** @@ -3332,7 +3330,7 @@ namespace ts { else { // export { x, y } for (const specifier of (node).exportClause.elements) { - if (!uniqueExports[specifier.name.text]) { + if (!uniqueExports.get(specifier.name.text)) { const name = specifier.propertyName || specifier.name; multiMapAdd(exportSpecifiers, name.text, specifier); @@ -3343,7 +3341,7 @@ namespace ts { multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); } - uniqueExports[specifier.name.text] = true; + uniqueExports.set(specifier.name.text, true); exportedNames = append(exportedNames, specifier.name); } } @@ -3377,9 +3375,9 @@ namespace ts { else { // export function x() { } const name = (node).name; - if (!uniqueExports[name.text]) { + if (!uniqueExports.get(name.text)) { multiMapAdd(exportedBindings, getOriginalNodeId(node), name); - uniqueExports[name.text] = true; + uniqueExports.set(name.text, true); exportedNames = append(exportedNames, name); } } @@ -3398,9 +3396,9 @@ namespace ts { else { // export class x { } const name = (node).name; - if (!uniqueExports[name.text]) { + if (!uniqueExports.get(name.text)) { multiMapAdd(exportedBindings, getOriginalNodeId(node), name); - uniqueExports[name.text] = true; + uniqueExports.set(name.text, true); exportedNames = append(exportedNames, name); } } @@ -3421,8 +3419,8 @@ namespace ts { } } else if (!isGeneratedIdentifier(decl.name)) { - if (!uniqueExports[decl.name.text]) { - uniqueExports[decl.name.text] = true; + if (!uniqueExports.get(decl.name.text)) { + uniqueExports.set(decl.name.text, true); exportedNames = append(exportedNames, decl.name); } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4aefa160077..3da9093ee5a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1131,7 +1131,7 @@ namespace ts { function internIdentifier(text: string): string { text = escapeIdentifier(text); - return identifiers[text] || (identifiers[text] = text); + return identifiers.get(text) || set(identifiers, text, text); } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index a48eb117e28..8c24b3b9f1b 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -27,8 +27,8 @@ namespace ts.performance { */ export function mark(markName: string) { if (enabled) { - marks[markName] = timestamp(); - counts[markName] = (counts[markName] || 0) + 1; + marks.set(markName, timestamp()); + counts.set(markName, (counts.get(markName) || 0) + 1); profilerEvent(markName); } } @@ -44,9 +44,9 @@ namespace ts.performance { */ export function measure(measureName: string, startMarkName?: string, endMarkName?: string) { if (enabled) { - const end = endMarkName && marks[endMarkName] || timestamp(); - const start = startMarkName && marks[startMarkName] || profilerStart; - measures[measureName] = (measures[measureName] || 0) + (end - start); + const end = endMarkName && marks.get(endMarkName) || timestamp(); + const start = startMarkName && marks.get(startMarkName) || profilerStart; + measures.set(measureName, (measures.get(measureName) || 0) + (end - start)); } } @@ -56,7 +56,7 @@ namespace ts.performance { * @param markName The name of the mark. */ export function getCount(markName: string) { - return counts && counts[markName] || 0; + return counts && counts.get(markName) || 0; } /** @@ -65,7 +65,7 @@ namespace ts.performance { * @param measureName The name of the measure whose durations should be accumulated. */ export function getDuration(measureName: string) { - return measures && measures[measureName] || 0; + return measures && measures.get(measureName) || 0; } /** @@ -74,9 +74,9 @@ namespace ts.performance { * @param cb The action to perform for each measure */ export function forEachMeasure(cb: (measureName: string, duration: number) => void) { - for (const key in measures) { - cb(key, measures[key]); - } + measures.forEach((measure, key) => { + cb(key, measure); + }); } /** Enables (and resets) performance measurements for the compiler. */ diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 73976d5d02e..3da9f57ca39 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -110,11 +110,11 @@ namespace ts { } function directoryExists(directoryPath: string): boolean { - if (directoryPath in existingDirectories) { + if (existingDirectories.has(directoryPath)) { return true; } if (sys.directoryExists(directoryPath)) { - existingDirectories[directoryPath] = true; + existingDirectories.set(directoryPath, true); return true; } return false; @@ -138,11 +138,11 @@ namespace ts { const hash = sys.createHash(data); const mtimeBefore = sys.getModifiedTime(fileName); - if (mtimeBefore && fileName in outputFingerprints) { - const fingerprint = outputFingerprints[fileName]; - + if (mtimeBefore) { + const fingerprint = outputFingerprints.get(fileName); // If output has not been changed, and the file has no external modification - if (fingerprint.byteOrderMark === writeByteOrderMark && + if (fingerprint && + fingerprint.byteOrderMark === writeByteOrderMark && fingerprint.hash === hash && fingerprint.mtime.getTime() === mtimeBefore.getTime()) { return; @@ -153,11 +153,11 @@ namespace ts { const mtimeAfter = sys.getModifiedTime(fileName); - outputFingerprints[fileName] = { + outputFingerprints.set(fileName, { hash, byteOrderMark: writeByteOrderMark, mtime: mtimeAfter - }; + }); } function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { @@ -277,9 +277,9 @@ namespace ts { const resolutions: T[] = []; const cache = createMap(); for (const name of names) { - const result = name in cache - ? cache[name] - : cache[name] = loader(name, containingFile); + const result = cache.has(name) + ? cache.get(name) + : set(cache, name, loader(name, containingFile)); resolutions.push(result); } return resolutions; @@ -454,7 +454,7 @@ namespace ts { classifiableNames = createMap(); for (const sourceFile of files) { - copyProperties(sourceFile.classifiableNames, classifiableNames); + copyMapEntries(sourceFile.classifiableNames, classifiableNames); } } @@ -729,7 +729,7 @@ namespace ts { } function isSourceFileFromExternalLibrary(file: SourceFile): boolean { - return sourceFilesFoundSearchingNodeModules[file.path]; + return sourceFilesFoundSearchingNodeModules.get(file.path); } function getDiagnosticsProducingTypeChecker() { @@ -1292,20 +1292,20 @@ namespace ts { // If the file was previously found via a node_modules search, but is now being processed as a root file, // then everything it sucks in may also be marked incorrectly, and needs to be checked again. - if (file && sourceFilesFoundSearchingNodeModules[file.path] && currentNodeModulesDepth == 0) { - sourceFilesFoundSearchingNodeModules[file.path] = false; + if (file && sourceFilesFoundSearchingNodeModules.get(file.path) && currentNodeModulesDepth == 0) { + sourceFilesFoundSearchingNodeModules.set(file.path, false); if (!options.noResolve) { processReferencedFiles(file, isDefaultLib); processTypeReferenceDirectives(file); } - modulesWithElidedImports[file.path] = false; + modulesWithElidedImports.set(file.path, false); processImportedModules(file); } // See if we need to reprocess the imports due to prior skipped imports - else if (file && modulesWithElidedImports[file.path]) { + else if (file && modulesWithElidedImports.get(file.path)) { if (currentNodeModulesDepth < maxNodeModuleJsDepth) { - modulesWithElidedImports[file.path] = false; + modulesWithElidedImports.set(file.path, false); processImportedModules(file); } } @@ -1326,7 +1326,7 @@ namespace ts { filesByName.set(path, file); if (file) { - sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0); + sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { @@ -1387,7 +1387,7 @@ namespace ts { refFile?: SourceFile, refPos?: number, refEnd?: number): void { // If we already found this library as a primary reference - nothing to do - const previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + const previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective); if (previousResolution && previousResolution.primary) { return; } @@ -1427,7 +1427,7 @@ namespace ts { } if (saveResolution) { - resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective); } } @@ -1480,7 +1480,7 @@ namespace ts { const shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { - modulesWithElidedImports[file.path] = true; + modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { const path = toPath(resolvedFileName, currentDirectory, getCanonicalFileName); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 82302e98e37..4f32b453ecd 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -275,9 +275,9 @@ namespace ts { function makeReverseMap(source: Map): string[] { const result: string[] = []; - for (const name in source) { - result[source[name]] = name; - } + source.forEach((value, name) => { + result[value] = name; + }); return result; } @@ -289,7 +289,7 @@ namespace ts { /* @internal */ export function stringToToken(s: string): SyntaxKind { - return textToToken[s]; + return textToToken.get(s); } /* @internal */ @@ -363,8 +363,6 @@ namespace ts { return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } - const hasOwnProperty = Object.prototype.hasOwnProperty; - export function isWhiteSpace(ch: number): boolean { return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } @@ -1183,8 +1181,11 @@ namespace ts { const len = tokenValue.length; if (len >= 2 && len <= 11) { const ch = tokenValue.charCodeAt(0); - if (ch >= CharacterCodes.a && ch <= CharacterCodes.z && hasOwnProperty.call(textToToken, tokenValue)) { - return token = textToToken[tokenValue]; + if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } } } return token = SyntaxKind.Identifier; diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 650b9b0ef02..a814a91c355 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -362,7 +362,7 @@ namespace ts { const emitNode = node && node.emitNode; const emitFlags = emitNode && emitNode.flags; - const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; + const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges.get(token); tokenPos = skipTrivia(currentSourceText, range ? range.pos : tokenPos); if ((emitFlags & EmitFlags.NoTokenLeadingSourceMaps) === 0 && tokenPos >= 0) { diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index a1e82a66595..c34527f8954 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -18,7 +18,7 @@ namespace ts { getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; /** - * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that + * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that * use native OS file watching */ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; @@ -248,18 +248,18 @@ namespace ts { function reduceDirWatcherRefCountForFile(fileName: string) { const dirName = getDirectoryPath(fileName); - const watcher = dirWatchers[dirName]; + const watcher = dirWatchers.get(dirName); if (watcher) { watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - delete dirWatchers[dirName]; + dirWatchers.delete(dirName); } } } function addDirWatcher(dirPath: string): void { - let watcher = dirWatchers[dirPath]; + let watcher = dirWatchers.get(dirPath); if (watcher) { watcher.referenceCount += 1; return; @@ -270,7 +270,7 @@ namespace ts { (eventName: string, relativeFileName: string) => fileEventHandler(eventName, relativeFileName, dirPath) ); watcher.referenceCount = 1; - dirWatchers[dirPath] = watcher; + dirWatchers.set(dirPath, watcher); return; } @@ -300,9 +300,12 @@ namespace ts { ? undefined : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks[fileName]) { - for (const fileCallback of fileWatcherCallbacks[fileName]) { - fileCallback(fileName); + if ((eventName === "change" || eventName === "rename")) { + const callbacks = fileWatcherCallbacks.get(fileName); + if (callbacks) { + for (const fileCallback of callbacks) { + fileCallback(fileName); + } } } } diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 10a718448e9..1440481d38e 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -13,14 +13,14 @@ /* @internal */ namespace ts { - const moduleTransformerMap = createMap({ - [ModuleKind.ES2015]: transformES2015Module, - [ModuleKind.System]: transformSystemModule, - [ModuleKind.AMD]: transformModule, - [ModuleKind.CommonJS]: transformModule, - [ModuleKind.UMD]: transformModule, - [ModuleKind.None]: transformModule, - }); + const moduleTransformerMap = createMapFromPairs( + [ModuleKind.ES2015, transformES2015Module], + [ModuleKind.System, transformSystemModule], + [ModuleKind.AMD, transformModule], + [ModuleKind.CommonJS, transformModule], + [ModuleKind.UMD, transformModule], + [ModuleKind.None, transformModule], + ); const enum SyntaxKindFeatureFlags { Substitution = 1 << 0, @@ -56,7 +56,7 @@ namespace ts { transformers.push(transformGenerators); } - transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ModuleKind.None]); + transformers.push(moduleTransformerMap.get(moduleKind) || moduleTransformerMap.get(ModuleKind.None)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index c1398f75da6..13c44f2d7d5 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -561,7 +561,7 @@ namespace ts { // - break/continue is non-labeled and located in non-converted loop/switch statement const jump = node.kind === SyntaxKind.BreakStatement ? Jump.Break : Jump.Continue; const canUseBreakOrContinue = - (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { @@ -1929,7 +1929,7 @@ namespace ts { if (!convertedLoopState.labels) { convertedLoopState.labels = createMap(); } - convertedLoopState.labels[node.label.text] = node.label.text; + convertedLoopState.labels.set(node.label.text, node.label.text); } let result: VisitResult; @@ -1941,7 +1941,7 @@ namespace ts { } if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels.set(node.label.text, undefined); } return result; @@ -2548,13 +2548,13 @@ namespace ts { if (!state.labeledNonLocalBreaks) { state.labeledNonLocalBreaks = createMap(); } - state.labeledNonLocalBreaks[labelText] = labelMarker; + state.labeledNonLocalBreaks.set(labelText, labelMarker); } else { if (!state.labeledNonLocalContinues) { state.labeledNonLocalContinues = createMap(); } - state.labeledNonLocalContinues[labelText] = labelMarker; + state.labeledNonLocalContinues.set(labelText, labelMarker); } } @@ -2562,13 +2562,12 @@ namespace ts { if (!table) { return; } - for (const labelText in table) { - const labelMarker = table[labelText]; + table.forEach((labelMarker, labelText) => { const statements: Statement[] = []; // if there are no outer converted loop or outer label in question is located inside outer converted loop // then emit labeled break\continue // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + if (!outerLoop || (outerLoop.labels && outerLoop.labels.get(labelText))) { const label = createIdentifier(labelText); statements.push(isBreak ? createBreak(label) : createContinue(label)); } @@ -2577,7 +2576,7 @@ namespace ts { statements.push(createReturn(loopResultName)); } caseClauses.push(createCaseClause(createLiteral(labelMarker), statements)); - } + }); } function processLoopVariableDeclaration(decl: VariableDeclaration | BindingElement, loopParameters: ParameterDeclaration[], loopOutParameters: LoopOutParameter[]) { diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index c383902d495..0b853649e81 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -217,13 +217,13 @@ namespace ts { Endfinally = 7, } - const instructionNames = createMap({ - [Instruction.Return]: "return", - [Instruction.Break]: "break", - [Instruction.Yield]: "yield", - [Instruction.YieldStar]: "yield*", - [Instruction.Endfinally]: "endfinally", - }); + const instructionNames = createMapFromPairs( + [Instruction.Return, "return"], + [Instruction.Break, "break"], + [Instruction.Yield, "yield"], + [Instruction.YieldStar, "yield*"], + [Instruction.Endfinally, "endfinally"], + ); export function transformGenerators(context: TransformationContext) { const { @@ -1921,12 +1921,12 @@ namespace ts { } function substituteExpressionIdentifier(node: Identifier) { - if (renamedCatchVariables && hasProperty(renamedCatchVariables, node.text)) { + if (renamedCatchVariables && renamedCatchVariables.has(node.text)) { const original = getOriginalNode(node); if (isIdentifier(original) && original.parent) { const declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - const name = getProperty(renamedCatchVariableDeclarations, String(getOriginalNodeId(declaration))); + const name = renamedCatchVariableDeclarations.get(getOriginalNodeId(declaration)); if (name) { const clone = getMutableClone(name); setSourceMapRange(clone, node); @@ -2096,8 +2096,8 @@ namespace ts { context.enableSubstitution(SyntaxKind.Identifier); } - renamedCatchVariables[text] = true; - renamedCatchVariableDeclarations[getOriginalNodeId(variable)] = name; + renamedCatchVariables.set(text, true); + renamedCatchVariableDeclarations.set(getOriginalNodeId(variable), name); const exception = peekBlock(); Debug.assert(exception.state < ExceptionBlockState.Catch); @@ -2401,7 +2401,7 @@ namespace ts { */ function createInstruction(instruction: Instruction): NumericLiteral { const literal = createLiteral(instruction); - literal.trailingComment = instructionNames[instruction]; + literal.trailingComment = instructionNames.get(instruction); return literal; } diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index ecb5dd053e0..0f7a0eb7fba 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -229,7 +229,7 @@ namespace ts { return String.fromCharCode(parseInt(hex, 16)); } else { - const ch = entities[word]; + const ch = entities.get(word); // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) return ch ? String.fromCharCode(ch) : match; } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index c900b7d20e1..2e926406fb4 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -10,12 +10,12 @@ namespace ts { importAliasNames: ParameterDeclaration[]; } - const transformModuleDelegates = createMap<(node: SourceFile) => SourceFile>({ - [ModuleKind.None]: transformCommonJSModule, - [ModuleKind.CommonJS]: transformCommonJSModule, - [ModuleKind.AMD]: transformAMDModule, - [ModuleKind.UMD]: transformUMDModule, - }); + const transformModuleDelegates = createMapFromPairs<(node: SourceFile) => SourceFile>( + [ModuleKind.None, transformCommonJSModule], + [ModuleKind.CommonJS, transformCommonJSModule], + [ModuleKind.AMD, transformAMDModule], + [ModuleKind.UMD, transformUMDModule], + ); const { startLexicalEnvironment, @@ -60,10 +60,10 @@ namespace ts { } currentSourceFile = node; - currentModuleInfo = moduleInfoMap[getOriginalNodeId(node)] = collectExternalModuleInfo(node, resolver, compilerOptions); + currentModuleInfo = set(moduleInfoMap, getOriginalNodeId(node), collectExternalModuleInfo(node, resolver, compilerOptions)); // Perform the transformation. - const transformModule = transformModuleDelegates[moduleKind] || transformModuleDelegates[ModuleKind.None]; + const transformModule = transformModuleDelegates.get(moduleKind) || transformModuleDelegates.get(ModuleKind.None); const updated = transformModule(node); currentSourceFile = undefined; @@ -444,7 +444,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfImportDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfImportDeclaration(statements, node); @@ -523,7 +523,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfImportEqualsDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfImportEqualsDeclaration(statements, node); @@ -610,7 +610,7 @@ namespace ts { if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + deferredExports.set(id, appendExportStatement(deferredExports.get(id), createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true)); } else { statements = appendExportStatement(statements, createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); @@ -651,7 +651,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -690,7 +690,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -741,7 +741,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node)); } else { statements = appendExportsOfVariableStatement(statements, node); @@ -794,7 +794,7 @@ namespace ts { // statement. if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === SyntaxKind.VariableStatement) { const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node.original)); } return node; @@ -820,9 +820,9 @@ namespace ts { // end of the transformed declaration. We use this marker to emit any deferred exports // of the declaration. const id = getOriginalNodeId(node); - const statements = deferredExports[id]; + const statements = deferredExports.get(id); if (statements) { - delete deferredExports[id]; + deferredExports.delete(id); return append(statements, node); } @@ -973,7 +973,7 @@ namespace ts { */ function appendExportsOfDeclaration(statements: Statement[] | undefined, decl: Declaration): Statement[] | undefined { const name = getDeclarationName(decl); - const exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + const exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (const exportSpecifier of exportSpecifiers) { statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); @@ -997,7 +997,7 @@ namespace ts { function appendExportStatement(statements: Statement[] | undefined, exportName: Identifier, expression: Expression, location?: TextRange, allowComments?: boolean): Statement[] | undefined { if (exportName.text === "default") { const sourceFile = getOriginalNode(currentSourceFile, isSourceFile); - if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (sourceFile && !sourceFile.symbol.exports.get("___esModule")) { if (languageVersion === ScriptTarget.ES3) { statements = append(statements, createStatement( @@ -1102,7 +1102,7 @@ namespace ts { function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void { if (node.kind === SyntaxKind.SourceFile) { currentSourceFile = node; - currentModuleInfo = moduleInfoMap[getOriginalNodeId(currentSourceFile)]; + currentModuleInfo = moduleInfoMap.get(getOriginalNodeId(currentSourceFile)); noSubstitution = createMap(); previousOnEmitNode(emitContext, node, emitCallback); @@ -1128,7 +1128,7 @@ namespace ts { */ function onSubstituteNode(emitContext: EmitContext, node: Node) { node = previousOnSubstituteNode(emitContext, node); - if (node.id && noSubstitution[node.id]) { + if (node.id && noSubstitution.get(node.id)) { return node; } @@ -1254,7 +1254,7 @@ namespace ts { let expression: Expression = node; for (const exportName of exportedNames) { // Mark the node to prevent triggering this rule again. - noSubstitution[getNodeId(expression)] = true; + noSubstitution.set(getNodeId(expression), true); expression = createExportExpression(exportName, expression, /*location*/ node); } @@ -1296,7 +1296,7 @@ namespace ts { : node; for (const exportName of exportedNames) { // Mark the node to prevent triggering this rule again. - noSubstitution[getNodeId(expression)] = true; + noSubstitution.set(getNodeId(expression), true); expression = createExportExpression(exportName, expression); } @@ -1318,7 +1318,7 @@ namespace ts { || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { return currentModuleInfo - && currentModuleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]; + && currentModuleInfo.exportedBindings.get(getOriginalNodeId(valueDeclaration)); } } } diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 91e29e09886..8d1e1749c0b 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -73,11 +73,11 @@ namespace ts { // see comment to 'substitutePostfixUnaryExpression' for more details // Collect information about the external module and dependency groups. - moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfo = set(moduleInfoMap, id, collectExternalModuleInfo(node, resolver, compilerOptions)); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. - exportFunction = exportFunctionsMap[id] = createUniqueName("exports"); + exportFunction = set(exportFunctionsMap, id, createUniqueName("exports")); contextObject = createUniqueName("context"); // Add the body of the module. @@ -121,7 +121,7 @@ namespace ts { } if (noSubstitution) { - noSubstitutionMap[id] = noSubstitution; + noSubstitutionMap.set(id, noSubstitution); noSubstitution = undefined; } @@ -147,13 +147,13 @@ namespace ts { const externalImport = externalImports[i]; const externalModuleName = getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); const text = externalModuleName.text; - if (hasProperty(groupIndices, text)) { + const groupIndex = groupIndices.get(text); + if (groupIndex !== undefined) { // deduplicate/group entries in dependency list by the dependency name - const groupIndex = groupIndices[text]; dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - groupIndices[text] = dependencyGroups.length; + groupIndices.set(text, dependencyGroups.length); dependencyGroups.push({ name: externalModuleName, externalImports: [externalImport] @@ -305,7 +305,7 @@ namespace ts { // this set is used to filter names brought by star expors. // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && isEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && mapIsEmpty(moduleInfo.exportSpecifiers)) { // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. let hasExportDeclarationWithExportClause = false; @@ -608,7 +608,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfImportDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfImportDeclaration(statements, node); @@ -631,7 +631,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfImportEqualsDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfImportEqualsDeclaration(statements, node); @@ -656,7 +656,7 @@ namespace ts { if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], createIdentifier("default"), expression, /*allowComments*/ true); + deferredExports.set(id, appendExportStatement(deferredExports.get(id), createIdentifier("default"), expression, /*allowComments*/ true)); } else { return createExportStatement(createIdentifier("default"), expression, /*allowComments*/ true); @@ -688,7 +688,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); } else { hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); @@ -730,7 +730,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -770,7 +770,7 @@ namespace ts { if (isMarkedDeclaration) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node, isExportedDeclaration)); } else { statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); @@ -883,7 +883,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === SyntaxKind.VariableStatement) { const id = getOriginalNodeId(node); const isExportedDeclaration = hasModifier(node.original, ModifierFlags.Export); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node.original, isExportedDeclaration)); } return node; @@ -909,9 +909,9 @@ namespace ts { // end of the transformed declaration. We use this marker to emit any deferred exports // of the declaration. const id = getOriginalNodeId(node); - const statements = deferredExports[id]; + const statements = deferredExports.get(id); if (statements) { - delete deferredExports[id]; + deferredExports.delete(id); return append(statements, node); } @@ -1080,7 +1080,7 @@ namespace ts { } const name = getDeclarationName(decl); - const exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + const exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); if (exportSpecifiers) { for (const exportSpecifier of exportSpecifiers) { if (exportSpecifier.name.text !== excludeName) { @@ -1554,12 +1554,12 @@ namespace ts { if (node.kind === SyntaxKind.SourceFile) { const id = getOriginalNodeId(node); currentSourceFile = node; - moduleInfo = moduleInfoMap[id]; - exportFunction = exportFunctionsMap[id]; - noSubstitution = noSubstitutionMap[id]; + moduleInfo = moduleInfoMap.get(id); + exportFunction = exportFunctionsMap.get(id); + noSubstitution = noSubstitutionMap.get(id); if (noSubstitution) { - delete noSubstitutionMap[id]; + noSubstitutionMap.delete(id); } previousOnEmitNode(emitContext, node, emitCallback); @@ -1756,7 +1756,7 @@ namespace ts { exportedNames = append(exportedNames, getDeclarationName(valueDeclaration)); } - exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]); + exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings.get(getOriginalNodeId(valueDeclaration))); } } @@ -1770,7 +1770,7 @@ namespace ts { */ function preventSubstitution(node: T): T { if (noSubstitution === undefined) noSubstitution = createMap(); - noSubstitution[getNodeId(node)] = true; + noSubstitution.set(getNodeId(node), true); return node; } @@ -1780,7 +1780,7 @@ namespace ts { * @param node The node to test. */ function isSubstitutionPrevented(node: Node) { - return noSubstitution && node.id && noSubstitution[node.id]; + return noSubstitution && node.id && noSubstitution.get(node.id); } } } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 77af854269e..4b0f981f27c 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -752,7 +752,7 @@ namespace ts { if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. enableSubstitutionForClassAliases(); - classAliases[getOriginalNodeId(node)] = getSynthesizedClone(temp); + classAliases.set(getOriginalNodeId(node), getSynthesizedClone(temp)); } // To preserve the behavior of the old emitter, we explicitly indent @@ -1420,7 +1420,7 @@ namespace ts { return undefined; } - const classAlias = classAliases && classAliases[getOriginalNodeId(node)]; + const classAlias = classAliases && classAliases.get(getOriginalNodeId(node)); const localName = getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); const decorate = createDecorateHelper(context, decoratorExpressions, localName); const expression = createAssignment(localName, classAlias ? createAssignment(classAlias, decorate) : decorate); @@ -2530,8 +2530,8 @@ namespace ts { currentScopeFirstDeclarationsOfName = createMap(); } - if (!(name in currentScopeFirstDeclarationsOfName)) { - currentScopeFirstDeclarationsOfName[name] = node; + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } } @@ -2544,7 +2544,7 @@ namespace ts { if (currentScopeFirstDeclarationsOfName) { const name = node.symbol && node.symbol.name; if (name) { - return currentScopeFirstDeclarationsOfName[name] === node; + return currentScopeFirstDeclarationsOfName.get(name) === node; } } @@ -3085,7 +3085,7 @@ namespace ts { if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference) { enableSubstitutionForClassAliases(); const classAlias = createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? node.name.text : "default"); - classAliases[getOriginalNodeId(node)] = classAlias; + classAliases.set(getOriginalNodeId(node), classAlias); hoistVariableDeclaration(classAlias); return classAlias; } @@ -3230,7 +3230,7 @@ namespace ts { // constructor references in static property initializers. const declaration = resolver.getReferencedValueDeclaration(node); if (declaration) { - const classAlias = classAliases[declaration.id]; + const classAlias = classAliases.get(declaration.id); if (classAlias) { const clone = getSynthesizedClone(classAlias); setSourceMapRange(clone, node); diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index a7304eebe4b..0e66ccb14b8 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -67,11 +67,11 @@ namespace ts { const gutterSeparator = " "; const resetEscapeSequence = "\u001b[0m"; const ellipsis = "..."; - const categoryFormatMap = createMap({ - [DiagnosticCategory.Warning]: yellowForegroundEscapeSequence, - [DiagnosticCategory.Error]: redForegroundEscapeSequence, - [DiagnosticCategory.Message]: blueForegroundEscapeSequence, - }); + const categoryFormatMap = createMapFromPairs( + [DiagnosticCategory.Warning, yellowForegroundEscapeSequence], + [DiagnosticCategory.Error, redForegroundEscapeSequence], + [DiagnosticCategory.Message, blueForegroundEscapeSequence], + ); function formatAndReset(text: string, formatStyle: string) { return formatStyle + text + resetEscapeSequence; @@ -139,7 +139,7 @@ namespace ts { output += `${ relativeFileName }(${ firstLine + 1 },${ firstLineChar + 1 }): `; } - const categoryColor = categoryFormatMap[diagnostic.category]; + const categoryColor = categoryFormatMap.get(diagnostic.category); const category = DiagnosticCategory[diagnostic.category].toLowerCase(); output += `${ formatAndReset(category, categoryColor) } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }`; output += sys.newLine + sys.newLine; @@ -378,9 +378,8 @@ namespace ts { } function cachedFileExists(fileName: string): boolean { - return fileName in cachedExistingFiles - ? cachedExistingFiles[fileName] - : cachedExistingFiles[fileName] = hostFileExists(fileName); + const fileExists = cachedExistingFiles.get(fileName); + return fileExists !== undefined ? fileExists : set(cachedExistingFiles, fileName, hostFileExists(fileName)); } function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) { @@ -674,13 +673,9 @@ namespace ts { if (option.name === "lib") { description = getDiagnosticText(option.description); - const options: string[] = []; const element = (option).element; const typeMap = >element.type; - for (const key in typeMap) { - options.push(`'${key}'`); - } - optionsDescriptionMap[description] = options; + optionsDescriptionMap.set(description, keysOfMap(typeMap).map(key => `'${key}'`)); } else { description = getDiagnosticText(option.description); @@ -702,7 +697,7 @@ namespace ts { for (let i = 0; i < usageColumn.length; i++) { const usage = usageColumn[i]; const description = descriptionColumn[i]; - const kindsList = optionsDescriptionMap[description]; + const kindsList = optionsDescriptionMap.get(description); output.push(usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine); if (kindsList) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c1592d30eae..055049999ec 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,11 +1,25 @@ namespace ts { - + /** + * Type of objects whose values are all of the same type. + * The `in` and `for-in` operators can *not* be safely used, + * since `Object.prototype` may be modified by outside code. + */ export interface MapLike { [index: string]: T; } - export interface Map extends MapLike { - __mapBrand: any; + /** It's allowed to get/set into a map with numbers. However, when iterating, you may get strings back due to the shim being an ordinary object (which only allows string keys). */ + export type MapKey = string | number; + + /** Minimal ES6 Map interface. */ + export interface Map { + get(key: MapKey): T; + has(key: MapKey): boolean; + set(key: MapKey, value: T): this; + delete(key: MapKey): boolean; + clear(): void; + /** `key` may *not* be a string if it was set with a number and we are not using the shim. */ + forEach(action: (value: T, key: string) => void): void; } // branded string type used to store absolute, normalized and canonicalized paths diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3dd7054a405..94b0fa20987 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -70,11 +70,11 @@ namespace ts { } export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); } export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; } export function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModuleFull): void { @@ -82,7 +82,7 @@ namespace ts { sourceFile.resolvedModules = createMap(); } - sourceFile.resolvedModules[moduleNameText] = resolvedModule; + sourceFile.resolvedModules.set(moduleNameText, resolvedModule); } export function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void { @@ -90,7 +90,7 @@ namespace ts { sourceFile.resolvedTypeReferenceDirectiveNames = createMap(); } - sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective); } /* @internal */ @@ -112,7 +112,7 @@ namespace ts { } for (let i = 0; i < names.length; i++) { const newResolution = newResolutions[i]; - const oldResolution = oldResolutions && oldResolutions[names[i]]; + const oldResolution = oldResolutions && oldResolutions.get(names[i]); const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) @@ -2217,22 +2217,16 @@ namespace ts { } function reattachFileDiagnostics(newFile: SourceFile): void { - if (!hasProperty(fileDiagnostics, newFile.fileName)) { - return; - } - - for (const diagnostic of fileDiagnostics[newFile.fileName]) { - diagnostic.file = newFile; - } + forEach(fileDiagnostics.get(newFile.fileName), diagnostic => diagnostic.file = newFile); } function add(diagnostic: Diagnostic): void { let diagnostics: Diagnostic[]; if (diagnostic.file) { - diagnostics = fileDiagnostics[diagnostic.file.fileName]; + diagnostics = fileDiagnostics.get(diagnostic.file.fileName); if (!diagnostics) { diagnostics = []; - fileDiagnostics[diagnostic.file.fileName] = diagnostics; + fileDiagnostics.set(diagnostic.file.fileName, diagnostics); } } else { @@ -2252,7 +2246,7 @@ namespace ts { function getDiagnostics(fileName?: string): Diagnostic[] { sortAndDeduplicate(); if (fileName) { - return fileDiagnostics[fileName] || []; + return fileDiagnostics.get(fileName) || []; } const allDiagnostics: Diagnostic[] = []; @@ -2262,9 +2256,9 @@ namespace ts { forEach(nonFileDiagnostics, pushDiagnostic); - for (const key in fileDiagnostics) { - forEach(fileDiagnostics[key], pushDiagnostic); - } + fileDiagnostics.forEach(diagnostics => { + forEach(diagnostics, pushDiagnostic); + }); return sortAndDeduplicateDiagnostics(allDiagnostics); } @@ -2277,9 +2271,9 @@ namespace ts { diagnosticsModified = false; nonFileDiagnostics = sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (const key in fileDiagnostics) { - fileDiagnostics[key] = sortAndDeduplicateDiagnostics(fileDiagnostics[key]); - } + fileDiagnostics.forEach((diagnostics, key) => { + fileDiagnostics.set(key, sortAndDeduplicateDiagnostics(diagnostics)); + }); } } @@ -2316,7 +2310,7 @@ namespace ts { return s; function getReplacement(c: string) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + return escapedCharsMap.get(c) || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } } @@ -3322,13 +3316,14 @@ namespace ts { export function formatSyntaxKind(kind: SyntaxKind): string { const syntaxKindEnum = (ts).SyntaxKind; if (syntaxKindEnum) { - if (syntaxKindCache[kind]) { - return syntaxKindCache[kind]; + const cached = syntaxKindCache.get(kind); + if (cached !== undefined) { + return cached; } for (const name in syntaxKindEnum) { if (syntaxKindEnum[name] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name + ")"; + return set(syntaxKindCache, kind, kind.toString() + " (" + name + ")"); } } } diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 43e01ca56bb..c9ea2af1a87 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -46,54 +46,54 @@ namespace ts { * supplant the existing `forEachChild` implementation if performance is not * significantly impacted. */ - const nodeEdgeTraversalMap = createMap({ - [SyntaxKind.QualifiedName]: [ + const nodeEdgeTraversalMap = createMapFromPairs( + [SyntaxKind.QualifiedName, [ { name: "left", test: isEntityName }, { name: "right", test: isIdentifier } - ], - [SyntaxKind.Decorator]: [ + ]], + [SyntaxKind.Decorator, [ { name: "expression", test: isLeftHandSideExpression } - ], - [SyntaxKind.TypeAssertionExpression]: [ + ]], + [SyntaxKind.TypeAssertionExpression, [ { name: "type", test: isTypeNode }, { name: "expression", test: isUnaryExpression } - ], - [SyntaxKind.AsExpression]: [ + ]], + [SyntaxKind.AsExpression, [ { name: "expression", test: isExpression }, { name: "type", test: isTypeNode } - ], - [SyntaxKind.NonNullExpression]: [ + ]], + [SyntaxKind.NonNullExpression, [ { name: "expression", test: isLeftHandSideExpression } - ], - [SyntaxKind.EnumDeclaration]: [ + ]], + [SyntaxKind.EnumDeclaration, [ { name: "decorators", test: isDecorator }, { name: "modifiers", test: isModifier }, { name: "name", test: isIdentifier }, { name: "members", test: isEnumMember } - ], - [SyntaxKind.ModuleDeclaration]: [ + ]], + [SyntaxKind.ModuleDeclaration, [ { name: "decorators", test: isDecorator }, { name: "modifiers", test: isModifier }, { name: "name", test: isModuleName }, { name: "body", test: isModuleBody } - ], - [SyntaxKind.ModuleBlock]: [ + ]], + [SyntaxKind.ModuleBlock, [ { name: "statements", test: isStatement } - ], - [SyntaxKind.ImportEqualsDeclaration]: [ + ]], + [SyntaxKind.ImportEqualsDeclaration, [ { name: "decorators", test: isDecorator }, { name: "modifiers", test: isModifier }, { name: "name", test: isIdentifier }, { name: "moduleReference", test: isModuleReference } - ], - [SyntaxKind.ExternalModuleReference]: [ + ]], + [SyntaxKind.ExternalModuleReference, [ { name: "expression", test: isExpression, optional: true } - ], - [SyntaxKind.EnumMember]: [ + ]], + [SyntaxKind.EnumMember, [ { name: "name", test: isPropertyName }, { name: "initializer", test: isExpression, optional: true, parenthesize: parenthesizeExpressionForList } - ] - }); + ]] + ); function reduceNode(node: Node, f: (memo: T, node: Node) => T, initial: T) { return node ? f(initial, node) : initial; @@ -530,7 +530,7 @@ namespace ts { break; default: - const edgeTraversalPath = nodeEdgeTraversalMap[kind]; + const edgeTraversalPath = nodeEdgeTraversalMap.get(kind); if (edgeTraversalPath) { for (const edge of edgeTraversalPath) { const value = (>node)[edge.name]; @@ -1188,10 +1188,10 @@ namespace ts { default: let updated: Node & MapLike; - const edgeTraversalPath = nodeEdgeTraversalMap[kind]; + const edgeTraversalPath = nodeEdgeTraversalMap.get(kind); if (edgeTraversalPath) { for (const edge of edgeTraversalPath) { - const value = >(>node)[edge.name]; + const value = >(>node)[edge.name]; if (value !== undefined) { const visited = isArray(value) ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 7c7a06db0b6..d4d6056f320 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -96,7 +96,7 @@ namespace FourSlash { }); export function escapeXmlAttributeValue(s: string) { - return s.replace(/[&<>"'\/]/g, ch => entityMap[ch]); + return s.replace(/[&<>"'\/]/g, ch => entityMap.get(ch)); } // Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions @@ -222,7 +222,7 @@ namespace FourSlash { } function tryAdd(path: string) { - const inputFile = inputFiles[path]; + const inputFile = inputFiles.get(path); if (inputFile && !Harness.isDefaultLibraryFile(path)) { languageServiceAdapterHost.addScript(path, inputFile, /*isRootFile*/ true); return true; @@ -256,7 +256,7 @@ namespace FourSlash { ts.forEach(testData.files, file => { // Create map between fileName and its content for easily looking up when resolveReference flag is specified - this.inputFiles[file.fileName] = file.content; + this.inputFiles.set(file.fileName, file.content); if (ts.getBaseFileName(file.fileName).toLowerCase() === "tsconfig.json") { const configJson = ts.parseConfigFileTextToJson(file.fileName, file.content); @@ -322,11 +322,11 @@ namespace FourSlash { } else { // resolveReference file-option is not specified then do not resolve any files and include all inputFiles - for (const fileName in this.inputFiles) { + this.inputFiles.forEach((file, fileName) => { if (!Harness.isDefaultLibraryFile(fileName)) { - this.languageServiceAdapterHost.addScript(fileName, this.inputFiles[fileName], /*isRootFile*/ true); + this.languageServiceAdapterHost.addScript(fileName, file, /*isRootFile*/ true); } - } + }); this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.getDefaultLibrarySourceFile().text, /*isRootFile*/ false); } @@ -659,11 +659,12 @@ namespace FourSlash { const completions = this.getCompletionListAtCaret(); const uniqueItems = ts.createMap(); for (const item of completions.entries) { - if (!(item.name in uniqueItems)) { - uniqueItems[item.name] = item.kind; + const uniqueItem = uniqueItems.get(item.name); + if (!uniqueItem) { + uniqueItems.set(item.name, item.kind); } else { - assert.equal(item.kind, uniqueItems[item.name], `Items should have the same kind, got ${item.kind} and ${uniqueItems[item.name]}`); + assert.equal(item.kind, uniqueItem, `Items should have the same kind, got ${item.kind} and ${uniqueItem}`); } } } @@ -831,7 +832,7 @@ namespace FourSlash { } public verifyRangesWithSameTextReferenceEachOther() { - ts.forEachProperty(this.rangesByText(), ranges => this.verifyRangesReferenceEachOther(ranges)); + this.rangesByText().forEach(ranges => this.verifyRangesReferenceEachOther(ranges)); } public verifyDisplayPartsOfReferencedSymbol(expected: ts.SymbolDisplayPart[]) { @@ -903,7 +904,8 @@ namespace FourSlash { } public verifyQuickInfos(namesAndTexts: { [name: string]: string | [string, string] }) { - ts.forEachProperty(ts.createMap(namesAndTexts), (text, name) => { + for (const name in namesAndTexts) if (ts.hasProperty(namesAndTexts, name)) { + const text = namesAndTexts[name]; if (text instanceof Array) { assert(text.length === 2); const [expectedText, expectedDocumentation] = text; @@ -912,7 +914,7 @@ namespace FourSlash { else { this.verifyQuickInfoAt(name, text); } - }); + } } public verifyQuickInfoString(expectedText: string, expectedDocumentation?: string) { @@ -2087,7 +2089,7 @@ namespace FourSlash { "<": ts.CharacterCodes.lessThan }); - const charCode = openBraceMap[openingBrace]; + const charCode = openBraceMap.get(openingBrace); if (!charCode) { this.raiseError(`Invalid openingBrace '${openingBrace}' specified.`); diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 26a4a6f963d..265fe4c142c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -918,10 +918,9 @@ namespace Harness { return undefined; } - if (!libFileNameSourceFileMap[fileName]) { - libFileNameSourceFileMap[fileName] = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest); - } - return libFileNameSourceFileMap[fileName]; + const sourceFile = libFileNameSourceFileMap.get(fileName); + return sourceFile || ts.set(libFileNameSourceFileMap, fileName, + createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest)); } export function getDefaultLibFileName(options: ts.CompilerOptions): string { @@ -1103,10 +1102,10 @@ namespace Harness { optionsIndex = ts.createMap(); const optionDeclarations = harnessOptionDeclarations.concat(ts.optionDeclarations); for (const option of optionDeclarations) { - optionsIndex[option.name.toLowerCase()] = option; + optionsIndex.set(option.name.toLowerCase(), option); } } - return optionsIndex[name.toLowerCase()]; + return optionsIndex.get(name.toLowerCase()); } export function setCompilerOptionsFromHarnessSetting(settings: Harness.TestCaseParser.CompilerSettings, options: ts.CompilerOptions & HarnessOptions): void { @@ -1466,7 +1465,7 @@ namespace Harness { const fullResults = ts.createMap(); for (const sourceFile of allFiles) { - fullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName); + fullResults.set(sourceFile.unitName, fullWalker.getTypeAndSymbols(sourceFile.unitName)); } // Produce baselines. The first gives the types for all expressions. @@ -1519,7 +1518,7 @@ namespace Harness { allFiles.forEach(file => { const codeLines = file.content.split("\n"); - typeWriterResults[file.unitName].forEach(result => { + typeWriterResults.get(file.unitName).forEach(result => { if (isSymbolBaseline && !result.symbol) { return; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index a49f8926729..2ddc38499d0 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -262,7 +262,7 @@ namespace Harness.LanguageService { this.getModuleResolutionsForFile = (fileName) => { const scriptInfo = this.getScriptInfo(fileName); const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true); - const imports = ts.createMap(); + const imports = ts.createMapLike(); for (const module of preprocessInfo.importedFiles) { const resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); if (resolutionInfo.resolvedModule) { @@ -275,7 +275,7 @@ namespace Harness.LanguageService { const scriptInfo = this.getScriptInfo(fileName); if (scriptInfo) { const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ false); - const resolutions = ts.createMap(); + const resolutions = ts.createMapLike(); const settings = this.nativeHost.getCompilationSettings(); for (const typeReferenceDirective of preprocessInfo.typeReferenceDirectives) { const resolutionInfo = ts.resolveTypeReferenceDirective(typeReferenceDirective.fileName, fileName, settings, moduleResolutionHost); diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index f7541dc9bfe..f1cc992c4a7 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -256,17 +256,20 @@ class ProjectRunner extends RunnerBase { // Set the values specified using json const optionNameMap = ts.arrayToMap(ts.optionDeclarations, option => option.name); for (const name in testCase) { - if (name !== "mapRoot" && name !== "sourceRoot" && name in optionNameMap) { - const option = optionNameMap[name]; - const optType = option.type; - let value = testCase[name]; - if (typeof optType !== "string") { - const key = value.toLowerCase(); - if (key in optType) { - value = optType[key]; + if (name !== "mapRoot" && name !== "sourceRoot") { + const option = optionNameMap.get(name); + if (option) { + const optType = option.type; + let value = testCase[name]; + if (typeof optType !== "string") { + const key = value.toLowerCase(); + const optTypeValue = optType.get(key); + if (optTypeValue) { + value = optTypeValue; + } } + compilerOptions[option.name] = value; } - compilerOptions[option.name] = value; } } diff --git a/src/harness/unittests/cachingInServerLSHost.ts b/src/harness/unittests/cachingInServerLSHost.ts index 4286d3555d8..b6a90f53259 100644 --- a/src/harness/unittests/cachingInServerLSHost.ts +++ b/src/harness/unittests/cachingInServerLSHost.ts @@ -8,25 +8,28 @@ namespace ts { function createDefaultServerHost(fileMap: Map): server.ServerHost { const existingDirectories = createMap(); - for (const name in fileMap) { + forEachKeyInMap(fileMap, name => { let dir = getDirectoryPath(name); let previous: string; do { - existingDirectories[dir] = true; + existingDirectories.set(dir, true); previous = dir; dir = getDirectoryPath(dir); } while (dir !== previous); - } + }); return { args: [], newLine: "\r\n", useCaseSensitiveFileNames: false, write: noop, - readFile: path => path in fileMap ? fileMap[path].content : undefined, + readFile: path => { + const file = fileMap.get(path); + return file && file.content; + }, writeFile: notImplemented, resolvePath: notImplemented, - fileExists: path => path in fileMap, - directoryExists: path => existingDirectories[path] || false, + fileExists: path => fileMap.has(path), + directoryExists: path => existingDirectories.get(path) || false, createDirectory: noop, getExecutingFilePath: () => "", getCurrentDirectory: () => "", @@ -191,7 +194,7 @@ namespace ts { assert.isTrue(typeof diags[0].messageText === "string" && ((diags[0].messageText).indexOf("Cannot find module") === 0), "should be 'cannot find module' message"); // assert that import will success once file appear on disk - fileMap[imported.name] = imported; + fileMap.set(imported.name, imported); fileExistsCalledForBar = false; rootScriptInfo.editContent(0, root.content.length, `import {y} from "bar"`); diff --git a/src/harness/unittests/moduleResolution.ts b/src/harness/unittests/moduleResolution.ts index 35313e15308..8e4ace38655 100644 --- a/src/harness/unittests/moduleResolution.ts +++ b/src/harness/unittests/moduleResolution.ts @@ -36,7 +36,7 @@ namespace ts { for (const f of files) { let name = getDirectoryPath(f.name); while (true) { - directories[name] = name; + directories.set(name, name); const baseName = getDirectoryPath(name); if (baseName === name) { break; @@ -46,20 +46,19 @@ namespace ts { } return { readFile, - directoryExists: path => { - return path in directories; - }, + directoryExists: path => directories.has(path), fileExists: path => { - assert.isTrue(getDirectoryPath(path) in directories, `'fileExists' '${path}' request in non-existing directory`); - return path in map; + assert.isTrue(directories.has(getDirectoryPath(path)), `'fileExists' '${path}' request in non-existing directory`); + return map.has(path); } }; } else { - return { readFile, fileExists: path => path in map, }; + return { readFile, fileExists: path => map.has(path) }; } function readFile(path: string): string { - return path in map ? map[path].content : undefined; + const file = map.get(path); + return file && file.content; } } @@ -300,7 +299,8 @@ namespace ts { const host: CompilerHost = { getSourceFile: (fileName: string, languageVersion: ScriptTarget) => { const path = normalizePath(combinePaths(currentDirectory, fileName)); - return path in files ? createSourceFile(fileName, files[path], languageVersion) : undefined; + const file = files.get(path); + return file && createSourceFile(fileName, file, languageVersion); }, getDefaultLibFileName: () => "lib.d.ts", writeFile: notImplemented, @@ -311,7 +311,7 @@ namespace ts { useCaseSensitiveFileNames: () => false, fileExists: fileName => { const path = normalizePath(combinePaths(currentDirectory, fileName)); - return path in files; + return files.has(path); }, readFile: notImplemented }; @@ -371,7 +371,11 @@ export = C; function test(files: Map, options: CompilerOptions, currentDirectory: string, useCaseSensitiveFileNames: boolean, rootFiles: string[], diagnosticCodes: number[]): void { const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); if (!useCaseSensitiveFileNames) { - files = reduceProperties(files, (files, file, fileName) => (files[getCanonicalFileName(fileName)] = file, files), createMap()); + const oldFiles = files; + files = createMap(); + oldFiles.forEach((file, fileName) => { + files.set(getCanonicalFileName(fileName), file); + }); } const host: CompilerHost = { @@ -380,7 +384,8 @@ export = C; return library; } const path = getCanonicalFileName(normalizePath(combinePaths(currentDirectory, fileName))); - return path in files ? createSourceFile(fileName, files[path], languageVersion) : undefined; + const file = files.get(path); + return file && createSourceFile(fileName, file, languageVersion); }, getDefaultLibFileName: () => "lib.d.ts", writeFile: notImplemented, @@ -391,7 +396,7 @@ export = C; useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, fileExists: fileName => { const path = getCanonicalFileName(normalizePath(combinePaths(currentDirectory, fileName))); - return path in files; + return files.has(path); }, readFile: notImplemented }; @@ -1020,8 +1025,8 @@ import b = require("./moduleB"); const names = map(files, f => f.name); const sourceFiles = arrayToMap(map(files, f => createSourceFile(f.name, f.content, ScriptTarget.ES2015)), f => f.fileName); const compilerHost: CompilerHost = { - fileExists : fileName => fileName in sourceFiles, - getSourceFile: fileName => sourceFiles[fileName], + fileExists : fileName => sourceFiles.has(fileName), + getSourceFile: fileName => sourceFiles.get(fileName), getDefaultLibFileName: () => "lib.d.ts", writeFile: notImplemented, getCurrentDirectory: () => "/", @@ -1029,7 +1034,10 @@ import b = require("./moduleB"); getCanonicalFileName: f => f.toLowerCase(), getNewLine: () => "\r\n", useCaseSensitiveFileNames: () => false, - readFile: fileName => fileName in sourceFiles ? sourceFiles[fileName].text : undefined + readFile: fileName => { + const file = sourceFiles.get(fileName); + return file && file.text; + } }; const program1 = createProgram(names, {}, compilerHost); const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics(); diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index 6dbd74e71d2..54c05a9c383 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -122,7 +122,7 @@ namespace ts { trace: s => trace.push(s), getTrace: () => trace, getSourceFile(fileName): SourceFile { - return files[fileName]; + return files.get(fileName); }, getDefaultLibFileName(): string { return "lib.d.ts"; @@ -143,9 +143,10 @@ namespace ts { getNewLine(): string { return sys ? sys.newLine : newLine; }, - fileExists: fileName => fileName in files, + fileExists: fileName => files.has(fileName), readFile: fileName => { - return fileName in files ? files[fileName].text : undefined; + const file = files.get(fileName); + return file && file.text; }, }; } @@ -188,7 +189,7 @@ namespace ts { } else { assert.isTrue(cache !== undefined, `expected ${caption} to be set`); - assert.isTrue(equalOwnProperties(expectedContent, cache, entryChecker), `contents of ${caption} did not match the expected contents.`); + assert.isTrue(mapsAreEqual(expectedContent, cache, entryChecker), `contents of ${caption} did not match the expected contents.`); } } diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index 8800e84474b..da24fe1606b 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -422,9 +422,10 @@ namespace ts.server { handle(msg: protocol.Message): void { if (msg.type === "response") { const response = msg; - if (response.request_seq in this.callbacks) { - this.callbacks[response.request_seq](response); - delete this.callbacks[response.request_seq]; + const handler = this.callbacks.get(response.request_seq); + if (handler) { + handler(response); + this.callbacks.delete(response.request_seq); } } else if (msg.type === "event") { @@ -434,13 +435,14 @@ namespace ts.server { } emit(name: string, args: any): void { - if (name in this.eventHandlers) { - this.eventHandlers[name](args); + const handler = this.eventHandlers.get(name); + if (handler) { + handler(args); } } on(name: string, handler: (args: any) => void): void { - this.eventHandlers[name] = handler; + this.eventHandlers.set(name, handler); } connect(session: InProcSession): void { @@ -458,7 +460,7 @@ namespace ts.server { command, arguments: args }); - this.callbacks[this.seq] = callback; + this.callbacks.set(this.seq, callback); } }; diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 77ebee6fadd..bec3a700879 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -243,12 +243,18 @@ namespace ts.projectSystem { } export function checkMapKeys(caption: string, map: Map, expectedKeys: string[]) { - assert.equal(reduceProperties(map, count => count + 1, 0), expectedKeys.length, `${caption}: incorrect size of map`); + assert.equal(mapSize(map), expectedKeys.length, `${caption}: incorrect size of map`); for (const name of expectedKeys) { - assert.isTrue(name in map, `${caption} is expected to contain ${name}, actual keys: ${Object.keys(map)}`); + assert.isTrue(map.has(name), `${caption} is expected to contain ${name}, actual keys: ${keysOfMap(map)}`); } } + function mapSize(map: Map): number { + let size = 0; + map.forEach(() => { size++; }); + return size; + } + export function checkFileNames(caption: string, actualFileNames: string[], expectedFileNames: string[]) { assert.equal(actualFileNames.length, expectedFileNames.length, `${caption}: incorrect actual number of files, expected ${JSON.stringify(expectedFileNames)}, got ${actualFileNames}`); for (const f of expectedFileNames) { @@ -291,38 +297,30 @@ namespace ts.projectSystem { } export class Callbacks { - private map: { [n: number]: TimeOutCallback } = {}; + private map = createMap(); private nextId = 1; register(cb: (...args: any[]) => void, args: any[]) { const timeoutId = this.nextId; this.nextId++; - this.map[timeoutId] = cb.bind(undefined, ...args); + this.map.set(timeoutId, cb.bind(undefined, ...args)); return timeoutId; } unregister(id: any) { if (typeof id === "number") { - delete this.map[id]; + this.map.delete(id); } } count() { - let n = 0; - for (const _ in this.map) { - // TODO: GH#11734 - _; - n++; - } - return n; + return mapSize(this.map); } invoke() { - for (const id in this.map) { - if (hasProperty(this.map, id)) { - this.map[id](); - } - } - this.map = {}; + this.map.forEach(cb => { + cb(); + }); + this.map.clear(); } } @@ -439,7 +437,7 @@ namespace ts.projectSystem { triggerDirectoryWatcherCallback(directoryName: string, fileName: string): void { const path = this.toPath(directoryName); - const callbacks = this.watchedDirectories[path]; + const callbacks = this.watchedDirectories.get(path); if (callbacks) { for (const callback of callbacks) { callback.cb(fileName); @@ -449,7 +447,7 @@ namespace ts.projectSystem { triggerFileWatcherCallback(fileName: string, removed?: boolean): void { const path = this.toPath(fileName); - const callbacks = this.watchedFiles[path]; + const callbacks = this.watchedFiles.get(path); if (callbacks) { for (const callback of callbacks) { callback(path, removed); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index 62d2f7ac801..d99f12294af 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -14,7 +14,7 @@ namespace ts.projectSystem { function createTypesRegistry(...list: string[]): Map { const map = createMap(); for (const l of list) { - map[l] = undefined; + map.set(l, undefined); } return map; } diff --git a/src/server/builder.ts b/src/server/builder.ts index 5354e7ed508..44fb2224371 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -336,24 +336,24 @@ namespace ts.server { // Use slice to clone the array to avoid manipulating in place const queue = fileInfo.referencedBy.slice(0); const fileNameSet = createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; + fileNameSet.set(scriptInfo.fileName, scriptInfo); while (queue.length > 0) { const processingFileInfo = queue.pop(); if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { for (const potentialFileInfo of processingFileInfo.referencedBy) { - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { + if (!fileNameSet.has(potentialFileInfo.scriptInfo.fileName)) { queue.push(potentialFileInfo); } } } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; + fileNameSet.set(processingFileInfo.scriptInfo.fileName, processingFileInfo.scriptInfo); } const result: string[] = []; - for (const fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { + fileNameSet.forEach((scriptInfo, fileName) => { + if (shouldEmitFile(scriptInfo)) { result.push(fileName); } - } + }); return result; } } diff --git a/src/server/client.ts b/src/server/client.ts index 3b09a926754..13d16073d1c 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -31,10 +31,10 @@ namespace ts.server { } private getLineMap(fileName: string): number[] { - let lineMap = this.lineMaps[fileName]; + let lineMap = this.lineMaps.get(fileName); if (!lineMap) { const scriptSnapshot = this.host.getScriptSnapshot(fileName); - lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + lineMap = set(this.lineMaps, fileName, ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength()))); } return lineMap; } @@ -140,7 +140,7 @@ namespace ts.server { changeFile(fileName: string, start: number, end: number, newText: string): void { // clear the line map after an edit - this.lineMaps[fileName] = undefined; + this.lineMaps.set(fileName, undefined); const lineOffset = this.positionToOneBasedLineOffset(fileName, start); const endLineOffset = this.positionToOneBasedLineOffset(fileName, end); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 9e53b3cd526..a358b0dab00 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -41,10 +41,10 @@ namespace ts.server { if (typeof option.type === "object") { const optionMap = >option.type; // verify that map contains only numbers - for (const id in optionMap) { - Debug.assert(typeof optionMap[id] === "number"); - } - map[option.name] = optionMap; + optionMap.forEach(value => { + Debug.assert(typeof value === "number"); + }); + map.set(option.name, optionMap); } } return map; @@ -59,20 +59,19 @@ namespace ts.server { export function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings { if (typeof protocolOptions.indentStyle === "string") { - protocolOptions.indentStyle = indentStyle[protocolOptions.indentStyle.toLowerCase()]; + protocolOptions.indentStyle = indentStyle.get(protocolOptions.indentStyle.toLowerCase()); Debug.assert(protocolOptions.indentStyle !== undefined); } return protocolOptions; } export function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin { - for (const id in compilerOptionConverters) { + compilerOptionConverters.forEach((mappedValues, id) => { const propertyValue = protocolOptions[id]; if (typeof propertyValue === "string") { - const mappedValues = compilerOptionConverters[id]; - protocolOptions[id] = mappedValues[propertyValue.toLowerCase()]; + protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); } - } + }); return protocolOptions; } @@ -189,11 +188,12 @@ namespace ts.server { stopWatchingDirectory(directory: string) { // if the ref count for this directory watcher drops to 0, it's time to close it - this.directoryWatchersRefCount[directory]--; - if (this.directoryWatchersRefCount[directory] === 0) { + const refCount = this.directoryWatchersRefCount.get(directory) - 1; + this.directoryWatchersRefCount.set(directory, refCount); + if (refCount === 0) { this.projectService.logger.info(`Close directory watcher for: ${directory}`); - this.directoryWatchersForTsconfig[directory].close(); - delete this.directoryWatchersForTsconfig[directory]; + this.directoryWatchersForTsconfig.get(directory).close(); + this.directoryWatchersForTsconfig.delete(directory); } } @@ -201,13 +201,13 @@ namespace ts.server { let currentPath = getDirectoryPath(fileName); let parentPath = getDirectoryPath(currentPath); while (currentPath != parentPath) { - if (!this.directoryWatchersForTsconfig[currentPath]) { + if (!this.directoryWatchersForTsconfig.has(currentPath)) { this.projectService.logger.info(`Add watcher for: ${currentPath}`); - this.directoryWatchersForTsconfig[currentPath] = this.projectService.host.watchDirectory(currentPath, callback); - this.directoryWatchersRefCount[currentPath] = 1; + this.directoryWatchersForTsconfig.set(currentPath, this.projectService.host.watchDirectory(currentPath, callback)); + this.directoryWatchersRefCount.set(currentPath, 1); } else { - this.directoryWatchersRefCount[currentPath] += 1; + this.directoryWatchersRefCount.set(currentPath, this.directoryWatchersRefCount.get(currentPath) + 1); } project.directoriesWatchedForTsconfig.push(currentPath); currentPath = parentPath; @@ -425,7 +425,7 @@ namespace ts.server { } else { if (info && (!info.isOpen)) { - // file has been changed which might affect the set of referenced files in projects that include + // file has been changed which might affect the set of referenced files in projects that include // this file and set of inferred projects info.reloadFromFile(); this.updateProjectGraphs(info.containingProjects); @@ -444,7 +444,7 @@ namespace ts.server { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; - // capture list of projects since detachAllProjects will wipe out original list + // capture list of projects since detachAllProjects will wipe out original list const containingProjects = info.containingProjects.slice(); info.detachAllProjects(); @@ -600,7 +600,7 @@ namespace ts.server { const inferredProject = this.createInferredProjectWithRootFileIfNecessary(info); if (!this.useSingleInferredProject) { // if useOneInferredProject is not set then try to fixup ownership of open files - // check 'defaultProject !== inferredProject' is necessary to handle cases + // check 'defaultProject !== inferredProject' is necessary to handle cases // when creation inferred project for some file has added other open files into this project (i.e. as referenced files) // we definitely don't want to delete the project that was just created for (const f of this.openFiles) { @@ -610,7 +610,7 @@ namespace ts.server { } const defaultProject = f.getDefaultProject(); if (isRootFileInInferredProject(info) && defaultProject !== inferredProject && inferredProject.containsScriptInfo(f)) { - // open file used to be root in inferred project, + // open file used to be root in inferred project, // this inferred project is different from the one we've just created for current file // and new inferred project references this open file. // We should delete old inferred project and attach open file to the new one @@ -990,7 +990,7 @@ namespace ts.server { if (toAdd) { for (const f of toAdd) { if (f.isOpen && isRootFileInInferredProject(f)) { - // if file is already root in some inferred project + // if file is already root in some inferred project // - remove the file from that project and delete the project if necessary const inferredProject = f.containingProjects[0]; inferredProject.removeFile(f); @@ -1143,7 +1143,7 @@ namespace ts.server { this.logger.info(`Host information ${args.hostInfo}`); } if (args.formatOptions) { - mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); + mergeMapLikes(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } } @@ -1265,7 +1265,7 @@ namespace ts.server { for (const file of changedFiles) { const scriptInfo = this.getScriptInfo(file.fileName); Debug.assert(!!scriptInfo); - // apply changes in reverse order + // apply changes in reverse order for (let i = file.changes.length - 1; i >= 0; i--) { const change = file.changes[i]; scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText); @@ -1302,7 +1302,7 @@ namespace ts.server { closeExternalProject(uncheckedFileName: string, suppressRefresh = false): void { const fileName = toNormalizedPath(uncheckedFileName); - const configFiles = this.externalProjectToConfiguredProjectMap[fileName]; + const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName); if (configFiles) { let shouldRefreshInferredProjects = false; for (const configFile of configFiles) { @@ -1310,7 +1310,7 @@ namespace ts.server { shouldRefreshInferredProjects = true; } } - delete this.externalProjectToConfiguredProjectMap[fileName]; + this.externalProjectToConfiguredProjectMap.delete(fileName); if (shouldRefreshInferredProjects && !suppressRefresh) { this.refreshInferredProjects(); } @@ -1331,19 +1331,19 @@ namespace ts.server { // record project list before the update const projectsToClose = arrayToMap(this.externalProjects, p => p.getProjectName(), _ => true); for (const externalProjectName in this.externalProjectToConfiguredProjectMap) { - projectsToClose[externalProjectName] = true; + projectsToClose.set(externalProjectName, true); } for (const externalProject of projects) { this.openExternalProject(externalProject, /*suppressRefreshOfInferredProjects*/ true); // delete project that is present in input list - delete projectsToClose[externalProject.projectFileName]; + projectsToClose.delete(externalProject.projectFileName); } // close projects that were missing in the input list - for (const externalProjectName in projectsToClose) { + forEachKeyInMap(projectsToClose, externalProjectName => { this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true) - } + }); this.refreshInferredProjects(); } @@ -1386,7 +1386,7 @@ namespace ts.server { // close existing project and later we'll open a set of configured projects for these files this.closeExternalProject(proj.projectFileName, /*suppressRefresh*/ true); } - else if (this.externalProjectToConfiguredProjectMap[proj.projectFileName]) { + else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) { // this project used to include config files if (!tsConfigFiles) { // config files were removed from the project - close existing external project which in turn will close configured projects @@ -1394,7 +1394,7 @@ namespace ts.server { } else { // project previously had some config files - compare them with new set of files and close all configured projects that correspond to unused files - const oldConfigFiles = this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName); let iNew = 0; let iOld = 0; while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) { @@ -1422,7 +1422,7 @@ namespace ts.server { } if (tsConfigFiles) { // store the list of tsconfig files that belong to the external project - this.externalProjectToConfiguredProjectMap[proj.projectFileName] = tsConfigFiles; + this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles); for (const tsconfigFile of tsConfigFiles) { let project = this.findConfiguredProjectByProjectName(tsconfigFile); if (!project) { @@ -1438,7 +1438,7 @@ namespace ts.server { } else { // no config files - remove the item from the collection - delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; + this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName); this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } if (!suppressRefreshOfInferredProjects) { diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index aa37008ff66..ffeeb57a0e8 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -75,15 +75,16 @@ namespace ts.server { for (const name of names) { // check if this is a duplicate entry in the list - let resolution = newResolutions[name]; + let resolution = newResolutions.get(name); if (!resolution) { - const existingResolution = currentResolutionsInFile && currentResolutionsInFile[name]; + const existingResolution = currentResolutionsInFile && currentResolutionsInFile.get(name); if (moduleResolutionIsValid(existingResolution)) { // ok, it is safe to use existing name resolution results resolution = existingResolution; } else { - newResolutions[name] = resolution = loader(name, containingFile, compilerOptions, this); + resolution = loader(name, containingFile, compilerOptions, this); + newResolutions.set(name, resolution); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); diff --git a/src/server/project.ts b/src/server/project.ts index 049f61269f8..14889dccd8a 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -495,9 +495,9 @@ namespace ts.server { } let unresolvedImports: string[]; if (file.resolvedModules) { - for (const name in file.resolvedModules) { + file.resolvedModules.forEach((resolvedModule, name) => { // pick unresolved non-relative names - if (!file.resolvedModules[name] && !isExternalModuleNameRelative(name)) { + if (!resolvedModule && !isExternalModuleNameRelative(name)) { // for non-scoped names extract part up-to the first slash // for scoped names - extract up to the second slash let trimmed = name.trim(); @@ -511,7 +511,7 @@ namespace ts.server { (unresolvedImports || (unresolvedImports = [])).push(trimmed); result.push(trimmed); } - } + }); } this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || emptyArray); } @@ -537,7 +537,7 @@ namespace ts.server { } // 1. no changes in structure, no changes in unresolved imports - do nothing - // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files + // 2. no changes in structure, unresolved imports were changed - collect unresolved imports for all files // (can reuse cached imports for files that were not changed) // 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files // (can reuse cached imports for files that were not changed) @@ -679,16 +679,16 @@ namespace ts.server { const added: string[] = []; const removed: string[] = []; - for (const id in currentFiles) { - if (!hasProperty(lastReportedFileNames, id)) { + forEachKeyInMap(currentFiles, id => { + if (!lastReportedFileNames.has(id)) { added.push(id); } - } - for (const id in lastReportedFileNames) { - if (!hasProperty(currentFiles, id)) { + }); + forEachKeyInMap(lastReportedFileNames, id => { + if (!currentFiles.has(id)) { removed.push(id); } - } + }); this.lastReportedFileNames = currentFiles; this.lastReportedVersion = this.projectStructureVersion; return { info, changes: { added, removed }, projectErrors: this.projectErrors }; @@ -722,7 +722,7 @@ namespace ts.server { if (symbol && symbol.declarations && symbol.declarations[0]) { const declarationSourceFile = symbol.declarations[0].getSourceFile(); if (declarationSourceFile) { - referencedFiles[declarationSourceFile.path] = true; + referencedFiles.set(declarationSourceFile.path, true); } } } @@ -734,25 +734,24 @@ namespace ts.server { if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) { for (const referencedFile of sourceFile.referencedFiles) { const referencedPath = toPath(referencedFile.fileName, currentDirectory, getCanonicalFileName); - referencedFiles[referencedPath] = true; + referencedFiles.set(referencedPath, true); } } // Handle type reference directives if (sourceFile.resolvedTypeReferenceDirectiveNames) { - for (const typeName in sourceFile.resolvedTypeReferenceDirectiveNames) { - const resolvedTypeReferenceDirective = sourceFile.resolvedTypeReferenceDirectiveNames[typeName]; + sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => { if (!resolvedTypeReferenceDirective) { - continue; + return; } const fileName = resolvedTypeReferenceDirective.resolvedFileName; const typeFilePath = toPath(fileName, currentDirectory, getCanonicalFileName); - referencedFiles[typeFilePath] = true; - } + referencedFiles.set(typeFilePath, true); + }) } - const allFileNames = map(Object.keys(referencedFiles), key => key); + const allFileNames = keysOfMap(referencedFiles) as Path[]; return filter(allFileNames, file => this.projectService.host.fileExists(file)); } @@ -888,18 +887,19 @@ namespace ts.server { return; } const configDirectoryPath = getDirectoryPath(this.getConfigFilePath()); - this.directoriesWatchedForWildcards = reduceProperties(this.wildcardDirectories, (watchers, flag, directory) => { + + this.directoriesWatchedForWildcards = createMap(); + this.wildcardDirectories.forEach((flag, directory) => { if (comparePaths(configDirectoryPath, directory, ".", !this.projectService.host.useCaseSensitiveFileNames) !== Comparison.EqualTo) { const recursive = (flag & WatchDirectoryFlags.Recursive) !== 0; this.projectService.logger.info(`Add ${recursive ? "recursive " : ""}watcher for: ${directory}`); - watchers[directory] = this.projectService.host.watchDirectory( + this.directoriesWatchedForWildcards.set(directory, this.projectService.host.watchDirectory( directory, path => callback(this, path), recursive - ); + )); } - return watchers; - }, >{}); + }); } stopWatchingDirectory() { @@ -923,9 +923,9 @@ namespace ts.server { this.typeRootsWatchers = undefined; } - for (const id in this.directoriesWatchedForWildcards) { - this.directoriesWatchedForWildcards[id].close(); - } + this.directoriesWatchedForWildcards.forEach(watcher => { + watcher.close(); + }); this.directoriesWatchedForWildcards = undefined; this.stopWatchingDirectory(); diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 84649863a7b..fa9eac0e8e3 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -95,7 +95,7 @@ namespace ts.server { if (!this.formatCodeSettings) { this.formatCodeSettings = getDefaultFormatCodeSettings(this.host); } - mergeMaps(this.formatCodeSettings, formatSettings); + mergeMapLikes(this.formatCodeSettings, formatSettings); } } diff --git a/src/server/session.ts b/src/server/session.ts index 9abc5a447bf..0c200b33b84 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1607,14 +1607,14 @@ namespace ts.server { }); public addProtocolHandler(command: string, handler: (request: protocol.Request) => { response?: any, responseRequired: boolean }) { - if (command in this.handlers) { + if (this.handlers.has(command)) { throw new Error(`Protocol handler already exists for command "${command}"`); } - this.handlers[command] = handler; + this.handlers.set(command, handler); } public executeCommand(request: protocol.Request): { response?: any, responseRequired?: boolean } { - const handler = this.handlers[request.command]; + const handler = this.handlers.get(request.command); if (handler) { return handler(request); } diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 8b03d59003c..9379ae82d0e 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -35,17 +35,18 @@ namespace ts.server { let unique = 0; for (const v of arr1) { - if (set[v] !== true) { - set[v] = true; + if (set.get(v) !== true) { + set.set(v, true); unique++; } } for (const v of arr2) { - if (!hasProperty(set, v)) { + const isSet = set.get(v); + if (isSet === undefined) { return false; } - if (set[v] === true) { - set[v] = false; + if (isSet === true) { + set.set(v, false); unique--; } } @@ -83,7 +84,7 @@ namespace ts.server { return emptyArray; } - const entry = this.perProjectCache[project.getProjectName()]; + const entry = this.perProjectCache.get(project.getProjectName()); const result: SortedReadonlyArray = entry ? entry.typings : emptyArray; if (forceRefresh || !entry || @@ -92,13 +93,13 @@ namespace ts.server { unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) { // Note: entry is now poisoned since it does not really contain typings for a given combination of compiler options\typings options. // instead it acts as a placeholder to prevent issuing multiple requests - this.perProjectCache[project.getProjectName()] = { + this.perProjectCache.set(project.getProjectName(), { compilerOptions: project.getCompilerOptions(), typeAcquisition, typings: result, unresolvedImports, poisoned: true - }; + }); // something has been changed, issue a request to update typings this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports); } @@ -106,21 +107,21 @@ namespace ts.server { } updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]) { - this.perProjectCache[projectName] = { + this.perProjectCache.set(projectName, { compilerOptions, typeAcquisition, typings: toSortedReadonlyArray(newTypings), unresolvedImports, poisoned: false - }; + }); } deleteTypingsForProject(projectName: string) { - delete this.perProjectCache[projectName]; + this.perProjectCache.delete(projectName); } onProjectClosed(project: Project) { - delete this.perProjectCache[project.getProjectName()]; + this.perProjectCache.delete(project.getProjectName()); this.installer.onProjectClosed(project); } } diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index 7a09c1f6c21..82184f86850 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -112,7 +112,7 @@ namespace ts.server.typingsInstaller { if (this.log.isEnabled()) { this.log.writeLine(`Closing file watchers for project '${projectName}'`); } - const watchers = this.projectWatchers[projectName]; + const watchers = this.projectWatchers.get(projectName); if (!watchers) { if (this.log.isEnabled()) { this.log.writeLine(`No watchers are registered for project '${projectName}'`); @@ -123,7 +123,7 @@ namespace ts.server.typingsInstaller { w.close(); } - delete this.projectWatchers[projectName]; + this.projectWatchers.delete(projectName); if (this.log.isEnabled()) { this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`); @@ -177,7 +177,7 @@ namespace ts.server.typingsInstaller { if (this.log.isEnabled()) { this.log.writeLine(`Processing cache location '${cacheLocation}'`); } - if (this.knownCachesSet[cacheLocation]) { + if (this.knownCachesSet.get(cacheLocation)) { if (this.log.isEnabled()) { this.log.writeLine(`Cache location was already processed...`); } @@ -201,10 +201,10 @@ namespace ts.server.typingsInstaller { } const typingFile = typingToFileName(cacheLocation, packageName, this.installTypingHost, this.log); if (!typingFile) { - this.missingTypingsSet[packageName] = true; + this.missingTypingsSet.set(packageName, true); continue; } - const existingTypingFile = this.packageNameToTypingLocation[packageName]; + const existingTypingFile = this.packageNameToTypingLocation.get(packageName); if (existingTypingFile === typingFile) { continue; } @@ -216,14 +216,14 @@ namespace ts.server.typingsInstaller { if (this.log.isEnabled()) { this.log.writeLine(`Adding entry into typings cache: '${packageName}' => '${typingFile}'`); } - this.packageNameToTypingLocation[packageName] = typingFile; + this.packageNameToTypingLocation.set(packageName, typingFile); } } } if (this.log.isEnabled()) { this.log.writeLine(`Finished processing cache location '${cacheLocation}'`); } - this.knownCachesSet[cacheLocation] = true; + this.knownCachesSet.set(cacheLocation, true); } private filterTypings(typingsToInstall: string[]) { @@ -232,12 +232,12 @@ namespace ts.server.typingsInstaller { } const result: string[] = []; for (const typing of typingsToInstall) { - if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) { + if (this.missingTypingsSet.get(typing) || this.packageNameToTypingLocation.get(typing)) { continue; } const validationResult = validatePackageName(typing); if (validationResult === PackageNameValidationResult.Ok) { - if (typing in this.typesRegistry) { + if (this.typesRegistry.has(typing)) { result.push(typing); } else { @@ -248,7 +248,7 @@ namespace ts.server.typingsInstaller { } else { // add typing name to missing set so we won't process it again - this.missingTypingsSet[typing] = true; + this.missingTypingsSet.set(typing, true); if (this.log.isEnabled()) { switch (validationResult) { case PackageNameValidationResult.EmptyName: @@ -323,7 +323,7 @@ namespace ts.server.typingsInstaller { this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); } for (const typing of filteredTypings) { - this.missingTypingsSet[typing] = true; + this.missingTypingsSet.set(typing, true); } return; } @@ -336,11 +336,11 @@ namespace ts.server.typingsInstaller { for (const packageName of filteredTypings) { const typingFile = typingToFileName(cachePath, packageName, this.installTypingHost, this.log); if (!typingFile) { - this.missingTypingsSet[packageName] = true; + this.missingTypingsSet.set(packageName, true); continue; } - if (!this.packageNameToTypingLocation[packageName]) { - this.packageNameToTypingLocation[packageName] = typingFile; + if (!this.packageNameToTypingLocation.has(packageName)) { + this.packageNameToTypingLocation.set(packageName, typingFile); } installedTypingFiles.push(typingFile); } @@ -395,7 +395,7 @@ namespace ts.server.typingsInstaller { }, /*pollingInterval*/ 2000); watchers.push(w); } - this.projectWatchers[projectName] = watchers; + this.projectWatchers.set(projectName, watchers); } private createSetTypings(request: DiscoverTypings, typings: string[]): SetTypings { diff --git a/src/server/utilities.ts b/src/server/utilities.ts index fd370da7fa1..eb7801e5fd9 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -92,7 +92,7 @@ namespace ts.server { }; } - export function mergeMaps(target: MapLike, source: MapLike ): void { + export function mergeMapLikes(target: MapLike, source: MapLike ): void { for (const key in source) { if (hasProperty(source, key)) { target[key] = source[key]; @@ -142,20 +142,20 @@ namespace ts.server { export function createNormalizedPathMap(): NormalizedPathMap { /* tslint:disable:no-null-keyword */ - const map: Map = Object.create(null); + const map = createMap(); /* tslint:enable:no-null-keyword */ return { get(path) { - return map[path]; + return map.get(path); }, set(path, value) { - map[path] = value; + map.set(path, value); }, contains(path) { - return hasProperty(map, path); + return map.has(path); }, remove(path) { - delete map[path]; + map.delete(path); } }; } @@ -195,16 +195,17 @@ namespace ts.server { } public schedule(operationId: string, delay: number, cb: () => void) { - if (hasProperty(this.pendingTimeouts, operationId)) { + const pendingTimeout = this.pendingTimeouts.get(operationId); + if (pendingTimeout) { // another operation was already scheduled for this id - cancel it - this.host.clearTimeout(this.pendingTimeouts[operationId]); + this.host.clearTimeout(pendingTimeout); } // schedule new operation, pass arguments - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); + this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb)); } private static run(self: ThrottledOperations, operationId: string, cb: () => void) { - delete self.pendingTimeouts[operationId]; + self.pendingTimeouts.delete(operationId); cb(); } } diff --git a/src/services/classifier.ts b/src/services/classifier.ts index c22aec6a786..6c143ec2af0 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -557,7 +557,7 @@ namespace ts { // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { + if (classifiableNames.get(identifier.text)) { const symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { const type = classifySymbol(symbol, getMeaningFromLocation(node)); diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codefixes/codeFixProvider.ts index e4489fc2dca..c6373fc1909 100644 --- a/src/services/codefixes/codeFixProvider.ts +++ b/src/services/codefixes/codeFixProvider.ts @@ -20,21 +20,21 @@ namespace ts { export function registerCodeFix(action: CodeFix) { forEach(action.errorCodes, error => { - let fixes = codeFixes[error]; + let fixes = codeFixes.get(error); if (!fixes) { fixes = []; - codeFixes[error] = fixes; + codeFixes.set(error, fixes); } fixes.push(action); }); } export function getSupportedErrorCodes() { - return Object.keys(codeFixes); + return keysOfMap(codeFixes); } export function getFixes(context: CodeFixContext): CodeAction[] { - const fixes = codeFixes[context.errorCode]; + const fixes = codeFixes.get(context.errorCode); let allActions: CodeAction[] = []; forEach(fixes, f => { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index bda310f2d33..0e7743e29fc 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -21,18 +21,19 @@ namespace ts.codefix { return; } - if (!this.symbolIdToActionMap[symbolId]) { - this.symbolIdToActionMap[symbolId] = [newAction]; + const actions = this.symbolIdToActionMap.get(symbolId); + if (!actions) { + this.symbolIdToActionMap.set(symbolId, [newAction]); return; } if (newAction.kind === "CodeChange") { - this.symbolIdToActionMap[symbolId].push(newAction); + actions.push(newAction); return; } const updatedNewImports: ImportCodeAction[] = []; - for (const existingAction of this.symbolIdToActionMap[symbolId]) { + for (const existingAction of this.symbolIdToActionMap.get(symbolId)) { if (existingAction.kind === "CodeChange") { // only import actions should compare updatedNewImports.push(existingAction); @@ -62,7 +63,7 @@ namespace ts.codefix { } // if we reach here, it means the new one is better or equal to all of the existing ones. updatedNewImports.push(newAction); - this.symbolIdToActionMap[symbolId] = updatedNewImports; + this.symbolIdToActionMap.set(symbolId, updatedNewImports); } addActions(symbolId: number, newActions: ImportCodeAction[]) { @@ -73,9 +74,9 @@ namespace ts.codefix { getAllActions() { let result: ImportCodeAction[] = []; - for (const symbolId in this.symbolIdToActionMap) { - result = concatenate(result, this.symbolIdToActionMap[symbolId]); - } + this.symbolIdToActionMap.forEach(actions => { + result = concatenate(result, actions); + }); return result; } @@ -162,8 +163,9 @@ namespace ts.codefix { function getImportDeclarations(moduleSymbol: Symbol) { const moduleSymbolId = getUniqueSymbolId(moduleSymbol); - if (cachedImportDeclarations[moduleSymbolId]) { - return cachedImportDeclarations[moduleSymbolId]; + const cached = cachedImportDeclarations.get(moduleSymbolId); + if (cached) { + return cached; } const existingDeclarations: (ImportDeclaration | ImportEqualsDeclaration)[] = []; @@ -173,7 +175,7 @@ namespace ts.codefix { existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); } } - cachedImportDeclarations[moduleSymbolId] = existingDeclarations; + cachedImportDeclarations.set(moduleSymbolId, existingDeclarations); return existingDeclarations; function getImportDeclaration(moduleSpecifier: LiteralExpression) { diff --git a/src/services/completions.ts b/src/services/completions.ts index b710aa8cd78..f7efe1fec56 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -64,14 +64,14 @@ namespace ts.Completions { const entries: CompletionEntry[] = []; const nameTable = getNameTable(sourceFile); - for (const name in nameTable) { + nameTable.forEach((namePosition, name) => { // Skip identifiers produced only from the current location - if (nameTable[name] === position) { - continue; + if (namePosition === position) { + return; } - if (!uniqueNames[name]) { - uniqueNames[name] = name; + if (!uniqueNames.get(name)) { + uniqueNames.set(name, name); const displayName = getCompletionEntryDisplayName(unescapeIdentifier(name), compilerOptions.target, /*performCharacterChecks*/ true); if (displayName) { const entry = { @@ -83,7 +83,7 @@ namespace ts.Completions { entries.push(entry); } } - } + }); return entries; } @@ -122,9 +122,9 @@ namespace ts.Completions { const entry = createCompletionEntry(symbol, location, performCharacterChecks); if (entry) { const id = escapeIdentifier(entry.name); - if (!uniqueNames[id]) { + if (!uniqueNames.get(id)) { entries.push(entry); - uniqueNames[id] = id; + uniqueNames.set(id, id); } } } @@ -373,14 +373,14 @@ namespace ts.Completions { const foundFileName = includeExtensions ? getBaseFileName(filePath) : removeFileExtension(getBaseFileName(filePath)); - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; + if (!foundFiles.get(foundFileName)) { + foundFiles.set(foundFileName, true); } } - for (const foundFile in foundFiles) { + forEachKeyInMap(foundFiles, foundFile => { result.push(createCompletionEntryForModule(foundFile, ScriptElementKind.scriptElement, span)); - } + }); } // If possible, get folder completion as well @@ -1563,14 +1563,14 @@ namespace ts.Completions { } const name = element.propertyName || element.name; - existingImportsOrExports[name.text] = true; + existingImportsOrExports.set(name.text, true); } - if (!someProperties(existingImportsOrExports)) { + if (mapIsEmpty(existingImportsOrExports)) { return filter(exportsOfModule, e => e.name !== "default"); } - return filter(exportsOfModule, e => e.name !== "default" && !existingImportsOrExports[e.name]); + return filter(exportsOfModule, e => e.name !== "default" && !existingImportsOrExports.get(e.name)); } /** @@ -1616,10 +1616,10 @@ namespace ts.Completions { existingName = (m.name).text; } - existingMemberNames[existingName] = true; + existingMemberNames.set(existingName, true); } - return filter(contextualMemberSymbols, m => !existingMemberNames[m.name]); + return filter(contextualMemberSymbols, m => !existingMemberNames.get(m.name)); } /** @@ -1637,11 +1637,11 @@ namespace ts.Completions { } if (attr.kind === SyntaxKind.JsxAttribute) { - seenNames[(attr).name.text] = true; + seenNames.set((attr).name.text, true); } } - return filter(symbols, a => !seenNames[a.name]); + return filter(symbols, a => !seenNames.get(a.name)); } } diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 0f18427e568..212e145ca60 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -44,11 +44,11 @@ namespace ts.DocumentHighlights { for (const referencedSymbol of referencedSymbols) { for (const referenceEntry of referencedSymbol.references) { const fileName = referenceEntry.fileName; - let documentHighlights = fileNameToDocumentHighlights[fileName]; + let documentHighlights = fileNameToDocumentHighlights.get(fileName); if (!documentHighlights) { documentHighlights = { fileName, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName] = documentHighlights; + fileNameToDocumentHighlights.set(fileName, documentHighlights); result.push(documentHighlights); } diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index d73e4d3b0a1..4291abf6c1f 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -113,16 +113,16 @@ namespace ts { } function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): FileMap { - let bucket = buckets[key]; + let bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets[key] = bucket = createFileMap(); + buckets.set(key, bucket = createFileMap()); } return bucket; } function reportStats() { - const bucketInfoArray = Object.keys(buckets).filter(name => name && name.charAt(0) === "_").map(name => { - const entries = buckets[name]; + const bucketInfoArray = keysOfMap(buckets).filter(name => name && name.charAt(0) === "_").map(name => { + const entries = buckets.get(name); const sourceFiles: { name: string; refCount: number; references: string[]; }[] = []; entries.forEachValue((key, entry) => { sourceFiles.push({ diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 313a3d2ea3e..9e53537b69b 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -96,7 +96,7 @@ namespace ts.FindAllReferences { const nameTable = getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { + if (nameTable.get(internedName) !== undefined) { result = result || []; getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); } @@ -501,14 +501,14 @@ namespace ts.FindAllReferences { function findOwnConstructorCalls(classSymbol: Symbol): Node[] { const result: Node[] = []; - for (const decl of classSymbol.members["__constructor"].declarations) { + for (const decl of classSymbol.members.get("__constructor").declarations) { Debug.assert(decl.kind === SyntaxKind.Constructor); const ctrKeyword = decl.getChildAt(0); Debug.assert(ctrKeyword.kind === SyntaxKind.ConstructorKeyword); result.push(ctrKeyword); } - forEachProperty(classSymbol.exports, member => { + forEachInMap(classSymbol.exports, member => { const decl = member.valueDeclaration; if (decl && decl.kind === SyntaxKind.MethodDeclaration) { const body = (decl).body; @@ -528,7 +528,7 @@ namespace ts.FindAllReferences { /** Find references to `super` in the constructor of an extending class. */ function superConstructorAccesses(cls: ClassLikeDeclaration): Node[] { const symbol = cls.symbol; - const ctr = symbol.members["__constructor"]; + const ctr = symbol.members.get("__constructor"); if (!ctr) { return []; } @@ -715,12 +715,13 @@ namespace ts.FindAllReferences { } const key = getSymbolId(symbol) + "," + getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; + const cached = cachedResults.get(key); + if (cached !== undefined) { + return cached; } // Set the key so that we don't infinitely recurse - cachedResults[key] = false; + cachedResults.set(key, false); const inherits = forEach(symbol.getDeclarations(), declaration => { if (isClassLike(declaration)) { @@ -744,7 +745,7 @@ namespace ts.FindAllReferences { return false; }); - cachedResults[key] = inherits; + cachedResults.set(key, inherits); return inherits; } @@ -1078,7 +1079,7 @@ namespace ts.FindAllReferences { // the function will add any found symbol of the property-name, then its sub-routine will call // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { + if (previousIterationSymbolsCache.has(symbol.name)) { return; } @@ -1105,7 +1106,7 @@ namespace ts.FindAllReferences { } // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; + previousIterationSymbolsCache.set(symbol.name, symbol); getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); } } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..215289159c2 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -4,7 +4,7 @@ namespace ts.formatting { export class Rules { public getRuleName(rule: Rule) { - const o: ts.Map = this; + const o: ts.MapLike = this; for (const name in o) { if (o[name] === rule) { return name; diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 4c005640d6a..d6ade7aed6b 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -14,7 +14,7 @@ namespace ts.GoToDefinition { // Type reference directives const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - const referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; + const referenceFile = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName); if (referenceFile && referenceFile.resolvedFileName) { return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 04ac60c4e74..e587a14b459 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -17,11 +17,11 @@ namespace ts.JsTyping { interface PackageJson { _requiredBy?: string[]; - dependencies?: Map; - devDependencies?: Map; + dependencies?: MapLike; + devDependencies?: MapLike; name?: string; - optionalDependencies?: Map; - peerDependencies?: Map; + optionalDependencies?: MapLike; + peerDependencies?: MapLike; typings?: string; }; @@ -107,34 +107,34 @@ namespace ts.JsTyping { // add typings for unresolved imports if (unresolvedImports) { for (const moduleId of unresolvedImports) { - const typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; + const typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } } // Add the cached typing locations for inferred typings that are already installed - for (const name in packageNameToTypingLocation) { - if (name in inferredTypings && !inferredTypings[name]) { - inferredTypings[name] = packageNameToTypingLocation[name]; + packageNameToTypingLocation.forEach((typingLocation, name) => { + if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { + inferredTypings.set(name, typingLocation); } - } + }); // Remove typings that the user has added to the exclude list for (const excludeTypingName of exclude) { - delete inferredTypings[excludeTypingName]; + inferredTypings.delete(excludeTypingName); } const newTypingNames: string[] = []; const cachedTypingPaths: string[] = []; - for (const typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); + inferredTypings.forEach((inferred, typing) => { + if (inferred !== undefined) { + cachedTypingPaths.push(inferred); } else { newTypingNames.push(typing); } - } + }); return { cachedTypingPaths, newTypingNames, filesToWatch }; /** @@ -146,8 +146,8 @@ namespace ts.JsTyping { } for (const typing of typingNames) { - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; + if (!inferredTypings.has(typing)) { + inferredTypings.set(typing, undefined); } } } @@ -189,7 +189,7 @@ namespace ts.JsTyping { const cleanedTypingNames = map(inferredTypingNames, f => f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, "")); if (safeList !== EmptySafeList) { - mergeTypings(filter(cleanedTypingNames, f => f in safeList)); + mergeTypings(filter(cleanedTypingNames, f => safeList.has(f))); } const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX); @@ -236,7 +236,7 @@ namespace ts.JsTyping { } if (packageJson.typings) { const absolutePath = getNormalizedAbsolutePath(packageJson.typings, getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; + inferredTypings.set(packageJson.name, absolutePath); } else { typingNames.push(packageJson.name); diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 82f4dd49f2b..40f22941268 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -7,23 +7,21 @@ namespace ts.NavigateTo { let rawItems: RawNavigateToItem[] = []; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - forEach(sourceFiles, sourceFile => { + for (const sourceFile of sourceFiles) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && fileExtensionIs(sourceFile.fileName, ".d.ts")) { - return; + continue; } - const nameToDeclarations = sourceFile.getNamedDeclarations(); - for (const name in nameToDeclarations) { - const declarations = nameToDeclarations[name]; + forEachInMap(sourceFile.getNamedDeclarations(), (declarations, name) => { if (declarations) { // 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. let matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { - continue; + return; // continue to next named declarations } for (const declaration of declarations) { @@ -32,13 +30,13 @@ namespace ts.NavigateTo { if (patternMatcher.patternContainsDots) { const containers = getContainers(declaration); if (!containers) { - return undefined; + return true; // Break out of named declarations and go to the next source file. } matches = patternMatcher.getMatches(containers, name); if (!matches) { - continue; + return; // continue to next named declarations } } @@ -47,8 +45,8 @@ namespace ts.NavigateTo { rawItems.push({ name, fileName, matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration }); } } - } - }); + }); + } // Remove imports when the imported declaration is already in the list and has the same name. rawItems = filter(rawItems, item => { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 1cbaa3d640f..7d95787939d 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -248,9 +248,9 @@ namespace ts.NavigationBar { return true; } - const itemsWithSameName = nameToItems[name]; + const itemsWithSameName = nameToItems.get(name); if (!itemsWithSameName) { - nameToItems[name] = child; + nameToItems.set(name, child); return true; } @@ -268,7 +268,7 @@ namespace ts.NavigationBar { if (tryMerge(itemWithSameName, child)) { return false; } - nameToItems[name] = [itemWithSameName, child]; + nameToItems.set(name, [itemWithSameName, child]); return true; } @@ -626,15 +626,15 @@ namespace ts.NavigationBar { /** * Matches all whitespace characters in a string. Eg: - * + * * "app. - * + * * onactivated" - * + * * matches because of the newline, whereas - * + * * "app.onactivated" - * + * * does not match. */ const whiteSpaceRegex = /\s+/g; diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index b4f67ca056d..b8941ef3147 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -188,11 +188,7 @@ namespace ts { } function getWordSpans(word: string): TextSpan[] { - if (!(word in stringToWordSpans)) { - stringToWordSpans[word] = breakIntoWordSpans(word); - } - - return stringToWordSpans[word]; + return stringToWordSpans.get(word) || set(stringToWordSpans, word, breakIntoWordSpans(word)); } function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { diff --git a/src/services/services.ts b/src/services/services.ts index d28dd871105..77a5e916067 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -532,7 +532,7 @@ namespace ts { } function getDeclarations(name: string) { - return result[name] || (result[name] = []); + return result.get(name) || set(result, name, []); } function getDeclarationName(declaration: Declaration) { @@ -1956,9 +1956,11 @@ namespace ts { function walk(node: Node) { switch (node.kind) { - case SyntaxKind.Identifier: - nameTable[(node).text] = nameTable[(node).text] === undefined ? node.pos : -1; + case SyntaxKind.Identifier: { + const text = (node).text; + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); break; + } case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: // We want to store any numbers/strings if they were a name that could be @@ -1970,7 +1972,8 @@ namespace ts { isArgumentOfElementAccessExpression(node) || isLiteralComputedPropertyDeclarationName(node)) { - nameTable[(node).text] = nameTable[(node).text] === undefined ? node.pos : -1; + const text = (node).text; + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); } break; default: diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 44c2ede9fbb..aa799eb32c7 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -237,7 +237,7 @@ namespace ts.SignatureHelp { const typeChecker = program.getTypeChecker(); for (const sourceFile of program.getSourceFiles()) { const nameToDeclarations = sourceFile.getNamedDeclarations(); - const declarations = nameToDeclarations[name.text]; + const declarations = nameToDeclarations.get(name.text); if (declarations) { for (const declaration of declarations) { diff --git a/src/services/transpile.ts b/src/services/transpile.ts index da54faed1a2..d989a528497 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -126,7 +126,7 @@ namespace ts { function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || filter(optionDeclarations, o => - typeof o.type === "object" && !forEachProperty(o.type, v => typeof v !== "number")); + typeof o.type === "object" && !forEachInMap(o.type, v => typeof v !== "number")); options = clone(options); @@ -142,7 +142,7 @@ namespace ts { options[opt.name] = parseCustomTypeOption(opt, value, diagnostics); } else { - if (!forEachProperty(opt.type, v => v === value)) { + if (!someInMap(opt.type, v => v === value)) { // Supplied value isn't a valid enum value. diagnostics.push(createCompilerDiagnosticForInvalidCustomType(opt)); } diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.types b/tests/baselines/reference/computedPropertyNames10_ES5.types index 650890fb10e..96130979298 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } +>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types index 2ff86ed9712..5bbda2e8f19 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES6.types +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } ->{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [0](): void; [""](): void; } +>v : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; } +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : { [x: string]: () => void; [x: number]: () => void; [""](): void; [0](): void; } [s]() { }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.types b/tests/baselines/reference/computedPropertyNames11_ES5.types index 0787a889f40..88fbc690323 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } +>v : { [x: string]: any; [x: number]: any; [""]: any; readonly [0]: number; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; [""]: any; readonly [0]: number; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types index 4783d07a2af..458d6d1de49 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES6.types +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } ->{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; readonly [0]: number; [""]: any; } +>v : { [x: string]: any; [x: number]: any; [""]: any; readonly [0]: number; } +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : { [x: string]: any; [x: number]: any; [""]: any; readonly [0]: number; } get [s]() { return 0; }, >s : string diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.types b/tests/baselines/reference/computedPropertyNames4_ES5.types index 64ef5f6a611..6f875aaddac 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } +>v : { [x: string]: string | number; [x: number]: string | number; [""]: number; [0]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [""]: number; [0]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types index 0c608e21601..e9feac0a81f 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES6.types +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -9,8 +9,8 @@ var a: any; >a : any var v = { ->v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } ->{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; } +>v : { [x: string]: string | number; [x: number]: string | number; [""]: number; [0]: number; } +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [""]: number; [0]: number; } [s]: 0, >s : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index 91ad88c8ade..f144bb9d020 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; 0: () => void; p: ""; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; p: ""; 0: () => void; } p: "", >p : string diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types index 131e49dd173..6b8c8ae2e34 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -19,7 +19,7 @@ declare function foo(obj: I): T foo({ >foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] >foo : (obj: I) => T ->{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; 0: () => void; p: ""; } +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: true | "" | (() => void) | 0 | number[]; [x: number]: (() => void) | 0 | number[]; p: ""; 0: () => void; } p: "", >p : string diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types index 94a5f2173aa..32e5b33e411 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types @@ -1,8 +1,8 @@ === tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts === var object = { ->object : { 0: number; _0: number; } ->{ _0: 2, get 0() { return this._0; }, set 0(x: number) { this._0 = x; },} : { 0: number; _0: number; } +>object : { _0: number; 0: number; } +>{ _0: 2, get 0() { return this._0; }, set 0(x: number) { this._0 = x; },} : { _0: number; 0: number; } _0: 2, >_0 : number @@ -30,31 +30,31 @@ var object = { object[0] **= object[0]; >object[0] **= object[0] : number >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 object[0] **= object[0] **= 2; >object[0] **= object[0] **= 2 : number >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 >object[0] **= 2 : number >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 >2 : 2 object[0] **= object[0] ** 2; >object[0] **= object[0] ** 2 : number >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 >object[0] ** 2 : number >object[0] : number ->object : { 0: number; _0: number; } +>object : { _0: number; 0: number; } >0 : 0 >2 : 2 diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt index ec0f330f1a3..f532bd23755 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(50,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(68,5): error TS2412: Property '2.0' of type 'number' is not assignable to numeric index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(79,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(79,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(88,9): error TS2304: Cannot find name 'Myn'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -107,7 +107,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo var b: { [x: number]: string; } = { a: '', ~~~~~ -!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. +!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: any; X: string; foo(): string; }' is not assignable to type '{ [x: number]: string; }'. !!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ [x: number]: string; }'. b: 1, c: () => { }, diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt index e6d22ff0712..74cd032c40e 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(16,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(25,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(34,5): error TS2412: Property '3.0' of type 'number' is not assignable to numeric index type 'A'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(44,5): error TS2322: Type '{ 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerConstrainsPropertyDeclarations2.ts(44,5): error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'. @@ -57,6 +57,6 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/numericIndexerCo 3.0: 1, "4.0": '' ~~~~~~~~~ -!!! error TS2322: Type '{ 1.0: A; 2.0: B; 3.0: number; "2.5": B; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. +!!! error TS2322: Type '{ 1.0: A; 2.0: B; "2.5": B; 3.0: number; "4.0": string; }' is not assignable to type '{ [x: number]: A; }'. !!! error TS2322: Object literal may only specify known properties, and '"4.0"' does not exist in type '{ [x: number]: A; }'. } \ No newline at end of file diff --git a/tests/baselines/reference/numericIndexerConstraint5.errors.txt b/tests/baselines/reference/numericIndexerConstraint5.errors.txt index cb888de08c4..04b7e0dc337 100644 --- a/tests/baselines/reference/numericIndexerConstraint5.errors.txt +++ b/tests/baselines/reference/numericIndexerConstraint5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'. +tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ name: string; 0: Date; }' is not assignable to type '{ [name: number]: string; }'. Property '0' is incompatible with index signature. Type 'Date' is not assignable to type 'string'. @@ -7,6 +7,6 @@ tests/cases/compiler/numericIndexerConstraint5.ts(2,5): error TS2322: Type '{ 0: var x = { name: "x", 0: new Date() }; var z: { [name: number]: string } = x; ~ -!!! error TS2322: Type '{ 0: Date; name: string; }' is not assignable to type '{ [name: number]: string; }'. +!!! error TS2322: Type '{ name: string; 0: Date; }' is not assignable to type '{ [name: number]: string; }'. !!! error TS2322: Property '0' is incompatible with index signature. !!! error TS2322: Type 'Date' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt index 9d5ff7ea0a2..53abb5b7658 100644 --- a/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralIndexerErrors.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(13,5): error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. Property '0' is incompatible with index signature. Type 'A' is not assignable to type 'B'. Property 'y' is missing in type 'A'. -tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. Property '0' is incompatible with index signature. Type 'A' is not assignable to type 'B'. @@ -22,12 +22,12 @@ tests/cases/compiler/objectLiteralIndexerErrors.ts(14,1): error TS2322: Type '{ var o1: { [s: string]: A;[n: number]: B; } = { x: b, 0: a }; // both indexers are A ~~ -!!! error TS2322: Type '{ 0: A; x: B; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Type '{ x: B; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. !!! error TS2322: Property '0' is incompatible with index signature. !!! error TS2322: Type 'A' is not assignable to type 'B'. !!! error TS2322: Property 'y' is missing in type 'A'. o1 = { x: c, 0: a }; // string indexer is any, number indexer is A ~~ -!!! error TS2322: Type '{ 0: A; x: any; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. +!!! error TS2322: Type '{ x: any; 0: A; }' is not assignable to type '{ [s: string]: A; [n: number]: B; }'. !!! error TS2322: Property '0' is incompatible with index signature. !!! error TS2322: Type 'A' is not assignable to type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralIndexers.types b/tests/baselines/reference/objectLiteralIndexers.types index 9e3aa4bac49..ef242fd1fe3 100644 --- a/tests/baselines/reference/objectLiteralIndexers.types +++ b/tests/baselines/reference/objectLiteralIndexers.types @@ -31,23 +31,23 @@ var o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer i >A : A >n : number >B : B ->{ x: a, 0: b } : { 0: B; x: A; } +>{ x: a, 0: b } : { x: A; 0: B; } >x : A >a : A >b : B o1 = { x: b, 0: c }; // both indexers are any ->o1 = { x: b, 0: c } : { 0: any; x: B; } +>o1 = { x: b, 0: c } : { x: B; 0: any; } >o1 : { [s: string]: A; [n: number]: B; } ->{ x: b, 0: c } : { 0: any; x: B; } +>{ x: b, 0: c } : { x: B; 0: any; } >x : B >b : B >c : any o1 = { x: c, 0: b }; // string indexer is any, number indexer is B ->o1 = { x: c, 0: b } : { 0: B; x: any; } +>o1 = { x: c, 0: b } : { x: any; 0: B; } >o1 : { [s: string]: A; [n: number]: B; } ->{ x: c, 0: b } : { 0: B; x: any; } +>{ x: c, 0: b } : { x: any; 0: B; } >x : any >c : any >b : B diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types index e050d33024c..1f34c4fafac 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.types @@ -267,7 +267,7 @@ var r13 = i[-01] >01 : 1 var a: { ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } "0.1": void; ".1": Object; @@ -289,19 +289,19 @@ var a: { var r1 = a['0.1']; >r1 : void >a['0.1'] : void ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'0.1' : "0.1" var r2 = a['.1']; >r2 : Object >a['.1'] : Object ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'.1' : ".1" var r3 = a['1']; >r3 : number >a['1'] : number ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'1' : "1" var r3 = c[1]; @@ -313,7 +313,7 @@ var r3 = c[1]; var r4 = a['1.']; >r4 : string >a['1.'] : string ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'1.' : "1." var r3 = c[1.]; // same as indexing by 1 when done numerically @@ -325,13 +325,13 @@ var r3 = c[1.]; // same as indexing by 1 when done numerically var r5 = a['1..']; >r5 : boolean >a['1..'] : boolean ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'1..' : "1.." var r6 = a['1.0']; >r6 : Date >a['1.0'] : Date ->a : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } +>a : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": Date; } >'1.0' : "1.0" var r3 = c[1.0]; // same as indexing by 1 when done numerically @@ -394,8 +394,8 @@ var r13 = i[-01] >01 : 1 var b = { ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } ->{ "0.1": null, ".1": new Object(), "1": 1, "1.": "", "1..": true, "1.0": new Date(), "-1.0": /123/, "-1": Date} : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>{ "0.1": null, ".1": new Object(), "1": 1, "1.": "", "1..": true, "1.0": new Date(), "-1.0": /123/, "-1": Date} : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } "0.1": null, >null : void @@ -429,19 +429,19 @@ var b = { var r1 = b['0.1']; >r1 : void >b['0.1'] : void ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'0.1' : "0.1" var r2 = b['.1']; >r2 : Object >b['.1'] : Object ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'.1' : ".1" var r3 = b['1']; >r3 : number >b['1'] : number ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'1' : "1" var r3 = c[1]; @@ -453,7 +453,7 @@ var r3 = c[1]; var r4 = b['1.']; >r4 : string >b['1.'] : string ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'1.' : "1." var r3 = c[1.]; // same as indexing by 1 when done numerically @@ -465,13 +465,13 @@ var r3 = c[1.]; // same as indexing by 1 when done numerically var r5 = b['1..']; >r5 : boolean >b['1..'] : boolean ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'1..' : "1.." var r6 = b['1.0']; >r6 : Date >b['1.0'] : Date ->b : { "1": number; "0.1": void; ".1": Object; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } +>b : { "0.1": void; ".1": Object; "1": number; "1.": string; "1..": boolean; "1.0": Date; "-1.0": RegExp; "-1": DateConstructor; } >'1.0' : "1.0" var r3 = c[1.0]; // same as indexing by 1 when done numerically diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt index 8f4bbe2025a..606cc39afef 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations.errors.txt @@ -22,8 +22,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(71,5): error TS2411: Property 'foo' of type '() => string' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(73,5): error TS2411: Property '"4.0"' of type 'number' is not assignable to string index type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(74,5): error TS2411: Property 'f' of type 'MyString' is not assignable to string index type 'string'. -tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. - Property '2.0' is incompatible with index signature. +tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(78,5): error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. + Property 'b' is incompatible with index signature. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(90,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerConstrainsPropertyDeclarations.ts(93,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -157,8 +157,8 @@ tests/cases/conformance/types/objectTypeLiteral/indexSignatures/stringIndexerCon // error var b: { [x: string]: string; } = { ~ -!!! error TS2322: Type '{ 1.0: string; 2.0: number; a: string; b: number; c: () => void; "d": string; "e": number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. -!!! error TS2322: Property '2.0' is incompatible with index signature. +!!! error TS2322: Type '{ a: string; b: number; c: () => void; "d": string; "e": number; 1.0: string; 2.0: number; "3.0": string; "4.0": number; f: MyString; X: string; foo(): string; }' is not assignable to type '{ [x: string]: string; }'. +!!! error TS2322: Property 'b' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. a: '', b: 1, diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 745a746db11..f97e122aabb 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -43,6 +43,16 @@ // TODO: figure out a better solution to the API exposure problem. declare module ts { + export type MapKey = string | number; + export interface Map { + forEach(action: (value: T, key: string) => void): void; + get(key: MapKey): T; + has(key: MapKey): boolean; + set(key: MapKey, value: T): this; + delete(key: MapKey): boolean; + clear(): void; + } + interface SymbolDisplayPart { text: string; kind: string; @@ -103,7 +113,7 @@ declare namespace FourSlashInterface { markerNames(): string[]; marker(name?: string): Marker; ranges(): Range[]; - rangesByText(): { [text: string]: Range[] }; + rangesByText(): ts.Map; markerByName(s: string): Marker; } class goTo { diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index b05346a366a..fa9e59cabcf 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -202,15 +202,14 @@ goTo.marker("4"); verify.referencesAre([]); const rangesByText = test.rangesByText(); -for (const text in rangesByText) { - const ranges = rangesByText[text]; +rangesByText.forEach((ranges, text) => { if (text === "globalVar") { verify.rangesReferenceEachOther(ranges.filter(isShadow)); verify.rangesReferenceEachOther(ranges.filter(r => !isShadow(r))); } else { verify.rangesReferenceEachOther(ranges); } -} +}); function isShadow(r) { return r.marker && r.marker.data && r.marker.data.shadow; diff --git a/tslint.json b/tslint.json index 26657981a63..13de7acec63 100644 --- a/tslint.json +++ b/tslint.json @@ -46,6 +46,7 @@ "prefer-const": true, "no-increment-decrement": true, "object-literal-surrounding-space": true, - "no-type-assertion-whitespace": true + "no-type-assertion-whitespace": true, + "no-in-operator": true } } From b15ffda7f699097c7abf49252558dcafb3da3a50 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Dec 2016 06:55:49 -0800 Subject: [PATCH 114/289] Simplify forEachKeyInMap and someKeyInMap --- src/compiler/checker.ts | 2 +- src/compiler/core.ts | 46 +++++++++-------------------------------- 2 files changed, 11 insertions(+), 37 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 00a6ad2c366..67c4db715e2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18991,7 +18991,7 @@ namespace ts { } function hasExportedMembers(moduleSymbol: Symbol) { - return someKeyInMap(moduleSymbol.exports, id => id !== "export="); + return someInMap(moduleSymbol.exports, (_, id) => id !== "export="); } function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index affd225b3a7..3fe3b386701 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -68,7 +68,6 @@ namespace ts { interface ES6Map extends Map { readonly size: number; entries(): Iterator<[string, T]>; - keys(): Iterator; } /** ES6 Iterator type. */ @@ -80,9 +79,7 @@ namespace ts { interface ShimMap extends Map { isEmpty(): boolean; forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined; - forEachKey(callback: (key: string) => U | undefined): U | undefined; some(predicate: (value: T, key: string) => boolean): boolean; - someKey(predicate: (key: string) => boolean): boolean; } // The global Map object. This may not be available, so we must test for it. @@ -130,16 +127,12 @@ namespace ts { } isEmpty(): boolean { - return !this.someKey(() => true); + return !this.some(() => true); } forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined { - return this.forEachKey(key => callback(this.data[key], key)); - } - - forEachKey(callback: (key: string) => U | undefined): U | undefined { for (const key in this.data) { - const result = callback(key); + const result = callback(this.data[key], key); if (result !== undefined) { return result; } @@ -147,12 +140,8 @@ namespace ts { } some(predicate: (value: T, key: string) => boolean): boolean { - return this.someKey(key => predicate(this.data[key], key)); - } - - someKey(predicate: (key: string) => boolean): boolean { for (const key in this.data) { - if (predicate(key)) { + if (predicate(this.data[key], key)) { return true; } } @@ -939,17 +928,9 @@ namespace ts { : (map: ShimMap, callback: (value: T, key: string) => U | undefined) => map.forEachInMap(callback); /** `forEachInMap` for just keys. */ - export const forEachKeyInMap: (map: Map<{}>, callback: (key: string) => T | undefined) => T | undefined = usingNativeMaps - ? (map: ES6Map, callback: (key: string) => T | undefined) => { - const iterator = map.keys(); - while (true) { - const { value: key, done } = iterator.next(); - if (done) return undefined; - const result = callback(key); - if (result !== undefined) return result; - } - } - : (map: ShimMap, callback: (key: string) => T | undefined) => map.forEachKey(callback); + export function forEachKeyInMap(map: Map<{}>, callback: (key: string) => T | undefined): T | undefined { + return forEachInMap(map, (_, key) => callback(key)); + } /** Whether `predicate` is true for some entry in the map. */ export const someInMap: (map: Map, predicate: (value: T, key: string) => boolean) => boolean = usingNativeMaps @@ -964,17 +945,10 @@ namespace ts { } : (map: ShimMap, predicate: (value: T, key: string) => boolean) => map.some(predicate); - /** Whether `predicate` is true for some key in the map. */ - export const someKeyInMap: (map: Map<{}>, predicate: (key: string) => boolean) => boolean = usingNativeMaps - ? (map: ES6Map<{}>, predicate: (key: string) => boolean) => { - const iterator = map.keys(); - while (true) { - const { value: key, done } = iterator.next(); - if (done) return false; - if (predicate(key)) return true; - } - } - : (map: ShimMap<{}>, predicate: (key: string) => boolean) => map.someKey(predicate); + /** `someInMap` for just keys. */ + export function someKeyInMap(map: Map<{}>, predicate: (key: string) => boolean): boolean { + return someInMap(map, (_, key) => predicate(key)); + } /** Copy entries from `source` to `target`. */ export function copyMapEntries(source: Map, target: Map): void { From 863e4d6fa06b7d705592167285f17dd12981d8e8 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Dec 2016 08:00:10 -0800 Subject: [PATCH 115/289] Clean up helpers --- src/compiler/core.ts | 23 +++++++------------ src/compiler/types.ts | 1 + .../unittests/reuseProgramStructure.ts | 14 +++++++++++ .../unittests/tsserverProjectSystem.ts | 10 ++------ 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3fe3b386701..3c370f7b154 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -66,7 +66,6 @@ namespace ts { /** Methods on native maps but not on shim maps. Only used in this file. */ interface ES6Map extends Map { - readonly size: number; entries(): Iterator<[string, T]>; } @@ -130,6 +129,14 @@ namespace ts { return !this.some(() => true); } + get size(): number { + let size = 0; + for (const _ in this.data) { + size++; + } + return size; + } + forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined { for (const key in this.data) { const result = callback(this.data[key], key); @@ -988,20 +995,6 @@ namespace ts { return true; } - /** True if the maps have the same keys and values. */ - export function mapsAreEqual(left: Map, right: Map, valuesAreEqual?: (left: T, right: T) => boolean): boolean { - if (left === right) return true; - if (!left || !right) return false; - const someInLeftHasNoMatch = someInMap(left, (leftValue, leftKey) => { - if (!right.has(leftKey)) return true; - const rightValue = right.get(leftKey); - return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue); - }); - if (someInLeftHasNoMatch) return false; - const someInRightHasNoMatch = someKeyInMap(right, rightKey => !left.has(rightKey)); - return !someInRightHasNoMatch; - } - /** * Creates a map from the elements of an array. * diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 055049999ec..75e1e82e7f6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -20,6 +20,7 @@ namespace ts { clear(): void; /** `key` may *not* be a string if it was set with a number and we are not using the shim. */ forEach(action: (value: T, key: string) => void): void; + readonly size: number; } // branded string type used to store absolute, normalized and canonicalized paths diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index 54c05a9c383..eb4395154e4 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -193,6 +193,20 @@ namespace ts { } } + /** True if the maps have the same keys and values. */ + function mapsAreEqual(left: Map, right: Map, valuesAreEqual?: (left: T, right: T) => boolean): boolean { + if (left === right) return true; + if (!left || !right) return false; + const someInLeftHasNoMatch = someInMap(left, (leftValue, leftKey) => { + if (!right.has(leftKey)) return true; + const rightValue = right.get(leftKey); + return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue); + }); + if (someInLeftHasNoMatch) return false; + const someInRightHasNoMatch = someKeyInMap(right, rightKey => !left.has(rightKey)); + return !someInRightHasNoMatch; + } + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule); } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index bec3a700879..9beefe480df 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -243,18 +243,12 @@ namespace ts.projectSystem { } export function checkMapKeys(caption: string, map: Map, expectedKeys: string[]) { - assert.equal(mapSize(map), expectedKeys.length, `${caption}: incorrect size of map`); + assert.equal(map.size, expectedKeys.length, `${caption}: incorrect size of map`); for (const name of expectedKeys) { assert.isTrue(map.has(name), `${caption} is expected to contain ${name}, actual keys: ${keysOfMap(map)}`); } } - function mapSize(map: Map): number { - let size = 0; - map.forEach(() => { size++; }); - return size; - } - export function checkFileNames(caption: string, actualFileNames: string[], expectedFileNames: string[]) { assert.equal(actualFileNames.length, expectedFileNames.length, `${caption}: incorrect actual number of files, expected ${JSON.stringify(expectedFileNames)}, got ${actualFileNames}`); for (const f of expectedFileNames) { @@ -313,7 +307,7 @@ namespace ts.projectSystem { } count() { - return mapSize(this.map); + return this.map.size; } invoke() { From 8121de74d47b6ea70a5b64375967a15727f95c90 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Dec 2016 08:33:58 -0800 Subject: [PATCH 116/289] Fix target error for gulp --- Gulpfile.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/Gulpfile.ts b/Gulpfile.ts index 054e99c8003..7072becc2da 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -330,6 +330,7 @@ const builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "dia // processDiagnosticMessages script gulp.task(processDiagnosticMessagesJs, false, [], () => { const settings: tsc.Settings = getCompilerSettings({ + target: "es5", declaration: false, removeComments: true, noResolve: false, From 8dbb8e7bf6ac861515670a86c23da6ae9275eda2 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 8 Dec 2016 08:34:56 -0800 Subject: [PATCH 117/289] Add comment --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 75e1e82e7f6..ca2295e5ba2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -11,7 +11,7 @@ namespace ts { /** It's allowed to get/set into a map with numbers. However, when iterating, you may get strings back due to the shim being an ordinary object (which only allows string keys). */ export type MapKey = string | number; - /** Minimal ES6 Map interface. */ + /** Minimal ES6 Map interface. Does not include iterators as those are hard to shim performantly. */ export interface Map { get(key: MapKey): T; has(key: MapKey): boolean; From 25c7caaef96f1519fc475588af9c2b7214d5dac7 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 7 Dec 2016 13:46:04 -0800 Subject: [PATCH 118/289] Simplify es2015 visitor, replace function tracking with flags --- src/compiler/factory.ts | 13 + src/compiler/transformers/es2015.ts | 947 +++++++++++------- src/compiler/utilities.ts | 12 + tests/baselines/reference/superAccess2.js | 6 +- .../reference/superInConstructorParam1.js | 2 +- .../reference/superInObjectLiterals_ES5.js | 12 +- ...perPropertyInConstructorBeforeSuperCall.js | 2 +- ...side-object-literal-getters-and-setters.js | 6 +- 8 files changed, 598 insertions(+), 402 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index ebcea221f9e..3bd88d78447 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1754,6 +1754,19 @@ namespace ts { // Utilities + export function restoreEnclosingLabels(node: Statement, enclosingLabeledStatements: LabeledStatement[]) { + if (enclosingLabeledStatements) { + for (const labeledStatement of enclosingLabeledStatements) { + node = updateLabel( + labeledStatement, + labeledStatement.label, + node + ); + } + } + return node; + } + export interface CallBinding { target: LeftHandSideExpression; thisArg: Expression; diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index c1398f75da6..094261f7002 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -162,6 +162,67 @@ namespace ts { ReplaceWithReturn, } + type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]) => Statement; + + // Facts we track as we descend the tree + const enum AncestorFacts { + None = 0, + Function = 1 << 0, // Enclosed in a non-arrow function + ArrowFunction = 1 << 1, // Enclosed in an arrow function + AsyncFunctionBody = 1 << 2, // Enclosed in an async function body + NonStaticClassElement = 1 << 3, // Enclosed in a non-static, non-async class element + CapturesThis = 1 << 4, // Enclosed in a function that captures the lexical 'this' (used in substitution) + ExportedVariableStatement = 1 << 5, // Enclosed in an exported variable statement in the current scope + TopLevel = 1 << 6, // Enclosing block-scoped container is a top-level container + Block = 1 << 7, // Enclosing block-scoped container is a Block + IterationStatement = 1 << 8, // Enclosed in an IterationStatement + IterationStatementBlock = 1 << 9, // Enclosing Block is enclosed in an IterationStatement + ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement + ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement + ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + BlockScopeIncludes = None, + BlockScopeExcludes = TopLevel | Block | IterationStatement | IterationStatementBlock | ForStatement | ForInOrForOfStatement, + + // A source file is a top-level block scope. + SourceFileIncludes = TopLevel, + SourceFileExcludes = BlockScopeExcludes & ~TopLevel, + + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + FunctionIncludes = Function | TopLevel, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + + // Arrow functions are lexically scoped to their container, but are new block scopes. + ArrowFunctionIncludes = ArrowFunction | TopLevel, + ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper, + + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + ConstructorIncludes = FunctionIncludes | NonStaticClassElement, + ConstructorExcludes = FunctionExcludes & ~NonStaticClassElement, + + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + DoOrWhileStatementIncludes = IterationStatement, + DoOrWhileStatementExcludes = None, + + // 'for' statements are new block scopes and have special handling for 'let' declarations. + ForStatementIncludes = IterationStatement | ForStatement, + ForStatementExcludes = BlockScopeExcludes & ~ForStatement, + + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + ForInOrForOfStatementIncludes = IterationStatement | ForInOrForOfStatement, + ForInOrForOfStatementExcludes = BlockScopeExcludes & ~ForInOrForOfStatement, + + // Blocks (other than function bodies) are new block scopes. + BlockIncludes = Block, + BlockExcludes = BlockScopeExcludes & ~Block, + } + export function transformES2015(context: TransformationContext) { const { startLexicalEnvironment, @@ -178,15 +239,7 @@ namespace ts { let currentSourceFile: SourceFile; let currentText: string; - let currentParent: Node; - let currentNode: Node; - let enclosingVariableStatement: VariableStatement; - let enclosingBlockScopeContainer: Node; - let enclosingBlockScopeContainerParent: Node; - let enclosingFunction: FunctionLikeDeclaration; - let enclosingNonArrowFunction: FunctionLikeDeclaration; - let enclosingNonAsyncFunctionBody: FunctionLikeDeclaration | ClassElement; - let isInConstructorWithCapturedSuper: boolean; + let ancestorFacts: AncestorFacts; /** * Used to track if we are emitting body of the converted loop @@ -210,166 +263,86 @@ namespace ts { currentSourceFile = node; currentText = node.text; - const visited = saveStateAndInvoke(node, visitSourceFile); + const visited = visitSourceFile(node); addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + ancestorFacts = AncestorFacts.None; return visited; } - function visitor(node: Node): VisitResult { - return saveStateAndInvoke(node, dispatcher); - } - - function dispatcher(node: Node): VisitResult { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - - function saveStateAndInvoke(node: T, f: (node: T) => U): U { - const savedEnclosingFunction = enclosingFunction; - const savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - const savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - const savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - const savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - const savedEnclosingVariableStatement = enclosingVariableStatement; - const savedCurrentParent = currentParent; - const savedCurrentNode = currentNode; - const savedConvertedLoopState = convertedLoopState; - const savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - - onBeforeVisitNode(node); - const visited = f(node); - - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - - function onBeforeVisitNode(node: Node) { - if (currentNode) { - if (isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - - if (isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== SyntaxKind.ArrowFunction) { - enclosingNonArrowFunction = currentNode; - if (!(getEmitFlags(currentNode) & EmitFlags.AsyncFunctionBody)) { - enclosingNonAsyncFunctionBody = currentNode; + function setAncestorFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node?: Node, container?: Node) { + if (node) { + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + if (container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static)) { + includeFacts |= AncestorFacts.NonStaticClassElement; } - } - } - - // keep track of the enclosing variable statement when in the context of - // variable statements, variable declarations, binding elements, and binding - // patterns. - switch (currentNode.kind) { - case SyntaxKind.VariableStatement: - enclosingVariableStatement = currentNode; break; - case SyntaxKind.VariableDeclarationList: - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: - case SyntaxKind.ObjectBindingPattern: - case SyntaxKind.ArrayBindingPattern: + case SyntaxKind.FunctionExpression: + const emitFlags = getEmitFlags(node); + if (emitFlags & EmitFlags.CapturesThis) { + includeFacts |= AncestorFacts.CapturesThis; + } + if (emitFlags & EmitFlags.AsyncFunctionBody) { + excludeFacts &= ~AncestorFacts.NonStaticClassElement; + includeFacts |= AncestorFacts.AsyncFunctionBody; + } + break; + case SyntaxKind.FunctionDeclaration: + if (getEmitFlags(node) & EmitFlags.CapturesThis) { + includeFacts |= AncestorFacts.CapturesThis; + } + break; + case SyntaxKind.Block: + if (ancestorFacts & AncestorFacts.IterationStatement) { + includeFacts = includeFacts & ~AncestorFacts.Block | AncestorFacts.IterationStatementBlock; + excludeFacts |= AncestorFacts.Block; + } break; - - default: - enclosingVariableStatement = undefined; } } - - currentParent = currentNode; - currentNode = node; - } - - function returnCapturedThis(node: Node): Node { - return setOriginalNode(createReturn(createIdentifier("_this")), node); + ancestorFacts = ancestorFacts & ~excludeFacts | includeFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node: Node): boolean { - return isInConstructorWithCapturedSuper && node.kind === SyntaxKind.ReturnStatement && !(node).expression; + return ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper + && node.kind === SyntaxKind.ReturnStatement + && !(node).expression; } - function shouldCheckNode(node: Node): boolean { - return (node.transformFlags & TransformFlags.ES2015) !== 0 || - node.kind === SyntaxKind.LabeledStatement || - (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node: Node): boolean { + return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 + || convertedLoopState !== undefined + || (ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper && isStatement(node)) + || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node: Node): VisitResult { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node: Node): VisitResult { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & TransformFlags.ContainsES2015 || (isInConstructorWithCapturedSuper && !isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node: Node): VisitResult { - let result: VisitResult; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node: Block): Block { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node: Node): VisitResult { - switch (node.kind) { - case SyntaxKind.ReturnStatement: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - - case SyntaxKind.VariableStatement: - return visitVariableStatement(node); - - case SyntaxKind.SwitchStatement: - return visitSwitchStatement(node); - - case SyntaxKind.BreakStatement: - case SyntaxKind.ContinueStatement: - return visitBreakOrContinueStatement(node); - - case SyntaxKind.ThisKeyword: - return visitThisKeyword(node); - - case SyntaxKind.Identifier: - return visitIdentifier(node); - - default: - return visitEachChild(node, visitor, context); + function callExpressionVisitor(node: Node): VisitResult { + if (node.kind === SyntaxKind.SuperKeyword) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node: Node): VisitResult { @@ -404,23 +377,34 @@ namespace ts { case SyntaxKind.VariableDeclarationList: return visitVariableDeclarationList(node); + case SyntaxKind.SwitchStatement: + return visitSwitchStatement(node); + + case SyntaxKind.CaseBlock: + return visitCaseBlock(node); + + case SyntaxKind.Block: + return visitBlock(node, /*isFunctionBody*/ false); + + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + return visitBreakOrContinueStatement(node); + case SyntaxKind.LabeledStatement: return visitLabeledStatement(node); case SyntaxKind.DoStatement: - return visitDoStatement(node); - case SyntaxKind.WhileStatement: - return visitWhileStatement(node); + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForStatement: - return visitForStatement(node); + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForInStatement: - return visitForInStatement(node); + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ForOfStatement: - return visitForOfStatement(node); + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); case SyntaxKind.ExpressionStatement: return visitExpressionStatement(node); @@ -434,6 +418,9 @@ namespace ts { case SyntaxKind.ShorthandPropertyAssignment: return visitShorthandPropertyAssignment(node); + case SyntaxKind.ComputedPropertyName: + return visitComputedPropertyName(node); + case SyntaxKind.ArrayLiteralExpression: return visitArrayLiteralExpression(node); @@ -468,31 +455,39 @@ namespace ts { return visitSpreadElement(node); case SyntaxKind.SuperKeyword: - return visitSuperKeyword(); + return visitSuperKeyword(/*isExpressionOfCall*/ false); - case SyntaxKind.YieldExpression: - // `yield` will be handled by a generators transform. - return visitEachChild(node, visitor, context); + case SyntaxKind.ThisKeyword: + return visitThisKeyword(node); case SyntaxKind.MethodDeclaration: return visitMethodDeclaration(node); + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return visitAccessorDeclaration(node); + case SyntaxKind.VariableStatement: return visitVariableStatement(node); + case SyntaxKind.ReturnStatement: + return visitReturnStatement(node); + default: - Debug.failBadSyntaxKind(node); return visitEachChild(node, visitor, context); } } function visitSourceFile(node: SourceFile): SourceFile { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.SourceFileExcludes, AncestorFacts.SourceFileIncludes); const statements: Statement[] = []; startLexicalEnvironment(); const statementOffset = addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset)); addRange(statements, endLexicalEnvironment()); + ancestorFacts = savedAncestorFacts; return updateSourceFileNode( node, createNodeArray(statements, node.statements) @@ -500,44 +495,64 @@ namespace ts { } function visitSwitchStatement(node: SwitchStatement): SwitchStatement { - Debug.assert(convertedLoopState !== undefined); + if (convertedLoopState !== undefined) { + const savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= Jump.Break; + const result = visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return visitEachChild(node, visitor, context); + } - const savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= Jump.Break; + function visitCaseBlock(node: CaseBlock): CaseBlock { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const updated = visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; + } - const result = visitEachChild(node, visitor, context); - - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + function returnCapturedThis(node: Node): ReturnStatement { + return setOriginalNode(createReturn(createIdentifier("_this")), node); } function visitReturnStatement(node: ReturnStatement): Statement { - Debug.assert(convertedLoopState !== undefined); - - convertedLoopState.nonLocalJumps |= Jump.Return; - return createReturn( - createObjectLiteral( - [ - createPropertyAssignment( - createIdentifier("value"), - node.expression - ? visitNode(node.expression, visitor, isExpression) - : createVoidZero() - ) - ] - ) - ); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= Jump.Return; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return createReturn( + createObjectLiteral( + [ + createPropertyAssignment( + createIdentifier("value"), + node.expression + ? visitNode(node.expression, visitor, isExpression) + : createVoidZero() + ) + ] + ) + ); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return visitEachChild(node, visitor, context); } function visitThisKeyword(node: Node): Node { - Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === SyntaxKind.ArrowFunction) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (ancestorFacts & AncestorFacts.ArrowFunction) { + // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = createUniqueName("this")); + return node; } function visitIdentifier(node: Identifier): Identifier { @@ -811,9 +826,14 @@ namespace ts { * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.ConstructorExcludes, AncestorFacts.ConstructorIncludes); + convertedLoopState = undefined; + const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); - const constructorFunction = createFunctionDeclaration( /*decorators*/ undefined, @@ -830,7 +850,11 @@ namespace ts { if (extendsClauseElement) { setEmitFlags(constructorFunction, EmitFlags.CapturesThis); } + statements.push(constructorFunction); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; } /** @@ -890,11 +914,11 @@ namespace ts { } if (constructor) { - const body = saveStateAndInvoke(constructor, constructor => { - isInConstructorWithCapturedSuper = superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture; - return visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset); - }); - addRange(statements, body); + if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture) { + ancestorFacts |= AncestorFacts.ConstructorWithCapturedSuper; + } + + addRange(statements, visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. @@ -1016,11 +1040,7 @@ namespace ts { firstStatement = ctorStatements[statementOffset]; if (firstStatement.kind === SyntaxKind.ExpressionStatement && isSuperCall((firstStatement as ExpressionStatement).expression)) { - const superCall = (firstStatement as ExpressionStatement).expression as CallExpression; - superCallExpression = setOriginalNode( - saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), - superCall - ); + superCallExpression = visitImmediateSuperCallInBody((firstStatement as ExpressionStatement).expression as CallExpression); } } @@ -1369,14 +1389,14 @@ namespace ts { break; case SyntaxKind.MethodDeclaration: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: const accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; @@ -1407,11 +1427,11 @@ namespace ts { * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration) { + function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration, container: Node) { const commentRange = getCommentRange(member); const sourceMapRange = getSourceMapRange(member); const memberName = createMemberAccessForPropertyName(receiver, visitNode(member.name, visitor, isPropertyName), /*location*/ member.name); - const memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + const memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); setEmitFlags(memberFunction, EmitFlags.NoComments); setSourceMapRange(memberFunction, sourceMapRange); @@ -1436,9 +1456,9 @@ namespace ts { * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver: LeftHandSideExpression, accessors: AllAccessorDeclarations): Statement { + function transformAccessorsToStatement(receiver: LeftHandSideExpression, accessors: AllAccessorDeclarations, container: Node): Statement { const statement = createStatement( - transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), + transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false), /*location*/ getSourceMapRange(accessors.firstAccessor) ); @@ -1455,7 +1475,7 @@ namespace ts { * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, startsOnNewLine: boolean): Expression { + function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression { // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); @@ -1468,7 +1488,7 @@ namespace ts { const properties: ObjectLiteralElementLike[] = []; if (getAccessor) { - const getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + const getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); setSourceMapRange(getterFunction, getSourceMapRange(getAccessor)); setEmitFlags(getterFunction, EmitFlags.NoLeadingComments); const getter = createPropertyAssignment("get", getterFunction); @@ -1477,7 +1497,7 @@ namespace ts { } if (setAccessor) { - const setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + const setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); setSourceMapRange(setterFunction, getSourceMapRange(setAccessor)); setEmitFlags(setterFunction, EmitFlags.NoLeadingComments); const setter = createPropertyAssignment("set", setterFunction); @@ -1514,6 +1534,13 @@ namespace ts { if (node.transformFlags & TransformFlags.ContainsLexicalThis) { enableSubstitutionsForCapturedThis(); } + + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.ArrowFunctionExcludes, AncestorFacts.ArrowFunctionIncludes); + convertedLoopState = undefined; + const func = createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -1524,8 +1551,11 @@ namespace ts { transformFunctionBody(node), node ); + setOriginalNode(func, node); setEmitFlags(func, EmitFlags.CapturesThis); + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; return func; } @@ -1535,7 +1565,13 @@ namespace ts { * @param node a FunctionExpression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - return updateFunctionExpression( + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = updateFunctionExpression( node, /*modifiers*/ undefined, node.name, @@ -1544,8 +1580,12 @@ namespace ts { /*type*/ undefined, node.transformFlags & TransformFlags.ES2015 ? transformFunctionBody(node) - : visitFunctionBody(node.body, visitor, context) + : visitFunctionBody(node.body, functionBodyVisitor, context) ); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; } /** @@ -1554,18 +1594,28 @@ namespace ts { * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node: FunctionDeclaration): FunctionDeclaration { - return updateFunctionDeclaration( + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = updateFunctionDeclaration( node, /*decorators*/ undefined, - node.modifiers, + visitNodes(node.modifiers, visitor, isModifier), node.name, /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, node.transformFlags & TransformFlags.ES2015 ? transformFunctionBody(node) - : visitFunctionBody(node.body, visitor, context) + : visitFunctionBody(node.body, functionBodyVisitor, context) ); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; } /** @@ -1575,11 +1625,12 @@ namespace ts { * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier): FunctionExpression { - const savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== SyntaxKind.ArrowFunction) { - enclosingNonArrowFunction = node; - } + function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier, container: Node): FunctionExpression { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node, container); + convertedLoopState = undefined; const expression = setOriginalNode( createFunctionExpression( @@ -1589,13 +1640,14 @@ namespace ts { /*typeParameters*/ undefined, visitParameterList(node.parameters, visitor, context), /*type*/ undefined, - saveStateAndInvoke(node, transformFunctionBody), + transformFunctionBody(node), location ), /*original*/ node ); - enclosingNonArrowFunction = savedContainingNonArrowFunction; + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; return expression; } @@ -1689,6 +1741,19 @@ namespace ts { return block; } + function visitBlock(node: Block, isFunctionBody: boolean): Block { + if (!isFunctionBody) { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockExcludes, AncestorFacts.BlockIncludes, node); + const updated = visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; + } + + // A function body is not a block scope. + return visitEachChild(node, visitor, context); + } + /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -1742,9 +1807,16 @@ namespace ts { FlattenLevel.All, needsDestructuringValue); } + return visitEachChild(node, visitor, context); } function visitVariableStatement(node: VariableStatement): Statement { + const savedAncestorFacts = ancestorFacts; + if (hasModifier(node, ModifierFlags.Export)) { + ancestorFacts |= AncestorFacts.ExportedVariableStatement; + } + + let updated: Statement; if (convertedLoopState && (getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) == 0) { // we are inside a converted loop - hoist variable declarations let assignments: Expression[]; @@ -1767,15 +1839,19 @@ namespace ts { } } if (assignments) { - return createStatement(reduceLeft(assignments, (acc, v) => createBinary(v, SyntaxKind.CommaToken, acc)), node); + updated = createStatement(reduceLeft(assignments, (acc, v) => createBinary(v, SyntaxKind.CommaToken, acc)), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } + else { + updated = visitEachChild(node, visitor, context); + } - return visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; } /** @@ -1784,29 +1860,32 @@ namespace ts { * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node: VariableDeclarationList): VariableDeclarationList { - if (node.flags & NodeFlags.BlockScoped) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & TransformFlags.ES2015) { + if (node.flags & NodeFlags.BlockScoped) { + enableSubstitutionsForBlockScopedBindings(); + } + + const declarations = flatten(map(node.declarations, node.flags & NodeFlags.Let + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + + const declarationList = createVariableDeclarationList(declarations, /*location*/ node); + setOriginalNode(declarationList, node); + setCommentRange(declarationList, node); + + if (node.transformFlags & TransformFlags.ContainsBindingPattern + && (isBindingPattern(node.declarations[0].name) + || isBindingPattern(lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + const firstDeclaration = firstOrUndefined(declarations); + const lastDeclaration = lastOrUndefined(declarations); + setSourceMapRange(declarationList, createRange(firstDeclaration.pos, lastDeclaration.end)); + } + + return declarationList; } - - const declarations = flatten(map(node.declarations, node.flags & NodeFlags.Let - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - - const declarationList = createVariableDeclarationList(declarations, /*location*/ node); - setOriginalNode(declarationList, node); - setCommentRange(declarationList, node); - - if (node.transformFlags & TransformFlags.ContainsBindingPattern - && (isBindingPattern(node.declarations[0].name) - || isBindingPattern(lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - const firstDeclaration = firstOrUndefined(declarations); - const lastDeclaration = lastOrUndefined(declarations); - setSourceMapRange(declarationList, createRange(firstDeclaration.pos, lastDeclaration.end)); - } - - return declarationList; + return visitEachChild(node, visitor, context); } /** @@ -1860,20 +1939,18 @@ namespace ts { const isCapturedInFunction = flags & NodeCheckFlags.CapturedBlockScopedBinding; const isDeclaredInLoop = flags & NodeCheckFlags.BlockScopedBindingInLoop; const emittedAsTopLevel = - isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + (ancestorFacts & AncestorFacts.TopLevel) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && isBlock(enclosingBlockScopeContainer) - && isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (ancestorFacts & AncestorFacts.IterationStatementBlock) !== 0); const emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== SyntaxKind.ForInStatement - && enclosingBlockScopeContainer.kind !== SyntaxKind.ForOfStatement + && (ancestorFacts & AncestorFacts.ForInOrForOfStatement) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (ancestorFacts & (AncestorFacts.ForStatement | AncestorFacts.ForInOrForOfStatement)) === 0)); return emitExplicitInitializer; } @@ -1907,72 +1984,108 @@ namespace ts { * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node: VariableDeclaration): VisitResult { - // If we are here it is because the name contains a binding pattern. + const savedAncestorFacts = ancestorFacts; + ancestorFacts &= ~AncestorFacts.ExportedVariableStatement; + + let updated: VisitResult; if (isBindingPattern(node.name)) { - const hoistTempVariables = enclosingVariableStatement - && hasModifier(enclosingVariableStatement, ModifierFlags.Export); - return flattenDestructuringBinding( + updated = flattenDestructuringBinding( node, visitor, context, FlattenLevel.All, /*value*/ undefined, - hoistTempVariables + (savedAncestorFacts & AncestorFacts.ExportedVariableStatement) !== 0 ); } + else { + updated = visitEachChild(node, visitor, context); + } - return visitEachChild(node, visitor, context); + ancestorFacts = savedAncestorFacts; + return updated; } function visitLabeledStatement(node: LabeledStatement): VisitResult { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = createMap(); + const statement = unwrapInnermostStatmentOfLabel(node); + return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node); + } + + function unwrapInnermostStatmentOfLabel(node: LabeledStatement) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = createMap(); + } + while (true) { + if (convertedLoopState) { + convertedLoopState.labels[node.label.text] = node.label.text; } - convertedLoopState.labels[node.label.text] = node.label.text; + if (node.statement.kind !== SyntaxKind.LabeledStatement) { + return node.statement; + } + node = node.statement; } + } - let result: VisitResult; - if (isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = visitNodes(createNodeArray([node.statement]), visitor, isStatement); + function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement): Statement { + if (!outermostLabeledStatement) { + return node; } - else { - result = visitEachChild(node, visitor, context); - } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + convertedLoopState.labels[outermostLabeledStatement.label.text] = undefined; } - - return result; + return updateLabel( + outermostLabeledStatement, + outermostLabeledStatement.label, + outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node + ); } - function visitDoStatement(node: DoStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(excludeFacts, includeFacts, node); + const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + ancestorFacts = savedAncestorFacts; + return updated; } - function visitWhileStatement(node: WhileStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node: DoStatement | WhileStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.DoOrWhileStatementExcludes, + AncestorFacts.DoOrWhileStatementIncludes, + node, + outermostLabeledStatement); } - function visitForStatement(node: ForStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node: ForStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.ForStatementExcludes, + AncestorFacts.ForStatementIncludes, + node, + outermostLabeledStatement); } - function visitForInStatement(node: ForInStatement) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement) { + return visitIterationStatementWithFacts( + AncestorFacts.ForInOrForOfStatementExcludes, + AncestorFacts.ForInOrForOfStatementIncludes, + node, + outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node: ForOfStatement): VisitResult { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { + return visitIterationStatementWithFacts( + AncestorFacts.ForInOrForOfStatementExcludes, + AncestorFacts.ForInOrForOfStatementIncludes, + node, + outermostLabeledStatement, + convertForOfToFor); } - function convertForOfToFor(node: ForOfStatement, convertedLoopBodyStatements: Statement[]): ForStatement { + function convertForOfToFor(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { // The following ES6 code: // // for (let v of expr) { } @@ -2139,7 +2252,21 @@ namespace ts { // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. setEmitFlags(forStatement, EmitFlags.NoTokenTrailingSourceMaps); - return forStatement; + return restoreEnclosingLabel(forStatement, outermostLabeledStatement); + } + + function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { + switch (node.kind) { + case SyntaxKind.DoStatement: + case SyntaxKind.WhileStatement: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case SyntaxKind.ForStatement: + return visitForStatement(node, outermostLabeledStatement); + case SyntaxKind.ForInStatement: + return visitForInStatement(node, outermostLabeledStatement); + case SyntaxKind.ForOfStatement: + return visitForOfStatement(node, outermostLabeledStatement); + } } /** @@ -2155,45 +2282,56 @@ namespace ts { // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. let numInitialProperties = numProperties; + let numInitialPropertiesWithoutYield = numProperties; for (let i = 0; i < numProperties; i++) { const property = properties[i]; - if (property.transformFlags & TransformFlags.ContainsYield - || property.name.kind === SyntaxKind.ComputedPropertyName) { + if ((property.transformFlags & TransformFlags.ContainsYield && ancestorFacts & AncestorFacts.AsyncFunctionBody) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === SyntaxKind.ComputedPropertyName) { numInitialProperties = i; break; } } - Debug.assert(numInitialProperties !== numProperties); + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } - // 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. - const temp = createTempVariable(hoistVariableDeclaration); + // 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. + const temp = createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - const expressions: Expression[] = []; - const assignment = createAssignment( - temp, - setEmitFlags( - createObjectLiteral( - visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, - node.multiLine - ), - EmitFlags.Indented - ) - ); - if (node.multiLine) { - assignment.startsOnNewLine = true; + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + const expressions: Expression[] = []; + const assignment = createAssignment( + temp, + setEmitFlags( + createObjectLiteral( + visitNodes(properties, visitor, isObjectLiteralElementLike, 0, numInitialProperties), + /*location*/ undefined, + node.multiLine + ), + EmitFlags.Indented + ) + ); + + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + + expressions.push(assignment); + + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? startOnNewLine(getMutableClone(temp)) : temp); + return inlineExpressions(expressions); } - expressions.push(assignment); - - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? startOnNewLine(getMutableClone(temp)) : temp); - return inlineExpressions(expressions); + return visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node: IterationStatement): boolean { @@ -2224,7 +2362,7 @@ namespace ts { } } - function convertIterationStatementBodyIfNecessary(node: IterationStatement, convert?: (node: IterationStatement, convertedLoopBodyStatements: Statement[]) => IterationStatement): VisitResult { + function convertIterationStatementBodyIfNecessary(node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter): VisitResult { if (!shouldConvertIterationStatementBody(node)) { let saveAllowedNonLabeledJumps: Jump; if (convertedLoopState) { @@ -2234,7 +2372,9 @@ namespace ts { convertedLoopState.allowedNonLabeledJumps = Jump.Break | Jump.Continue; } - const result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : visitEachChild(node, visitor, context); + const result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -2302,8 +2442,7 @@ namespace ts { } const isAsyncBlockContainingAwait = - enclosingNonArrowFunction - && (getEmitFlags(enclosingNonArrowFunction) & EmitFlags.AsyncFunctionBody) !== 0 + ancestorFacts & AncestorFacts.AsyncFunctionBody && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; let loopBodyFlags: EmitFlags = 0; @@ -2422,34 +2561,30 @@ namespace ts { } const convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); - let loop: IterationStatement; + let loop: Statement; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = getMutableClone(node); + let clone = getMutableClone(node); // clean statement part - loop.statement = undefined; + clone.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = visitEachChild(loop, visitor, context); + clone = visitEachChild(clone, visitor, context); // set loop statement - loop.statement = createBlock( + clone.statement = createBlock( convertedLoopBodyStatements, /*location*/ undefined, /*multiline*/ true ); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - aggregateTransformFlags(loop); + clone.transformFlags = 0; + aggregateTransformFlags(clone); + loop = restoreEnclosingLabel(clone, outermostLabeledStatement); } - - statements.push( - currentParent.kind === SyntaxKind.LabeledStatement - ? createLabel((currentParent).label, loop) - : loop - ); + statements.push(loop); return statements; } @@ -2617,11 +2752,15 @@ namespace ts { case SyntaxKind.SetAccessor: const accessors = getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; + case SyntaxKind.MethodDeclaration: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case SyntaxKind.PropertyAssignment: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; @@ -2630,10 +2769,6 @@ namespace ts { expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case SyntaxKind.MethodDeclaration: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; - default: Debug.failBadSyntaxKind(node); break; @@ -2692,13 +2827,13 @@ namespace ts { * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, startsOnNewLine: boolean) { + function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, container: Node, startsOnNewLine: boolean) { const expression = createAssignment( createMemberAccessForPropertyName( receiver, visitNode(method.name, visitor, isPropertyName) ), - transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), + transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container), /*location*/ method ); if (startsOnNewLine) { @@ -2708,22 +2843,28 @@ namespace ts { } function visitCatchClause(node: CatchClause): CatchClause { - Debug.assert(isBindingPattern(node.variableDeclaration.name)); - - const temp = createTempVariable(undefined); - const newVariableDeclaration = createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - - const vars = flattenDestructuringBinding( - node.variableDeclaration, - visitor, - context, - FlattenLevel.All, - temp - ); - const list = createVariableDeclarationList(vars, /*location*/node.variableDeclaration, /*flags*/node.variableDeclaration.flags); - const destructure = createVariableStatement(undefined, list); - - return updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + let updated: CatchClause; + if (isBindingPattern(node.variableDeclaration.name)) { + const temp = createTempVariable(undefined); + const newVariableDeclaration = createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + const vars = flattenDestructuringBinding( + node.variableDeclaration, + visitor, + context, + FlattenLevel.All, + temp + ); + const list = createVariableDeclarationList(vars, /*location*/node.variableDeclaration, /*flags*/node.variableDeclaration.flags); + const destructure = createVariableStatement(undefined, list); + updated = updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = visitEachChild(node, visitor, context); + } + ancestorFacts = savedAncestorFacts; + return updated; } function addStatementToStartOfBlock(block: Block, statement: Statement): Block { @@ -2742,7 +2883,7 @@ namespace ts { // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. Debug.assert(!isComputedPropertyName(node.name)); - const functionExpression = transformFunctionLikeToExpression(node, /*location*/ moveRangePos(node, -1), /*name*/ undefined); + const functionExpression = transformFunctionLikeToExpression(node, /*location*/ moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); setEmitFlags(functionExpression, EmitFlags.NoLeadingComments | getEmitFlags(functionExpression)); return createPropertyAssignment( node.name, @@ -2751,6 +2892,25 @@ namespace ts { ); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node: AccessorDeclaration): AccessorDeclaration { + const savedAncestorFacts = ancestorFacts; + const savedConvertedLoopState = convertedLoopState; + + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + convertedLoopState = undefined; + + const updated = visitEachChild(node, visitor, context); + + ancestorFacts = savedAncestorFacts; + convertedLoopState = savedConvertedLoopState; + return updated; + } + /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * @@ -2764,6 +2924,10 @@ namespace ts { ); } + function visitComputedPropertyName(node: ComputedPropertyName) { + return visitEachChild(node, visitor, context); + } + /** * Visits a YieldExpression node. * @@ -2780,8 +2944,11 @@ namespace ts { * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node: ArrayLiteralExpression): Expression { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & TransformFlags.ES2015) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return visitEachChild(node, visitor, context); } /** @@ -2790,7 +2957,15 @@ namespace ts { * @param node a CallExpression. */ function visitCallExpression(node: CallExpression) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & TransformFlags.ES2015) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return updateCall( + node, + visitNode(node.expression, callExpressionVisitor, isExpression), + /*typeArguments*/ undefined, + visitNodes(node.arguments, visitor, isExpression) + ); } function visitImmediateSuperCallInBody(node: CallExpression) { @@ -2822,7 +2997,7 @@ namespace ts { // _super.prototype.m.apply(this, a.concat([b])) resultingCall = createFunctionApply( - visitNode(target, visitor, isExpression), + visitNode(target, callExpressionVisitor, isExpression), visitNode(thisArg, visitor, isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) ); @@ -2838,7 +3013,7 @@ namespace ts { // _super.m.call(this, a) // _super.prototype.m.call(this, a) resultingCall = createFunctionCall( - visitNode(target, visitor, isExpression), + visitNode(target, callExpressionVisitor, isExpression), visitNode(thisArg, visitor, isExpression), visitNodes(node.arguments, visitor, isExpression), /*location*/ node @@ -2853,11 +3028,11 @@ namespace ts { resultingCall, actualThis ); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? createAssignment(createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return setOriginalNode(resultingCall, node); } /** @@ -2866,25 +3041,26 @@ namespace ts { * @param node A NewExpression node. */ function visitNewExpression(node: NewExpression): LeftHandSideExpression { - // We are here because we contain a SpreadElementExpression. - Debug.assert((node.transformFlags & TransformFlags.ContainsSpread) !== 0); + if (node.transformFlags & TransformFlags.ContainsSpread) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - - const { target, thisArg } = createCallBinding(createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration); - return createNew( - createFunctionApply( - visitNode(target, visitor, isExpression), - thisArg, - transformAndSpreadElements(createNodeArray([createVoidZero(), ...node.arguments]), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) - ), - /*typeArguments*/ undefined, - [] - ); + const { target, thisArg } = createCallBinding(createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration); + return createNew( + createFunctionApply( + visitNode(target, visitor, isExpression), + thisArg, + transformAndSpreadElements(createNodeArray([createVoidZero(), ...node.arguments]), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false) + ), + /*typeArguments*/ undefined, + [] + ); + } + return visitEachChild(node, visitor, context); } /** @@ -3120,11 +3296,9 @@ namespace ts { /** * Visits the `super` keyword */ - function visitSuperKeyword(): LeftHandSideExpression { - return enclosingNonAsyncFunctionBody - && isClassElement(enclosingNonAsyncFunctionBody) - && !hasModifier(enclosingNonAsyncFunctionBody, ModifierFlags.Static) - && currentParent.kind !== SyntaxKind.CallExpression + function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression { + return ancestorFacts & AncestorFacts.NonStaticClassElement + && !isExpressionOfCall ? createPropertyAccess(createIdentifier("_super"), "prototype") : createIdentifier("_super"); } @@ -3135,16 +3309,15 @@ namespace ts { * @param node The node to be printed. */ function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { - const savedEnclosingFunction = enclosingFunction; - if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + const savedAncestorFacts = ancestorFacts; + setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + previousOnEmitNode(emitContext, node, emitCallback); + ancestorFacts = savedAncestorFacts; + return; } - previousOnEmitNode(emitContext, node, emitCallback); - - enclosingFunction = savedEnclosingFunction; } /** @@ -3272,11 +3445,9 @@ namespace ts { */ function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis - && enclosingFunction - && getEmitFlags(enclosingFunction) & EmitFlags.CapturesThis) { + && ancestorFacts & AncestorFacts.CapturesThis) { return createIdentifier("_this", /*location*/ node); } - return node; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ddfa85bc311..328f80abc5c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -883,6 +883,18 @@ namespace ts { return false; } + export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } { + switch (node.statement.kind) { + case SyntaxKind.LabeledStatement: + const result = getAllLabeledStatements(node.statement); + if (result) { + result.labeledStatements.push(node); + } + return result; + default: + return { statement: node.statement, labeledStatements: [node] }; + } + } export function isFunctionBlock(node: Node) { return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent); diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index da19770584a..fc3960fba3e 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -41,9 +41,9 @@ var Q = (function (_super) { __extends(Q, _super); // Super is not allowed in constructor args function Q(z, zz, zzz) { - if (z === void 0) { z = _super.; } - if (zz === void 0) { zz = _super.; } - if (zzz === void 0) { zzz = function () { return _super.; }; } + if (z === void 0) { z = _super.prototype.; } + if (zz === void 0) { zz = _super.prototype.; } + if (zzz === void 0) { zzz = function () { return _super.prototype.; }; } var _this = _super.call(this) || this; _this.z = z; _this.xx = _super.prototype.; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 8c99b649917..d345bbc8d3a 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -27,7 +27,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C(a) { - if (a === void 0) { a = _super.foo.call(_this); } + if (a === void 0) { a = _super.prototype.foo.call(_this); } var _this; return _this; } diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 816277e4e9e..5bc2b64fe36 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -72,14 +72,14 @@ var obj = { } }, method: function () { - _super.prototype.method.call(this); + _super.method.call(this); }, get prop() { - _super.prototype.method.call(this); + _super.method.call(this); return 10; }, set prop(value) { - _super.prototype.method.call(this); + _super.method.call(this); }, p1: function () { _super.method.call(this); @@ -110,14 +110,14 @@ var B = (function (_super) { } }, method: function () { - _super.prototype.method.call(this); + _super.method.call(this); }, get prop() { - _super.prototype.method.call(this); + _super.method.call(this); return 10; }, set prop(value) { - _super.prototype.method.call(this); + _super.method.call(this); }, p1: function () { _super.method.call(this); diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 15bc0c40f37..a41400809d2 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -40,7 +40,7 @@ var C1 = (function (_super) { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.call(this, _super.x.call(_this)) || this; + return _super.call(this, _super.prototype.x.call(_this)) || this; } return C2; }(B)); diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 6815b71ce11..d6f8e36c526 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -38,10 +38,10 @@ var ObjectLiteral; var ThisInObjectLiteral = { _foo: '1', get foo() { - return _super.prototype._foo; + return _super._foo; }, set foo(value) { - _super.prototype._foo = value; + _super._foo = value; }, test: function () { return _super._foo; @@ -62,7 +62,7 @@ var SuperObjectTest = (function (_super) { SuperObjectTest.prototype.testing = function () { var test = { get F() { - return _super.prototype.test.call(this); + return _super.test.call(this); } }; }; From c1a41b9f3c9804ee8069ec5882519abd45fb3c29 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 8 Dec 2016 15:40:35 -0800 Subject: [PATCH 119/289] Expose indexSignaturePrinting --- src/compiler/checker.ts | 58 +++++++++++++++++++++++++---------------- src/compiler/types.ts | 2 ++ 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0834322ff48..e2c6e4d6a53 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -95,6 +95,7 @@ namespace ts { getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment, signatureToString, + indexSignatureToString, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -2035,6 +2036,15 @@ namespace ts { return result; } + function indexSignatureToString(info: IndexInfo, kind: SyntaxKind, enclosingDeclaration?: Node): string { + const writer = getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration); + const result = writer.string(); + releaseStringWriter(writer); + + return result; + } + function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { const writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); @@ -2459,26 +2469,6 @@ namespace ts { buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags); } - function writeIndexSignature(info: IndexInfo, keyword: SyntaxKind) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, SyntaxKind.ReadonlyKeyword); - writeSpace(writer); - } - writePunctuation(writer, SyntaxKind.OpenBracketToken); - writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, SyntaxKind.CloseBracketToken); - writePunctuation(writer, SyntaxKind.ColonToken); - writeSpace(writer); - writeType(info.type, TypeFormatFlags.None); - writePunctuation(writer, SyntaxKind.SemicolonToken); - writer.writeLine(); - } - } - function writePropertyWithModifiers(prop: Symbol) { if (isReadonlySymbol(prop)) { writeKeyword(writer, SyntaxKind.ReadonlyKeyword); @@ -2566,8 +2556,8 @@ namespace ts { writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, SyntaxKind.StringKeyword); - writeIndexSignature(resolved.numberIndexInfo, SyntaxKind.NumberKeyword); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, SyntaxKind.StringKeyword, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, SyntaxKind.NumberKeyword, enclosingDeclaration, globalFlags, symbolStack); for (const p of resolved.properties) { const t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { @@ -2800,6 +2790,29 @@ namespace ts { buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + /** + * @param keyword The keyword for the type of IndexSignature. Must be one of SyntaxKind.NumberKeyword or SyntaxKind.StringKeyword. + */ + function buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, keyword: SyntaxKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, SyntaxKind.ReadonlyKeyword); + writeSpace(writer); + } + writePunctuation(writer, SyntaxKind.OpenBracketToken); + writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + writeKeyword(writer, keyword); + writePunctuation(writer, SyntaxKind.CloseBracketToken); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, SyntaxKind.SemicolonToken); + writer.writeLine(); + } + } + return _displayBuilder || (_displayBuilder = { buildSymbolDisplay, buildTypeDisplay, @@ -2810,6 +2823,7 @@ namespace ts { buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol, buildSignatureDisplay, + buildIndexSignatureDisplay, buildReturnTypeDisplay }); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4adf4f7ac95..eb9584f638a 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2352,6 +2352,7 @@ namespace ts { getTypeAtLocation(node: Node): Type; getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; + indexSignatureToString(info: IndexInfo, kind: SyntaxKind, enclosingDeclaration?: Node): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; createSymbol(flags: SymbolFlags, name: string): Symbol; @@ -2396,6 +2397,7 @@ namespace ts { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, keyword: SyntaxKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; From 2f51b363bfd2b71c6e34034cbfd958ae3e911d17 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 8 Dec 2016 16:34:15 -0800 Subject: [PATCH 120/289] add missing index signature support --- .../fixClassIncorrectlyImplementsInterface.ts | 26 ++++++++++++++++--- src/services/codefixes/helpers.ts | 18 +++++-------- ...mentedInterfaceComputedPropertyLiterals.ts | 2 +- ...ImplementedInterfaceIndexSignaturesBoth.ts | 14 ++++++++++ ...mplementedInterfaceIndexSignaturesNoFix.ts | 11 ++++++++ ...plementedInterfaceIndexSignaturesNumber.ts | 12 +++++++++ ...plementedInterfaceIndexSignaturesString.ts | 11 ++++++++ 7 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 2cec3adb8f5..e82c579a54f 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -14,19 +14,37 @@ namespace ts.codefix { } const startPos: number = classDecl.members.pos; - + const classType = checker.getTypeAtLocation(classDecl); const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - const result: CodeAction[] = []; + const hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.Number); + const hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.String); + for (const implementedTypeNode of implementedTypeNodes) { - const implementedType = checker.getTypeFromTypeReference(implementedTypeNode); + const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceTypeWithDeclaredMembers; // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); - const insertion = getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + let insertion = ""; + + if (!hasNumericIndexSignature) { + const typeNumericIndexInfo = implementedType.declaredNumberIndexInfo; + if (typeNumericIndexInfo) { + insertion = checker.indexSignatureToString(typeNumericIndexInfo, SyntaxKind.NumberKeyword, classDecl); + } + } + + if (!hasStringIndexSignature) { + const typeStringIndexInfo = implementedType.declaredStringIndexInfo; + if (typeStringIndexInfo) { + insertion += checker.indexSignatureToString(typeStringIndexInfo, SyntaxKind.StringKeyword, classDecl); + } + } + + insertion += getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); const message = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); if (insertion) { pushAction(result, insertion, message); diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index ef0ca1a9a57..4b921c1a81c 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -5,7 +5,7 @@ namespace ts.codefix { * Finds members of the resolved type that are missing in the class pointed to by class decl * and generates source code for the missing members. * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. - * @returns undefined iff there is no insertion available. + * @returns Empty string iff there are no member insertions. */ export function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string { const classMembers = classDeclaration.symbol.members; @@ -16,9 +16,12 @@ namespace ts.codefix { for (const symbol of missingMembers) { insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); } - return insertion.length > 0 ? insertion : undefined; + return insertion; } + /** + * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`. + */ function getInsertionForMemberSymbol(symbol: Symbol, enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker, newlineChar: string): string { // const name = symbol.getName(); const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); @@ -28,8 +31,9 @@ namespace ts.codefix { } const declaration = declarations[0] as Declaration; - const name = declaration.name.getText(); + const name = declaration.name ? declaration.name.getText() : undefined; const visibility = getVisibilityPrefix(getModifierFlags(declaration)); + switch (declaration.kind) { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: @@ -77,14 +81,6 @@ namespace ts.codefix { result += `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`; return result; - case SyntaxKind.ComputedPropertyName: - if (hasDynamicName(declaration)) { - return ""; - } - throw new Error("Not implemented, computed property name."); - case SyntaxKind.IndexSignature: - throw new Error("Not implemented."); - default: return ""; } diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts index 98f9c978c3d..465f9a5b4f1 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts @@ -6,7 +6,7 @@ //// [1](): string; //// [2]: boolean; //// } - +//// //// class C implements I {[| |]} verify.rangeAfterCodeFix(` diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts new file mode 100644 index 00000000000..e47eeb6d5c1 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts @@ -0,0 +1,14 @@ +/// + + +//// interface I { +//// [x: number]: I; +//// [y: string]: I; +//// } +//// +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + [x: number]: I; + [y: string]: I; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts new file mode 100644 index 00000000000..07896b4cdb3 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts @@ -0,0 +1,11 @@ +/// + +//// interface I4 { +//// [x: string, y: number]: number; +//// } +//// +//// class C implements I {[| |]} + +verify.not.codeFixAvailable(); + + diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts new file mode 100644 index 00000000000..0f143442530 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts @@ -0,0 +1,12 @@ +/// + +//// interface I { +//// [x: number]: I; +//// } +//// +//// class C implements I {[| +//// |]} + +verify.rangeAfterCodeFix(` + [x: number]: I; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts new file mode 100644 index 00000000000..37abd751382 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts @@ -0,0 +1,11 @@ +/// + +//// interface I { +//// [x: string]: number; +//// } +//// +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + [x: string]: number; +`); \ No newline at end of file From 97b3d7a9ef675a6f992dc2b38c99b9deb68b8e35 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 8 Dec 2016 17:19:19 -0800 Subject: [PATCH 121/289] make index signature fix work with generics --- src/compiler/checker.ts | 1 + src/compiler/types.ts | 1 + .../codefixes/fixClassIncorrectlyImplementsInterface.ts | 4 ++-- .../codeFixUnImplementedInterfaceIndexSignaturesString.ts | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e2c6e4d6a53..f75ba15254b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -79,6 +79,7 @@ namespace ts { getDeclaredTypeOfSymbol, getPropertiesOfType, getPropertyOfType, + getIndexInfoOfType, getSignaturesOfType, getIndexTypeOfType, getBaseTypes, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index eb9584f638a..81b4005ae5e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2335,6 +2335,7 @@ namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index e82c579a54f..11db00eb43c 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -31,14 +31,14 @@ namespace ts.codefix { let insertion = ""; if (!hasNumericIndexSignature) { - const typeNumericIndexInfo = implementedType.declaredNumberIndexInfo; + const typeNumericIndexInfo = checker.getIndexInfoOfType(implementedType, IndexKind.Number); if (typeNumericIndexInfo) { insertion = checker.indexSignatureToString(typeNumericIndexInfo, SyntaxKind.NumberKeyword, classDecl); } } if (!hasStringIndexSignature) { - const typeStringIndexInfo = implementedType.declaredStringIndexInfo; + const typeStringIndexInfo = checker.getIndexInfoOfType(implementedType, IndexKind.String); if (typeStringIndexInfo) { insertion += checker.indexSignatureToString(typeStringIndexInfo, SyntaxKind.StringKeyword, classDecl); } diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts index 37abd751382..4b595c6eda7 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts @@ -1,10 +1,10 @@ /// -//// interface I { -//// [x: string]: number; +//// interface I { +//// [x: string]: X; //// } //// -//// class C implements I {[| |]} +//// class C implements I {[| |]} verify.rangeAfterCodeFix(` [x: string]: number; From 6a1ccd8de449e23f4d2fdd4ece979ac8a616f5bd Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 8 Dec 2016 17:31:18 -0800 Subject: [PATCH 122/289] Adds support for new.target --- src/compiler/binder.ts | 1 + src/compiler/checker.ts | 64 +++ src/compiler/core.ts | 63 ++- src/compiler/diagnosticMessages.json | 16 + src/compiler/emitter.ts | 27 +- src/compiler/parser.ts | 15 +- src/compiler/transformers/es2015.ts | 420 +++++++++++++----- src/compiler/types.ts | 10 + src/compiler/utilities.ts | 16 + .../reference/invalidNewTarget.es5.errors.txt | 78 ++++ .../reference/invalidNewTarget.es5.js | 77 ++++ .../reference/invalidNewTarget.es6.errors.txt | 78 ++++ .../reference/invalidNewTarget.es6.js | 50 +++ tests/baselines/reference/newTarget.es5.js | 74 +++ .../baselines/reference/newTarget.es5.symbols | 63 +++ tests/baselines/reference/newTarget.es5.types | 95 ++++ tests/baselines/reference/newTarget.es6.js | 61 +++ .../baselines/reference/newTarget.es6.symbols | 63 +++ tests/baselines/reference/newTarget.es6.types | 95 ++++ .../es6/newTarget/invalidNewTarget.es5.ts | 25 ++ .../es6/newTarget/invalidNewTarget.es6.ts | 25 ++ .../es6/newTarget/newTarget.es5.ts | 32 ++ .../es6/newTarget/newTarget.es6.ts | 32 ++ 23 files changed, 1352 insertions(+), 128 deletions(-) create mode 100644 tests/baselines/reference/invalidNewTarget.es5.errors.txt create mode 100644 tests/baselines/reference/invalidNewTarget.es5.js create mode 100644 tests/baselines/reference/invalidNewTarget.es6.errors.txt create mode 100644 tests/baselines/reference/invalidNewTarget.es6.js create mode 100644 tests/baselines/reference/newTarget.es5.js create mode 100644 tests/baselines/reference/newTarget.es5.symbols create mode 100644 tests/baselines/reference/newTarget.es5.types create mode 100644 tests/baselines/reference/newTarget.es6.js create mode 100644 tests/baselines/reference/newTarget.es6.symbols create mode 100644 tests/baselines/reference/newTarget.es6.types create mode 100644 tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts create mode 100644 tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts create mode 100644 tests/cases/conformance/es6/newTarget/newTarget.es5.ts create mode 100644 tests/cases/conformance/es6/newTarget/newTarget.es6.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a6f5993f6c8..f9ebc9688a9 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3133,6 +3133,7 @@ namespace ts { case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.ShorthandPropertyAssignment: case SyntaxKind.StaticKeyword: + case SyntaxKind.MetaProperty: // These nodes are ES6 syntax. transformFlags |= TransformFlags.AssertES2015; break; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cdef31ee400..39e673b2b57 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -241,6 +241,7 @@ namespace ts { const visitedFlowNodes: FlowNode[] = []; const visitedFlowTypes: FlowType[] = []; const potentialThisCollisions: Node[] = []; + const potentialNewTargetCollisions: Node[] = []; const awaitedTypeStack: number[] = []; const diagnostics = createDiagnosticCollection(); @@ -10196,6 +10197,7 @@ namespace ts { checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); const type = getTypeOfSymbol(localOrExportSymbol); @@ -13720,6 +13722,24 @@ namespace ts { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node: MetaProperty) { + checkGrammarMetaProperty(node); + Debug.assert(node.keywordToken === SyntaxKind.NewKeyword && node.name.text === "target", "Unrecognized meta-property."); + const container = getNewTargetContainer(node); + if (!container) { + error(node, Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === SyntaxKind.Constructor) { + const symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + const symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } + function getTypeOfParameter(symbol: Symbol) { const type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -14128,6 +14148,7 @@ namespace ts { if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration) { checkCollisionWithCapturedSuperVariable(node, (node).name); checkCollisionWithCapturedThisVariable(node, (node).name); + checkCollisionWithCapturedNewTargetVariable(node, (node).name); } return type; @@ -15152,6 +15173,8 @@ namespace ts { return checkAssertion(node); case SyntaxKind.NonNullExpression: return checkNonNullAssertion(node); + case SyntaxKind.MetaProperty: + return checkMetaProperty(node); case SyntaxKind.DeleteExpression: return checkDeleteExpression(node); case SyntaxKind.VoidExpression: @@ -16552,6 +16575,7 @@ namespace ts { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -16835,6 +16859,12 @@ namespace ts { } } + function checkCollisionWithCapturedNewTargetVariable(node: Node, name: Identifier): void { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } + // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node: Node): void { let current = node; @@ -16853,6 +16883,23 @@ namespace ts { } } + function checkIfNewTargetIsCapturedInEnclosingScope(node: Node): void { + let current = node; + while (current) { + if (getNodeCheckFlags(current) & NodeCheckFlags.CaptureNewTarget) { + const isDeclaration = node.kind !== SyntaxKind.Identifier; + if (isDeclaration) { + error((node).name, Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } + function checkCollisionWithCapturedSuperVariable(node: Node, name: Identifier) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -17148,6 +17195,7 @@ namespace ts { } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -17984,6 +18032,7 @@ namespace ts { if (node.name) { checkTypeNameIsReserved(node.name, Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -18518,6 +18567,7 @@ namespace ts { checkTypeNameIsReserved(node.name, Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -19223,6 +19273,7 @@ namespace ts { checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; @@ -19251,6 +19302,11 @@ namespace ts { potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope) + potentialNewTargetCollisions.length = 0; + } + links.flags |= NodeCheckFlags.TypeChecked; } } @@ -21581,6 +21637,14 @@ namespace ts { } } + function checkGrammarMetaProperty(node: MetaProperty) { + if (node.keywordToken === SyntaxKind.NewKeyword) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, tokenToString(node.keywordToken), "target"); + } + } + } + function hasParseDiagnostics(sourceFile: SourceFile): boolean { return sourceFile.parseDiagnostics.length > 0; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 89057dd2939..70674d400c3 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -568,14 +568,35 @@ namespace ts { * is created if `value` was appended. * @param value The value to append to the array. If `value` is `undefined`, nothing is * appended. + * @param copyOnWrite Indicates whether to return a fresh array rather than modify the + * existing array. */ - export function append(to: T[] | undefined, value: T | undefined): T[] | undefined { + export function append(to: T[] | undefined, value: T | undefined, copyOnWrite?: boolean): T[] | undefined { if (value === undefined) return to; if (to === undefined) return [value]; + if (copyOnWrite) return [...to, value]; to.push(value); return to; } + /** + * Prepends a value to an array, returning the array. + * + * @param to The array to which `value` is to be prepended. If `to` is `undefined`, a new array + * is created if `value` was prepended. + * @param value The value to prepend to the array. If `value` is `undefined`, nothing is + * prepended. + * @param copyOnWrite Indicates whether to return a fresh array rather than modify the + * existing array. + */ + export function prepend(to: T[] | undefined, value: T | undefined, copyOnWrite?: boolean): T[] | undefined { + if (value === undefined) return to; + if (to === undefined) return [value]; + if (copyOnWrite) return [value, ...to]; + to.unshift(value); + return to; + } + /** * Appends a range of value to an array, returning the array. * @@ -583,11 +604,45 @@ namespace ts { * is created if `value` was appended. * @param from The values to append to the array. If `from` is `undefined`, nothing is * appended. If an element of `from` is `undefined`, that element is not appended. + * @param copyOnWrite Indicates whether to return a fresh array rather than modify the + * existing array. */ - export function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined { + export function addRange(to: T[] | undefined, from: T[] | undefined, copyOnWrite?: boolean): T[] | undefined { if (from === undefined) return to; - for (const v of from) { - to = append(to, v); + from = filter(from, isDefined); + if (to === undefined) return from; + if (from.length > 0) { + if (copyOnWrite) { + return [...to, ...from]; + } + for (const v of from) { + to.push(v); + } + } + return to; + } + + /** + * Appends a range of value to an array, returning the array. + * + * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array + * is created if `value` was appended. + * @param from The values to append to the array. If `from` is `undefined`, nothing is + * appended. If an element of `from` is `undefined`, that element is not appended. + * @param copyOnWrite Indicates whether to return a fresh array rather than modify the + * existing array. + */ + export function prependRange(to: T[] | undefined, from: T[] | undefined, copyOnWrite?: boolean): T[] | undefined { + if (from === undefined) return to; + from = filter(from, isDefined); + if (to === undefined) return from; + if (from.length > 0) { + if (copyOnWrite) { + return [...from, ...to]; + } + for (let i = from.length - 1; i >= 0; i--) { + to.unshift(from[i]); + } } return to; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b59921c2948..c063182ba6f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1771,6 +1771,14 @@ "category": "Error", "code": 2542 }, + "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference.": { + "category": "Error", + "code": 2543 + }, + "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference.": { + "category": "Error", + "code": 2544 + }, "JSX element attributes type '{0}' may not be a union type.": { "category": "Error", "code": 2600 @@ -3169,6 +3177,14 @@ "category": "Error", "code": 17011 }, + "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?": { + "category": "Error", + "code": 17012 + }, + "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor.": { + "category": "Error", + "code": 17013 + }, "Circularity detected while resolving configuration: {0}": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 90738d828be..8b383304352 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -660,6 +660,8 @@ namespace ts { return emitAsExpression(node); case SyntaxKind.NonNullExpression: return emitNonNullExpression(node); + case SyntaxKind.MetaProperty: + return emitMetaProperty(node); // JSX case SyntaxKind.JsxElement: @@ -1249,6 +1251,12 @@ namespace ts { write("!"); } + function emitMetaProperty(node: MetaProperty) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } + // // Misc // @@ -2571,6 +2579,13 @@ namespace ts { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node: MethodDeclaration | AccessorDeclaration) { + if (isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(TempFlags.Auto); + } + /** * Generates a unique name from a node. * @@ -2592,6 +2607,10 @@ namespace ts { return generateNameForExportDefault(); case SyntaxKind.ClassExpression: return generateNameForClassExpression(); + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(TempFlags.Auto); } @@ -2642,6 +2661,11 @@ namespace ts { return node; } + function generateNameForNodeCached(node: Node) { + const nodeId = getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = unescapeIdentifier(generateNameForNode(node))); + } + /** * Gets the generated identifier text from a generated identifier. * @@ -2652,8 +2676,7 @@ namespace ts { // Generated names generate unique names based on their original node // and are cached based on that node's id const node = getNodeForGeneratedName(name); - const nodeId = getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { // Auto, Loop, and Unique names are cached based on their unique diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 4aefa160077..c3506d441cd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -198,6 +198,8 @@ namespace ts { visitNode(cbNode, (node).type); case SyntaxKind.NonNullExpression: return visitNode(cbNode, (node).expression); + case SyntaxKind.MetaProperty: + return visitNode(cbNode, (node).name); case SyntaxKind.ConditionalExpression: return visitNode(cbNode, (node).condition) || visitNode(cbNode, (node).questionToken) || @@ -4329,15 +4331,22 @@ namespace ts { return isIdentifier() ? parseIdentifier() : undefined; } - function parseNewExpression(): NewExpression { - const node = createNode(SyntaxKind.NewExpression); + function parseNewExpression(): NewExpression | MetaProperty { + const fullStart = scanner.getStartPos(); parseExpected(SyntaxKind.NewKeyword); + if (parseOptional(SyntaxKind.DotToken)) { + const node = createNode(SyntaxKind.MetaProperty, fullStart); + node.keywordToken = SyntaxKind.NewKeyword; + node.name = parseIdentifierName(); + return finishNode(node); + } + + const node = createNode(SyntaxKind.NewExpression, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === SyntaxKind.OpenParenToken) { node.arguments = parseArgumentList(); } - return finishNode(node); } diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 094261f7002..644e52c33c6 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -164,22 +164,32 @@ namespace ts { type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]) => Statement; - // Facts we track as we descend the tree - const enum AncestorFacts { + // Facts we track as we traverse the tree + const enum HierarchyFacts { None = 0, - Function = 1 << 0, // Enclosed in a non-arrow function - ArrowFunction = 1 << 1, // Enclosed in an arrow function - AsyncFunctionBody = 1 << 2, // Enclosed in an async function body - NonStaticClassElement = 1 << 3, // Enclosed in a non-static, non-async class element - CapturesThis = 1 << 4, // Enclosed in a function that captures the lexical 'this' (used in substitution) - ExportedVariableStatement = 1 << 5, // Enclosed in an exported variable statement in the current scope - TopLevel = 1 << 6, // Enclosing block-scoped container is a top-level container - Block = 1 << 7, // Enclosing block-scoped container is a Block - IterationStatement = 1 << 8, // Enclosed in an IterationStatement - IterationStatementBlock = 1 << 9, // Enclosing Block is enclosed in an IterationStatement - ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement - ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement - ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + + // Ancestor facts + Function = 1 << 0, // Enclosed in a non-arrow function + ArrowFunction = 1 << 1, // Enclosed in an arrow function + AsyncFunctionBody = 1 << 2, // Enclosed in an async function body + NonStaticClassElement = 1 << 3, // Enclosed in a non-static, non-async class element + CapturesThis = 1 << 4, // Enclosed in a function that captures the lexical 'this' (used in substitution) + ExportedVariableStatement = 1 << 5, // Enclosed in an exported variable statement in the current scope + TopLevel = 1 << 6, // Enclosing block-scoped container is a top-level container + Block = 1 << 7, // Enclosing block-scoped container is a Block + IterationStatement = 1 << 8, // Enclosed in an IterationStatement + IterationStatementBlock = 1 << 9, // Enclosing Block is enclosed in an IterationStatement + ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement + ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement + ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + ComputedPropertyName = 1 << 13, // Enclosed in a computed property name + AncestorFactsMask = (ComputedPropertyName << 1) - 1, + + // Subtree facts + NewTarget = 1 << 14, // Contains a 'new.target' meta-property + NewTargetInComputedPropertyName = 1 << 15, // Contains a 'new.target' meta-property in a computed property name. + + SubtreeFactsMask = ~AncestorFactsMask, // We are always in *some* kind of block scope, but only specific block-scope containers are // top-level or Blocks. @@ -192,11 +202,11 @@ namespace ts { // Functions, methods, and accessors are both new lexical scopes and new block scopes. FunctionIncludes = Function | TopLevel, - FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper | ComputedPropertyName, // Arrow functions are lexically scoped to their container, but are new block scopes. ArrowFunctionIncludes = ArrowFunction | TopLevel, - ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper, + ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper | ComputedPropertyName, // Constructors are both new lexical scopes and new block scopes. Constructors are also // always considered non-static members of a class. @@ -221,6 +231,11 @@ namespace ts { // Blocks (other than function bodies) are new block scopes. BlockIncludes = Block, BlockExcludes = BlockScopeExcludes & ~Block, + + ComputedPropertyNameIncludes = ComputedPropertyName, + ComputedPropertyNameExcludes = None, + + PropagateNewTargetMask = NewTarget | NewTargetInComputedPropertyName, } export function transformES2015(context: TransformationContext) { @@ -239,7 +254,7 @@ namespace ts { let currentSourceFile: SourceFile; let currentText: string; - let ancestorFacts: AncestorFacts; + let hierarchyFacts: HierarchyFacts; /** * Used to track if we are emitting body of the converted loop @@ -268,49 +283,73 @@ namespace ts { currentSourceFile = undefined; currentText = undefined; - ancestorFacts = AncestorFacts.None; + hierarchyFacts = HierarchyFacts.None; return visited; } - function setAncestorFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node?: Node, container?: Node) { + function getAncestorFacts() { + return hierarchyFacts & HierarchyFacts.AncestorFactsMask; + } + + function restoreAncestorFacts(facts: HierarchyFacts) { + hierarchyFacts = facts & HierarchyFacts.AncestorFactsMask | getSubtreeFacts(); + } + + function setAncestorFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node?: Node, container?: Node) { if (node) { switch (node.kind) { case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: if (container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static)) { - includeFacts |= AncestorFacts.NonStaticClassElement; + includeFacts |= HierarchyFacts.NonStaticClassElement; } break; case SyntaxKind.FunctionExpression: const emitFlags = getEmitFlags(node); if (emitFlags & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; + includeFacts |= HierarchyFacts.CapturesThis; } if (emitFlags & EmitFlags.AsyncFunctionBody) { - excludeFacts &= ~AncestorFacts.NonStaticClassElement; - includeFacts |= AncestorFacts.AsyncFunctionBody; + excludeFacts &= ~HierarchyFacts.NonStaticClassElement; + includeFacts |= HierarchyFacts.AsyncFunctionBody; } break; case SyntaxKind.FunctionDeclaration: if (getEmitFlags(node) & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; + includeFacts |= HierarchyFacts.CapturesThis; } break; case SyntaxKind.Block: - if (ancestorFacts & AncestorFacts.IterationStatement) { - includeFacts = includeFacts & ~AncestorFacts.Block | AncestorFacts.IterationStatementBlock; - excludeFacts |= AncestorFacts.Block; + if (hierarchyFacts & HierarchyFacts.IterationStatement) { + includeFacts = includeFacts & ~HierarchyFacts.Block | HierarchyFacts.IterationStatementBlock; + excludeFacts |= HierarchyFacts.Block; } break; } } - ancestorFacts = ancestorFacts & ~excludeFacts | includeFacts; + hierarchyFacts = hierarchyFacts & ~excludeFacts | includeFacts; + } + + function getSubtreeFacts() { + return hierarchyFacts & HierarchyFacts.SubtreeFactsMask; + } + + function resetSubtreeFacts() { + hierarchyFacts = getAncestorFacts(); + } + + function propagateHierarchyFacts(savedHierarchyFacts: HierarchyFacts, propagateSubtreeMask: HierarchyFacts, propagateSubtreeFacts: HierarchyFacts) { + const subtreeFacts = getSubtreeFacts(); + hierarchyFacts = savedHierarchyFacts; + if (subtreeFacts & propagateSubtreeMask) { + hierarchyFacts |= propagateSubtreeFacts & HierarchyFacts.SubtreeFactsMask; + } } function isReturnVoidStatementInConstructorWithCapturedSuper(node: Node): boolean { - return ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper + return hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && node.kind === SyntaxKind.ReturnStatement && !(node).expression; } @@ -318,7 +357,7 @@ namespace ts { function shouldVisitNode(node: Node): boolean { return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 || convertedLoopState !== undefined - || (ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper && isStatement(node)) + || (hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && isStatement(node)) || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } @@ -460,6 +499,9 @@ namespace ts { case SyntaxKind.ThisKeyword: return visitThisKeyword(node); + case SyntaxKind.MetaProperty: + return visitMetaProperty(node); + case SyntaxKind.MethodDeclaration: return visitMethodDeclaration(node); @@ -479,15 +521,17 @@ namespace ts { } function visitSourceFile(node: SourceFile): SourceFile { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.SourceFileExcludes, AncestorFacts.SourceFileIncludes); + const savedHierarchyFacts = hierarchyFacts; + setAncestorFacts(HierarchyFacts.SourceFileExcludes, HierarchyFacts.SourceFileIncludes); + const statements: Statement[] = []; startLexicalEnvironment(); const statementOffset = addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset)); addRange(statements, endLexicalEnvironment()); - ancestorFacts = savedAncestorFacts; + + hierarchyFacts = savedHierarchyFacts; return updateSourceFileNode( node, createNodeArray(statements, node.statements) @@ -507,10 +551,10 @@ namespace ts { } function visitCaseBlock(node: CaseBlock): CaseBlock { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const savedAncestorFacts = getAncestorFacts(); + setAncestorFacts(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } @@ -545,7 +589,7 @@ namespace ts { function visitThisKeyword(node: Node): Node { if (convertedLoopState) { - if (ancestorFacts & AncestorFacts.ArrowFunction) { + if (hierarchyFacts & HierarchyFacts.ArrowFunction) { // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. convertedLoopState.containsLexicalThis = true; return node; @@ -826,11 +870,12 @@ namespace ts { * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { - const savedAncestorFacts = ancestorFacts; + const savedHierarchyFacts = hierarchyFacts; const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.ConstructorExcludes, AncestorFacts.ConstructorIncludes); convertedLoopState = undefined; + setAncestorFacts(HierarchyFacts.ConstructorExcludes, HierarchyFacts.ConstructorIncludes); + resetSubtreeFacts(); const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); @@ -852,8 +897,7 @@ namespace ts { } statements.push(constructorFunction); - - ancestorFacts = savedAncestorFacts; + hierarchyFacts = savedHierarchyFacts; convertedLoopState = savedConvertedLoopState; } @@ -915,7 +959,7 @@ namespace ts { if (constructor) { if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture) { - ancestorFacts |= AncestorFacts.ConstructorWithCapturedSuper; + hierarchyFacts |= HierarchyFacts.ConstructorWithCapturedSuper; } addRange(statements, visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); @@ -934,6 +978,11 @@ namespace ts { } addRange(statements, endLexicalEnvironment()); + + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); + } + const block = createBlock( createNodeArray( statements, @@ -1374,6 +1423,73 @@ namespace ts { statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements: Statement[], node: FunctionLikeDeclaration, copyOnWrite: boolean): Statement[] { + if (hierarchyFacts & HierarchyFacts.NewTarget) { + let newTarget: Expression; + switch (node.kind) { + case SyntaxKind.ArrowFunction: + return statements; + + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + // Methods and accessors cannot be constructors, so 'new.target' will + // always return 'undefined'. + newTarget = createVoidZero(); + break; + + case SyntaxKind.Constructor: + // Class constructors can only be called with `new`, so `this.constructor` + // should be relatively safe to use. + newTarget = createPropertyAccess( + setEmitFlags(createThis(), EmitFlags.NoSubstitution), + "constructor" + ); + break; + + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + // Functions can be called or constructed, and may have a `this` due to + // being a member or when calling an imported function via `other_1.f()`. + newTarget = createConditional( + createLogicalAnd( + setEmitFlags(createThis(), EmitFlags.NoSubstitution), + createBinary( + setEmitFlags(createThis(), EmitFlags.NoSubstitution), + SyntaxKind.InstanceOfKeyword, + getLocalName(node) + ) + ), + createPropertyAccess( + setEmitFlags(createThis(), EmitFlags.NoSubstitution), + "constructor" + ), + createVoidZero() + ); + break; + } + + const captureNewTargetStatement = createVariableStatement( + /*modifiers*/ undefined, + createVariableDeclarationList([ + createVariableDeclaration( + "_newTarget", + /*type*/ undefined, + newTarget + ) + ]) + ); + + if (copyOnWrite) { + return [captureNewTargetStatement, ...statements]; + } + + statements.unshift(captureNewTargetStatement); + } + + return statements; + } + /** * Adds statements to the class body function for a class to define the members of the * class. @@ -1428,6 +1544,9 @@ namespace ts { * @param member The MethodDeclaration node. */ function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration, container: Node) { + const savedHierarchyFacts = hierarchyFacts; + resetSubtreeFacts(); + const commentRange = getCommentRange(member); const sourceMapRange = getSourceMapRange(member); const memberName = createMemberAccessForPropertyName(receiver, visitNode(member.name, visitor, isPropertyName), /*location*/ member.name); @@ -1447,6 +1566,8 @@ namespace ts { // No source map should be emitted for this statement to align with the // old emitter. setEmitFlags(statement, EmitFlags.NoSourceMap); + + propagateHierarchyFacts(savedHierarchyFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.NewTarget); return statement; } @@ -1476,6 +1597,9 @@ namespace ts { * @param receiver The receiver for the member. */ function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression { + const savedHierarchyFacts = hierarchyFacts; + resetSubtreeFacts(); + // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); @@ -1522,6 +1646,8 @@ namespace ts { if (startsOnNewLine) { call.startsOnNewLine = true; } + + propagateHierarchyFacts(savedHierarchyFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.NewTarget); return call; } @@ -1535,10 +1661,10 @@ namespace ts { enableSubstitutionsForCapturedThis(); } - const savedAncestorFacts = ancestorFacts; + const savedAncestorFacts = getAncestorFacts(); const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.ArrowFunctionExcludes, AncestorFacts.ArrowFunctionIncludes); + setAncestorFacts(HierarchyFacts.ArrowFunctionExcludes, HierarchyFacts.ArrowFunctionIncludes); convertedLoopState = undefined; const func = createFunctionExpression( @@ -1554,7 +1680,7 @@ namespace ts { setOriginalNode(func, node); setEmitFlags(func, EmitFlags.CapturesThis); - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); convertedLoopState = savedConvertedLoopState; return func; } @@ -1565,27 +1691,32 @@ namespace ts { * @param node a FunctionExpression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - const savedAncestorFacts = ancestorFacts; + const savedHierarchyFacts = hierarchyFacts; const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + setAncestorFacts(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes, node); + resetSubtreeFacts(); convertedLoopState = undefined; - const updated = updateFunctionExpression( + const parameters = visitParameterList(node.parameters, visitor, context); + const body = node.transformFlags & TransformFlags.ES2015 + ? transformFunctionBody(node) + : visitFunctionBodyDownLevel(node); + const name = hierarchyFacts & HierarchyFacts.NewTarget + ? getLocalName(node) + : node.name; + + hierarchyFacts = savedHierarchyFacts; + convertedLoopState = savedConvertedLoopState; + return updateFunctionExpression( node, /*modifiers*/ undefined, - node.name, + name, /*typeParameters*/ undefined, - visitParameterList(node.parameters, visitor, context), + parameters, /*type*/ undefined, - node.transformFlags & TransformFlags.ES2015 - ? transformFunctionBody(node) - : visitFunctionBody(node.body, functionBodyVisitor, context) + body ); - - ancestorFacts = savedAncestorFacts; - convertedLoopState = savedConvertedLoopState; - return updated; } /** @@ -1594,28 +1725,33 @@ namespace ts { * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node: FunctionDeclaration): FunctionDeclaration { - const savedAncestorFacts = ancestorFacts; + const savedHierarchyFacts = hierarchyFacts; const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + setAncestorFacts(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes, node); + resetSubtreeFacts(); convertedLoopState = undefined; - const updated = updateFunctionDeclaration( + const parameters = visitParameterList(node.parameters, visitor, context); + const body = node.transformFlags & TransformFlags.ES2015 + ? transformFunctionBody(node) + : visitFunctionBodyDownLevel(node); + const name = hierarchyFacts & HierarchyFacts.NewTarget + ? getLocalName(node) + : node.name; + + hierarchyFacts = savedHierarchyFacts; + convertedLoopState = savedConvertedLoopState; + return updateFunctionDeclaration( node, /*decorators*/ undefined, visitNodes(node.modifiers, visitor, isModifier), - node.name, + name, /*typeParameters*/ undefined, - visitParameterList(node.parameters, visitor, context), + parameters, /*type*/ undefined, - node.transformFlags & TransformFlags.ES2015 - ? transformFunctionBody(node) - : visitFunctionBody(node.body, functionBodyVisitor, context) + body ); - - ancestorFacts = savedAncestorFacts; - convertedLoopState = savedConvertedLoopState; - return updated; } /** @@ -1626,29 +1762,34 @@ namespace ts { * @param name The name of the new FunctionExpression. */ function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier, container: Node): FunctionExpression { - const savedAncestorFacts = ancestorFacts; + const savedHierarchyFacts = hierarchyFacts; const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node, container); + setAncestorFacts(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes, node, container); + resetSubtreeFacts(); convertedLoopState = undefined; - const expression = setOriginalNode( + const parameters = visitParameterList(node.parameters, visitor, context); + const body = transformFunctionBody(node); + if (hierarchyFacts & HierarchyFacts.NewTarget && !name && (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.FunctionExpression)) { + name = getGeneratedNameForNode(node); + } + + hierarchyFacts = savedHierarchyFacts; + convertedLoopState = savedConvertedLoopState; + return setOriginalNode( createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, /*typeParameters*/ undefined, - visitParameterList(node.parameters, visitor, context), + parameters, /*type*/ undefined, - transformFunctionBody(node), + body, location ), /*original*/ node ); - - ancestorFacts = savedAncestorFacts; - convertedLoopState = savedConvertedLoopState; - return expression; } /** @@ -1723,6 +1864,8 @@ namespace ts { const lexicalEnvironment = context.endLexicalEnvironment(); addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); + // If we added any final generated statements, this must be a multi-line block if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; @@ -1741,12 +1884,23 @@ namespace ts { return block; } + function visitFunctionBodyDownLevel(node: FunctionDeclaration | FunctionExpression) { + const updated = visitFunctionBody(node.body, functionBodyVisitor, context); + return updateBlock( + updated, + createNodeArray( + prependCaptureNewTargetIfNeeded(updated.statements, node, /*copyOnWrite*/ true), + /*location*/ updated.statements + ) + ); + } + function visitBlock(node: Block, isFunctionBody: boolean): Block { if (!isFunctionBody) { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockExcludes, AncestorFacts.BlockIncludes, node); + const savedAncestorFacts = getAncestorFacts(); + setAncestorFacts(HierarchyFacts.BlockExcludes, HierarchyFacts.BlockIncludes, node); const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } @@ -1811,13 +1965,13 @@ namespace ts { } function visitVariableStatement(node: VariableStatement): Statement { - const savedAncestorFacts = ancestorFacts; + const savedAncestorFacts = getAncestorFacts(); if (hasModifier(node, ModifierFlags.Export)) { - ancestorFacts |= AncestorFacts.ExportedVariableStatement; + hierarchyFacts |= HierarchyFacts.ExportedVariableStatement; } let updated: Statement; - if (convertedLoopState && (getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) == 0) { + if (convertedLoopState && (node.declarationList.flags & NodeFlags.BlockScoped) == 0) { // we are inside a converted loop - hoist variable declarations let assignments: Expression[]; for (const decl of node.declarationList.declarations) { @@ -1850,7 +2004,7 @@ namespace ts { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } @@ -1939,18 +2093,18 @@ namespace ts { const isCapturedInFunction = flags & NodeCheckFlags.CapturedBlockScopedBinding; const isDeclaredInLoop = flags & NodeCheckFlags.BlockScopedBindingInLoop; const emittedAsTopLevel = - (ancestorFacts & AncestorFacts.TopLevel) !== 0 + (hierarchyFacts & HierarchyFacts.TopLevel) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && (ancestorFacts & AncestorFacts.IterationStatementBlock) !== 0); + && (hierarchyFacts & HierarchyFacts.IterationStatementBlock) !== 0); const emitExplicitInitializer = !emittedAsTopLevel - && (ancestorFacts & AncestorFacts.ForInOrForOfStatement) === 0 + && (hierarchyFacts & HierarchyFacts.ForInOrForOfStatement) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && (ancestorFacts & (AncestorFacts.ForStatement | AncestorFacts.ForInOrForOfStatement)) === 0)); + && (hierarchyFacts & (HierarchyFacts.ForStatement | HierarchyFacts.ForInOrForOfStatement)) === 0)); return emitExplicitInitializer; } @@ -1984,8 +2138,8 @@ namespace ts { * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node: VariableDeclaration): VisitResult { - const savedAncestorFacts = ancestorFacts; - ancestorFacts &= ~AncestorFacts.ExportedVariableStatement; + const savedAncestorFacts = getAncestorFacts(); + hierarchyFacts &= ~HierarchyFacts.ExportedVariableStatement; let updated: VisitResult; if (isBindingPattern(node.name)) { @@ -1995,14 +2149,14 @@ namespace ts { context, FlattenLevel.All, /*value*/ undefined, - (savedAncestorFacts & AncestorFacts.ExportedVariableStatement) !== 0 + (savedAncestorFacts & HierarchyFacts.ExportedVariableStatement) !== 0 ); } else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } @@ -2044,42 +2198,42 @@ namespace ts { ); } - function visitIterationStatementWithFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { - const savedAncestorFacts = ancestorFacts; + function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { + const savedAncestorFacts = getAncestorFacts(); setAncestorFacts(excludeFacts, includeFacts, node); const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } function visitDoOrWhileStatement(node: DoStatement | WhileStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.DoOrWhileStatementExcludes, - AncestorFacts.DoOrWhileStatementIncludes, + HierarchyFacts.DoOrWhileStatementExcludes, + HierarchyFacts.DoOrWhileStatementIncludes, node, outermostLabeledStatement); } function visitForStatement(node: ForStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForStatementExcludes, - AncestorFacts.ForStatementIncludes, + HierarchyFacts.ForStatementExcludes, + HierarchyFacts.ForStatementIncludes, node, outermostLabeledStatement); } function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement); } function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement, convertForOfToFor); @@ -2285,7 +2439,7 @@ namespace ts { let numInitialPropertiesWithoutYield = numProperties; for (let i = 0; i < numProperties; i++) { const property = properties[i]; - if ((property.transformFlags & TransformFlags.ContainsYield && ancestorFacts & AncestorFacts.AsyncFunctionBody) + if ((property.transformFlags & TransformFlags.ContainsYield && hierarchyFacts & HierarchyFacts.AsyncFunctionBody) && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } @@ -2442,7 +2596,7 @@ namespace ts { } const isAsyncBlockContainingAwait = - ancestorFacts & AncestorFacts.AsyncFunctionBody + hierarchyFacts & HierarchyFacts.AsyncFunctionBody && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; let loopBodyFlags: EmitFlags = 0; @@ -2828,6 +2982,8 @@ namespace ts { * @param receiver The receiver for the assignment. */ function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, container: Node, startsOnNewLine: boolean) { + const savedHierarchyFacts = hierarchyFacts; + resetSubtreeFacts(); const expression = createAssignment( createMemberAccessForPropertyName( receiver, @@ -2839,12 +2995,14 @@ namespace ts { if (startsOnNewLine) { expression.startsOnNewLine = true; } + + propagateHierarchyFacts(savedHierarchyFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.NewTarget); return expression; } function visitCatchClause(node: CatchClause): CatchClause { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const savedAncestorFacts = getAncestorFacts(); + setAncestorFacts(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); let updated: CatchClause; if (isBindingPattern(node.variableDeclaration.name)) { const temp = createTempVariable(undefined); @@ -2863,7 +3021,7 @@ namespace ts { else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + restoreAncestorFacts(savedAncestorFacts); return updated; } @@ -2898,15 +3056,17 @@ namespace ts { * @param node An AccessorDeclaration node. */ function visitAccessorDeclaration(node: AccessorDeclaration): AccessorDeclaration { - const savedAncestorFacts = ancestorFacts; + Debug.assert(!isComputedPropertyName(node.name)); + + const savedHierarchyFacts = hierarchyFacts; const savedConvertedLoopState = convertedLoopState; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + setAncestorFacts(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes, node); convertedLoopState = undefined; const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; + hierarchyFacts = savedHierarchyFacts; convertedLoopState = savedConvertedLoopState; return updated; } @@ -2925,9 +3085,18 @@ namespace ts { } function visitComputedPropertyName(node: ComputedPropertyName) { - return visitEachChild(node, visitor, context); + const savedHierarchyFacts = hierarchyFacts; + + setAncestorFacts(HierarchyFacts.ComputedPropertyNameExcludes, HierarchyFacts.ArrowFunctionIncludes); + resetSubtreeFacts(); + + const updated = visitEachChild(node, visitor, context); + + propagateHierarchyFacts(savedHierarchyFacts, HierarchyFacts.PropagateNewTargetMask, HierarchyFacts.NewTargetInComputedPropertyName); + return updated; } + /** * Visits a YieldExpression node. * @@ -3297,12 +3466,25 @@ namespace ts { * Visits the `super` keyword */ function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression { - return ancestorFacts & AncestorFacts.NonStaticClassElement + return hierarchyFacts & HierarchyFacts.NonStaticClassElement && !isExpressionOfCall ? createPropertyAccess(createIdentifier("_super"), "prototype") : createIdentifier("_super"); } + function visitMetaProperty(node: MetaProperty) { + if (node.keywordToken === SyntaxKind.NewKeyword && node.name.text === "target") { + if (hierarchyFacts & HierarchyFacts.ComputedPropertyName) { + hierarchyFacts |= HierarchyFacts.NewTargetInComputedPropertyName; + } + else { + hierarchyFacts |= HierarchyFacts.NewTarget; + } + return createIdentifier("_newTarget"); + } + return node; + } + /** * Called by the printer just before a node is printed. * @@ -3311,10 +3493,10 @@ namespace ts { function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + const savedHierarchyFacts = hierarchyFacts; + setAncestorFacts(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes, node); previousOnEmitNode(emitContext, node, emitCallback); - ancestorFacts = savedAncestorFacts; + hierarchyFacts = savedHierarchyFacts; return; } previousOnEmitNode(emitContext, node, emitCallback); @@ -3445,7 +3627,7 @@ namespace ts { */ function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis - && ancestorFacts & AncestorFacts.CapturesThis) { + && hierarchyFacts & HierarchyFacts.CapturesThis) { return createIdentifier("_this", /*location*/ node); } return node; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c1592d30eae..dcba3672d78 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -253,6 +253,7 @@ namespace ts { ExpressionWithTypeArguments, AsExpression, NonNullExpression, + MetaProperty, // Misc TemplateSpan, @@ -1444,6 +1445,14 @@ namespace ts { expression: Expression; } + // NOTE: MetaProperty is really a MemberExpression, but we consider it a PrimaryExpression + // for the same reasons we treat NewExpression as a PrimaryExpression. + export interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } + /// A JSX expression of the form ... export interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; @@ -2713,6 +2722,7 @@ namespace ts { TypeChecked = 0x00000001, // Node has been type checked LexicalThis = 0x00000002, // Lexical 'this' reference CaptureThis = 0x00000004, // Lexical 'this' used in body + CaptureNewTarget = 0x00000008, // Lexical 'new.target' used in body SuperInstance = 0x00000100, // Instance 'super' reference SuperStatic = 0x00000200, // Static 'super' reference ContextChecked = 0x00000400, // Contextual types have been assigned diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 328f80abc5c..ff619f07020 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -996,6 +996,20 @@ namespace ts { } } + export function getNewTargetContainer(node: Node) { + const container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (container) { + switch (container.kind) { + case SyntaxKind.Constructor: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + return container; + } + } + + return undefined; + } + /** * Given an super call/property node, returns the closest node where * - a super call/property access is legal in the node and not legal in the parent node the node. @@ -1203,6 +1217,7 @@ namespace ts { case SyntaxKind.JsxSelfClosingElement: case SyntaxKind.YieldExpression: case SyntaxKind.AwaitExpression: + case SyntaxKind.MetaProperty: return true; case SyntaxKind.QualifiedName: while (node.parent.kind === SyntaxKind.QualifiedName) { @@ -3892,6 +3907,7 @@ namespace ts { || kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.SuperKeyword || kind === SyntaxKind.NonNullExpression + || kind === SyntaxKind.MetaProperty || kind === SyntaxKind.RawExpression; } diff --git a/tests/baselines/reference/invalidNewTarget.es5.errors.txt b/tests/baselines/reference/invalidNewTarget.es5.errors.txt new file mode 100644 index 00000000000..080267c36eb --- /dev/null +++ b/tests/baselines/reference/invalidNewTarget.es5.errors.txt @@ -0,0 +1,78 @@ +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(1,11): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(2,17): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(5,6): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(6,18): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(7,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(8,20): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(9,15): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(11,13): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(12,25): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(13,29): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(14,27): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(15,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(19,6): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(20,18): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(21,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(22,20): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts(23,8): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + +==== tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts (17 errors) ==== + const a = new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + const b = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + class C { + [new.target]() { } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + c() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + get d() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + set e(_) { _ = new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + f = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + static [new.target]() { } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static g() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static get h() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static set i(_) { _ = new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static j = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + } + + const O = { + [new.target]: undefined, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + k() { return new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + get l() { return new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + set m(_) { _ = new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + n: new.target, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + }; \ No newline at end of file diff --git a/tests/baselines/reference/invalidNewTarget.es5.js b/tests/baselines/reference/invalidNewTarget.es5.js new file mode 100644 index 00000000000..866dac270af --- /dev/null +++ b/tests/baselines/reference/invalidNewTarget.es5.js @@ -0,0 +1,77 @@ +//// [invalidNewTarget.es5.ts] +const a = new.target; +const b = () => new.target; + +class C { + [new.target]() { } + c() { return new.target; } + get d() { return new.target; } + set e(_) { _ = new.target; } + f = () => new.target; + + static [new.target]() { } + static g() { return new.target; } + static get h() { return new.target; } + static set i(_) { _ = new.target; } + static j = () => new.target; +} + +const O = { + [new.target]: undefined, + k() { return new.target; }, + get l() { return new.target; }, + set m(_) { _ = new.target; }, + n: new.target, +}; + +//// [invalidNewTarget.es5.js] +var a = _newTarget; +var b = function () { return _newTarget; }; +var C = (function () { + function C() { + var _newTarget = this.constructor; + this.f = function () { return _newTarget; }; + } + C.prototype[_newTarget] = function () { }; + C.prototype.c = function () { var _newTarget = void 0; return _newTarget; }; + Object.defineProperty(C.prototype, "d", { + get: function () { var _newTarget = void 0; return _newTarget; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "e", { + set: function (_) { var _newTarget = void 0; _ = _newTarget; }, + enumerable: true, + configurable: true + }); + C[_newTarget] = function () { }; + C.g = function () { var _newTarget = void 0; return _newTarget; }; + Object.defineProperty(C, "h", { + get: function () { var _newTarget = void 0; return _newTarget; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "i", { + set: function (_) { var _newTarget = void 0; _ = _newTarget; }, + enumerable: true, + configurable: true + }); + return C; +}()); +C.j = function () { return _newTarget; }; +var O = (_a = {}, + _a[_newTarget] = undefined, + _a.k = function () { var _newTarget = void 0; return _newTarget; }, + Object.defineProperty(_a, "l", { + get: function () { var _newTarget = void 0; return _newTarget; }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "m", { + set: function (_) { var _newTarget = void 0; _ = _newTarget; }, + enumerable: true, + configurable: true + }), + _a.n = _newTarget, + _a); +var _a; diff --git a/tests/baselines/reference/invalidNewTarget.es6.errors.txt b/tests/baselines/reference/invalidNewTarget.es6.errors.txt new file mode 100644 index 00000000000..ee5404ed781 --- /dev/null +++ b/tests/baselines/reference/invalidNewTarget.es6.errors.txt @@ -0,0 +1,78 @@ +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(1,11): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(2,17): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(5,6): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(6,18): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(7,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(8,20): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(9,15): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(11,13): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(12,25): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(13,29): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(14,27): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(15,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(19,6): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(20,18): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(21,22): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(22,20): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. +tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts(23,8): error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + +==== tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts (17 errors) ==== + const a = new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + const b = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + class C { + [new.target]() { } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + c() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + get d() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + set e(_) { _ = new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + f = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + + static [new.target]() { } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static g() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static get h() { return new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static set i(_) { _ = new.target; } + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + static j = () => new.target; + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + } + + const O = { + [new.target]: undefined, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + k() { return new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + get l() { return new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + set m(_) { _ = new.target; }, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + n: new.target, + ~~~~~~~~~~ +!!! error TS17013: Meta-property 'new.target' is only allowed in the body of a function declaration, function expression, or constructor. + }; \ No newline at end of file diff --git a/tests/baselines/reference/invalidNewTarget.es6.js b/tests/baselines/reference/invalidNewTarget.es6.js new file mode 100644 index 00000000000..ed1b2cc1592 --- /dev/null +++ b/tests/baselines/reference/invalidNewTarget.es6.js @@ -0,0 +1,50 @@ +//// [invalidNewTarget.es6.ts] +const a = new.target; +const b = () => new.target; + +class C { + [new.target]() { } + c() { return new.target; } + get d() { return new.target; } + set e(_) { _ = new.target; } + f = () => new.target; + + static [new.target]() { } + static g() { return new.target; } + static get h() { return new.target; } + static set i(_) { _ = new.target; } + static j = () => new.target; +} + +const O = { + [new.target]: undefined, + k() { return new.target; }, + get l() { return new.target; }, + set m(_) { _ = new.target; }, + n: new.target, +}; + +//// [invalidNewTarget.es6.js] +const a = new.target; +const b = () => new.target; +class C { + constructor() { + this.f = () => new.target; + } + [new.target]() { } + c() { return new.target; } + get d() { return new.target; } + set e(_) { _ = new.target; } + static [new.target]() { } + static g() { return new.target; } + static get h() { return new.target; } + static set i(_) { _ = new.target; } +} +C.j = () => new.target; +const O = { + [new.target]: undefined, + k() { return new.target; }, + get l() { return new.target; }, + set m(_) { _ = new.target; }, + n: new.target, +}; diff --git a/tests/baselines/reference/newTarget.es5.js b/tests/baselines/reference/newTarget.es5.js new file mode 100644 index 00000000000..0de967d5477 --- /dev/null +++ b/tests/baselines/reference/newTarget.es5.js @@ -0,0 +1,74 @@ +//// [newTarget.es5.ts] +class A { + constructor() { + const a = new.target; + const b = () => new.target; + } + static c = function () { return new.target; } + d = function () { return new.target; } +} + +class B extends A { + constructor() { + super(); + const e = new.target; + const f = () => new.target; + } +} + +function f1() { + const g = new.target; + const h = () => new.target; +} + +const f2 = function () { + const i = new.target; + const j = () => new.target; +} + +const O = { + k: function () { return new.target; } +}; + + + +//// [newTarget.es5.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var A = (function () { + function A() { + var _newTarget = this.constructor; + this.d = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; }; + var a = _newTarget; + var b = function () { return _newTarget; }; + } + return A; +}()); +A.c = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; }; +var B = (function (_super) { + __extends(B, _super); + function B() { + var _newTarget = this.constructor; + var _this = _super.call(this) || this; + var e = _newTarget; + var f = function () { return _newTarget; }; + return _this; + } + return B; +}(A)); +function f1() { + var _newTarget = this && this instanceof f1 ? this.constructor : void 0; + var g = _newTarget; + var h = function () { return _newTarget; }; +} +var f2 = function _b() { + var _newTarget = this && this instanceof _b ? this.constructor : void 0; + var i = _newTarget; + var j = function () { return _newTarget; }; +}; +var O = { + k: function _c() { var _newTarget = this && this instanceof _c ? this.constructor : void 0; return _newTarget; } +}; diff --git a/tests/baselines/reference/newTarget.es5.symbols b/tests/baselines/reference/newTarget.es5.symbols new file mode 100644 index 00000000000..34cdb3f34c3 --- /dev/null +++ b/tests/baselines/reference/newTarget.es5.symbols @@ -0,0 +1,63 @@ +=== tests/cases/conformance/es6/newTarget/newTarget.es5.ts === +class A { +>A : Symbol(A, Decl(newTarget.es5.ts, 0, 0)) + + constructor() { + const a = new.target; +>a : Symbol(a, Decl(newTarget.es5.ts, 2, 13)) + + const b = () => new.target; +>b : Symbol(b, Decl(newTarget.es5.ts, 3, 13)) + } + static c = function () { return new.target; } +>c : Symbol(A.c, Decl(newTarget.es5.ts, 4, 5)) + + d = function () { return new.target; } +>d : Symbol(A.d, Decl(newTarget.es5.ts, 5, 49)) +} + +class B extends A { +>B : Symbol(B, Decl(newTarget.es5.ts, 7, 1)) +>A : Symbol(A, Decl(newTarget.es5.ts, 0, 0)) + + constructor() { + super(); +>super : Symbol(A, Decl(newTarget.es5.ts, 0, 0)) + + const e = new.target; +>e : Symbol(e, Decl(newTarget.es5.ts, 12, 13)) + + const f = () => new.target; +>f : Symbol(f, Decl(newTarget.es5.ts, 13, 13)) + } +} + +function f1() { +>f1 : Symbol(f1, Decl(newTarget.es5.ts, 15, 1)) + + const g = new.target; +>g : Symbol(g, Decl(newTarget.es5.ts, 18, 9)) + + const h = () => new.target; +>h : Symbol(h, Decl(newTarget.es5.ts, 19, 9)) +} + +const f2 = function () { +>f2 : Symbol(f2, Decl(newTarget.es5.ts, 22, 5)) + + const i = new.target; +>i : Symbol(i, Decl(newTarget.es5.ts, 23, 9)) + + const j = () => new.target; +>j : Symbol(j, Decl(newTarget.es5.ts, 24, 9)) +} + +const O = { +>O : Symbol(O, Decl(newTarget.es5.ts, 27, 5)) + + k: function () { return new.target; } +>k : Symbol(k, Decl(newTarget.es5.ts, 27, 11)) + +}; + + diff --git a/tests/baselines/reference/newTarget.es5.types b/tests/baselines/reference/newTarget.es5.types new file mode 100644 index 00000000000..ddbe78537b2 --- /dev/null +++ b/tests/baselines/reference/newTarget.es5.types @@ -0,0 +1,95 @@ +=== tests/cases/conformance/es6/newTarget/newTarget.es5.ts === +class A { +>A : A + + constructor() { + const a = new.target; +>a : typeof A +>new.target : typeof A +>target : any + + const b = () => new.target; +>b : () => typeof A +>() => new.target : () => typeof A +>new.target : typeof A +>target : any + } + static c = function () { return new.target; } +>c : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any + + d = function () { return new.target; } +>d : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any +} + +class B extends A { +>B : B +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + + const e = new.target; +>e : typeof B +>new.target : typeof B +>target : any + + const f = () => new.target; +>f : () => typeof B +>() => new.target : () => typeof B +>new.target : typeof B +>target : any + } +} + +function f1() { +>f1 : () => void + + const g = new.target; +>g : () => void +>new.target : () => void +>target : any + + const h = () => new.target; +>h : () => () => void +>() => new.target : () => () => void +>new.target : () => void +>target : any +} + +const f2 = function () { +>f2 : () => void +>function () { const i = new.target; const j = () => new.target;} : () => void + + const i = new.target; +>i : () => void +>new.target : () => void +>target : any + + const j = () => new.target; +>j : () => () => void +>() => new.target : () => () => void +>new.target : () => void +>target : any +} + +const O = { +>O : { k: () => any; } +>{ k: function () { return new.target; }} : { k: () => any; } + + k: function () { return new.target; } +>k : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any + +}; + + diff --git a/tests/baselines/reference/newTarget.es6.js b/tests/baselines/reference/newTarget.es6.js new file mode 100644 index 00000000000..2bd95ff9f98 --- /dev/null +++ b/tests/baselines/reference/newTarget.es6.js @@ -0,0 +1,61 @@ +//// [newTarget.es6.ts] +class A { + constructor() { + const a = new.target; + const b = () => new.target; + } + static c = function () { return new.target; } + d = function () { return new.target; } +} + +class B extends A { + constructor() { + super(); + const e = new.target; + const f = () => new.target; + } +} + +function f1() { + const g = new.target; + const h = () => new.target; +} + +const f2 = function () { + const i = new.target; + const j = () => new.target; +} + +const O = { + k: function () { return new.target; } +}; + + + +//// [newTarget.es6.js] +class A { + constructor() { + this.d = function () { return new.target; }; + const a = new.target; + const b = () => new.target; + } +} +A.c = function () { return new.target; }; +class B extends A { + constructor() { + super(); + const e = new.target; + const f = () => new.target; + } +} +function f1() { + const g = new.target; + const h = () => new.target; +} +const f2 = function () { + const i = new.target; + const j = () => new.target; +}; +const O = { + k: function () { return new.target; } +}; diff --git a/tests/baselines/reference/newTarget.es6.symbols b/tests/baselines/reference/newTarget.es6.symbols new file mode 100644 index 00000000000..b20ea3dba93 --- /dev/null +++ b/tests/baselines/reference/newTarget.es6.symbols @@ -0,0 +1,63 @@ +=== tests/cases/conformance/es6/newTarget/newTarget.es6.ts === +class A { +>A : Symbol(A, Decl(newTarget.es6.ts, 0, 0)) + + constructor() { + const a = new.target; +>a : Symbol(a, Decl(newTarget.es6.ts, 2, 13)) + + const b = () => new.target; +>b : Symbol(b, Decl(newTarget.es6.ts, 3, 13)) + } + static c = function () { return new.target; } +>c : Symbol(A.c, Decl(newTarget.es6.ts, 4, 5)) + + d = function () { return new.target; } +>d : Symbol(A.d, Decl(newTarget.es6.ts, 5, 49)) +} + +class B extends A { +>B : Symbol(B, Decl(newTarget.es6.ts, 7, 1)) +>A : Symbol(A, Decl(newTarget.es6.ts, 0, 0)) + + constructor() { + super(); +>super : Symbol(A, Decl(newTarget.es6.ts, 0, 0)) + + const e = new.target; +>e : Symbol(e, Decl(newTarget.es6.ts, 12, 13)) + + const f = () => new.target; +>f : Symbol(f, Decl(newTarget.es6.ts, 13, 13)) + } +} + +function f1() { +>f1 : Symbol(f1, Decl(newTarget.es6.ts, 15, 1)) + + const g = new.target; +>g : Symbol(g, Decl(newTarget.es6.ts, 18, 9)) + + const h = () => new.target; +>h : Symbol(h, Decl(newTarget.es6.ts, 19, 9)) +} + +const f2 = function () { +>f2 : Symbol(f2, Decl(newTarget.es6.ts, 22, 5)) + + const i = new.target; +>i : Symbol(i, Decl(newTarget.es6.ts, 23, 9)) + + const j = () => new.target; +>j : Symbol(j, Decl(newTarget.es6.ts, 24, 9)) +} + +const O = { +>O : Symbol(O, Decl(newTarget.es6.ts, 27, 5)) + + k: function () { return new.target; } +>k : Symbol(k, Decl(newTarget.es6.ts, 27, 11)) + +}; + + diff --git a/tests/baselines/reference/newTarget.es6.types b/tests/baselines/reference/newTarget.es6.types new file mode 100644 index 00000000000..08ef8429b3c --- /dev/null +++ b/tests/baselines/reference/newTarget.es6.types @@ -0,0 +1,95 @@ +=== tests/cases/conformance/es6/newTarget/newTarget.es6.ts === +class A { +>A : A + + constructor() { + const a = new.target; +>a : typeof A +>new.target : typeof A +>target : any + + const b = () => new.target; +>b : () => typeof A +>() => new.target : () => typeof A +>new.target : typeof A +>target : any + } + static c = function () { return new.target; } +>c : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any + + d = function () { return new.target; } +>d : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any +} + +class B extends A { +>B : B +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + + const e = new.target; +>e : typeof B +>new.target : typeof B +>target : any + + const f = () => new.target; +>f : () => typeof B +>() => new.target : () => typeof B +>new.target : typeof B +>target : any + } +} + +function f1() { +>f1 : () => void + + const g = new.target; +>g : () => void +>new.target : () => void +>target : any + + const h = () => new.target; +>h : () => () => void +>() => new.target : () => () => void +>new.target : () => void +>target : any +} + +const f2 = function () { +>f2 : () => void +>function () { const i = new.target; const j = () => new.target;} : () => void + + const i = new.target; +>i : () => void +>new.target : () => void +>target : any + + const j = () => new.target; +>j : () => () => void +>() => new.target : () => () => void +>new.target : () => void +>target : any +} + +const O = { +>O : { k: () => any; } +>{ k: function () { return new.target; }} : { k: () => any; } + + k: function () { return new.target; } +>k : () => any +>function () { return new.target; } : () => any +>new.target : () => any +>target : any + +}; + + diff --git a/tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts b/tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts new file mode 100644 index 00000000000..cda2d4d2ce7 --- /dev/null +++ b/tests/cases/conformance/es6/newTarget/invalidNewTarget.es5.ts @@ -0,0 +1,25 @@ +// @target: es5 +const a = new.target; +const b = () => new.target; + +class C { + [new.target]() { } + c() { return new.target; } + get d() { return new.target; } + set e(_) { _ = new.target; } + f = () => new.target; + + static [new.target]() { } + static g() { return new.target; } + static get h() { return new.target; } + static set i(_) { _ = new.target; } + static j = () => new.target; +} + +const O = { + [new.target]: undefined, + k() { return new.target; }, + get l() { return new.target; }, + set m(_) { _ = new.target; }, + n: new.target, +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts b/tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts new file mode 100644 index 00000000000..5043c160e10 --- /dev/null +++ b/tests/cases/conformance/es6/newTarget/invalidNewTarget.es6.ts @@ -0,0 +1,25 @@ +// @target: es6 +const a = new.target; +const b = () => new.target; + +class C { + [new.target]() { } + c() { return new.target; } + get d() { return new.target; } + set e(_) { _ = new.target; } + f = () => new.target; + + static [new.target]() { } + static g() { return new.target; } + static get h() { return new.target; } + static set i(_) { _ = new.target; } + static j = () => new.target; +} + +const O = { + [new.target]: undefined, + k() { return new.target; }, + get l() { return new.target; }, + set m(_) { _ = new.target; }, + n: new.target, +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/newTarget/newTarget.es5.ts b/tests/cases/conformance/es6/newTarget/newTarget.es5.ts new file mode 100644 index 00000000000..b912f5f0596 --- /dev/null +++ b/tests/cases/conformance/es6/newTarget/newTarget.es5.ts @@ -0,0 +1,32 @@ +// @target: es5 +class A { + constructor() { + const a = new.target; + const b = () => new.target; + } + static c = function () { return new.target; } + d = function () { return new.target; } +} + +class B extends A { + constructor() { + super(); + const e = new.target; + const f = () => new.target; + } +} + +function f1() { + const g = new.target; + const h = () => new.target; +} + +const f2 = function () { + const i = new.target; + const j = () => new.target; +} + +const O = { + k: function () { return new.target; } +}; + diff --git a/tests/cases/conformance/es6/newTarget/newTarget.es6.ts b/tests/cases/conformance/es6/newTarget/newTarget.es6.ts new file mode 100644 index 00000000000..de61a49334a --- /dev/null +++ b/tests/cases/conformance/es6/newTarget/newTarget.es6.ts @@ -0,0 +1,32 @@ +// @target: es6 +class A { + constructor() { + const a = new.target; + const b = () => new.target; + } + static c = function () { return new.target; } + d = function () { return new.target; } +} + +class B extends A { + constructor() { + super(); + const e = new.target; + const f = () => new.target; + } +} + +function f1() { + const g = new.target; + const h = () => new.target; +} + +const f2 = function () { + const i = new.target; + const j = () => new.target; +} + +const O = { + k: function () { return new.target; } +}; + From c0a73b2ed84ab0b542fd301274924ad782f09d47 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 8 Dec 2016 18:27:49 -0800 Subject: [PATCH 123/289] Revert changes to core.ts --- src/compiler/core.ts | 61 +++----------------------------------------- 1 file changed, 4 insertions(+), 57 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 70674d400c3..72c09e490c3 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -571,32 +571,13 @@ namespace ts { * @param copyOnWrite Indicates whether to return a fresh array rather than modify the * existing array. */ - export function append(to: T[] | undefined, value: T | undefined, copyOnWrite?: boolean): T[] | undefined { + export function append(to: T[] | undefined, value: T | undefined): T[] | undefined { if (value === undefined) return to; if (to === undefined) return [value]; - if (copyOnWrite) return [...to, value]; to.push(value); return to; } - /** - * Prepends a value to an array, returning the array. - * - * @param to The array to which `value` is to be prepended. If `to` is `undefined`, a new array - * is created if `value` was prepended. - * @param value The value to prepend to the array. If `value` is `undefined`, nothing is - * prepended. - * @param copyOnWrite Indicates whether to return a fresh array rather than modify the - * existing array. - */ - export function prepend(to: T[] | undefined, value: T | undefined, copyOnWrite?: boolean): T[] | undefined { - if (value === undefined) return to; - if (to === undefined) return [value]; - if (copyOnWrite) return [value, ...to]; - to.unshift(value); - return to; - } - /** * Appends a range of value to an array, returning the array. * @@ -604,45 +585,11 @@ namespace ts { * is created if `value` was appended. * @param from The values to append to the array. If `from` is `undefined`, nothing is * appended. If an element of `from` is `undefined`, that element is not appended. - * @param copyOnWrite Indicates whether to return a fresh array rather than modify the - * existing array. */ - export function addRange(to: T[] | undefined, from: T[] | undefined, copyOnWrite?: boolean): T[] | undefined { + export function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined { if (from === undefined) return to; - from = filter(from, isDefined); - if (to === undefined) return from; - if (from.length > 0) { - if (copyOnWrite) { - return [...to, ...from]; - } - for (const v of from) { - to.push(v); - } - } - return to; - } - - /** - * Appends a range of value to an array, returning the array. - * - * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array - * is created if `value` was appended. - * @param from The values to append to the array. If `from` is `undefined`, nothing is - * appended. If an element of `from` is `undefined`, that element is not appended. - * @param copyOnWrite Indicates whether to return a fresh array rather than modify the - * existing array. - */ - export function prependRange(to: T[] | undefined, from: T[] | undefined, copyOnWrite?: boolean): T[] | undefined { - if (from === undefined) return to; - from = filter(from, isDefined); - if (to === undefined) return from; - if (from.length > 0) { - if (copyOnWrite) { - return [...from, ...to]; - } - for (let i = from.length - 1; i >= 0; i--) { - to.unshift(from[i]); - } + for (const v of from) { + to = append(to, v); } return to; } From 819a654bb30acc817343f02db221a1c1c233f575 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 8 Dec 2016 18:34:35 -0800 Subject: [PATCH 124/289] Add tests and fix rest parameters --- src/services/codefixes/helpers.ts | 23 ++++++++++++++----- ...eFixUnImplementedInterfaceMissingMethod.ts | 13 ----------- ...ementedInterfaceMissingMethodWithParams.ts | 4 ++-- ...tedInterfaceMissingMethodWithReturnType.ts | 13 ----------- ...ementedInterfaceMultipleSignaturesRest1.ts | 18 +++++++++++++++ ...ementedInterfaceMultipleSignaturesRest2.ts | 18 +++++++++++++++ 6 files changed, 55 insertions(+), 34 deletions(-) delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts create mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 4b921c1a81c..d0a005f8c8a 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -114,18 +114,29 @@ namespace ts.codefix { newSignatureDeclaration.parameters = createNodeArray(); for (let i = 0; i < maxArgs - 1; i++) { - const newParameter = createParameterDeclaration(i, minArgumentCount, newSignatureDeclaration); + const newParameter = createParameterDeclaration(i, minArgumentCount, anyTypeNode, newSignatureDeclaration); newSignatureDeclaration.parameters.push(newParameter); } - const lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, newSignatureDeclaration); + let lastParameter: ParameterDeclaration; if (hasRestParameter) { - lastParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); + + const anyArrayTypeNode = createNode(SyntaxKind.ArrayType) as ArrayTypeNode; + anyArrayTypeNode.elementType = anyTypeNode; if (!allMaxArgsAreRest) { - const newParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, newSignatureDeclaration); + const newParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyTypeNode, newSignatureDeclaration); newSignatureDeclaration.parameters.push(newParameter); + lastParameter = createParameterDeclaration(maxArgs, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); } + else { + lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); + } + + lastParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); + } + else { + lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyTypeNode, newSignatureDeclaration); } newSignatureDeclaration.parameters.push(lastParameter); @@ -135,12 +146,12 @@ namespace ts.codefix { return checker.getSignatureFromDeclaration(newSignatureDeclaration); - function createParameterDeclaration(index: number, minArgCount: number, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { + function createParameterDeclaration(index: number, minArgCount: number, typeNode: TypeNode, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, "arg" + index); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; - newParameter.type = anyTypeNode; + newParameter.type = typeNode; newParameter.parent = enclosingSignatureDeclaration; if (index >= minArgCount) { newParameter.questionToken = optionalToken; diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts deleted file mode 100644 index b5ba2e20697..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethod.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -//// interface I { -//// f1(); -//// } -//// -//// class C implements I {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(){ - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts index f0b1e669b46..0ee842975e0 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts @@ -1,14 +1,14 @@ /// //// interface I { -//// f(x: number, y: string) +//// f(x: number, y: string): I //// } //// //// class C implements I {[| //// |]} verify.rangeAfterCodeFix(` -f(x: number,y: string){ +f(x: number,y: string): I { throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts deleted file mode 100644 index c85f1d0043a..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithReturnType.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -//// interface I { -//// f1(): string; -//// } -//// -//// class C implements I {[| -//// |]} - -verify.rangeAfterCodeFix(`f1(): string { - throw new Error('Method not implemented.'); -} -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts new file mode 100644 index 00000000000..a473b9dccbe --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts @@ -0,0 +1,18 @@ +/// + +//// interface I { +//// method(a: number, ...b: string[]): boolean; +//// method(a: string, ...b: number[]): Function; +//// method(a: string): Function; +//// } +//// +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + method(a: number, ...b: string[]): boolean; + method(a: string, ...b: number[]): Function; + method(a: string): Function; + method(arg0: any, ...arg1?: any[]) { + throw new Error('Method not implemented.'); + } +`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts new file mode 100644 index 00000000000..7cacbda171b --- /dev/null +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts @@ -0,0 +1,18 @@ +/// + +//// interface I { +//// method(a: number, ...b: string[]): boolean; +//// method(a: string, b: number): Function; +//// method(a: string): Function; +//// } +//// +//// class C implements I {[| |]} + +verify.rangeAfterCodeFix(` + method(a: number, ...b: string[]): boolean; + method(a: string, b: number): Function; + method(a: string): Function; + method(arg0: any, arg1?: any, ...arg2?: any[]) { + throw new Error('Method not implemented.'); + } +`); From 5e48e339dd4903fa4826d0af599bc59856c98569 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Thu, 8 Dec 2016 18:34:49 -0800 Subject: [PATCH 125/289] cleanup --- .../codefixes/fixClassDoesntImplementInheritedAbstractMember.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 2ce45a64bc3..cfb771e2324 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -12,7 +12,7 @@ namespace ts.codefix { const classDecl = token.parent; const startPos = classDecl.members.pos; - const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)); + const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)) as InterfaceType; // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const extendsSymbols = checker.getPropertiesOfType(InstantiatedExtendsType); From 1338b94b2c63b4b4e94d01933c61ef0dfdba0610 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 9 Dec 2016 10:48:17 -0800 Subject: [PATCH 126/289] Simplify rest parameter handling --- src/services/codefixes/helpers.ts | 36 ++++++++----------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index d0a005f8c8a..d2122d95382 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -92,54 +92,36 @@ namespace ts.codefix { newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; - let maxArgs = -1; + let maxNonRestArgs = -1; let minArgumentCount = signatures[0].minArgumentCount; let hasRestParameter = false; - let allMaxArgsAreRest = true; for (let i = 0; i < signatures.length; i++) { const sig = signatures[i]; minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); - if (sig.parameters.length > maxArgs) { - maxArgs = sig.parameters.length; - allMaxArgsAreRest = sig.hasRestParameter; - } - else if (sig.parameters.length === maxArgs) { - allMaxArgsAreRest = allMaxArgsAreRest && sig.hasRestParameter; - } hasRestParameter = hasRestParameter || sig.hasRestParameter; + const nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); + if (nonRestLength > maxNonRestArgs) { + maxNonRestArgs = nonRestLength; + } } const anyTypeNode: TypeNode = createNode(SyntaxKind.AnyKeyword) as TypeNode; const optionalToken = createToken(SyntaxKind.QuestionToken); newSignatureDeclaration.parameters = createNodeArray(); - for (let i = 0; i < maxArgs - 1; i++) { + for (let i = 0; i < maxNonRestArgs; i++) { const newParameter = createParameterDeclaration(i, minArgumentCount, anyTypeNode, newSignatureDeclaration); newSignatureDeclaration.parameters.push(newParameter); } - let lastParameter: ParameterDeclaration; if (hasRestParameter) { - const anyArrayTypeNode = createNode(SyntaxKind.ArrayType) as ArrayTypeNode; anyArrayTypeNode.elementType = anyTypeNode; - if (!allMaxArgsAreRest) { - const newParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyTypeNode, newSignatureDeclaration); - newSignatureDeclaration.parameters.push(newParameter); - lastParameter = createParameterDeclaration(maxArgs, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); - } - else { - lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); - } - - lastParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); + const restParameter = createParameterDeclaration(maxNonRestArgs, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); + restParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); + newSignatureDeclaration.parameters.push(restParameter); } - else { - lastParameter = createParameterDeclaration(maxArgs - 1, minArgumentCount, anyTypeNode, newSignatureDeclaration); - } - - newSignatureDeclaration.parameters.push(lastParameter); newSignatureDeclaration.type = anyTypeNode; newSignatureDeclaration.type.parent = newSignatureDeclaration; From b9ae36cfbee88109cea0b4e035230f02e5e3a2f3 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 9 Dec 2016 13:25:58 -0800 Subject: [PATCH 127/289] Simplify index signature generation --- src/compiler/checker.ts | 21 ++++++++----- src/compiler/types.ts | 4 +-- .../fixClassIncorrectlyImplementsInterface.ts | 31 +++++++++---------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f75ba15254b..862e3d4f932 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2037,7 +2037,7 @@ namespace ts { return result; } - function indexSignatureToString(info: IndexInfo, kind: SyntaxKind, enclosingDeclaration?: Node): string { + function indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string { const writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration); const result = writer.string(); @@ -2557,8 +2557,8 @@ namespace ts { writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } - buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, SyntaxKind.StringKeyword, enclosingDeclaration, globalFlags, symbolStack); - buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, SyntaxKind.NumberKeyword, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, IndexKind.String, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, IndexKind.Number, enclosingDeclaration, globalFlags, symbolStack); for (const p of resolved.properties) { const t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { @@ -2791,10 +2791,7 @@ namespace ts { buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } - /** - * @param keyword The keyword for the type of IndexSignature. Must be one of SyntaxKind.NumberKeyword or SyntaxKind.StringKeyword. - */ - function buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, keyword: SyntaxKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]) { + function buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]) { if (info) { if (info.isReadonly) { writeKeyword(writer, SyntaxKind.ReadonlyKeyword); @@ -2804,7 +2801,15 @@ namespace ts { writer.writeParameter(info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : "x"); writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); - writeKeyword(writer, keyword); + switch (kind) { + case IndexKind.Number: + writeKeyword(writer, SyntaxKind.NumberKeyword); + break; + case IndexKind.String: + writeKeyword(writer, SyntaxKind.StringKeyword); + break; + } + writePunctuation(writer, SyntaxKind.CloseBracketToken); writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 81b4005ae5e..dfb71e29540 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2353,7 +2353,7 @@ namespace ts { getTypeAtLocation(node: Node): Type; getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; - indexSignatureToString(info: IndexInfo, kind: SyntaxKind, enclosingDeclaration?: Node): string; + indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; createSymbol(flags: SymbolFlags, name: string): Symbol; @@ -2398,7 +2398,7 @@ namespace ts { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; - buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, keyword: SyntaxKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 11db00eb43c..900b2c21720 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -22,29 +22,16 @@ namespace ts.codefix { const hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.String); for (const implementedTypeNode of implementedTypeNodes) { - const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceTypeWithDeclaredMembers; + const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceType; // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); - let insertion = ""; - - if (!hasNumericIndexSignature) { - const typeNumericIndexInfo = checker.getIndexInfoOfType(implementedType, IndexKind.Number); - if (typeNumericIndexInfo) { - insertion = checker.indexSignatureToString(typeNumericIndexInfo, SyntaxKind.NumberKeyword, classDecl); - } - } - - if (!hasStringIndexSignature) { - const typeStringIndexInfo = checker.getIndexInfoOfType(implementedType, IndexKind.String); - if (typeStringIndexInfo) { - insertion += checker.indexSignatureToString(typeStringIndexInfo, SyntaxKind.StringKeyword, classDecl); - } - } - + let insertion = getMissingIndexSignatureInsertion(implementedType, IndexKind.Number, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, IndexKind.String, classDecl, hasStringIndexSignature); insertion += getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + const message = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); if (insertion) { pushAction(result, insertion, message); @@ -53,6 +40,16 @@ namespace ts.codefix { return result; + function getMissingIndexSignatureInsertion(type: InterfaceType, kind: IndexKind, enclosingDeclaration: ClassLikeDeclaration, hasIndexSigOfKind: boolean) { + if (!hasIndexSigOfKind) { + const IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + return checker.indexSignatureToString(IndexInfoOfKind, kind, enclosingDeclaration); + } + } + return ""; + } + function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { const decls = symbol.getDeclarations(); Debug.assert(!!(decls && decls.length > 0)); From 469745b1819c32851f61c04bb5032e3e035d1e4d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Sun, 11 Dec 2016 21:50:46 -0800 Subject: [PATCH 128/289] Synthetic signature uses existing parameter names --- .../fixClassDoesntImplementInheritedAbstractMember.ts | 2 +- src/services/codefixes/helpers.ts | 5 ++++- tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts | 2 +- ...plementedInterfaceComputedPropertyNameWellKnownSymbols.ts | 2 +- .../codeFixUnImplementedInterfaceMultipleSignatures.ts | 2 +- .../codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts | 2 +- .../codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index cfb771e2324..86463b60f35 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -20,7 +20,7 @@ namespace ts.codefix { const insertion = getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); - if (insertion) { + if (insertion.length) { return [{ description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), changes: [{ diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index d2122d95382..1bc4278144f 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -93,6 +93,7 @@ namespace ts.codefix { newSignatureDeclaration.name = signatures[0].getDeclaration().name; let maxNonRestArgs = -1; + let maxArgsIndex = 0; let minArgumentCount = signatures[0].minArgumentCount; let hasRestParameter = false; for (let i = 0; i < signatures.length; i++) { @@ -102,8 +103,10 @@ namespace ts.codefix { const nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); if (nonRestLength > maxNonRestArgs) { maxNonRestArgs = nonRestLength; + maxArgsIndex = i; } } + const maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(symbol => symbol.getName()); const anyTypeNode: TypeNode = createNode(SyntaxKind.AnyKeyword) as TypeNode; const optionalToken = createToken(SyntaxKind.QuestionToken); @@ -130,7 +133,7 @@ namespace ts.codefix { function createParameterDeclaration(index: number, minArgCount: number, typeNode: TypeNode, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; - newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, "arg" + index); + newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; newParameter.type = typeNode; diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts index 587b5d9b2b7..a657dfeb718 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts @@ -12,7 +12,7 @@ verify.rangeAfterCodeFix(` f(a: number, b: string): boolean; f(a: string, b: number): Function; f(a: string): Function; - f(arg0: any, arg1?: any) { + f(a: any, b?: any) { throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts index 8a6e7e8f2d8..7c1156acd78 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts @@ -44,7 +44,7 @@ verify.rangeAfterCodeFix(` [Symbol.toPrimitive](hint: "number"): number; [Symbol.toPrimitive](hint: "default"): number; [Symbol.toPrimitive](hint: "string"): string; - [Symbol.toPrimitive](arg0: any) { + [Symbol.toPrimitive](hint: any) { throw new Error('Method not implemented.'); } [Symbol.toStringTag]: string; diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts index ce777567e1e..bda58b3767d 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts @@ -12,7 +12,7 @@ verify.rangeAfterCodeFix(` method(a: number, b: string): boolean; method(a: string, b: number): Function; method(a: string): Function; - method(arg0: any, arg1?: any) { + method(a: any, b?: any) { throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts index a473b9dccbe..6e0a272a42a 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts @@ -12,7 +12,7 @@ verify.rangeAfterCodeFix(` method(a: number, ...b: string[]): boolean; method(a: string, ...b: number[]): Function; method(a: string): Function; - method(arg0: any, ...arg1?: any[]) { + method(a: any, ...b?: any[]) { throw new Error('Method not implemented.'); } `); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts index 7cacbda171b..7ba7ae2c98c 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts @@ -12,7 +12,7 @@ verify.rangeAfterCodeFix(` method(a: number, ...b: string[]): boolean; method(a: string, b: number): Function; method(a: string): Function; - method(arg0: any, arg1?: any, ...arg2?: any[]) { + method(a: any, b?: any, ...rest?: any[]) { throw new Error('Method not implemented.'); } `); From ad011108e60e26f8d38caee388e1da747e30eedc Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Sun, 11 Dec 2016 22:07:49 -0800 Subject: [PATCH 129/289] Consolidate Tests --- ...FixUnImplementedClassMissingPropertyModifiers.ts} | 5 +++++ ...codeFixUnImplementedInterfaceMethodWithParams.ts} | 0 .../codeFixUnImplementedInterfaceMissingProperty.ts | 11 ----------- ...mplementedInterfaceMissingPropertyIntersection.ts | 12 ------------ ...codeFixUnImplementedInterfaceNamespaceConflict.ts | 2 +- ...nterfacePropertyFromParentConstructorFunction.ts} | 0 ...FixUnImplementedInterfaceSomePropertiesPresent.ts | 4 ++-- ...eFixUnimplementedInterfaceMultipleImplements1.ts} | 0 ...eFixUnimplementedInterfaceMultipleImplements2.ts} | 0 ...entedInterfaceMultipleImplementsIntersection1.ts} | 0 ...entedInterfaceMultipleImplementsIntersection2.ts} | 0 ...ementedInterfaceMultipleMembersAndPunctuation.ts} | 0 12 files changed, 8 insertions(+), 26 deletions(-) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingAbstractProperty.ts => codeFixUnImplementedClassMissingPropertyModifiers.ts} (56%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingMethodWithParams.ts => codeFixUnImplementedInterfaceMethodWithParams.ts} (100%) delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts delete mode 100644 tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts => codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplements1.ts => codeFixUnimplementedInterfaceMultipleImplements1.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplements2.ts => codeFixUnimplementedInterfaceMultipleImplements2.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts => codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts => codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts => codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts} (100%) diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyModifiers.ts similarity index 56% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts rename to tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyModifiers.ts index 25edca0964e..a40ffc8aeb0 100644 --- a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractProperty.ts +++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyModifiers.ts @@ -2,10 +2,15 @@ //// abstract class A { //// abstract x: number; +//// private y: number; +//// protected z: number; +//// public w: number; //// } //// //// class C implements A {[| |]} verify.rangeAfterCodeFix(` x: number; +protected z: number; +public w: number; `); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMethodWithParams.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingMethodWithParams.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfaceMethodWithParams.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts deleted file mode 100644 index 4e08a30cde4..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingProperty.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -//// interface I1 { -//// x: number; -//// } -//// -//// class C1 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(`x: number; -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts deleted file mode 100644 index 5221810bc40..00000000000 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyIntersection.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -//// interface I1 { -//// x: number & { __iBrand: any }; -//// } -//// -//// class C1 implements I1 {[| -//// |]} - -verify.rangeAfterCodeFix(` -x: number & { __iBrand: any; }; -`); diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts index 8e0a35c7fe7..4fea72aa48f 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts @@ -14,4 +14,4 @@ verify.rangeAfterCodeFix(` x: number; -`); +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts b/tests/cases/fourslash/codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMissingPropertyFromParentConstructorFunction.ts rename to tests/cases/fourslash/codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts index 6fea1a38d1b..6e0658019f5 100644 --- a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts +++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts @@ -3,7 +3,7 @@ //// interface I { //// x: number; //// y: number; -//// z: number; +//// z: number & { __iBrand: any }; //// } //// //// class C implements I {[| |] @@ -12,5 +12,5 @@ //// } verify.rangeAfterCodeFix(` -z: number; +z: number & { __iBrand: any; }; `); diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements1.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements1.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements1.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplements2.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements2.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection1.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleImplementsIntersection2.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleMembersAndPunctuation.ts rename to tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts From 5c304d0d0f3d4e08d0bd11ea48a479cbc422c417 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 12 Dec 2016 08:15:55 -0800 Subject: [PATCH 130/289] Remove `createObject`; use `Object.create` directly. --- src/compiler/core.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index fd9eedeeece..4ed20bcdecf 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -26,10 +26,9 @@ namespace ts { // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. export const collator: { compare(a: string, b: string): number } = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - const createObject = Object.create; /** Create a MapLike with good performance. Prefer this over a literal `{}`. */ export function createMapLike(): MapLike { - const map = createObject(null); // tslint:disable-line:no-null-keyword + const map = Object.create(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. // This disables creation of hidden classes, which are expensive when an object is From b53b5cf4ab8f60090cc6ad764d9cfae718d3a50e Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 12 Dec 2016 08:42:12 -0800 Subject: [PATCH 131/289] Remove the "set" function and use `map.set` with multiple lines of code if necessary. --- src/compiler/binder.ts | 7 ++- src/compiler/checker.ts | 52 ++++++++++++++++------ src/compiler/core.ts | 15 ++----- src/compiler/emitter.ts | 3 +- src/compiler/parser.ts | 6 ++- src/compiler/program.ts | 10 +++-- src/compiler/transformers/module/module.ts | 3 +- src/compiler/transformers/module/system.ts | 6 ++- src/compiler/tsc.ts | 7 ++- src/compiler/utilities.ts | 4 +- src/harness/harness.ts | 8 ++-- src/server/client.ts | 3 +- src/services/patternMatcher.ts | 6 ++- src/services/services.ts | 6 ++- 14 files changed, 91 insertions(+), 45 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 18a6d00e922..046b67ccd1c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -349,7 +349,10 @@ namespace ts { // Otherwise, we'll be merging into a compatible existing symbol (for example when // you have multiple 'vars' with the same name in the same container). In this case // just add this node into the declarations list of the symbol. - symbol = symbolTable.get(name) || set(symbolTable, name, createSymbol(SymbolFlags.None, name)); + symbol = symbolTable.get(name); + if (!symbol) { + symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name)); + } if (name && (includes & SymbolFlags.Classifiable)) { classifiableNames.set(name, name); @@ -359,7 +362,7 @@ namespace ts { if (symbol.isReplaceableByMethod) { // Javascript constructor-declared symbols can be discarded in favor of // prototype symbols like methods. - symbol = set(symbolTable, name, createSymbol(SymbolFlags.None, name)); + symbolTable.set(name, symbol = createSymbol(SymbolFlags.None, name)); } else { if (node.name) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6bbbab8822e..2394d5017a3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4062,7 +4062,8 @@ namespace ts { const memberSymbol = getSymbolOfNode(member); const value = getEnumMemberValue(member); if (!memberTypes.has(value)) { - const memberType = set(memberTypes, value, createEnumLiteralType(memberSymbol, enumType, "" + value)); + const memberType = createEnumLiteralType(memberSymbol, enumType, "" + value); + memberTypes.set(value, memberType); memberTypeList.push(memberType); } } @@ -5192,7 +5193,11 @@ namespace ts { function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { const instantiations = signature.instantiations || (signature.instantiations = createMap()); const id = getTypeListId(typeArguments); - return instantiations.get(id) || set(instantiations, id, createSignatureInstantiation(signature, typeArguments)); + let instantiation = instantiations.get(id); + if (!instantiation) { + instantiations.set(id, instantiation = createSignatureInstantiation(signature, typeArguments)); + } + return instantiation; } function createSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { @@ -5348,7 +5353,8 @@ namespace ts { const id = getTypeListId(typeArguments); let type = target.instantiations.get(id); if (!type) { - type = set(target.instantiations, id, createObjectType(ObjectFlags.Reference, target.symbol)); + type = createObjectType(ObjectFlags.Reference, target.symbol); + target.instantiations.set(id, type); type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; @@ -5395,7 +5401,11 @@ namespace ts { const links = getSymbolLinks(symbol); const typeParameters = links.typeParameters; const id = getTypeListId(typeArguments); - return links.instantiations.get(id) || set(links.instantiations, id, instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + let instantiation = links.instantiations.get(id); + if (!instantiation) { + links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } + return instantiation; } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include @@ -5844,7 +5854,8 @@ namespace ts { let type = unionTypes.get(id); if (!type) { const propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ TypeFlags.Nullable); - type = set(unionTypes, id, createType(TypeFlags.Union | propagatedFlags)); + type = createType(TypeFlags.Union | propagatedFlags); + unionTypes.set(id, type); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -5918,7 +5929,8 @@ namespace ts { let type = intersectionTypes.get(id); if (!type) { const propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ TypeFlags.Nullable); - type = set(intersectionTypes, id, createType(TypeFlags.Intersection | propagatedFlags)); + type = createType(TypeFlags.Intersection | propagatedFlags); + intersectionTypes.set(id, type); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; @@ -6100,7 +6112,11 @@ namespace ts { } // Otherwise we defer the operation by creating an indexed access type. const id = objectType.id + "," + indexType.id; - return indexedAccessTypes.get(id) || set(indexedAccessTypes, id, createIndexedAccessType(objectType, indexType)); + let type = indexedAccessTypes.get(id); + if (!type) { + indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType)); + } + return type; } // In the following we resolve T[K] to the type of the property in T selected by K. const apparentObjectType = getApparentType(objectType); @@ -6268,7 +6284,11 @@ namespace ts { function getLiteralTypeForText(flags: TypeFlags, text: string) { const map = flags & TypeFlags.StringLiteral ? stringLiteralTypes : numericLiteralTypes; - return map.get(text) || set(map, text, createLiteralType(flags, text)); + let type = map.get(text); + if (!type) { + map.set(text, type = createLiteralType(flags, text)); + } + return type; } function getTypeFromLiteralTypeNode(node: LiteralTypeNode): Type { @@ -7060,7 +7080,8 @@ namespace ts { if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & SymbolFlags.RegularEnum) || !(target.symbol.flags & SymbolFlags.RegularEnum) || (source.flags & TypeFlags.Union) !== (target.flags & TypeFlags.Union)) { - return set(enumRelation, id, false); + enumRelation.set(id, false); + return false; } const targetEnumType = getTypeOfSymbol(target.symbol); for (const property of getPropertiesOfType(getTypeOfSymbol(source.symbol))) { @@ -7071,11 +7092,13 @@ namespace ts { errorReporter(Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType)); } - return set(enumRelation, id, false); + enumRelation.set(id, false); + return false; } } } - return set(enumRelation, id, true); + enumRelation.set(id, true); + return true; } function isSimpleTypeRelatedTo(source: Type, target: Type, relation: Map, errorReporter?: ErrorReporter) { @@ -9815,7 +9838,8 @@ namespace ts { if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } - return set(cache, key, result); + cache.set(key, result); + return result; } function isMatchingReferenceDiscriminant(expr: Expression) { @@ -11771,9 +11795,9 @@ namespace ts { } function getJsxType(name: string) { - const jsxType = jsxTypes.get(name); + let jsxType = jsxTypes.get(name); if (jsxType === undefined) { - return set(jsxTypes, name, getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); + jsxTypes.set(name, jsxType = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType); } return jsxType; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 4ed20bcdecf..6239dc93146 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -156,15 +156,6 @@ namespace ts { } } - /** - * Unlike `map.set(key, value)`, this returns the value, making it useful as an expression. - * Prefer `map.set(key, value)` for statements. - */ - export function set(map: Map, key: MapKey, value: T): T { - map.set(key, value); - return value; - } - export function createFileMap(keyMapper?: (key: string) => string): FileMap { const files = createMap(); return { @@ -1050,14 +1041,14 @@ namespace ts { * Creates the array if it does not already exist. */ export function multiMapAdd(map: Map, key: string | number, value: V): V[] { - const values = map.get(key); + let values = map.get(key); if (values) { values.push(value); - return values; } else { - return set(map, key, [value]); + map.set(key, values = [value]); } + return values; } /** diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 191a39a5797..00144f2d00b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2545,7 +2545,8 @@ namespace ts { while (true) { const generatedName = baseName + i; if (isUniqueName(generatedName)) { - return set(generatedNameSet, generatedName, generatedName); + generatedNameSet.set(generatedName, generatedName); + return generatedName; } i++; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3da9093ee5a..bb53eeba0e0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1131,7 +1131,11 @@ namespace ts { function internIdentifier(text: string): string { text = escapeIdentifier(text); - return identifiers.get(text) || set(identifiers, text, text); + let identifier = identifiers.get(text); + if (identifier === undefined) { + identifiers.set(text, identifier = text); + } + return identifier; } // An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3da9f57ca39..ab04a21ee69 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -277,9 +277,13 @@ namespace ts { const resolutions: T[] = []; const cache = createMap(); for (const name of names) { - const result = cache.has(name) - ? cache.get(name) - : set(cache, name, loader(name, containingFile)); + let result: T; + if (cache.has(name)) { + result = cache.get(name); + } + else { + cache.set(name, result = loader(name, containingFile)); + } resolutions.push(result); } return resolutions; diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 2e926406fb4..5d05667e4c2 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -60,7 +60,8 @@ namespace ts { } currentSourceFile = node; - currentModuleInfo = set(moduleInfoMap, getOriginalNodeId(node), collectExternalModuleInfo(node, resolver, compilerOptions)); + currentModuleInfo = collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap.set(getOriginalNodeId(node), currentModuleInfo); // Perform the transformation. const transformModule = transformModuleDelegates.get(moduleKind) || transformModuleDelegates.get(ModuleKind.None); diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 8d1e1749c0b..bc613bcfaf6 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -73,11 +73,13 @@ namespace ts { // see comment to 'substitutePostfixUnaryExpression' for more details // Collect information about the external module and dependency groups. - moduleInfo = set(moduleInfoMap, id, collectExternalModuleInfo(node, resolver, compilerOptions)); + moduleInfo = collectExternalModuleInfo(node, resolver, compilerOptions); + moduleInfoMap.set(id, moduleInfo); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. - exportFunction = set(exportFunctionsMap, id, createUniqueName("exports")); + exportFunction = createUniqueName("exports"); + exportFunctionsMap.set(id, exportFunction); contextObject = createUniqueName("context"); // Add the body of the module. diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 0e66ccb14b8..5de16a20fc2 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -378,8 +378,11 @@ namespace ts { } function cachedFileExists(fileName: string): boolean { - const fileExists = cachedExistingFiles.get(fileName); - return fileExists !== undefined ? fileExists : set(cachedExistingFiles, fileName, hostFileExists(fileName)); + let fileExists = cachedExistingFiles.get(fileName); + if (fileExists === undefined) { + cachedExistingFiles.set(fileName, fileExists = hostFileExists(fileName)); + } + return fileExists; } function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 94b0fa20987..25973cae5cb 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3323,7 +3323,9 @@ namespace ts { for (const name in syntaxKindEnum) { if (syntaxKindEnum[name] === kind) { - return set(syntaxKindCache, kind, kind.toString() + " (" + name + ")"); + const result = `${kind} (${name})`; + syntaxKindCache.set(kind, result); + return result; } } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 265fe4c142c..c94a9360745 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -918,9 +918,11 @@ namespace Harness { return undefined; } - const sourceFile = libFileNameSourceFileMap.get(fileName); - return sourceFile || ts.set(libFileNameSourceFileMap, fileName, - createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest)); + let sourceFile = libFileNameSourceFileMap.get(fileName); + if (!sourceFile) { + libFileNameSourceFileMap.set(fileName, sourceFile = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest)); + } + return sourceFile; } export function getDefaultLibFileName(options: ts.CompilerOptions): string { diff --git a/src/server/client.ts b/src/server/client.ts index 13d16073d1c..d9e93769bd9 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -34,7 +34,8 @@ namespace ts.server { let lineMap = this.lineMaps.get(fileName); if (!lineMap) { const scriptSnapshot = this.host.getScriptSnapshot(fileName); - lineMap = set(this.lineMaps, fileName, ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength()))); + lineMap = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + this.lineMaps.set(fileName, lineMap); } return lineMap; } diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index b8941ef3147..940290a2f94 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -188,7 +188,11 @@ namespace ts { } function getWordSpans(word: string): TextSpan[] { - return stringToWordSpans.get(word) || set(stringToWordSpans, word, breakIntoWordSpans(word)); + let spans = stringToWordSpans.get(word); + if (!spans) { + stringToWordSpans.set(word, spans = breakIntoWordSpans(word)); + } + return spans; } function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { diff --git a/src/services/services.ts b/src/services/services.ts index 87ae9fb8561..6d0d384bcdd 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -532,7 +532,11 @@ namespace ts { } function getDeclarations(name: string) { - return result.get(name) || set(result, name, []); + let declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; } function getDeclarationName(declaration: Declaration) { From 7fce634e8547e3e54c75ee759824ab449bbd77ed Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Wed, 14 Dec 2016 23:54:59 +0900 Subject: [PATCH 132/289] merge --- .mailmap | 43 +- .travis.yml | 1 + AUTHORS.md | 33 + Jakefile.js | 1 + netci.groovy | 2 +- package.json | 2 +- src/compiler/binder.ts | 23 - src/compiler/checker.ts | 854 ++++++--- src/compiler/commandLineParser.ts | 19 +- src/compiler/comments.ts | 3 + src/compiler/core.ts | 36 +- src/compiler/declarationEmitter.ts | 7 + src/compiler/factory.ts | 14 +- src/compiler/parser.ts | 12 +- src/compiler/sourcemap.ts | 2 +- src/compiler/transformers/destructuring.ts | 2 +- src/compiler/transformers/es2015.ts | 10 +- src/compiler/transformers/module/system.ts | 25 +- src/compiler/transformers/ts.ts | 82 +- src/compiler/tsconfig.json | 3 +- src/compiler/types.ts | 85 +- src/compiler/utilities.ts | 71 +- src/harness/fourslash.ts | 65 +- src/harness/unittests/textStorage.ts | 70 + .../unittests/tsserverProjectSystem.ts | 335 +++- src/harness/unittests/typingsInstaller.ts | 114 +- src/lib/es2016.array.include.d.ts | 9 + src/lib/es2017.object.d.ts | 13 +- src/lib/es5.d.ts | 12 + src/server/builder.ts | 32 +- src/server/editorServices.ts | 160 +- src/server/lsHost.ts | 2 +- src/server/project.ts | 149 +- src/server/protocol.ts | 50 +- src/server/scriptInfo.ts | 232 ++- src/server/scriptVersionCache.ts | 5 +- src/server/server.ts | 84 +- src/server/session.ts | 15 +- src/server/shared.ts | 3 +- src/server/types.d.ts | 22 +- .../typingsInstaller/nodeTypingsInstaller.ts | 8 +- .../typingsInstaller/typingsInstaller.ts | 84 +- src/server/utilities.ts | 2 +- src/services/jsDoc.ts | 12 +- src/services/services.ts | 2 +- src/services/types.ts | 4 +- src/services/utilities.ts | 1 + .../reference/awaitInheritedPromise_es2017.js | 11 + .../awaitInheritedPromise_es2017.symbols | 15 + .../awaitInheritedPromise_es2017.types | 16 + .../reference/capturedLetConstInLoop9.js | 3 +- .../circularIndexedAccessErrors.errors.txt | 57 + .../reference/circularIndexedAccessErrors.js | 70 + .../reference/circularReferenceInImport.js | 27 + .../circularReferenceInImport.symbols | 23 + .../reference/circularReferenceInImport.types | 24 + .../classAbstractAccessor.errors.txt | 17 + .../reference/classAbstractAccessor.js | 28 + ...eclarationEmitIndexTypeNotFound.errors.txt | 17 + .../declarationEmitIndexTypeNotFound.js | 9 + .../decoratedClassExportsCommonJS1.js | 6 +- .../decoratedClassExportsCommonJS2.js | 6 +- .../reference/decoratedClassExportsSystem1.js | 6 +- .../reference/decoratedClassExportsSystem2.js | 6 +- ...orMetadataRestParameterWithImportedType.js | 112 ++ ...adataRestParameterWithImportedType.symbols | 77 + ...etadataRestParameterWithImportedType.types | 82 + .../decoratorOnClassAccessor7.errors.txt | 41 + .../reference/decoratorOnClassAccessor7.js | 125 ++ .../reference/decoratorOnClassAccessor8.js | 135 ++ .../decoratorOnClassAccessor8.symbols | 76 + .../reference/decoratorOnClassAccessor8.types | 81 + .../reference/decoratorOnClassConstructor4.js | 58 + .../decoratorOnClassConstructor4.symbols | 28 + .../decoratorOnClassConstructor4.types | 28 + .../decoratorWithUnderscoreMethod.js | 37 + .../decoratorWithUnderscoreMethod.symbols | 42 + .../decoratorWithUnderscoreMethod.types | 46 + .../reference/errorSuperCalls.errors.txt | 5 +- ...xhaustiveSwitchWithWideningLiteralTypes.js | 39 + ...tiveSwitchWithWideningLiteralTypes.symbols | 33 + ...ustiveSwitchWithWideningLiteralTypes.types | 40 + ...xplicitAnyAfterSpreadNoImplicitAnyError.js | 16 + ...itAnyAfterSpreadNoImplicitAnyError.symbols | 7 + ...icitAnyAfterSpreadNoImplicitAnyError.types | 13 + tests/baselines/reference/importHelpers.js | 6 +- .../importHelpersDeclarations.symbols | 8 + .../reference/importHelpersDeclarations.types | 8 + .../importHelpersInIsolatedModules.js | 6 +- .../importHelpersNoHelpers.errors.txt | 32 +- .../reference/importHelpersNoHelpers.js | 6 +- .../importHelpersNoModule.errors.txt | 7 +- .../reference/importHelpersNoModule.js | 6 +- .../inOperatorWithInvalidOperands.errors.txt | 8 +- .../intersectionTypeNormalization.js | 50 + .../intersectionTypeNormalization.symbols | 110 ++ .../intersectionTypeNormalization.types | 111 ++ .../intersectionTypeWithLeadingOperator.js | 10 + ...ntersectionTypeWithLeadingOperator.symbols | 20 + .../intersectionTypeWithLeadingOperator.types | 20 + .../invalidImportAliasIdentifiers.errors.txt | 4 +- .../invalidUseOfTypeAsNamespace.errors.txt | 11 + .../reference/invalidUseOfTypeAsNamespace.js | 8 + .../isomorphicMappedTypeInference.js | 330 ++++ .../isomorphicMappedTypeInference.symbols | 489 +++++ .../isomorphicMappedTypeInference.types | 587 ++++++ .../jsxFactoryQualifiedNameWithEs5.js | 27 + .../jsxFactoryQualifiedNameWithEs5.symbols | 23 + .../jsxFactoryQualifiedNameWithEs5.types | 27 + tests/baselines/reference/keyofAndForIn.js | 81 + .../baselines/reference/keyofAndForIn.symbols | 125 ++ tests/baselines/reference/keyofAndForIn.types | 134 ++ .../reference/keyofAndIndexedAccess.js | 394 +++- .../reference/keyofAndIndexedAccess.symbols | 1598 ++++++++++++----- .../reference/keyofAndIndexedAccess.types | 937 +++++++++- .../keyofAndIndexedAccessErrors.errors.txt | 26 +- .../reference/keyofAndIndexedAccessErrors.js | 21 + .../keyofIsLiteralContexualType.errors.txt | 28 + .../reference/keyofIsLiteralContexualType.js | 23 + .../reference/mappedTypeErrors.errors.txt | 109 +- tests/baselines/reference/mappedTypeErrors.js | 116 +- .../mappedTypeInferenceCircularity.js | 12 + .../mappedTypeInferenceCircularity.symbols | 26 + .../mappedTypeInferenceCircularity.types | 27 + .../reference/mappedTypeModifiers.js | 133 ++ .../reference/mappedTypeModifiers.symbols | 355 ++++ .../reference/mappedTypeModifiers.types | 355 ++++ tests/baselines/reference/mappedTypes1.js | 35 +- .../baselines/reference/mappedTypes1.symbols | 17 +- tests/baselines/reference/mappedTypes1.types | 20 +- tests/baselines/reference/mappedTypes2.js | 41 +- .../baselines/reference/mappedTypes2.symbols | 191 +- tests/baselines/reference/mappedTypes2.types | 75 +- tests/baselines/reference/mappedTypes4.js | 129 ++ .../baselines/reference/mappedTypes4.symbols | 198 ++ tests/baselines/reference/mappedTypes4.types | 213 +++ .../reference/nestedFreshLiteral.errors.txt | 31 + .../baselines/reference/nestedFreshLiteral.js | 19 + .../newLexicalEnvironmentForConvertedLoop.js | 31 + ...LexicalEnvironmentForConvertedLoop.symbols | 30 + ...ewLexicalEnvironmentForConvertedLoop.types | 45 + .../reference/objectFreeze.errors.txt | 22 + tests/baselines/reference/objectFreeze.js | 29 + tests/baselines/reference/objectRest.js | 8 +- tests/baselines/reference/objectRest.symbols | 7 + tests/baselines/reference/objectRest.types | 12 + .../reference/objectRestAssignment.js | 2 +- tests/baselines/reference/objectRestForOf.js | 2 +- .../reference/objectRestNegative.errors.txt | 13 +- .../baselines/reference/objectRestNegative.js | 8 +- .../reference/objectRestParameter.js | 2 +- .../baselines/reference/objectSpread.symbols | 1 - .../reference/objectSpreadNegative.errors.txt | 30 +- .../reference/objectSpreadNegative.js | 8 +- .../parserExportAssignment9.errors.txt | 8 +- tests/baselines/reference/restIntersection.js | 20 + .../reference/restIntersection.symbols | 19 + .../reference/restIntersection.types | 19 + .../restInvalidArgumentType.errors.txt | 104 ++ .../reference/restInvalidArgumentType.js | 115 ++ tests/baselines/reference/restUnion.js | 36 + tests/baselines/reference/restUnion.symbols | 44 + tests/baselines/reference/restUnion.types | 45 + tests/baselines/reference/restUnion2.js | 38 + tests/baselines/reference/restUnion2.symbols | 52 + tests/baselines/reference/restUnion2.types | 55 + .../selfReferencingSpreadInLoop.errors.txt | 14 + .../reference/selfReferencingSpreadInLoop.js | 13 + .../baselines/reference/spreadIntersection.js | 23 + .../reference/spreadIntersection.symbols | 26 + .../reference/spreadIntersection.types | 29 + .../spreadInvalidArgumentType.errors.txt | 104 ++ .../reference/spreadInvalidArgumentType.js | 114 ++ tests/baselines/reference/spreadUnion.js | 28 + tests/baselines/reference/spreadUnion.symbols | 38 + tests/baselines/reference/spreadUnion.types | 42 + tests/baselines/reference/spreadUnion2.js | 49 + .../baselines/reference/spreadUnion2.symbols | 74 + tests/baselines/reference/spreadUnion2.types | 84 + ...eReservedWordInClassDeclaration.errors.txt | 8 +- ...ubSubClassCanAccessProtectedConstructor.js | 51 + ...ClassCanAccessProtectedConstructor.symbols | 40 + ...ubClassCanAccessProtectedConstructor.types | 46 + .../reference/superAccess2.errors.txt | 11 +- .../superInConstructorParam1.errors.txt | 5 +- .../reference/superNewCall1.errors.txt | 5 +- 186 files changed, 11685 insertions(+), 1584 deletions(-) create mode 100644 src/harness/unittests/textStorage.ts create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.js create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.symbols create mode 100644 tests/baselines/reference/awaitInheritedPromise_es2017.types create mode 100644 tests/baselines/reference/circularIndexedAccessErrors.errors.txt create mode 100644 tests/baselines/reference/circularIndexedAccessErrors.js create mode 100644 tests/baselines/reference/circularReferenceInImport.js create mode 100644 tests/baselines/reference/circularReferenceInImport.symbols create mode 100644 tests/baselines/reference/circularReferenceInImport.types create mode 100644 tests/baselines/reference/classAbstractAccessor.errors.txt create mode 100644 tests/baselines/reference/classAbstractAccessor.js create mode 100644 tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt create mode 100644 tests/baselines/reference/declarationEmitIndexTypeNotFound.js create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols create mode 100644 tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types create mode 100644 tests/baselines/reference/decoratorOnClassAccessor7.errors.txt create mode 100644 tests/baselines/reference/decoratorOnClassAccessor7.js create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.js create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.symbols create mode 100644 tests/baselines/reference/decoratorOnClassAccessor8.types create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.js create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.symbols create mode 100644 tests/baselines/reference/decoratorOnClassConstructor4.types create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.js create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.symbols create mode 100644 tests/baselines/reference/decoratorWithUnderscoreMethod.types create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols create mode 100644 tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols create mode 100644 tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types create mode 100644 tests/baselines/reference/importHelpersDeclarations.symbols create mode 100644 tests/baselines/reference/importHelpersDeclarations.types create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.js create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols create mode 100644 tests/baselines/reference/intersectionTypeWithLeadingOperator.types create mode 100644 tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt create mode 100644 tests/baselines/reference/invalidUseOfTypeAsNamespace.js create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.js create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.symbols create mode 100644 tests/baselines/reference/isomorphicMappedTypeInference.types create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols create mode 100644 tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types create mode 100644 tests/baselines/reference/keyofAndForIn.js create mode 100644 tests/baselines/reference/keyofAndForIn.symbols create mode 100644 tests/baselines/reference/keyofAndForIn.types create mode 100644 tests/baselines/reference/keyofIsLiteralContexualType.errors.txt create mode 100644 tests/baselines/reference/keyofIsLiteralContexualType.js create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.js create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.symbols create mode 100644 tests/baselines/reference/mappedTypeInferenceCircularity.types create mode 100644 tests/baselines/reference/mappedTypeModifiers.js create mode 100644 tests/baselines/reference/mappedTypeModifiers.symbols create mode 100644 tests/baselines/reference/mappedTypeModifiers.types create mode 100644 tests/baselines/reference/mappedTypes4.js create mode 100644 tests/baselines/reference/mappedTypes4.symbols create mode 100644 tests/baselines/reference/mappedTypes4.types create mode 100644 tests/baselines/reference/nestedFreshLiteral.errors.txt create mode 100644 tests/baselines/reference/nestedFreshLiteral.js create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols create mode 100644 tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types create mode 100644 tests/baselines/reference/objectFreeze.errors.txt create mode 100644 tests/baselines/reference/objectFreeze.js create mode 100644 tests/baselines/reference/restIntersection.js create mode 100644 tests/baselines/reference/restIntersection.symbols create mode 100644 tests/baselines/reference/restIntersection.types create mode 100644 tests/baselines/reference/restInvalidArgumentType.errors.txt create mode 100644 tests/baselines/reference/restInvalidArgumentType.js create mode 100644 tests/baselines/reference/restUnion.js create mode 100644 tests/baselines/reference/restUnion.symbols create mode 100644 tests/baselines/reference/restUnion.types create mode 100644 tests/baselines/reference/restUnion2.js create mode 100644 tests/baselines/reference/restUnion2.symbols create mode 100644 tests/baselines/reference/restUnion2.types create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt create mode 100644 tests/baselines/reference/selfReferencingSpreadInLoop.js create mode 100644 tests/baselines/reference/spreadIntersection.js create mode 100644 tests/baselines/reference/spreadIntersection.symbols create mode 100644 tests/baselines/reference/spreadIntersection.types create mode 100644 tests/baselines/reference/spreadInvalidArgumentType.errors.txt create mode 100644 tests/baselines/reference/spreadInvalidArgumentType.js create mode 100644 tests/baselines/reference/spreadUnion.js create mode 100644 tests/baselines/reference/spreadUnion.symbols create mode 100644 tests/baselines/reference/spreadUnion.types create mode 100644 tests/baselines/reference/spreadUnion2.js create mode 100644 tests/baselines/reference/spreadUnion2.symbols create mode 100644 tests/baselines/reference/spreadUnion2.types create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols create mode 100644 tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types diff --git a/.mailmap b/.mailmap index cc101c0517e..ede478c8a18 100644 --- a/.mailmap +++ b/.mailmap @@ -172,4 +172,45 @@ zhongsp # Patrick Zhong T18970237136 # @T18970237136 JBerger bootstraponline # @bootstraponline -yortus # @yortus \ No newline at end of file +yortus # @yortus +András Parditka +Anton Khlynovskiy +Charly POLY +Cotton Hou +Ethan Resnick +Marius Schulz +Mattias Buelens +Myles Megyesi +Tim Lancina +Aaron Holmes Aaron Holmes +Akshar Patel +Ali Sabzevari +Aliaksandr Radzivanovich +BuildTools # Franklin Tse +ChogyDan # Daniel Hollocher +Daniel Rosenwasser Daniel Rosenwasser +David Kmenta +E020873 # Nicolas Henry +Elisée Maurer +Emilio García-Pumarino dashaus +Guilherme Oenning +Herrington Darkholme +Ivo Gabe de Wolff +Joey Wilson +Jonathon Smith +Juan Luis Boya García +Kagami Sascha Rosylight +Lucien Greathouse +Martin Vseticka +Mattias Buelens +Michael Bromley +Paul Jolly +Perry Jiang +Peter Burns +Robert Coie +Thomas Loubiou +Tim Perry +Vidar Tonaas Fauske +Viktor Zozulyak +rix # Richard Sentino +rohitverma007 # Rohit Verma \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 2751337c708..08bd7817c79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - 'stable' + - '6' - '4' sudo: false diff --git a/AUTHORS.md b/AUTHORS.md index 50f1ea12c2b..ae7832176ea 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,17 +1,23 @@ TypeScript is authored by: +* Aaron Holmes * Abubaker Bashir * Adam Freidin * Adi Dahiya * Ahmad Farid +* Akshar Patel * Alex Eagle * Alexander Kuvaev * Alexander Rusakov +* Ali Sabzevari +* Aliaksandr Radzivanovich * Anatoly Ressin * Anders Hejlsberg * Andrej Baran * Andrew Z Allen +* András Parditka * Andy Hanson * Anil Anar +* Anton Khlynovskiy * Anton Tolmachev * Arnav Singh * Arthur Ozga @@ -27,16 +33,20 @@ TypeScript is authored by: * Brett Mayen * Bryan Forbes * Caitlin Potter +* Charly POLY * Chris Bubernak * Christophe Vidal * Chuck Jazdzewski * Colby Russell * Colin Snover +* Cotton Hou * Cyrus Najmabadi * Dafrok Zhang * Dan Corder * Dan Quirk +* Daniel Hollocher * Daniel Rosenwasser +* David Kmenta * David Li * David Souther * Denis Nedelyaev @@ -45,8 +55,11 @@ TypeScript is authored by: * Dirk Holtwick * Dom Chen * Doug Ilijev +* Elisée Maurer +* Emilio García-Pumarino * Eric Tsang * Erik Edrosa +* Ethan Resnick * Ethan Rubio * Evan Martin * Evan Sebastian @@ -54,12 +67,14 @@ TypeScript is authored by: * Fabian Cook * @falsandtru * Frank Wallis +* Franklin Tse * František Žiacik * Gabe Moothart * Gabriel Isenberg * Gilad Peleg * Godfrey Chan * Graeme Wicksted +* Guilherme Oenning * Guillaume Salles * Guy Bedford * Harald Niesche @@ -78,12 +93,14 @@ TypeScript is authored by: * Jeffrey Morlan * Jesse Schalken * Jiri Tobisek +* Joey Wilson * Johannes Rieken * John Vilk * Jonathan Bond-Caron * Jonathan Park * Jonathan Toland * Jonathan Turner +* Jonathon Smith * Josh Abernathy * Josh Kalderimis * Josh Soref @@ -102,15 +119,21 @@ TypeScript is authored by: * Lucien Greathouse * Lukas Elmer * Marin Marinov +* Marius Schulz * Martin Vseticka * Masahiro Wakame * Matt McCutchen +* Mattias Buelens +* Mattias Buelens * Max Deepfield * Micah Zoltu * Michael +* Michael Bromley * Mohamed Hegazy +* Myles Megyesi * Nathan Shively-Sanders * Nathan Yee +* Nicolas Henry * Nima Zahedi * Noah Chen * Noj Vek @@ -119,9 +142,12 @@ TypeScript is authored by: * Omer Sheikh * Oskar Segersva¨rd * Patrick Zhong +* Paul Jolly * Paul van Brenk * @pcbro * Pedro Maltez +* Perry Jiang +* Peter Burns * Philip Bulley * Piero Cangianiello * @piloopin @@ -130,6 +156,9 @@ TypeScript is authored by: * Punya Biswal * Rado Kirov * Richard Knoll +* Richard Sentino +* Robert Coie +* Rohit Verma * Ron Buckton * Rostislav Galimsky * Rowan Wyborn @@ -152,7 +181,9 @@ TypeScript is authored by: * @T18970237136 * Tarik Ozket * Tetsuharu Ohzeki +* Thomas Loubiou * Tien Hoanhtien +* Tim Lancina * Tim Perry * Tim Viiding-Spader * Tingan Ho @@ -161,6 +192,8 @@ TypeScript is authored by: * Tomas Grubliauskas * Torben Fitschen * TruongSinh Tran-Nguyen +* Vidar Tonaas Fauske +* Viktor Zozulyak * Vilic Vane * Vladimir Matveev * Wesley Wigham diff --git a/Jakefile.js b/Jakefile.js index d327b5bb47b..17346e8bc1f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -250,6 +250,7 @@ var harnessSources = harnessCoreSources.concat([ "convertToBase64.ts", "transpile.ts", "reuseProgramStructure.ts", + "textStorage.ts", "cachingInServerLSHost.ts", "moduleResolution.ts", "tsconfigParsing.ts", diff --git a/netci.groovy b/netci.groovy index 9f2a96cdeef..bc512f6b245 100644 --- a/netci.groovy +++ b/netci.groovy @@ -5,7 +5,7 @@ import jobs.generation.Utilities; def project = GithubProject def branch = GithubBranchName -def nodeVersions = ['stable', '4'] +def nodeVersions = ['stable', '6', '4'] nodeVersions.each { nodeVer -> diff --git a/package.json b/package.json index 175c1675f2c..fdb85ea764b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "tsserver": "./bin/tsserver" }, "engines": { - "node": ">=0.8.0" + "node": ">=4.2.0" }, "devDependencies": { "@types/browserify": "latest", diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c2bfce10e57..a6f5993f6c8 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -518,7 +518,6 @@ namespace ts { hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) node.flags &= ~NodeFlags.ReachabilityAndEmitFlags; if (!(currentFlow.flags & FlowFlags.Unreachable) && containerFlags & ContainerFlags.IsFunctionLike && nodeIsPresent((node).body)) { node.flags |= NodeFlags.HasImplicitReturn; @@ -1950,9 +1949,6 @@ namespace ts { return bindParameter(node); case SyntaxKind.VariableDeclaration: case SyntaxKind.BindingElement: - if ((node as BindingElement).dotDotDotToken && node.parent.kind === SyntaxKind.ObjectBindingPattern) { - emitFlags |= NodeFlags.HasRestAttribute; - } return bindVariableDeclarationOrBindingElement(node); case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -1980,7 +1976,6 @@ namespace ts { } root = root.parent; } - emitFlags |= hasRest ? NodeFlags.HasRestAttribute : NodeFlags.HasSpreadAttribute; return; case SyntaxKind.CallSignature: @@ -2236,15 +2231,6 @@ namespace ts { } function bindClassLikeDeclaration(node: ClassLikeDeclaration) { - if (!isDeclarationFile(file) && !isInAmbientContext(node)) { - if (getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= NodeFlags.HasClassExtends; - } - if (nodeIsDecorated(node)) { - emitFlags |= NodeFlags.HasDecorators; - } - } - if (node.kind === SyntaxKind.ClassDeclaration) { bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); } @@ -2314,12 +2300,6 @@ namespace ts { } function bindParameter(node: ParameterDeclaration) { - if (!isDeclarationFile(file) && - !isInAmbientContext(node) && - nodeIsDecorated(node)) { - emitFlags |= (NodeFlags.HasDecorators | NodeFlags.HasParamDecorators); - } - if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -2377,9 +2357,6 @@ namespace ts { if (isAsyncFunctionLike(node)) { emitFlags |= NodeFlags.HasAsyncFunctions; } - if (nodeIsDecorated(node)) { - emitFlags |= NodeFlags.HasDecorators; - } } if (currentFlow && isObjectLiteralOrClassExpressionMethod(node)) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 11085532794..f1b9f614fa7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -38,6 +38,8 @@ namespace ts { // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). let cancellationToken: CancellationToken; + let requestedExternalEmitHelpers: ExternalEmitHelpers; + let externalHelpersModule: Symbol; const Symbol = objectAllocator.getSymbolConstructor(); const Type = objectAllocator.getTypeConstructor(); @@ -922,6 +924,7 @@ namespace ts { if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); } @@ -1032,6 +1035,18 @@ namespace ts { } } + function checkAndReportErrorForUsingTypeAsNamespace(errorLocation: Node, name: string, meaning: SymbolFlags): boolean { + if (meaning === SymbolFlags.Namespace) { + const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); + if (symbol) { + error(errorLocation, Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + return true; + } + } + + return false; + } + function checkAndReportErrorForUsingTypeAsValue(errorLocation: Node, name: string, meaning: SymbolFlags): boolean { if (meaning & (SymbolFlags.Value & ~SymbolFlags.NamespaceModule)) { const symbol = resolveSymbol(resolveName(errorLocation, name, SymbolFlags.Type & ~SymbolFlags.Value, /*nameNotFoundMessage*/undefined, /*nameArg*/ undefined)); @@ -1424,9 +1439,8 @@ namespace ts { // May be an untyped module. If so, ignore resolutionDiagnostic. if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) { if (isForAugmentation) { - Debug.assert(!!moduleNotFoundError); const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; - error(errorNode, diag, moduleName, resolvedModule.resolvedFileName); + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); } else if (compilerOptions.noImplicitAny && moduleNotFoundError) { error(errorNode, @@ -1727,7 +1741,19 @@ namespace ts { } function getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] { - function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable): Symbol[] { + function getAccessibleSymbolChainFromSymbolTable(symbols: SymbolTable) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + + function getAccessibleSymbolChainFromSymbolTableWorker(symbols: SymbolTable, visitedSymbolTables: SymbolTable[]): Symbol[] { + if (contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + const result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; + function canQualifySymbol(symbolFromSymbolTable: Symbol, meaning: SymbolFlags) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -1749,34 +1775,36 @@ namespace ts { } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } + function trySymbolTable(symbols: SymbolTable) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } - // Check if symbol is any of the alias - return forEachProperty(symbols, symbolFromSymbolTable => { - if (symbolFromSymbolTable.flags & SymbolFlags.Alias - && symbolFromSymbolTable.name !== "export=" - && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { - if (!useOnlyExternalAliasing || // We can use any type of alias to get the name - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { + // Check if symbol is any of the alias + return forEachProperty(symbols, symbolFromSymbolTable => { + if (symbolFromSymbolTable.flags & SymbolFlags.Alias + && symbolFromSymbolTable.name !== "export=" + && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { + if (!useOnlyExternalAliasing || // We can use any type of alias to get the name + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { - const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } + const 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 - const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + const accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { @@ -2658,7 +2686,7 @@ namespace ts { } Debug.assert(bindingElement.kind === SyntaxKind.BindingElement); if (bindingElement.propertyName) { - writer.writeSymbol(getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writer.writeProperty(getTextOfNode(bindingElement.propertyName)); writePunctuation(writer, SyntaxKind.ColonToken); writeSpace(writer); } @@ -3041,7 +3069,15 @@ namespace ts { } function getRestType(source: Type, properties: PropertyName[], symbol: Symbol): Type { - Debug.assert(!!(source.flags & TypeFlags.Object), "Rest types only support object types right now."); + source = filterType(source, t => !(t.flags & TypeFlags.Nullable)); + if (source.flags & TypeFlags.Never) { + return emptyObjectType; + } + + if (source.flags & TypeFlags.Union) { + return mapType(source, t => getRestType(t, properties, symbol)); + } + const members = createMap(); const names = createMap(); for (const name of properties) { @@ -3082,7 +3118,7 @@ namespace ts { let type: Type; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { if (declaration.dotDotDotToken) { - if (!(parentType.flags & TypeFlags.Object)) { + if (!isValidSpreadType(parentType)) { error(declaration, Diagnostics.Rest_types_may_only_be_created_from_object_types); return unknownType; } @@ -3192,7 +3228,7 @@ namespace ts { // right hand expression is of a type parameter type. if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) { const indexType = getIndexType(checkNonNullExpression((declaration.parent.parent).expression)); - return indexType.flags & TypeFlags.Index ? indexType : stringType; + return indexType.flags & (TypeFlags.TypeParameter | TypeFlags.Index) ? indexType : stringType; } if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { @@ -3296,14 +3332,19 @@ namespace ts { // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern: ObjectBindingPattern, includePatternInType: boolean, reportErrors: boolean): Type { const members = createMap(); + let stringIndexInfo: IndexInfo; let hasComputedProperties = false; forEach(pattern.elements, e => { const name = e.propertyName || e.name; - if (isComputedNonLiteralName(name) || e.dotDotDotToken) { - // do not include computed properties or rests in the implied type + if (isComputedNonLiteralName(name)) { + // do not include computed properties in the implied type hasComputedProperties = true; return; } + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } const text = getTextOfPropertyName(name); const flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); @@ -3312,7 +3353,7 @@ namespace ts { symbol.bindingElement = e; members[symbol.name] = symbol; }); - const result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + const result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -3444,20 +3485,7 @@ namespace ts { } if (!popTypeResolution()) { - if ((symbol.valueDeclaration).type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, - symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, - symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -3591,11 +3619,33 @@ namespace ts { function getTypeOfInstantiatedSymbol(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { + return unknownType; + } + let type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol: Symbol) { + // Check if variable has type annotation that circularly references the variable itself + if ((symbol.valueDeclaration).type) { + error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, + symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, + symbolToString(symbol)); + } + return anyType; + } + function getTypeOfSymbol(symbol: Symbol): Type { if (symbol.flags & SymbolFlags.Instantiated) { return getTypeOfInstantiatedSymbol(symbol); @@ -4481,7 +4531,6 @@ namespace ts { function resolveMappedTypeMembers(type: MappedType) { const members: SymbolTable = createMap(); let stringIndexInfo: IndexInfo; - let numberIndexInfo: IndexInfo; // Resolve upfront such that recursive references see an empty object type. setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); // In { [P in K]: T }, we refer to P as the type parameter type, K as the constraint type, @@ -4489,12 +4538,13 @@ namespace ts { const typeParameter = getTypeParameterFromMappedType(type); const constraintType = getConstraintTypeFromMappedType(type); const templateType = getTemplateTypeFromMappedType(type); - const isReadonly = !!type.declaration.readonlyToken; - const isOptional = !!type.declaration.questionToken; + const modifiersType = getModifiersTypeFromMappedType(type); + const templateReadonly = !!type.declaration.readonlyToken; + const templateOptional = !!type.declaration.questionToken; // First, if the constraint type is a type parameter, obtain the base constraint. Then, // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. // Finally, iterate over the constituents of the resulting iteration type. - const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentType(constraintType) : constraintType; + const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentType(constraintType) : constraintType; const iterationType = keyType.flags & TypeFlags.Index ? getIndexType(getApparentType((keyType).type)) : keyType; forEachType(iterationType, t => { // Create a mapper from T to the current iteration type constituent. Then, if the @@ -4503,29 +4553,22 @@ namespace ts { const iterationMapper = createUnaryTypeMapper(typeParameter, t); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; const propType = instantiateType(templateType, templateMapper); - // If the current iteration type constituent is a literal type, create a property. - // Otherwise, for type string create a string index signature and for type number - // create a numeric index signature. - if (t.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.EnumLiteral)) { + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & TypeFlags.StringLiteral) { const propName = (t).text; + const modifiersProp = getPropertyOfType(modifiersType, propName); + const isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & SymbolFlags.Optional); const prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | (isOptional ? SymbolFlags.Optional : 0), propName); - prop.type = addOptionality(propType, isOptional); - prop.isReadonly = isReadonly; + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); members[propName] = prop; } else if (t.flags & TypeFlags.String) { - stringIndexInfo = createIndexInfo(propType, isReadonly); - } - else if (t.flags & TypeFlags.Number) { - numberIndexInfo = createIndexInfo(propType, isReadonly); + stringIndexInfo = createIndexInfo(propType, templateReadonly); } }); - // If we created both a string and a numeric string index signature, and if the two index - // signatures have identical types, discard the redundant numeric index signature. - if (stringIndexInfo && numberIndexInfo && isTypeIdenticalTo(stringIndexInfo.type, numberIndexInfo.type)) { - numberIndexInfo = undefined; - } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); } function getTypeParameterFromMappedType(type: MappedType) { @@ -4541,10 +4584,32 @@ namespace ts { function getTemplateTypeFromMappedType(type: MappedType) { return type.templateType || (type.templateType = type.declaration.type ? - instantiateType(getTypeFromTypeNode(type.declaration.type), type.mapper || identityMapper) : + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : unknownType); } + function getModifiersTypeFromMappedType(type: MappedType) { + if (!type.modifiersType) { + const constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === SyntaxKind.TypeOperator) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode((constraintDeclaration).type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + const declaredType = getTypeFromMappedTypeNode(type.declaration); + const constraint = getConstraintTypeFromMappedType(declaredType); + const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type: MappedType) { return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); } @@ -4552,7 +4617,7 @@ namespace ts { function isGenericMappedType(type: Type) { if (getObjectFlags(type) & ObjectFlags.Mapped) { const constraintType = getConstraintTypeFromMappedType(type); - return !!(constraintType.flags & (TypeFlags.TypeParameter | TypeFlags.Index)); + return maybeTypeOfKind(constraintType, TypeFlags.TypeVariable | TypeFlags.Index); } return false; } @@ -4640,33 +4705,24 @@ namespace ts { * The apparent type of a type parameter is the base constraint instantiated with the type parameter * as the type argument for the 'this' type. */ - function getApparentTypeOfTypeParameter(type: TypeParameter) { + function getApparentTypeOfTypeVariable(type: TypeVariable) { if (!type.resolvedApparentType) { - let constraintType = getConstraintOfTypeParameter(type); + let constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & TypeFlags.TypeParameter) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } return type.resolvedApparentType; } - /** - * The apparent type of an indexed access T[K] is the type of T's string index signature, if any. - */ - function getApparentTypeOfIndexedAccess(type: IndexedAccessType) { - return getIndexTypeOfType(getApparentType(type.objectType), IndexKind.String) || type; - } - /** * For a type parameter, return the base constraint of the type parameter. For the string, number, * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - const t = type.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(type) : - type.flags & TypeFlags.IndexedAccess ? getApparentTypeOfIndexedAccess(type) : - type; + const t = type.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(type) : type; return t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : @@ -5252,6 +5308,12 @@ namespace ts { return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type: TypeVariable): Type { + return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : + type.flags & TypeFlags.IndexedAccess ? (type).constraint : + undefined; + } + function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent); } @@ -5624,6 +5686,7 @@ namespace ts { containsString?: boolean; containsNumber?: boolean; containsStringOrNumberLiteral?: boolean; + unionIndex?: number; } function binarySearchTypes(types: Type[], type: Type): number { @@ -5818,6 +5881,9 @@ namespace ts { typeSet.containsAny = true; } else if (!(type.flags & TypeFlags.Never) && (strictNullChecks || !(type.flags & TypeFlags.Nullable)) && !contains(typeSet, type)) { + if (type.flags & TypeFlags.Union && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -5844,15 +5910,6 @@ namespace ts { if (types.length === 0) { return emptyObjectType; } - for (let i = 0; i < types.length; i++) { - const type = types[i]; - if (type.flags & TypeFlags.Union) { - // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of - // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. - return getUnionType(map((type).types, t => getIntersectionType(replaceElement(types, i, t))), - /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); - } - } const typeSet = [] as TypeSet; addTypesToIntersection(typeSet, types); if (typeSet.containsAny) { @@ -5861,6 +5918,14 @@ namespace ts { if (typeSet.length === 1) { return typeSet[0]; } + const unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + const unionType = typeSet[unionIndex]; + return getUnionType(map(unionType.types, t => getIntersectionType(replaceElement(typeSet, unionIndex, t))), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } const id = getTypeListId(typeSet); let type = intersectionTypes[id]; if (!type) { @@ -5882,7 +5947,7 @@ namespace ts { return links.resolvedType; } - function getIndexTypeForTypeParameter(type: TypeParameter) { + function getIndexTypeForGenericType(type: TypeVariable | UnionOrIntersectionType) { if (!type.resolvedIndexType) { type.resolvedIndexType = createType(TypeFlags.Index); type.resolvedIndexType.type = type; @@ -5901,12 +5966,17 @@ namespace ts { } function getIndexType(type: Type): Type { - return type.flags & TypeFlags.TypeParameter ? getIndexTypeForTypeParameter(type) : + return maybeTypeOfKind(type, TypeFlags.TypeVariable) ? getIndexTypeForGenericType(type) : getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(type) : type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType : getLiteralTypeFromPropertyNames(type); } + function getIndexTypeOrString(type: Type): Type { + const indexType = getIndexType(type); + return indexType !== neverType ? indexType : stringType; + } + function getTypeFromTypeOperatorNode(node: TypeOperatorNode) { const links = getNodeLinks(node); if (!links.resolvedType) { @@ -5919,6 +5989,24 @@ namespace ts { const type = createType(TypeFlags.IndexedAccess); type.objectType = objectType; type.indexType = indexType; + // We eagerly compute the constraint of the indexed access type such that circularity + // errors are immediately caught and reported. For example, class C { x: this["x"] } + // becomes an error only when the constraint is eagerly computed. + if (type.objectType.flags & TypeFlags.StructuredType) { + // The constraint of T[K], where T is an object, union, or intersection type, + // is the type of the string index signature of T, if any. + type.constraint = getIndexTypeOfType(type.objectType, IndexKind.String); + } + else if (type.objectType.flags & TypeFlags.TypeVariable) { + // The constraint of T[K], where T is a type variable, is A[K], where A is the + // apparent type of T. + const apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind((type).indexType, TypeFlags.StringLike) ? + getIndexedAccessType(apparentType, (type).indexType) : + getIndexTypeOfType(apparentType, IndexKind.String); + } + } return type; } @@ -5993,20 +6081,25 @@ namespace ts { } const mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; - return addOptionality(instantiateType(getTemplateTypeFromMappedType(type), templateMapper), !!type.declaration.questionToken); + return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode) { - if (indexType.flags & TypeFlags.TypeParameter || - objectType.flags & TypeFlags.TypeParameter && indexType.flags & TypeFlags.Index || + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // or if the object type is a mapped type with a generic constraint, we are performing a higher-order + // index access where we cannot meaningfully access the properties of the object type. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, TypeFlags.TypeVariable | TypeFlags.Index) || + maybeTypeOfKind(objectType, TypeFlags.TypeVariable) && !(accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression) || isGenericMappedType(objectType)) { - // If either the object type or the index type are type parameters, or if the object type is a mapped - // type with a generic constraint, we are performing a higher-order index access where we cannot - // meaningfully access the properties of the object type. In those cases, we first check that the - // index type is assignable to 'keyof T' for the object type. + if (objectType.flags & TypeFlags.Any) { + return objectType; + } + // We first check that the index type is assignable to 'keyof T' for the object type. if (accessNode) { - const keyType = indexType.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(indexType) || emptyObjectType : indexType; - if (!isTypeAssignableTo(keyType, getIndexType(objectType))) { + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); return unknownType; } @@ -6021,6 +6114,7 @@ namespace ts { const id = objectType.id + "," + indexType.id; return indexedAccessTypes[id] || (indexedAccessTypes[id] = createIndexedAccessType(objectType, indexType)); } + // In the following we resolve T[K] to the type of the property in T selected by K. const apparentObjectType = getApparentType(objectType); if (indexType.flags & TypeFlags.Union && !(indexType.flags & TypeFlags.Primitive)) { const propTypes: Type[] = []; @@ -6091,11 +6185,25 @@ namespace ts { * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left: Type, right: Type, isFromObjectLiteral: boolean): ResolvedType | IntrinsicType { - Debug.assert(!!(left.flags & (TypeFlags.Object | TypeFlags.Any)) && !!(right.flags & (TypeFlags.Object | TypeFlags.Any)), "Only object types may be spread."); + function getSpreadType(left: Type, right: Type, isFromObjectLiteral: boolean): Type { if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) { return anyType; } + left = filterType(left, t => !(t.flags & TypeFlags.Nullable)); + if (left.flags & TypeFlags.Never) { + return right; + } + right = filterType(right, t => !(t.flags & TypeFlags.Nullable)); + if (right.flags & TypeFlags.Never) { + return left; + } + if (left.flags & TypeFlags.Union) { + return mapType(left, t => getSpreadType(t, right, isFromObjectLiteral)); + } + if (right.flags & TypeFlags.Union) { + return mapType(right, t => getSpreadType(left, t, isFromObjectLiteral)); + } + const members = createMap(); const skippedPrivateMembers = createMap(); let stringIndexInfo: IndexInfo; @@ -6482,7 +6590,36 @@ namespace ts { return result; } - function instantiateMappedType(type: MappedType, mapper: TypeMapper): MappedType { + function instantiateMappedType(type: MappedType, mapper: TypeMapper): Type { + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable T. If so, the mapped type is distributive over a union type and when T is instantiated + // to a union type A | B, we produce { [P in keyof A]: X } | { [P in keyof B]: X }. Furthermore, for + // homomorphic mapped types we leave primitive types alone. For example, when T is instantiated to a + // union type A | undefined, we produce { [P in keyof A]: X } | undefined. + const constraintType = getConstraintTypeFromMappedType(type); + if (constraintType.flags & TypeFlags.Index) { + const typeVariable = (constraintType).type; + const mappedTypeVariable = instantiateType(typeVariable, mapper); + if (typeVariable !== mappedTypeVariable) { + return mapType(mappedTypeVariable, t => { + if (isMappableType(t)) { + const replacementMapper = createUnaryTypeMapper(typeVariable, t); + const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } + } + return instantiateMappedObjectType(type, mapper); + } + + function isMappableType(type: Type) { + return type.flags & (TypeFlags.TypeParameter | TypeFlags.Object | TypeFlags.Intersection | TypeFlags.IndexedAccess); + } + + function instantiateMappedObjectType(type: MappedType, mapper: TypeMapper): Type { const result = createObjectType(ObjectFlags.Mapped | ObjectFlags.Instantiated, type.symbol); result.declaration = type.declaration; result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; @@ -7084,6 +7221,25 @@ namespace ts { } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type: Type): boolean { + if (!(type.flags & TypeFlags.UnionOrIntersection)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + let seenNonNullable = false; + for (const t of (type).types) { + if (t.flags & TypeFlags.Nullable) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } + // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -7116,7 +7272,7 @@ namespace ts { // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & TypeFlags.UnionOrIntersection) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } @@ -7165,8 +7321,7 @@ namespace ts { return result; } } - - if (target.flags & TypeFlags.TypeParameter) { + else if (target.flags & TypeFlags.TypeParameter) { // A source type { [P in keyof T]: X } is related to a target type T if X is related to T[P]. if (getObjectFlags(source) & ObjectFlags.Mapped && getConstraintTypeFromMappedType(source) === getIndexType(target)) { if (!(source).declaration.questionToken) { @@ -7195,12 +7350,14 @@ namespace ts { return result; } } - // Given a type parameter T with a constraint C, a type S is assignable to + // Given a type variable T with a constraint C, a type S is assignable to // keyof T if S is assignable to keyof C. - const constraint = getConstraintOfTypeParameter((target).type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; + if ((target).type.flags & TypeFlags.TypeVariable) { + const constraint = getConstraintOfTypeVariable((target).type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } } } } @@ -7212,6 +7369,14 @@ namespace ts { return result; } } + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + if ((target).constraint) { + if (result = isRelatedTo(source, (target).constraint, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } } if (source.flags & TypeFlags.TypeParameter) { @@ -7220,6 +7385,7 @@ namespace ts { const indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target)); const templateType = getTemplateTypeFromMappedType(target); if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } @@ -7241,6 +7407,16 @@ namespace ts { } } } + else if (source.flags & TypeFlags.IndexedAccess) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + if ((source).constraint) { + if (result = isRelatedTo((source).constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + } else { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments @@ -7524,25 +7700,30 @@ namespace ts { // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. function mappedTypeRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary { - if (isGenericMappedType(source) && isGenericMappedType(target)) { - let result: Ternary; - if (relation === identityRelation) { - const readonlyMatches = !(source).declaration.readonlyToken === !(target).declaration.readonlyToken; - const optionalMatches = !(source).declaration.questionToken === !(target).declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !(source).declaration.questionToken || (target).declaration.questionToken) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + if (isGenericMappedType(target)) { + if (isGenericMappedType(source)) { + let result: Ternary; + if (relation === identityRelation) { + const readonlyMatches = !(source).declaration.readonlyToken === !(target).declaration.readonlyToken; + const optionalMatches = !(source).declaration.questionToken === !(target).declaration.questionToken; + if (readonlyMatches && optionalMatches) { + if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); + } + } + } + else { + if (relation === comparableRelation || !(source).declaration.questionToken || (target).declaration.questionToken) { + if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + return result & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); + } } } } } + else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { + return Ternary.True; + } return Ternary.False; } @@ -8376,28 +8557,78 @@ namespace ts { // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type: Type): boolean { + function couldContainTypeVariables(type: Type): boolean { const objectFlags = getObjectFlags(type); - return !!(type.flags & TypeFlags.TypeParameter || - objectFlags & ObjectFlags.Reference && forEach((type).typeArguments, couldContainTypeParameters) || + return !!(type.flags & TypeFlags.TypeVariable || + objectFlags & ObjectFlags.Reference && forEach((type).typeArguments, couldContainTypeVariables) || objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral | SymbolFlags.Class) || objectFlags & ObjectFlags.Mapped || - type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeParameters(type)); + type.flags & TypeFlags.UnionOrIntersection && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type: UnionOrIntersectionType): boolean { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type: UnionOrIntersectionType): boolean { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } function isTypeParameterAtTopLevel(type: Type, typeParameter: TypeParameter): boolean { return type === typeParameter || type.flags & TypeFlags.UnionOrIntersection && forEach((type).types, t => isTypeParameterAtTopLevel(t, typeParameter)); } - function inferTypes(context: InferenceContext, originalSource: Type, originalTarget: Type) { - const typeParameters = context.signature.typeParameters; + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source: Type, target: MappedType): Type { + const properties = getPropertiesOfType(source); + let indexInfo = getIndexInfoOfType(source, IndexKind.String); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + const typeVariable = getIndexedAccessType((getConstraintTypeFromMappedType(target)).type, getTypeParameterFromMappedType(target)); + const typeVariableArray = [typeVariable]; + const typeInferences = createTypeInferencesObject(); + const typeInferencesArray = [typeInferences]; + const templateType = getTemplateTypeFromMappedType(target); + const readonlyMask = target.declaration.readonlyToken ? false : true; + const optionalMask = target.declaration.questionToken ? 0 : SymbolFlags.Optional; + const members = createSymbolTable(properties); + for (const prop of properties) { + const inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + const inferredProp = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + const inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + + function inferTargetType(sourceType: Type): Type { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + const inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + + function inferTypesWithContext(context: InferenceContext, originalSource: Type, originalTarget: Type) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + + function inferTypes(typeVariables: TypeVariable[], typeInferences: TypeInferences[], originalSource: Type, originalTarget: Type) { let sourceStack: Type[]; let targetStack: Type[]; let depth = 0; @@ -8415,7 +8646,7 @@ namespace ts { } function inferFromTypes(source: Type, target: Type) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { @@ -8465,7 +8696,7 @@ namespace ts { target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & TypeFlags.TypeParameter) { + if (target.flags & TypeFlags.TypeVariable) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding @@ -8475,9 +8706,9 @@ namespace ts { if (source.flags & TypeFlags.ContainsAnyFunctionType) { return; } - for (let i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - const inferences = context.inferences[i]; + for (let i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + const inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -8491,7 +8722,7 @@ namespace ts { if (!contains(candidates, source)) { candidates.push(source); } - if (!isTypeParameterAtTopLevel(originalTarget, target)) { + if (target.flags & TypeFlags.TypeParameter && !isTypeParameterAtTopLevel(originalTarget, target)) { inferences.topLevel = false; } } @@ -8510,24 +8741,24 @@ namespace ts { } else if (target.flags & TypeFlags.UnionOrIntersection) { const targetTypes = (target).types; - let typeParameterCount = 0; - let typeParameter: TypeParameter; - // First infer to each type in union or intersection that isn't a type parameter + let typeVariableCount = 0; + let typeVariable: TypeVariable; + // First infer to each type in union or intersection that isn't a type variable for (const t of targetTypes) { - if (t.flags & TypeFlags.TypeParameter && contains(typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & TypeFlags.TypeVariable && contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } @@ -8539,19 +8770,6 @@ namespace ts { } } else { - if (getObjectFlags(target) & ObjectFlags.Mapped) { - const constraintType = getConstraintTypeFromMappedType(target); - if (getObjectFlags(source) & ObjectFlags.Mapped) { - inferFromTypes(getConstraintTypeFromMappedType(source), constraintType); - inferFromTypes(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target)); - return; - } - if (constraintType.flags & TypeFlags.TypeParameter) { - inferFromTypes(getIndexType(source), constraintType); - inferFromTypes(getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); - return; - } - } source = getApparentType(source); if (source.flags & TypeFlags.Object) { if (isInProcess(source, target)) { @@ -8572,15 +8790,45 @@ namespace ts { sourceStack[depth] = source; targetStack[depth] = target; depth++; - inferFromProperties(source, target); - inferFromSignatures(source, target, SignatureKind.Call); - inferFromSignatures(source, target, SignatureKind.Construct); - inferFromIndexTypes(source, target); + inferFromObjectTypes(source, target); depth--; } } } + function inferFromObjectTypes(source: Type, target: Type) { + if (getObjectFlags(target) & ObjectFlags.Mapped) { + const constraintType = getConstraintTypeFromMappedType(target); + if (constraintType.flags & TypeFlags.Index) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + const index = indexOf(typeVariables, (constraintType).type); + if (index >= 0 && !typeInferences[index].isFixed) { + const inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & TypeFlags.TypeParameter) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + inferFromTypes(getIndexType(source), constraintType); + inferFromTypes(getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol)), getTemplateTypeFromMappedType(target)); + return; + } + } + inferFromProperties(source, target); + inferFromSignatures(source, target, SignatureKind.Call); + inferFromSignatures(source, target, SignatureKind.Construct); + inferFromIndexTypes(source, target); + } + function inferFromProperties(source: Type, target: Type) { const properties = getPropertiesOfObjectType(target); for (const targetProp of properties) { @@ -10253,6 +10501,29 @@ namespace ts { return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node: Node, container: Node, diagnosticMessage: DiagnosticMessage) { + const containingClassDecl = container.parent; + const baseTypeNode = getClassExtendsHeritageClauseElement(containingClassDecl); + + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + const superCall = getSuperCallInConstructor(container); + + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } + function checkThisExpression(node: Node): Type { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. @@ -10260,26 +10531,7 @@ namespace ts { let needToCaptureLexicalThis = false; if (container.kind === SyntaxKind.Constructor) { - const containingClassDecl = container.parent; - const baseTypeNode = getClassExtendsHeritageClauseElement(containingClassDecl); - - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - const superCall = getSuperCallInConstructor(container); - - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. @@ -10427,6 +10679,10 @@ namespace ts { return unknownType; } + if (!isCallExpression && container.kind === SyntaxKind.Constructor) { + checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } + if ((getModifierFlags(container) & ModifierFlags.Static) || isCallExpression) { nodeCheckFlag = NodeCheckFlags.SuperStatic; } @@ -11092,13 +11348,7 @@ namespace ts { } function checkSpreadExpression(node: SpreadElement, contextualMapper?: TypeMapper): Type { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - const arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + const arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } @@ -11308,7 +11558,8 @@ namespace ts { if (impliedProp) { prop.flags |= impliedProp.flags & SymbolFlags.Optional; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, IndexKind.String)) { error(memberDecl.name, Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } @@ -11324,6 +11575,9 @@ namespace ts { member = prop; } else if (memberDecl.kind === SyntaxKind.SpreadAssignment) { + if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(memberDecl, ExternalEmitHelpers.Assign); + } if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); propertiesArray = []; @@ -11333,7 +11587,7 @@ namespace ts { typeFlags = 0; } const type = checkExpression((memberDecl as SpreadAssignment).expression); - if (!(type.flags & (TypeFlags.Object | TypeFlags.Any))) { + if (!isValidSpreadType(type)) { error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } @@ -11384,8 +11638,11 @@ namespace ts { if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); } - spread.flags |= propagatedFlags; - spread.symbol = node.symbol; + if (spread.flags & TypeFlags.Object) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } return spread; } @@ -11411,6 +11668,12 @@ namespace ts { } } + function isValidSpreadType(type: Type): boolean { + return !!(type.flags & (TypeFlags.Any | TypeFlags.Null | TypeFlags.Undefined) || + type.flags & TypeFlags.Object && !isGenericMappedType(type) || + type.flags & TypeFlags.UnionOrIntersection && !forEach((type).types, t => !isValidSpreadType(t))); + } + function checkJsxSelfClosingElement(node: JsxSelfClosingElement) { checkJsxOpeningLikeElement(node); return jsxElementType || anyType; @@ -11511,6 +11774,9 @@ namespace ts { } function checkJsxSpreadAttribute(node: JsxSpreadAttribute, elementAttributesType: Type, nameTable: Map) { + if (compilerOptions.jsx === JsxEmit.React) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Assign); + } const type = checkExpression(node.expression); const props = getPropertiesOfType(type); for (const prop of props) { @@ -12411,7 +12677,7 @@ namespace ts { const context = createInferenceContext(signature, /*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); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -12446,7 +12712,7 @@ namespace ts { if (thisType) { const thisArgumentNode = getThisArgumentOfCall(node); const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use @@ -12468,7 +12734,7 @@ namespace ts { argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } @@ -12483,7 +12749,7 @@ namespace ts { if (excludeArgument[i] === false) { const arg = args[i]; const paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -13302,13 +13568,14 @@ namespace ts { const containingClass = getContainingClass(node); if (containingClass) { const containingType = getTypeOfNode(containingClass); - const baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + let baseTypes = getBaseTypes(containingType as InterfaceType); + while (baseTypes.length) { const baseType = baseTypes[0]; if (modifiers & ModifierFlags.Protected && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType as InterfaceType); } } if (modifiers & ModifierFlags.Private) { @@ -13570,7 +13837,7 @@ namespace ts { for (let i = 0; i < len; i++) { const declaration = signature.parameters[i].valueDeclaration; if (declaration.type) { - inferTypes(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); } } } @@ -13656,7 +13923,7 @@ namespace ts { // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } @@ -13792,7 +14059,7 @@ namespace ts { if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func: FunctionLikeDeclaration) { @@ -14228,10 +14495,10 @@ namespace ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, TypeFlags.NumberLike | TypeFlags.ESSymbol))) { error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) { error(right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -14276,6 +14543,9 @@ namespace ts { } } else if (property.kind === SyntaxKind.SpreadAssignment) { + if (languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(property, ExternalEmitHelpers.Rest); + } const nonRestNames: PropertyName[] = []; if (allProperties) { for (let i = 0; i < allProperties.length - 1; i++) { @@ -14813,8 +15083,8 @@ namespace ts { function isLiteralContextualType(contextualType: Type) { if (contextualType) { - if (contextualType.flags & TypeFlags.TypeParameter) { - const apparentType = getApparentTypeOfTypeParameter(contextualType); + if (contextualType.flags & TypeFlags.TypeVariable) { + const apparentType = getApparentTypeOfTypeVariable(contextualType); // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. @@ -14823,7 +15093,7 @@ namespace ts { } contextualType = apparentType; } - return maybeTypeOfKind(contextualType, TypeFlags.Literal); + return maybeTypeOfKind(contextualType, (TypeFlags.Literal | TypeFlags.Index)); } return false; } @@ -15188,6 +15458,13 @@ namespace ts { checkGrammarFunctionLikeDeclaration(node); } + if (isAsyncFunctionLike(node) && languageVersion < ScriptTarget.ES2017) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Awaiter); + if (languageVersion < ScriptTarget.ES2015) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Generator); + } + } + checkTypeParameters(node.typeParameters); forEach(node.parameters, checkParameter); @@ -15642,7 +15919,7 @@ namespace ts { checkSourceElement(node.type); const type = getTypeFromMappedTypeNode(node); const constraintType = getConstraintTypeFromMappedType(type); - const keyType = constraintType.flags & TypeFlags.TypeParameter ? getApparentTypeOfTypeParameter(constraintType) : constraintType; + const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(constraintType) : constraintType; checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); } @@ -16024,7 +16301,7 @@ namespace ts { return undefined; } - const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefined); + const onfulfilledParameterType = getTypeWithFacts(getUnionType(map(thenSignatures, getTypeOfFirstParameterOfSignature)), TypeFacts.NEUndefinedOrNull); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -16307,6 +16584,10 @@ namespace ts { } } + function getParameterTypeNodeForDecoratorCheck(node: ParameterDeclaration): TypeNode { + return node.dotDotDotToken ? getRestParameterElementType(node.type) : node.type; + } + /** Check the decorators of a node */ function checkDecorators(node: Node): void { if (!node.decorators) { @@ -16323,14 +16604,22 @@ namespace ts { error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + const firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Decorate); + if (node.kind === SyntaxKind.Parameter) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Param); + } + if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, ExternalEmitHelpers.Metadata); + // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { case SyntaxKind.ClassDeclaration: const constructor = getFirstConstructorWithBody(node); if (constructor) { for (const parameter of constructor.parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } } break; @@ -16339,15 +16628,17 @@ namespace ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: for (const parameter of (node).parameters) { - markTypeNodeAsReferenced(parameter.type); + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markTypeNodeAsReferenced((node).type); break; case SyntaxKind.PropertyDeclaration: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; case SyntaxKind.Parameter: - markTypeNodeAsReferenced((node).type); + markTypeNodeAsReferenced((node).type); break; } } @@ -16510,6 +16801,14 @@ namespace ts { } } + function isRemovedPropertyFromObjectSpread(node: Node) { + if (isBindingElement(node) && isObjectBindingPattern(node.parent)) { + const lastElement = lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; + } + function errorUnusedLocal(node: Node, name: string) { if (isIdentifierThatStartsWithUnderScore(node)) { const declaration = getRootDeclaration(node.parent); @@ -16519,7 +16818,10 @@ namespace ts { return; } } - error(node, Diagnostics._0_is_declared_but_never_used, name); + + if (!isRemovedPropertyFromObjectSpread(node.kind === SyntaxKind.Identifier ? node.parent : node)) { + error(node, Diagnostics._0_is_declared_but_never_used, name); + } } function parameterNameStartsWithUnderscore(parameterName: DeclarationName) { @@ -16710,7 +17012,7 @@ namespace ts { } function checkCollisionWithGlobalPromiseInGeneratedCode(node: Node, name: Identifier): void { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= ScriptTarget.ES2017 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } @@ -16887,6 +17189,9 @@ namespace ts { } if (node.kind === SyntaxKind.BindingElement) { + if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext) { + checkExternalEmitHelpers(node, ExternalEmitHelpers.Rest); + } // check computed properties inside property names of binding elements if (node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.propertyName); @@ -17119,6 +17424,7 @@ namespace ts { // Grammar checking checkGrammarForInOrForOfStatement(node); + const rightType = checkNonNullExpression(node.expression); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (let VarDecl in Expr) Statement @@ -17129,7 +17435,6 @@ namespace ts { 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 { @@ -17142,7 +17447,7 @@ namespace ts { 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); } - else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, TypeFlags.StringLike)) { + else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -17151,10 +17456,9 @@ namespace ts { } } - const rightType = checkNonNullExpression(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 (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeParameter | TypeFlags.IndexedAccess)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, TypeFlags.Object | TypeFlags.TypeVariable)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -17805,6 +18109,10 @@ namespace ts { const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends); + } + const baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { const baseType = baseTypes[0]; @@ -20251,8 +20559,6 @@ namespace ts { // Initialize global symbol table let augmentations: LiteralExpression[][]; - let requestedExternalEmitHelpers: NodeFlags = 0; - let firstFileRequestingExternalHelpers: SourceFile; for (const file of host.getSourceFiles()) { if (!isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); @@ -20272,15 +20578,6 @@ namespace ts { } } } - if ((compilerOptions.isolatedModules || isExternalModule(file)) && !file.isDeclarationFile) { - const fileRequestedExternalEmitHelpers = file.flags & NodeFlags.EmitHelperFlags; - if (fileRequestedExternalEmitHelpers) { - requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers; - if (firstFileRequestingExternalHelpers === undefined) { - firstFileRequestingExternalHelpers = file; - } - } - } } if (augmentations) { @@ -20346,57 +20643,51 @@ namespace ts { const symbol = getGlobalSymbol("ReadonlyArray", SymbolFlags.Type, /*diagnostic*/ undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; + } - // If we have specified that we are importing helpers, we should report global - // errors if we cannot resolve the helpers external module, or if it does not have - // the necessary helpers exported. - if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) { - // Find the first reference to the helpers module. - const helpersModule = resolveExternalModule( - firstFileRequestingExternalHelpers, - externalHelpersModuleNameText, - Diagnostics.Cannot_find_module_0, - /*errorNode*/ undefined); - - // If we found the module, report errors if it does not have the necessary exports. - if (helpersModule) { - const exports = helpersModule.exports; - if (requestedExternalEmitHelpers & NodeFlags.HasClassExtends && languageVersion < ScriptTarget.ES2015) { - verifyHelperSymbol(exports, "__extends", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute && - (languageVersion < ScriptTarget.ESNext || compilerOptions.jsx === JsxEmit.React)) { - verifyHelperSymbol(exports, "__assign", SymbolFlags.Value); - } - if (languageVersion < ScriptTarget.ESNext && requestedExternalEmitHelpers & NodeFlags.HasRestAttribute) { - verifyHelperSymbol(exports, "__rest", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasDecorators) { - verifyHelperSymbol(exports, "__decorate", SymbolFlags.Value); - if (compilerOptions.emitDecoratorMetadata) { - verifyHelperSymbol(exports, "__metadata", SymbolFlags.Value); - } - } - if (requestedExternalEmitHelpers & NodeFlags.HasParamDecorators) { - verifyHelperSymbol(exports, "__param", SymbolFlags.Value); - } - if (requestedExternalEmitHelpers & NodeFlags.HasAsyncFunctions) { - verifyHelperSymbol(exports, "__awaiter", SymbolFlags.Value); - if (languageVersion < ScriptTarget.ES2015) { - verifyHelperSymbol(exports, "__generator", SymbolFlags.Value); + function checkExternalEmitHelpers(location: Node, helpers: ExternalEmitHelpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + const sourceFile = getSourceFileOfNode(location); + if (isEffectiveExternalModule(sourceFile, compilerOptions)) { + const helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (let helper = ExternalEmitHelpers.FirstEmitHelper; helper <= ExternalEmitHelpers.LastEmitHelper; helper <<= 1) { + if (uncheckedHelpers & helper) { + const name = getHelperName(helper); + const symbol = getSymbol(helpersModule.exports, escapeIdentifier(name), SymbolFlags.Value); + if (!symbol) { + error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, externalHelpersModuleNameText, name); + } + } } } + requestedExternalEmitHelpers |= helpers; } } } - function verifyHelperSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags) { - const symbol = getSymbol(symbols, escapeIdentifier(name), meaning); - if (!symbol) { - error(/*location*/ undefined, Diagnostics.Module_0_has_no_exported_member_1, externalHelpersModuleNameText, name); + function getHelperName(helper: ExternalEmitHelpers) { + switch (helper) { + case ExternalEmitHelpers.Extends: return "__extends"; + case ExternalEmitHelpers.Assign: return "__assign"; + case ExternalEmitHelpers.Rest: return "__rest"; + case ExternalEmitHelpers.Decorate: return "__decorate"; + case ExternalEmitHelpers.Metadata: return "__metadata"; + case ExternalEmitHelpers.Param: return "__param"; + case ExternalEmitHelpers.Awaiter: return "__awaiter"; + case ExternalEmitHelpers.Generator: return "__generator"; } } + function resolveHelpersModule(node: SourceFile, errorNode: Node) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, externalHelpersModuleNameText, Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } + + function createInstantiatedPromiseLikeType(): ObjectType { const promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -21141,6 +21432,9 @@ namespace ts { else if (accessor.body === undefined && !(getModifierFlags(accessor) & ModifierFlags.Abstract)) { return grammarErrorAtPos(getSourceFileOfNode(accessor), accessor.end - 1, ";".length, Diagnostics._0_expected, "{"); } + else if (accessor.body && getModifierFlags(accessor) & ModifierFlags.Abstract) { + return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, Diagnostics.An_accessor_cannot_have_type_parameters); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3c6a86134ea..251eeb58b15 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -272,7 +272,7 @@ namespace ts { "es2017": ScriptTarget.ES2017, "esnext": ScriptTarget.ESNext, }), - description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, paramType: Diagnostics.VERSION, }, { @@ -549,14 +549,7 @@ namespace ts { /* @internal */ export function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { - const key = trimString((value || "")).toLowerCase(); - const map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } /* @internal */ @@ -848,7 +841,7 @@ namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = []): ParsedCommandLine { + export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string, resolutionStack: Path[] = [], extraFileExtensions: FileExtensionInfo[] = []): ParsedCommandLine { const errors: Diagnostic[] = []; const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const resolvedPath = toPath(configFileName || "", basePath, getCanonicalFileName); @@ -988,7 +981,7 @@ namespace ts { includeSpecs = ["**/*"]; } - const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); if (result.fileNames.length === 0 && !hasProperty(json, "files") && resolutionStack.length === 0) { errors.push( @@ -1192,7 +1185,7 @@ namespace ts { * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[]): ExpandResult { + function matchFileNames(fileNames: string[], include: string[], exclude: string[], basePath: string, options: CompilerOptions, host: ParseConfigHost, errors: Diagnostic[], extraFileExtensions: FileExtensionInfo[]): ExpandResult { basePath = normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly @@ -1226,7 +1219,7 @@ namespace ts { // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - const supportedExtensions = getSupportedExtensions(options); + const supportedExtensions = getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index cd96981c093..bd9190dbec7 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -156,6 +156,9 @@ namespace ts { if (!skipTrailingComments) { emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } } if (extendedDiagnostics) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 89057dd2939..ceff1359579 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -863,24 +863,6 @@ namespace ts { return result; } - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - export function reduceOwnProperties(map: MapLike, callback: (aggregate: U, value: T, key: string) => U, initial: U): U { - let result = initial; - for (const key in map) if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -1942,8 +1924,18 @@ namespace ts { export const supportedJavascriptExtensions = [".js", ".jsx"]; const allSupportedExtensions = supportedTypeScriptExtensions.concat(supportedJavascriptExtensions); - export function getSupportedExtensions(options?: CompilerOptions): string[] { - return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions; + export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[] { + const needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions; + } + const extensions = (needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions).slice(0); + for (const extInfo of extraFileExtensions) { + if (needAllExtensions || extInfo.scriptKind === ScriptKind.TS) { + extensions.push(extInfo.extension); + } + } + return extensions; } export function hasJavaScriptFileExtension(fileName: string) { @@ -1954,10 +1946,10 @@ namespace ts { return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension)); } - export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) { + export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]) { if (!fileName) { return false; } - for (const extension of getSupportedExtensions(compilerOptions)) { + for (const extension of getSupportedExtensions(compilerOptions, extraFileExtensions)) { if (fileExtensionIs(fileName, extension)) { return true; } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index fd2740f20c2..cd98622e080 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -194,6 +194,7 @@ namespace ts { writer.writeSpace = writer.write; writer.writeStringLiteral = writer.writeLiteral; writer.writeParameter = writer.write; + writer.writeProperty = writer.write; writer.writeSymbol = writer.write; setWriter(writer); } @@ -1625,6 +1626,12 @@ namespace ts { Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case SyntaxKind.IndexSignature: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: if (hasModifier(node.parent, ModifierFlags.Static)) { diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 63333dbe0b2..ebcea221f9e 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1677,16 +1677,10 @@ namespace ts { function createJsxFactoryExpressionFromEntityName(jsxFactory: EntityName, parent: JsxOpeningLikeElement): Expression { if (isQualifiedName(jsxFactory)) { - return createPropertyAccess( - createJsxFactoryExpressionFromEntityName( - jsxFactory.left, - parent - ), - setEmitFlags( - getMutableClone(jsxFactory.right), - EmitFlags.NoSourceMap - ) - ); + const left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + const right = createSynthesizedNode(SyntaxKind.Identifier); + right.text = jsxFactory.right.text; + return createPropertyAccess(left, right); } else { return createReactNamespace(jsxFactory.text, parent); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0ce21b2d9fe..2f0d6a4d975 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2558,6 +2558,8 @@ namespace ts { case SyntaxKind.OpenBraceToken: case SyntaxKind.OpenBracketToken: case SyntaxKind.LessThanToken: + case SyntaxKind.BarToken: + case SyntaxKind.AmpersandToken: case SyntaxKind.NewKeyword: case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: @@ -2617,6 +2619,7 @@ namespace ts { } function parseUnionOrIntersectionType(kind: SyntaxKind, parseConstituentType: () => TypeNode, operator: SyntaxKind): TypeNode { + parseOptional(operator); let type = parseConstituentType(); if (token() === operator) { const types = createNodeArray([type], type.pos); @@ -6334,7 +6337,7 @@ namespace ts { break; case SyntaxKind.AsteriskToken: const asterisk = scanner.getTokenText(); - if (state === JSDocState.SawAsterisk) { + if (state === JSDocState.SawAsterisk || state === JSDocState.SavingComments) { // If we've already seen an asterisk, then we can no longer parse a tag on this line state = JSDocState.SavingComments; pushComment(asterisk); @@ -6355,7 +6358,10 @@ namespace ts { case SyntaxKind.WhitespaceTrivia: // only collect whitespace if we're already saving comments or have just crossed the comment indent margin const whitespace = scanner.getTokenText(); - if (state === JSDocState.SavingComments || margin !== undefined && indent + whitespace.length > margin) { + if (state === JSDocState.SavingComments) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent - 1)); } indent += whitespace.length; @@ -6363,6 +6369,8 @@ namespace ts { case SyntaxKind.EndOfFileToken: break; default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = JSDocState.SavingComments; pushComment(scanner.getTokenText()); break; } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 46db5188e33..650b9b0ef02 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -427,7 +427,7 @@ namespace ts { encodeLastRecordedSourceMapSpan(); - return stringify({ + return JSON.stringify({ version: 3, file: sourceMapData.sourceMapFile, sourceRoot: sourceMapData.sourceMapSourceRoot, diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index 43590791c83..8e32259ff0f 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -459,7 +459,7 @@ namespace ts { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index bc9341a4b4f..ad016972d0d 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -2286,14 +2286,19 @@ namespace ts { } } + startLexicalEnvironment(); let loopBody = visitNode(node.statement, visitor, isStatement); + const lexicalEnvironment = endLexicalEnvironment(); const currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; - if (loopOutParameters.length) { + if (loopOutParameters.length || lexicalEnvironment) { const statements = isBlock(loopBody) ? (loopBody).statements.slice() : [loopBody]; - copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements); + } + addRange(statements, lexicalEnvironment) loopBody = createBlock(statements, /*location*/ undefined, /*multiline*/ true); } @@ -2837,7 +2842,6 @@ namespace ts { // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = createFunctionCall( visitNode(target, visitor, isExpression), visitNode(thisArg, visitor, isExpression), diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 91e29e09886..0e3a42da0d2 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -101,20 +101,21 @@ namespace ts { // So the helper will be emit at the correct position instead of at the top of the source-file const moduleName = tryGetModuleNameFromFile(node, host, compilerOptions); const dependencies = createArrayLiteral(map(dependencyGroups, dependencyGroup => dependencyGroup.name)); - const updated = updateSourceFileNode( - node, - createNodeArray([ - createStatement( - createCall( - createPropertyAccess(createIdentifier("System"), "register"), + const updated = setEmitFlags( + updateSourceFileNode( + node, + createNodeArray([ + createStatement( + createCall( + createPropertyAccess(createIdentifier("System"), "register"), /*typeArguments*/ undefined, - moduleName - ? [moduleName, dependencies, moduleBodyFunction] - : [dependencies, moduleBodyFunction] + moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction] + ) ) - ) - ], node.statements) - ); + ], node.statements) + ), EmitFlags.NoTrailingComments); if (!(compilerOptions.outFile || compilerOptions.out)) { moveEmitHelpers(updated, moduleBodyBlock, helper => !helper.scoped); diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 62b2022b7df..877131b369c 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -345,6 +345,7 @@ namespace ts { case SyntaxKind.PropertyDeclaration: // TypeScript property declarations are elided. + return undefined; case SyntaxKind.Constructor: return visitConstructor(node); @@ -1222,11 +1223,12 @@ namespace ts { } const { firstAccessor, secondAccessor, setAccessor } = getAllAccessorDeclarations(node.members, accessor); - if (accessor !== firstAccessor) { + const firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { return undefined; } - const decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators); + const decorators = firstAccessorWithDecorators.decorators; const parameters = getDecoratorsOfParameters(setAccessor); if (!decorators && !parameters) { return undefined; @@ -1275,7 +1277,7 @@ namespace ts { * @param node The declaration node. * @param allDecorators An object containing all of the decorators for the declaration. */ - function transformAllDecoratorsOfDeclaration(node: Declaration, allDecorators: AllDecorators) { + function transformAllDecoratorsOfDeclaration(node: Declaration, container: ClassLikeDeclaration, allDecorators: AllDecorators) { if (!allDecorators) { return undefined; } @@ -1283,7 +1285,7 @@ namespace ts { const decoratorExpressions: Expression[] = []; addRange(decoratorExpressions, map(allDecorators.decorators, transformDecorator)); addRange(decoratorExpressions, flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); - addTypeMetadata(node, decoratorExpressions); + addTypeMetadata(node, container, decoratorExpressions); return decoratorExpressions; } @@ -1332,7 +1334,7 @@ namespace ts { */ function generateClassElementDecorationExpression(node: ClassExpression | ClassDeclaration, member: ClassElement) { const allDecorators = getAllDecoratorsOfClassElement(node, member); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1353,13 +1355,13 @@ namespace ts { // __metadata("design:type", Function), // __metadata("design:paramtypes", [Object]), // __metadata("design:returntype", void 0) - // ], C.prototype, "method", undefined); + // ], C.prototype, "method", null); // // The emit for an accessor is: // // __decorate([ // dec - // ], C.prototype, "accessor", undefined); + // ], C.prototype, "accessor", null); // // The emit for a property is: // @@ -1413,7 +1415,7 @@ namespace ts { */ function generateConstructorDecorationExpression(node: ClassExpression | ClassDeclaration) { const allDecorators = getAllDecoratorsOfConstructor(node); - const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators); + const decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); if (!decoratorExpressions) { return undefined; } @@ -1466,22 +1468,22 @@ namespace ts { * @param node The declaration node. * @param decoratorExpressions The destination array to which to add new decorator expressions. */ - function addTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (USE_NEW_TYPE_METADATA_FORMAT) { - addNewTypeMetadata(node, decoratorExpressions); + addNewTypeMetadata(node, container, decoratorExpressions); } else { - addOldTypeMetadata(node, decoratorExpressions); + addOldTypeMetadata(node, container, decoratorExpressions); } } - function addOldTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addOldTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { if (shouldAddTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); } if (shouldAddParamTypesMetadata(node)) { - decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node))); + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); } if (shouldAddReturnTypeMetadata(node)) { decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); @@ -1489,14 +1491,14 @@ namespace ts { } } - function addNewTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) { + function addNewTypeMetadata(node: Declaration, container: ClassLikeDeclaration, decoratorExpressions: Expression[]) { if (compilerOptions.emitDecoratorMetadata) { let properties: ObjectLiteralElementLike[]; if (shouldAddTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("type", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeTypeOfNode(node)))); } if (shouldAddParamTypesMetadata(node)) { - (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node)))); + (properties || (properties = [])).push(createPropertyAssignment("paramTypes", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeParameterTypesOfNode(node, container)))); } if (shouldAddReturnTypeMetadata(node)) { (properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, createToken(SyntaxKind.EqualsGreaterThanToken), serializeReturnTypeOfNode(node)))); @@ -1541,12 +1543,16 @@ namespace ts { * @param node The node to test. */ function shouldAddParamTypesMetadata(node: Declaration): boolean { - const kind = node.kind; - return kind === SyntaxKind.ClassDeclaration - || kind === SyntaxKind.ClassExpression - || kind === SyntaxKind.MethodDeclaration - || kind === SyntaxKind.GetAccessor - || kind === SyntaxKind.SetAccessor; + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + return getFirstConstructorWithBody(node) !== undefined; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + return true; + } + return false; } /** @@ -1571,30 +1577,12 @@ namespace ts { } } - /** - * Gets the most likely element type for a TypeNode. This is not an exhaustive test - * as it assumes a rest argument can only be an array type (either T[], or Array). - * - * @param node The type node. - */ - function getRestParameterElementType(node: TypeNode) { - if (node && node.kind === SyntaxKind.ArrayType) { - return (node).elementType; - } - else if (node && node.kind === SyntaxKind.TypeReference) { - return singleOrUndefined((node).typeArguments); - } - else { - return undefined; - } - } - /** * Serializes the types of the parameters of a node for use with decorator type metadata. * * @param node The node that should have its parameter types serialized. */ - function serializeParameterTypesOfNode(node: Node): Expression { + function serializeParameterTypesOfNode(node: Node, container: ClassLikeDeclaration): Expression { const valueDeclaration = isClassLike(node) ? getFirstConstructorWithBody(node) @@ -1604,7 +1592,7 @@ namespace ts { const expressions: Expression[] = []; if (valueDeclaration) { - const parameters = valueDeclaration.parameters; + const parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); const numParameters = parameters.length; for (let i = 0; i < numParameters; i++) { const parameter = parameters[i]; @@ -1623,6 +1611,16 @@ namespace ts { return createArrayLiteral(expressions); } + function getParametersOfDecoratedDeclaration(node: FunctionLikeDeclaration, container: ClassLikeDeclaration) { + if (container && node.kind === SyntaxKind.GetAccessor) { + const { setAccessor } = getAllAccessorDeclarations(container.members, node); + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } + /** * Serializes the return type of a node for use with decorator type metadata. * @@ -1905,7 +1903,7 @@ namespace ts { : (name).expression; } else if (isIdentifier(name)) { - return createLiteral(name.text); + return createLiteral(unescapeIdentifier(name.text)); } else { return getSynthesizedClone(name); diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index bd70a0afb10..cbbdbb04d50 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -11,7 +11,8 @@ "stripInternal": true, "target": "es5", "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "types": [ ] }, "files": [ "core.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 219e7efa90a..1ee59149b2c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -418,26 +418,20 @@ namespace ts { HasImplicitReturn = 1 << 7, // If function implicitly returns on one of codepaths (initialized by binding) HasExplicitReturn = 1 << 8, // If function has explicit reachable return on one of codepaths (initialized by binding) GlobalAugmentation = 1 << 9, // Set if module declaration is an augmentation for the global scope - HasClassExtends = 1 << 10, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding) - HasDecorators = 1 << 11, // If the file has decorators (initialized by binding) - HasParamDecorators = 1 << 12, // If the file has parameter decorators (initialized by binding) - HasAsyncFunctions = 1 << 13, // If the file has async functions (initialized by binding) - HasSpreadAttribute = 1 << 14, // If the file as JSX spread attributes (initialized by binding) - HasRestAttribute = 1 << 15, // If the file has object destructure elements - DisallowInContext = 1 << 16, // If node was parsed in a context where 'in-expressions' are not allowed - YieldContext = 1 << 17, // If node was parsed in the 'yield' context created when parsing a generator - DecoratorContext = 1 << 18, // If node was parsed as part of a decorator - AwaitContext = 1 << 19, // If node was parsed in the 'await' context created when parsing an async function - ThisNodeHasError = 1 << 20, // If the parser encountered an error when parsing the code that created this node - JavaScriptFile = 1 << 21, // If node was parsed in a JavaScript - ThisNodeOrAnySubNodesHasError = 1 << 22, // If this node or any of its children had an error - HasAggregatedChildData = 1 << 23, // If we've computed data from children and cached it in this node + HasAsyncFunctions = 1 << 10, // If the file has async functions (initialized by binding) + DisallowInContext = 1 << 11, // If node was parsed in a context where 'in-expressions' are not allowed + YieldContext = 1 << 12, // If node was parsed in the 'yield' context created when parsing a generator + DecoratorContext = 1 << 13, // If node was parsed as part of a decorator + AwaitContext = 1 << 14, // If node was parsed in the 'await' context created when parsing an async function + ThisNodeHasError = 1 << 15, // If the parser encountered an error when parsing the code that created this node + JavaScriptFile = 1 << 16, // If node was parsed in a JavaScript + ThisNodeOrAnySubNodesHasError = 1 << 17, // If this node or any of its children had an error + HasAggregatedChildData = 1 << 18, // If we've computed data from children and cached it in this node BlockScoped = Let | Const, ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, - EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute | HasRestAttribute, - ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags, + ReachabilityAndEmitFlags = ReachabilityCheckFlags | HasAsyncFunctions, // Parsing context flags ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile, @@ -2413,6 +2407,7 @@ namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -2803,6 +2798,7 @@ namespace ts { UnionOrIntersection = Union | Intersection, StructuredType = Object | Union | Intersection, StructuredOrTypeParameter = StructuredType | TypeParameter | Index, + TypeVariable = TypeParameter | IndexedAccess, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never @@ -2913,7 +2909,9 @@ namespace ts { /* @internal */ resolvedProperties: SymbolTable; // Cache of resolved properties /* @internal */ - couldContainTypeParameters: boolean; + resolvedIndexType: IndexType; + /* @internal */ + couldContainTypeVariables: boolean; } export interface UnionType extends UnionOrIntersectionType { } @@ -2935,6 +2933,7 @@ namespace ts { typeParameter?: TypeParameter; constraintType?: Type; templateType?: Type; + modifiersType?: Type; mapper?: TypeMapper; // Instantiation mapper } @@ -2969,28 +2968,35 @@ namespace ts { iteratorElementType?: Type; } + export interface TypeVariable extends Type { + /* @internal */ + resolvedApparentType: Type; + /* @internal */ + resolvedIndexType: IndexType; + } + // Type parameters (TypeFlags.TypeParameter) - export interface TypeParameter extends Type { + export interface TypeParameter extends TypeVariable { constraint: Type; // Constraint /* @internal */ target?: TypeParameter; // Instantiation target /* @internal */ mapper?: TypeMapper; // Instantiation mapper /* @internal */ - resolvedApparentType: Type; - /* @internal */ - resolvedIndexType: IndexType; - /* @internal */ isThisType?: boolean; } - export interface IndexType extends Type { - type: TypeParameter; - } - - export interface IndexedAccessType extends Type { + // Indexed access types (TypeFlags.IndexedAccess) + // Possible forms are T[xxx], xxx[T], or xxx[keyof T], where T is a type variable + export interface IndexedAccessType extends TypeVariable { objectType: Type; indexType: Type; + constraint?: Type; + } + + // keyof T types (TypeFlags.Index) + export interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; } export const enum SignatureKind { @@ -3082,6 +3088,12 @@ namespace ts { ThisProperty } + export interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } + export interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -3698,6 +3710,25 @@ namespace ts { readonly priority?: number; // Helpers with a higher priority are emitted earlier than other helpers on the node. } + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ + /* @internal */ + export const enum ExternalEmitHelpers { + Extends = 1 << 0, // __extends (used by the ES2015 class transformation) + Assign = 1 << 1, // __assign (used by Jsx and ESNext object spread transformations) + Rest = 1 << 2, // __rest (used by ESNext object rest transformation) + Decorate = 1 << 3, // __decorate (used by TypeScript decorators transformation) + Metadata = 1 << 4, // __metadata (used by TypeScript decorators transformation) + Param = 1 << 5, // __param (used by TypeScript decorators transformation) + Awaiter = 1 << 6, // __awaiter (used by ES2017 async functions transformation) + Generator = 1 << 7, // __generator (used by ES2015 generator transformation) + + FirstEmitHelper = Extends, + LastEmitHelper = Generator + } + /* @internal */ export const enum EmitContext { SourceFile, // Emitting a SourceFile diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 363ddf0de80..6f491f6708f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -43,6 +43,7 @@ namespace ts { writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to @@ -423,6 +424,10 @@ namespace ts { return false; } + export function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions) { + return isExternalModule(node) || compilerOptions.isolatedModules; + } + export function isBlockScope(node: Node, parentNode: Node) { switch (node.kind) { case SyntaxKind.SourceFile: @@ -798,6 +803,23 @@ namespace ts { } } + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + export function getRestParameterElementType(node: TypeNode) { + if (node && node.kind === SyntaxKind.ArrayType) { + return (node).elementType; + } + else if (node && node.kind === SyntaxKind.TypeReference) { + return singleOrUndefined((node).typeArguments); + } + else { + return undefined; + } + } export function isVariableLike(node: Node): node is VariableLikeDeclaration { if (node) { @@ -3184,55 +3206,6 @@ namespace ts { return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value: any): string { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - - function stringifyValue(value: any): string { - return typeof value === "string" ? `"${escapeString(value)}"` - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : /*fallback*/ "null"; - } - - function cycleCheck(cb: (value: any) => string, value: any) { - Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - const result = cb(value); - delete value.__cycle; - return result; - } - - function stringifyArray(value: any) { - return `[${reduceLeft(value, stringifyElement, "")}]`; - } - - function stringifyElement(memo: string, value: any) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - - function stringifyObject(value: any) { - return `{${reduceOwnProperties(value, stringifyProperty, "")}}`; - } - - function stringifyProperty(memo: string, value: any, key: string) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + `"${escapeString(key)}":${stringifyValue(value)}`; - } - const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 1486ea2253f..7c7a06db0b6 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -607,23 +607,13 @@ namespace FourSlash { }); } - public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) { - const members = this.getMemberListAtCaret(); - if (members) { - this.assertItemInCompletionList(members.entries, symbol, text, documentation, kind); - } - else { - this.raiseError("Expected a member list, but none was provided"); - } - } - - public verifyMemberListCount(expectedCount: number, negative: boolean) { + public verifyCompletionListCount(expectedCount: number, negative: boolean) { if (expectedCount === 0 && negative) { - this.verifyMemberListIsEmpty(/*negative*/ false); + this.verifyCompletionListIsEmpty(/*negative*/ false); return; } - const members = this.getMemberListAtCaret(); + const members = this.getCompletionListAtCaret(); if (members) { const match = members.entries.length === expectedCount; @@ -637,13 +627,6 @@ namespace FourSlash { } } - public verifyMemberListDoesNotContain(symbol: string) { - const members = this.getMemberListAtCaret(); - if (members && members.entries.filter(e => e.name === symbol).length !== 0) { - this.raiseError(`Member list did contain ${symbol}`); - } - } - public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) { const completions = this.getCompletionListAtCaret(); const itemsCount = completions.entries.length; @@ -685,16 +668,6 @@ namespace FourSlash { } } - public verifyMemberListIsEmpty(negative: boolean) { - const members = this.getMemberListAtCaret(); - if ((!members || members.entries.length === 0) && negative) { - this.raiseError("Member list is empty at Caret"); - } - else if ((members && members.entries.length !== 0) && !negative) { - this.raiseError(`Member list is not empty at Caret:\nMember List contains: ${stringify(members.entries.map(e => e.name))}`); - } - } - public verifyCompletionListIsEmpty(negative: boolean) { const completions = this.getCompletionListAtCaret(); if ((!completions || completions.entries.length === 0) && negative) { @@ -892,10 +865,6 @@ namespace FourSlash { this.raiseError(`verifyReferencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(references)})`); } - private getMemberListAtCaret() { - return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition); - } - private getCompletionListAtCaret() { return this.languageService.getCompletionsAtPosition(this.activeFile.fileName, this.currentCaretPosition); } @@ -1353,11 +1322,6 @@ namespace FourSlash { Harness.IO.log(stringify(sigHelp)); } - public printMemberListMembers() { - const members = this.getMemberListAtCaret(); - this.printMembersOrCompletions(members); - } - public printCompletionListMembers() { const completions = this.getCompletionListAtCaret(); this.printMembersOrCompletions(completions); @@ -3061,19 +3025,8 @@ namespace FourSlashInterface { } } - // Verifies the member list contains the specified symbol. The - // member list is brought up if necessary - public memberListContains(symbol: string, text?: string, documentation?: string, kind?: string) { - if (this.negative) { - this.state.verifyMemberListDoesNotContain(symbol); - } - else { - this.state.verifyMemberListContains(symbol, text, documentation, kind); - } - } - - public memberListCount(expectedCount: number) { - this.state.verifyMemberListCount(expectedCount, this.negative); + public completionListCount(expectedCount: number) { + this.state.verifyCompletionListCount(expectedCount, this.negative); } // Verifies the completion list contains the specified symbol. The @@ -3109,10 +3062,6 @@ namespace FourSlashInterface { this.state.verifyCompletionListAllowsNewIdentifier(this.negative); } - public memberListIsEmpty() { - this.state.verifyMemberListIsEmpty(this.negative); - } - public signatureHelpPresent() { this.state.verifySignatureHelpPresent(!this.negative); } @@ -3514,10 +3463,6 @@ namespace FourSlashInterface { this.state.printCurrentSignatureHelp(); } - public printMemberListMembers() { - this.state.printMemberListMembers(); - } - public printCompletionListMembers() { this.state.printCompletionListMembers(); } diff --git a/src/harness/unittests/textStorage.ts b/src/harness/unittests/textStorage.ts new file mode 100644 index 00000000000..b4287f2610c --- /dev/null +++ b/src/harness/unittests/textStorage.ts @@ -0,0 +1,70 @@ +/// +/// +/// + +namespace ts.textStorage { + describe("Text storage", () => { + const f = { + path: "/a/app.ts", + content: ` + let x = 1; + let y = 2; + function bar(a: number) { + return a + 1; + }` + }; + + it("text based storage should be have exactly the same as script version cache", () => { + + const host = ts.projectSystem.createServerHost([f]); + + const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + const ts2 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + + ts1.useScriptVersionCache(); + ts2.useText(); + + const lineMap = computeLineStarts(f.content); + + for (let line = 0; line < lineMap.length; line++) { + const start = lineMap[line]; + const end = line === lineMap.length - 1 ? f.path.length : lineMap[line + 1]; + + for (let offset = 0; offset < end - start; offset++) { + const pos1 = ts1.lineOffsetToPosition(line + 1, offset + 1); + const pos2 = ts2.lineOffsetToPosition(line + 1, offset + 1); + assert.isTrue(pos1 === pos2, `lineOffsetToPosition ${line + 1}-${offset + 1}: expected ${pos1} to equal ${pos2}`); + } + + const {start: start1, length: length1 } = ts1.lineToTextSpan(line); + const {start: start2, length: length2 } = ts2.lineToTextSpan(line); + assert.isTrue(start1 === start2, `lineToTextSpan ${line}::start:: expected ${start1} to equal ${start2}`); + assert.isTrue(length1 === length2, `lineToTextSpan ${line}::length:: expected ${length1} to equal ${length2}`); + } + + for (let pos = 0; pos < f.content.length; pos++) { + const { line: line1, offset: offset1 } = ts1.positionToLineOffset(pos); + const { line: line2, offset: offset2 } = ts2.positionToLineOffset(pos); + assert.isTrue(line1 === line2, `positionToLineOffset ${pos}::line:: expected ${line1} to equal ${line2}`); + assert.isTrue(offset1 === offset2, `positionToLineOffset ${pos}::offset:: expected ${offset1} to equal ${offset2}`); + } + }); + + it("should switch to script version cache if necessary", () => { + const host = ts.projectSystem.createServerHost([f]); + const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path)); + + ts1.getSnapshot(); + assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 1"); + + ts1.edit(0, 5, " "); + assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 1"); + + ts1.useText(); + assert.isTrue(!ts1.hasScriptVersionCache(), "should not have script version cache - 2"); + + ts1.getLineInfo(0); + assert.isTrue(ts1.hasScriptVersionCache(), "have script version cache - 2"); + }) + }); +} \ No newline at end of file diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 43f125b0bed..783a6016f7a 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -51,9 +51,8 @@ namespace ts.projectSystem { throttleLimit: number, installTypingHost: server.ServerHost, readonly typesRegistry = createMap(), - telemetryEnabled?: boolean, log?: TI.Log) { - super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, telemetryEnabled, log); + super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, log); } safeFileList = safeList.path; @@ -141,7 +140,6 @@ namespace ts.projectSystem { export interface TestServerHostCreationParameters { useCaseSensitiveFileNames?: boolean; executingFilePath?: string; - libFile?: FileOrFolder; currentDirectory?: string; } @@ -578,6 +576,35 @@ namespace ts.projectSystem { checkWatchedDirectories(host, ["/a/b/c", "/a/b", "/a"]); }); + it("can handle tsconfig file name with difference casing", () => { + const f1 = { + path: "/a/b/app.ts", + content: "let x = 1" + }; + const config = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ + include: [] + }) + }; + + const host = createServerHost([f1, config], { useCaseSensitiveFileNames: false }); + const service = createProjectService(host); + service.openExternalProject({ + projectFileName: "/a/b/project.csproj", + rootFiles: toExternalFiles([f1.path, combinePaths(getDirectoryPath(config.path).toUpperCase(), getBaseFileName(config.path))]), + options: {} + }); + service.checkNumberOfProjects({ configuredProjects: 1 }); + checkProjectActualFiles(service.configuredProjects[0], []); + + service.openClientFile(f1.path); + service.checkNumberOfProjects({ configuredProjects: 1, inferredProjects: 1 }); + + checkProjectActualFiles(service.configuredProjects[0], []); + checkProjectActualFiles(service.inferredProjects[0], [f1.path]); + }) + it("create configured project without file list", () => { const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", @@ -699,6 +726,66 @@ namespace ts.projectSystem { checkNumberOfInferredProjects(projectService, 1); }); + it("remove not-listed external projects", () => { + const f1 = { + path: "/a/app.ts", + content: "let x = 1" + }; + const f2 = { + path: "/b/app.ts", + content: "let x = 1" + }; + const f3 = { + path: "/c/app.ts", + content: "let x = 1" + }; + const makeProject = (f: FileOrFolder) => ({ projectFileName: f.path + ".csproj", rootFiles: [toExternalFile(f.path)], options: {} }); + const p1 = makeProject(f1); + const p2 = makeProject(f2); + const p3 = makeProject(f3); + + const host = createServerHost([f1, f2, f3]); + const session = createSession(host); + + session.executeCommand({ + seq: 1, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1, p2] } + }); + + const projectService = session.getProjectService(); + checkNumberOfProjects(projectService, { externalProjects: 2 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + assert.equal(projectService.externalProjects[1].getProjectName(), p2.projectFileName); + + session.executeCommand({ + seq: 2, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1, p3] } + }); + checkNumberOfProjects(projectService, { externalProjects: 2 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + assert.equal(projectService.externalProjects[1].getProjectName(), p3.projectFileName); + + session.executeCommand({ + seq: 3, + type: "request", + command: "openExternalProjects", + arguments: { projects: [] } + }); + checkNumberOfProjects(projectService, { externalProjects: 0 }); + + session.executeCommand({ + seq: 3, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p2] } + }); + assert.equal(projectService.externalProjects[0].getProjectName(), p2.projectFileName); + }); + it("handle recreated files correctly", () => { const configFile: FileOrFolder = { path: "/a/b/tsconfig.json", @@ -1057,6 +1144,69 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, {}); }); + it("reload regular file after closing", () => { + const f1 = { + path: "/a/b/app.ts", + content: "x." + }; + const f2 = { + path: "/a/b/lib.ts", + content: "let x: number;" + }; + + const host = createServerHost([f1, f2, libFile]); + const service = createProjectService(host); + service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: toExternalFiles([f1.path, f2.path]), options: {} }) + + service.openClientFile(f1.path); + service.openClientFile(f2.path, "let x: string"); + + service.checkNumberOfProjects({ externalProjects: 1 }); + checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]); + + const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2); + // should contain completions for string + assert.isTrue(completions1.entries.some(e => e.name === "charAt"), "should contain 'charAt'"); + assert.isFalse(completions1.entries.some(e => e.name === "toExponential"), "should not contain 'toExponential'"); + + service.closeClientFile(f2.path); + const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 2); + // should contain completions for string + assert.isFalse(completions2.entries.some(e => e.name === "charAt"), "should not contain 'charAt'"); + assert.isTrue(completions2.entries.some(e => e.name === "toExponential"), "should contain 'toExponential'"); + }); + + it("clear mixed content file after closing", () => { + const f1 = { + path: "/a/b/app.ts", + content: " " + }; + const f2 = { + path: "/a/b/lib.html", + content: "" + }; + + const host = createServerHost([f1, f2, libFile]); + const service = createProjectService(host); + service.openExternalProject({ projectFileName: "/a/b/project", rootFiles: [{ fileName: f1.path }, { fileName: f2.path, hasMixedContent: true }], options: {} }) + + service.openClientFile(f1.path); + service.openClientFile(f2.path, "let somelongname: string"); + + service.checkNumberOfProjects({ externalProjects: 1 }); + checkProjectActualFiles(service.externalProjects[0], [f1.path, f2.path, libFile.path]); + + const completions1 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0); + assert.isTrue(completions1.entries.some(e => e.name === "somelongname"), "should contain 'somelongname'"); + + service.closeClientFile(f2.path); + const completions2 = service.externalProjects[0].getLanguageService().getCompletionsAtPosition(f1.path, 0); + assert.isFalse(completions2.entries.some(e => e.name === "somelongname"), "should not contain 'somelongname'"); + const sf2 = service.externalProjects[0].getLanguageService().getProgram().getSourceFile(f2.path); + assert.equal(sf2.text, ""); + }); + + it("external project with included config file opened after configured project", () => { const file1 = { path: "/a/b/f1.ts", @@ -1088,6 +1238,7 @@ namespace ts.projectSystem { projectService.closeExternalProject(externalProjectName); checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("external project with included config file opened after configured project and then closed", () => { const file1 = { path: "/a/b/f1.ts", @@ -1441,6 +1592,67 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.inferredProjects[1], [file2.path]); }); + it("tsconfig script block support", () => { + const file1 = { + path: "/a/b/f1.ts", + content: ` ` + }; + const file2 = { + path: "/a/b/f2.html", + content: `var hello = "hello";` + }; + const config = { + path: "/a/b/tsconfig.json", + content: JSON.stringify({ compilerOptions: { allowJs: true } }) + }; + const host = createServerHost([file1, file2, config]); + const session = createSession(host); + openFilesForSession([file1], session); + const projectService = session.getProjectService(); + + // HTML file will not be included in any projects yet + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]); + + // Specify .html extension as mixed content + const extraFileExtensions = [{ extension: ".html", scriptKind: ScriptKind.JS, isMixedContent: true }]; + const configureHostRequest = makeSessionRequest(CommandNames.Configure, { extraFileExtensions }); + session.executeCommand(configureHostRequest).response; + + // HTML file still not included in the project as it is closed + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]); + + // Open HTML file + projectService.applyChangesInOpenFiles( + /*openFiles*/[{ fileName: file2.path, hasMixedContent: true, scriptKind: ScriptKind.JS, content: `var hello = "hello";` }], + /*changedFiles*/undefined, + /*closedFiles*/undefined); + + // Now HTML file is included in the project + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]); + + // Check identifiers defined in HTML content are available in .ts file + const project = projectService.configuredProjects[0]; + let completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 1); + assert(completions && completions.entries[0].name === "hello", `expected entry hello to be in completion list`); + + // Close HTML file + projectService.applyChangesInOpenFiles( + /*openFiles*/undefined, + /*changedFiles*/undefined, + /*closedFiles*/[file2.path]); + + // HTML file is still included in project + checkNumberOfProjects(projectService, { configuredProjects: 1 }); + checkProjectActualFiles(projectService.configuredProjects[0], [file1.path, file2.path]); + + // Check identifiers defined in HTML content are not available in .ts file + completions = project.getLanguageService().getCompletionsAtPosition(file1.path, 5); + assert(completions && completions.entries[0].name !== "hello", `unexpected hello entry in completion list`); + }); + it("project structure update is deferred if files are not added\removed", () => { const file1 = { path: "/a/b/f1.ts", @@ -1486,7 +1698,7 @@ namespace ts.projectSystem { const project = projectService.externalProjects[0]; const scriptInfo = project.getScriptInfo(file1.path); - const snap = scriptInfo.snap(); + const snap = scriptInfo.getSnapshot(); const actualText = snap.getText(0, snap.getLength()); assert.equal(actualText, "", `expected content to be empty string, got "${actualText}"`); @@ -1499,7 +1711,7 @@ namespace ts.projectSystem { projectService.closeClientFile(file1.path); const scriptInfo2 = project.getScriptInfo(file1.path); - const snap2 = scriptInfo2.snap(); + const snap2 = scriptInfo2.getSnapshot(); const actualText2 = snap2.getText(0, snap.getLength()); assert.equal(actualText2, "", `expected content to be empty string, got "${actualText2}"`); }); @@ -1586,6 +1798,49 @@ namespace ts.projectSystem { checkNumberOfProjects(projectService, { configuredProjects: 0 }); }); + it("language service disabled state is updated in external projects", () => { + debugger + const f1 = { + path: "/a/app.js", + content: "var x = 1" + }; + const f2 = { + path: "/a/largefile.js", + content: "" + }; + const host = createServerHost([f1, f2]); + const originalGetFileSize = host.getFileSize; + host.getFileSize = (filePath: string) => + filePath === f2.path ? server.maxProgramSizeForNonTsFiles + 1 : originalGetFileSize.call(host, filePath); + + const service = createProjectService(host); + const projectFileName = "/a/proj.csproj"; + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 1"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isTrue(service.externalProjects[0].languageServiceEnabled, "language service should be enabled"); + + service.openExternalProject({ + projectFileName, + rootFiles: toExternalFiles([f1.path, f2.path]), + options: {} + }); + service.checkNumberOfProjects({ externalProjects: 1 }); + assert.isFalse(service.externalProjects[0].languageServiceEnabled, "language service should be disabled - 2"); + }); + it("language service disabled events are triggered", () => { const f1 = { path: "/a/app.js", @@ -2197,13 +2452,13 @@ namespace ts.projectSystem { p.updateGraph(); const scriptInfo = p.getScriptInfo(f.path); - checkSnapLength(scriptInfo.snap(), f.content.length); + checkSnapLength(scriptInfo.getSnapshot(), f.content.length); // open project and replace its content with empty string projectService.openClientFile(f.path, ""); - checkSnapLength(scriptInfo.snap(), 0); + checkSnapLength(scriptInfo.getSnapshot(), 0); }); - function checkSnapLength(snap: server.LineIndexSnapshot, expectedLength: number) { + function checkSnapLength(snap: IScriptSnapshot, expectedLength: number) { assert.equal(snap.getLength(), expectedLength, "Incorrect snapshot size"); } }); @@ -2356,7 +2611,6 @@ namespace ts.projectSystem { const cwd = { path: "/a/c" }; - debugger; const host = createServerHost([f1, config, node, cwd], { currentDirectory: cwd.path }); const projectService = createProjectService(host); projectService.openClientFile(f1.path); @@ -2627,7 +2881,7 @@ namespace ts.projectSystem { // verify content const projectServiice = session.getProjectService(); - const snap1 = projectServiice.getScriptInfo(f1.path).snap(); + const snap1 = projectServiice.getScriptInfo(f1.path).getSnapshot(); assert.equal(snap1.getText(0, snap1.getLength()), tmp.content, "content should be equal to the content of temp file"); // reload from original file file @@ -2639,7 +2893,7 @@ namespace ts.projectSystem { }); // verify content - const snap2 = projectServiice.getScriptInfo(f1.path).snap(); + const snap2 = projectServiice.getScriptInfo(f1.path).getSnapshot(); assert.equal(snap2.getText(0, snap2.getLength()), f1.content, "content should be equal to the content of original file"); }); @@ -2700,6 +2954,65 @@ namespace ts.projectSystem { arguments: { projectFileName: projectName } }).response; assert.isTrue(diags.length === 0); + + session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsForInferredProjects, + seq: 3, + arguments: { options: { module: ModuleKind.CommonJS } } + }); + const diagsAfterUpdate = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 4, + arguments: { projectFileName: projectName } + }).response; + assert.isTrue(diagsAfterUpdate.length === 0); + }); + + it("for external project", () => { + const f1 = { + path: "/a/b/f1.js", + content: "function test1() { }" + }; + const host = createServerHost([f1, libFile]); + const session = createSession(host); + const projectService = session.getProjectService(); + const projectFileName = "/a/b/project.csproj"; + const externalFiles = toExternalFiles([f1.path]); + projectService.openExternalProject({ + projectFileName, + rootFiles: externalFiles, + options: {} + }); + + checkNumberOfProjects(projectService, { externalProjects: 1 }); + + const diags = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 2, + arguments: { projectFileName } + }).response; + assert.isTrue(diags.length === 0); + + session.executeCommand({ + type: "request", + command: server.CommandNames.OpenExternalProject, + seq: 3, + arguments: { + projectFileName, + rootFiles: externalFiles, + options: { module: ModuleKind.CommonJS } + } + }); + const diagsAfterUpdate = session.executeCommand({ + type: "request", + command: server.CommandNames.CompilerOptionsDiagnosticsFull, + seq: 4, + arguments: { projectFileName } + }).response; + assert.isTrue(diagsAfterUpdate.length === 0); }); }); diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts index aea9f4eb9ed..62d2f7ac801 100644 --- a/src/harness/unittests/typingsInstaller.ts +++ b/src/harness/unittests/typingsInstaller.ts @@ -20,13 +20,12 @@ namespace ts.projectSystem { } class Installer extends TestTypingsInstaller { - constructor(host: server.ServerHost, p?: InstallerParams, telemetryEnabled?: boolean, log?: TI.Log) { + constructor(host: server.ServerHost, p?: InstallerParams, log?: TI.Log) { super( (p && p.globalTypingsCacheLocation) || "/a/data", (p && p.throttleLimit) || 5, host, (p && p.typesRegistry), - telemetryEnabled, log); } @@ -36,7 +35,7 @@ namespace ts.projectSystem { } } - function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[], typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void { + function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[] | string, typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void { self.addPostExecAction(installedTypings, success => { for (const file of typingFiles) { host.createFileOrFolder(file, /*createParentDirectory*/ true); @@ -907,7 +906,7 @@ namespace ts.projectSystem { const host = createServerHost([f1, packageJson]); const installer = new (class extends Installer { constructor() { - super(host, { globalTypingsCacheLocation: "/tmp" }, /*telemetryEnabled*/ false, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); + super(host, { globalTypingsCacheLocation: "/tmp" }, { isEnabled: () => true, writeLine: msg => messages.push(msg) }); } installWorker(_requestId: number, _args: string[], _cwd: string, _cb: server.typingsInstaller.RequestCompletedAction) { assert(false, "runCommand should not be invoked"); @@ -971,15 +970,18 @@ namespace ts.projectSystem { let seenTelemetryEvent = false; const installer = new (class extends Installer { constructor() { - super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }, /*telemetryEnabled*/ true); + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); } installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { const installedTypings = ["@types/commander"]; const typingFiles = [commander]; executeCommand(this, host, installedTypings, typingFiles, cb); } - sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.TypingsInstallEvent) { - if (response.kind === server.EventInstall) { + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + return; + } + if (response.kind === server.EventEndInstallTypes) { assert.deepEqual(response.packagesToInstall, ["@types/commander"]); seenTelemetryEvent = true; return; @@ -997,4 +999,102 @@ namespace ts.projectSystem { checkProjectActualFiles(projectService.inferredProjects[0], [f1.path, commander.path]); }); }); + + describe("progress notifications", () => { + it ("should be sent for success", () => { + const f1 = { + path: "/a/app.js", + content: "" + }; + const package = { + path: "/a/package.json", + content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) + }; + const cachePath = "/a/cache/"; + const commander = { + path: cachePath + "node_modules/@types/commander/index.d.ts", + content: "export let x: number" + }; + const host = createServerHost([f1, package]); + let beginEvent: server.BeginInstallTypes; + let endEvent: server.EndInstallTypes; + const installer = new (class extends Installer { + constructor() { + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { + const installedTypings = ["@types/commander"]; + const typingFiles = [commander]; + executeCommand(this, host, installedTypings, typingFiles, cb); + } + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + beginEvent = response; + return; + } + if (response.kind === server.EventEndInstallTypes) { + endEvent = response; + return; + } + super.sendResponse(response); + } + })(); + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.openClientFile(f1.path); + + installer.installAll(/*expectedCount*/ 1); + + assert.isTrue(!!beginEvent); + assert.isTrue(!!endEvent); + assert.isTrue(beginEvent.eventId === endEvent.eventId); + assert.isTrue(endEvent.installSuccess); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + checkProjectActualFiles(projectService.inferredProjects[0], [f1.path, commander.path]); + }); + + it ("should be sent for error", () => { + const f1 = { + path: "/a/app.js", + content: "" + }; + const package = { + path: "/a/package.json", + content: JSON.stringify({ dependencies: { "commander": "1.0.0" } }) + }; + const cachePath = "/a/cache/"; + const host = createServerHost([f1, package]); + let beginEvent: server.BeginInstallTypes; + let endEvent: server.EndInstallTypes; + const installer = new (class extends Installer { + constructor() { + super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }); + } + installWorker(_requestId: number, _args: string[], _cwd: string, cb: server.typingsInstaller.RequestCompletedAction) { + executeCommand(this, host, "", [], cb); + } + sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.BeginInstallTypes | server.EndInstallTypes) { + if (response.kind === server.EventBeginInstallTypes) { + beginEvent = response; + return; + } + if (response.kind === server.EventEndInstallTypes) { + endEvent = response; + return; + } + super.sendResponse(response); + } + })(); + const projectService = createProjectService(host, { typingsInstaller: installer }); + projectService.openClientFile(f1.path); + + installer.installAll(/*expectedCount*/ 1); + + assert.isTrue(!!beginEvent); + assert.isTrue(!!endEvent); + assert.isTrue(beginEvent.eventId === endEvent.eventId); + assert.isFalse(endEvent.installSuccess); + checkNumberOfProjects(projectService, { inferredProjects: 1 }); + checkProjectActualFiles(projectService.inferredProjects[0], [f1.path]); + }); + }); } \ No newline at end of file diff --git a/src/lib/es2016.array.include.d.ts b/src/lib/es2016.array.include.d.ts index 17b3eaac1d3..fdd9ed4639f 100644 --- a/src/lib/es2016.array.include.d.ts +++ b/src/lib/es2016.array.include.d.ts @@ -7,6 +7,15 @@ interface Array { includes(searchElement: T, fromIndex?: number): boolean; } +interface ReadonlyArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + interface Int8Array { /** * Determines whether an array includes a certain element, returning true or false as appropriate. diff --git a/src/lib/es2017.object.d.ts b/src/lib/es2017.object.d.ts index c219f467ac9..80c2161506a 100644 --- a/src/lib/es2017.object.d.ts +++ b/src/lib/es2017.object.d.ts @@ -4,11 +4,22 @@ interface ObjectConstructor { * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ values(o: { [s: string]: T }): T[]; + + /** + * Returns an array of values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ values(o: any): any[]; + + /** + * Returns an array of key/values of the enumerable properties of an object + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + entries(o: { [s: string]: T }): [string, T][]; + /** * Returns an array of key/values of the enumerable properties of an object * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ - entries(o: T): [keyof T, T[K]][]; entries(o: any): [string, any][]; } diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 7ee47817802..1e6b44788b3 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -176,6 +176,18 @@ interface ObjectConstructor { */ 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(a: T[]): ReadonlyArray; + + /** + * 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(f: 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. diff --git a/src/server/builder.ts b/src/server/builder.ts index 5354e7ed508..60f56dc3241 100644 --- a/src/server/builder.ts +++ b/src/server/builder.ts @@ -75,17 +75,32 @@ namespace ts.server { getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; onProjectUpdateGraph(): void; emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; } abstract class AbstractBuilder implements Builder { - private fileInfos = createFileMap(); + /** + * stores set of files from the project. + * NOTE: this field is created on demand and should not be accessed directly. + * Use 'getFileInfos' instead. + */ + private fileInfos_doNotAccessDirectly: FileMap; constructor(public readonly project: Project, private ctor: { new (scriptInfo: ScriptInfo, project: Project): T }) { } + private getFileInfos() { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = createFileMap()); + } + + public clear() { + // drop the existing list - it will be re-created as necessary + this.fileInfos_doNotAccessDirectly = undefined; + } + protected getFileInfo(path: Path): T { - return this.fileInfos.get(path); + return this.getFileInfos().get(path); } protected getOrCreateFileInfo(path: Path): T { @@ -99,19 +114,19 @@ namespace ts.server { } protected getFileInfoPaths(): Path[] { - return this.fileInfos.getKeys(); + return this.getFileInfos().getKeys(); } protected setFileInfo(path: Path, info: T) { - this.fileInfos.set(path, info); + this.getFileInfos().set(path, info); } protected removeFileInfo(path: Path) { - this.fileInfos.remove(path); + this.getFileInfos().remove(path); } protected forEachFileInfo(action: (fileInfo: T) => any) { - this.fileInfos.forEachValue((_path, value) => action(value)); + this.getFileInfos().forEachValue((_path, value) => action(value)); } abstract getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; @@ -231,6 +246,11 @@ namespace ts.server { private projectVersionForDependencyGraph: string; + public clear() { + this.projectVersionForDependencyGraph = undefined; + super.clear(); + } + private getReferencedFileInfos(fileInfo: ModuleBuilderFileInfo): ModuleBuilderFileInfo[] { if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { return []; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 881d188307d..00df53e1e35 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -108,6 +108,7 @@ namespace ts.server { export interface HostConfiguration { formatCodeOptions: FormatCodeSettings; hostInfo: string; + extraFileExtensions?: FileExtensionInfo[]; } interface ConfigFileConversionResult { @@ -125,20 +126,23 @@ namespace ts.server { } export interface OpenConfiguredProjectResult { - configFileName?: string; + configFileName?: NormalizedPath; configFileErrors?: Diagnostic[]; } interface FilePropertyReader { getFileName(f: T): string; getScriptKind(f: T): ScriptKind; - hasMixedContent(f: T): boolean; + hasMixedContent(f: T, extraFileExtensions: FileExtensionInfo[]): boolean; } const fileNamePropertyReader: FilePropertyReader = { getFileName: x => x, getScriptKind: _ => undefined, - hasMixedContent: _ => false + hasMixedContent: (fileName, extraFileExtensions) => { + const mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, item => item.isMixedContent), item => item.extension); + return forEach(mixedContentExtensions, extension => fileExtensionIs(fileName, extension)) + } }; const externalFilePropertyReader: FilePropertyReader = { @@ -257,7 +261,7 @@ namespace ts.server { private changedFiles: ScriptInfo[]; - private toCanonicalFileName: (f: string) => string; + readonly toCanonicalFileName: (f: string) => string; public lastDeletedFile: ScriptInfo; @@ -282,7 +286,8 @@ namespace ts.server { this.hostConfiguration = { formatCodeOptions: getDefaultFormatCodeSettings(this.host), - hostInfo: "Unknown host" + hostInfo: "Unknown host", + extraFileExtensions: [] }; this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); @@ -424,7 +429,7 @@ namespace ts.server { this.handleDeletedFile(info); } else { - if (info && (!info.isOpen)) { + if (info && (!info.isScriptOpen())) { // file has been changed which might affect the set of referenced files in projects that include // this file and set of inferred projects info.reloadFromFile(); @@ -440,7 +445,7 @@ namespace ts.server { // TODO: handle isOpen = true case - if (!info.isOpen) { + if (!info.isScriptOpen()) { this.filenameToScriptInfo.remove(info.path); this.lastDeletedFile = info; @@ -486,7 +491,7 @@ namespace ts.server { // If a change was made inside "folder/file", node will trigger the callback twice: // one with the fileName being "folder/file", and the other one with "folder". // We don't respond to the second one. - if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions())) { + if (fileName && !ts.isSupportedSourceFileName(fileName, project.getCompilerOptions(), this.hostConfiguration.extraFileExtensions)) { return; } @@ -634,15 +639,17 @@ namespace ts.server { // Closing file should trigger re-reading the file content from disk. This is // because the user may chose to discard the buffer content before saving // to the disk, and the server's version of the file can be out of sync. - info.reloadFromFile(); + info.close(); removeItemFromSet(this.openFiles, info); - info.isOpen = false; // collect all projects that should be removed let projectsToRemove: Project[]; for (const p of info.containingProjects) { if (p.projectKind === ProjectKind.Configured) { + if (info.hasMixedContent) { + info.registerFileUpdate(); + } // last open file in configured project - close it if ((p).deleteOpenRef() === 0) { (projectsToRemove || (projectsToRemove = [])).push(p); @@ -652,6 +659,13 @@ namespace ts.server { // open file in inferred project (projectsToRemove || (projectsToRemove = [])).push(p); } + + if (!p.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + p.markAsDirty(); + } } if (projectsToRemove) { for (const project of projectsToRemove) { @@ -777,7 +791,13 @@ namespace ts.server { } private findConfiguredProjectByProjectName(configFileName: NormalizedPath) { - return findProjectByName(configFileName, this.configuredProjects); + // make sure that casing of config file name is consistent + configFileName = asNormalizedPath(this.toCanonicalFileName(configFileName)); + for (const proj of this.configuredProjects) { + if (proj.canonicalConfigFilePath === configFileName) { + return proj; + } + } } private findExternalProjectByProjectName(projectFileName: string) { @@ -805,7 +825,9 @@ namespace ts.server { this.host, getDirectoryPath(configFilename), /*existingOptions*/ {}, - configFilename); + configFilename, + /*resolutionStack*/ [], + this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { errors = concatenate(errors, parsedCommandLine.errors); @@ -909,7 +931,7 @@ namespace ts.server { for (const f of files) { const rootFilename = propertyReader.getFileName(f); const scriptKind = propertyReader.getScriptKind(f); - const hasMixedContent = propertyReader.hasMixedContent(f); + const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); if (this.host.fileExists(rootFilename)) { const info = this.getOrCreateScriptInfoForNormalizedPath(toNormalizedPath(rootFilename), /*openedByClient*/ clientFileName == rootFilename, /*fileContent*/ undefined, scriptKind, hasMixedContent); project.addRoot(info); @@ -955,7 +977,7 @@ namespace ts.server { rootFilesChanged = true; if (!scriptInfo) { const scriptKind = propertyReader.getScriptKind(f); - const hasMixedContent = propertyReader.hasMixedContent(f); + const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); scriptInfo = this.getOrCreateScriptInfoForNormalizedPath(normalizedPath, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent); } } @@ -983,7 +1005,7 @@ namespace ts.server { } if (toAdd) { for (const f of toAdd) { - if (f.isOpen && isRootFileInInferredProject(f)) { + if (f.isScriptOpen() && isRootFileInInferredProject(f)) { // if file is already root in some inferred project // - remove the file from that project and delete the project if necessary const inferredProject = f.containingProjects[0]; @@ -1037,9 +1059,7 @@ namespace ts.server { project.stopWatchingDirectory(); } else { - if (!project.languageServiceEnabled) { - project.enableLanguageService(); - } + project.enableLanguageService(); this.watchConfigDirectoryForProject(project, projectOptions); this.updateNonInferredProject(project, projectOptions.files, fileNamePropertyReader, projectOptions.compilerOptions, projectOptions.typeAcquisition, projectOptions.compileOnSave, configFileErrors); } @@ -1083,32 +1103,34 @@ namespace ts.server { getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean) { let info = this.getScriptInfoForNormalizedPath(fileName); if (!info) { - let content: string; - if (this.host.fileExists(fileName)) { - // by default pick whatever content was supplied as the argument - // if argument was not given - then for mixed content files assume that its content is empty string - content = fileContent || (hasMixedContent ? "" : this.host.readFile(fileName)); - } - if (!content) { - if (openedByClient) { - content = ""; - } - } - if (content !== undefined) { - info = new ScriptInfo(this.host, fileName, content, scriptKind, openedByClient, hasMixedContent); - // do not watch files with mixed content - server doesn't know how to interpret it + if (openedByClient || this.host.fileExists(fileName)) { + info = new ScriptInfo(this.host, fileName, scriptKind, hasMixedContent); + this.filenameToScriptInfo.set(info.path, info); - if (!info.isOpen && !hasMixedContent) { - info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName))); + + if (openedByClient) { + if (fileContent === undefined) { + // if file is opened by client and its content is not specified - use file text + fileContent = this.host.readFile(fileName) || ""; + } + } + else { + // do not watch files with mixed content - server doesn't know how to interpret it + if (!hasMixedContent) { + info.setWatcher(this.host.watchFile(fileName, _ => this.onSourceFileChanged(fileName))); + } } } } if (info) { - if (fileContent !== undefined) { - info.reload(fileContent); + if (openedByClient && !info.isScriptOpen()) { + info.open(fileContent); + if (hasMixedContent) { + info.registerFileUpdate(); + } } - if (openedByClient) { - info.isOpen = true; + else if (fileContent !== undefined) { + info.reload(fileContent); } } return info; @@ -1140,6 +1162,10 @@ namespace ts.server { mergeMaps(this.hostConfiguration.formatCodeOptions, convertFormatOptions(args.formatOptions)); this.logger.info("Format host information updated"); } + if (args.extraFileExtensions) { + this.hostConfiguration.extraFileExtensions = args.extraFileExtensions; + this.logger.info("Host file extension mappings updated"); + } } } @@ -1205,9 +1231,22 @@ namespace ts.server { } openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult { - const { configFileName = undefined, configFileErrors = undefined }: OpenConfiguredProjectResult = this.findContainingExternalProject(fileName) - ? {} - : this.openOrUpdateConfiguredProjectForFile(fileName); + let configFileName: NormalizedPath; + let configFileErrors: Diagnostic[]; + + let project: ConfiguredProject | ExternalProject = this.findContainingExternalProject(fileName); + if (!project) { + ({ configFileName, configFileErrors } = this.openOrUpdateConfiguredProjectForFile(fileName)); + if (configFileName) { + project = this.findConfiguredProjectByProjectName(configFileName); + } + } + if (project && !project.languageServiceEnabled) { + // if project language service is disabled then we create a program only for open files. + // this means that project should be marked as dirty to force rebuilding of the program + // on the next request + project.markAsDirty(); + } // at this point if file is the part of some configured/external project then this project should be created const info = this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent); @@ -1224,7 +1263,6 @@ namespace ts.server { const info = this.getScriptInfoForNormalizedPath(toNormalizedPath(uncheckedFileName)); if (info) { this.closeOpenFile(info); - info.isOpen = false; } this.printProjects(); } @@ -1249,7 +1287,7 @@ namespace ts.server { if (openFiles) { for (const file of openFiles) { const scriptInfo = this.getScriptInfo(file.fileName); - Debug.assert(!scriptInfo || !scriptInfo.isOpen); + Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); const normalizedPath = scriptInfo ? scriptInfo.fileName : toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -1321,7 +1359,28 @@ namespace ts.server { } } - openExternalProject(proj: protocol.ExternalProject): void { + openExternalProjects(projects: protocol.ExternalProject[]): void { + // record project list before the update + const projectsToClose = arrayToMap(this.externalProjects, p => p.getProjectName(), _ => true); + for (const externalProjectName in this.externalProjectToConfiguredProjectMap) { + projectsToClose[externalProjectName] = true; + } + + for (const externalProject of projects) { + this.openExternalProject(externalProject, /*suppressRefreshOfInferredProjects*/ true); + // delete project that is present in input list + delete projectsToClose[externalProject.projectFileName]; + } + + // close projects that were missing in the input list + for (const externalProjectName in projectsToClose) { + this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true) + } + + this.refreshInferredProjects(); + } + + openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects = false): void { // typingOptions has been deprecated and is only supported for backward compatibility // purposes. It should be removed in future releases - use typeAcquisition instead. if (proj.typingOptions && !proj.typeAcquisition) { @@ -1351,8 +1410,15 @@ namespace ts.server { let exisingConfigFiles: string[]; if (externalProject) { if (!tsConfigFiles) { + const compilerOptions = convertCompilerOptions(proj.options); + if (this.exceededTotalSizeLimitForNonTsFiles(compilerOptions, proj.rootFiles, externalFilePropertyReader)) { + externalProject.disableLanguageService(); + } + else { + externalProject.enableLanguageService(); + } // external project already exists and not config files were added - update the project and return; - this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, convertCompilerOptions(proj.options), proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); + this.updateNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, /*configFileErrors*/ undefined); return; } // some config files were added to external project (that previously were not there) @@ -1414,7 +1480,9 @@ namespace ts.server { delete this.externalProjectToConfiguredProjectMap[proj.projectFileName]; this.createAndAddExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition); } - this.refreshInferredProjects(); + if (!suppressRefreshOfInferredProjects) { + this.refreshInferredProjects(); + } } } } diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index aa37008ff66..d73a31933f4 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -169,7 +169,7 @@ namespace ts.server { getScriptSnapshot(filename: string): ts.IScriptSnapshot { const scriptInfo = this.project.getScriptInfoLSHost(filename); if (scriptInfo) { - return scriptInfo.snap(); + return scriptInfo.getSnapshot(); } } diff --git a/src/server/project.ts b/src/server/project.ts index c37dd6e135a..0037a470a49 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -90,87 +90,6 @@ namespace ts.server { } } - const emptyResult: any[] = []; - const getEmptyResult = () => emptyResult; - const getUndefined = () => undefined; - const emptyEncodedSemanticClassifications = { spans: emptyResult, endOfLineState: EndOfLineState.None }; - - export function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService { - return { - cleanupSemanticCache: noop, - getSyntacticDiagnostics: (fileName) => - fileName ? realLanguageService.getSyntacticDiagnostics(fileName) : emptyResult, - getSemanticDiagnostics: getEmptyResult, - getCompilerOptionsDiagnostics: () => - realLanguageService.getCompilerOptionsDiagnostics(), - getSyntacticClassifications: (fileName, span) => - realLanguageService.getSyntacticClassifications(fileName, span), - getEncodedSyntacticClassifications: (fileName, span) => - realLanguageService.getEncodedSyntacticClassifications(fileName, span), - getSemanticClassifications: getEmptyResult, - getEncodedSemanticClassifications: () => - emptyEncodedSemanticClassifications, - getCompletionsAtPosition: getUndefined, - findReferences: getEmptyResult, - getCompletionEntryDetails: getUndefined, - getQuickInfoAtPosition: getUndefined, - findRenameLocations: getEmptyResult, - getNameOrDottedNameSpan: (fileName, startPos, endPos) => - realLanguageService.getNameOrDottedNameSpan(fileName, startPos, endPos), - getBreakpointStatementAtPosition: (fileName, position) => - realLanguageService.getBreakpointStatementAtPosition(fileName, position), - getBraceMatchingAtPosition: (fileName, position) => - realLanguageService.getBraceMatchingAtPosition(fileName, position), - getSignatureHelpItems: getUndefined, - getDefinitionAtPosition: getEmptyResult, - getRenameInfo: () => ({ - canRename: false, - localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.Language_service_is_disabled), - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }), - getTypeDefinitionAtPosition: getUndefined, - getReferencesAtPosition: getEmptyResult, - getDocumentHighlights: getEmptyResult, - getOccurrencesAtPosition: getEmptyResult, - getNavigateToItems: getEmptyResult, - getNavigationBarItems: fileName => - realLanguageService.getNavigationBarItems(fileName), - getNavigationTree: fileName => - realLanguageService.getNavigationTree(fileName), - getOutliningSpans: fileName => - realLanguageService.getOutliningSpans(fileName), - getTodoComments: getEmptyResult, - getIndentationAtPosition: (fileName, position, options) => - realLanguageService.getIndentationAtPosition(fileName, position, options), - getFormattingEditsForRange: (fileName, start, end, options) => - realLanguageService.getFormattingEditsForRange(fileName, start, end, options), - getFormattingEditsForDocument: (fileName, options) => - realLanguageService.getFormattingEditsForDocument(fileName, options), - getFormattingEditsAfterKeystroke: (fileName, position, key, options) => - realLanguageService.getFormattingEditsAfterKeystroke(fileName, position, key, options), - getDocCommentTemplateAtPosition: (fileName, position) => - realLanguageService.getDocCommentTemplateAtPosition(fileName, position), - isValidBraceCompletionAtPosition: (fileName, position, openingBrace) => - realLanguageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace), - getEmitOutput: getUndefined, - getProgram: () => - realLanguageService.getProgram(), - getNonBoundSourceFile: fileName => - realLanguageService.getNonBoundSourceFile(fileName), - dispose: () => - realLanguageService.dispose(), - getCompletionEntrySymbol: getUndefined, - getImplementationAtPosition: getEmptyResult, - getSourceFile: fileName => - realLanguageService.getSourceFile(fileName), - getCodeFixesAtPosition: getEmptyResult - }; - } - export abstract class Project { private rootFiles: ScriptInfo[] = []; private rootFilesMap: FileMap = createFileMap(); @@ -181,12 +100,14 @@ namespace ts.server { private lastCachedUnresolvedImportsList: SortedReadonlyArray; private readonly languageService: LanguageService; - // wrapper over the real language service that will suppress all semantic operations - private readonly noSemanticFeaturesLanguageService: LanguageService; public languageServiceEnabled = true; builder: Builder; + /** + * Set of files names that were updated since the last call to getChangesSinceVersion. + */ + private updatedFileNames: Map; /** * Set of files that was returned from the last call to getChangesSinceVersion. */ @@ -248,15 +169,12 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { - this.compilerOptions.noEmitForJsFiles = true; - } + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken); this.lsHost.setCompilationSettings(this.compilerOptions); this.languageService = ts.createLanguageService(this.lsHost, this.documentRegistry); - this.noSemanticFeaturesLanguageService = createNoSemanticFeaturesWrapper(this.languageService); if (!languageServiceEnabled) { this.disableLanguageService(); @@ -266,6 +184,12 @@ namespace ts.server { this.markAsDirty(); } + private setInternalCompilerOptionsForEmittingJsFiles() { + if (this.projectKind === ProjectKind.Inferred || this.projectKind === ProjectKind.External) { + this.compilerOptions.noEmitForJsFiles = true; + } + } + getProjectErrors() { return this.projectErrors; } @@ -274,9 +198,7 @@ namespace ts.server { if (ensureSynchronized) { this.updateGraph(); } - return this.languageServiceEnabled - ? this.languageService - : this.noSemanticFeaturesLanguageService; + return this.languageService; } getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[] { @@ -365,7 +287,10 @@ namespace ts.server { const result: string[] = []; if (this.rootFiles) { for (const f of this.rootFiles) { - result.push(f.fileName); + if (this.languageServiceEnabled || f.isScriptOpen()) { + // if language service is disabled - process only files that are open + result.push(f.fileName); + } } if (this.typingFiles) { for (const f of this.typingFiles) { @@ -381,6 +306,10 @@ namespace ts.server { } getScriptInfos() { + if (!this.languageServiceEnabled) { + // if language service is not enabled - return just root files + return this.rootFiles; + } return map(this.program.getSourceFiles(), sourceFile => { const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { @@ -444,7 +373,7 @@ namespace ts.server { containsFile(filename: NormalizedPath, requireOpen?: boolean) { const info = this.projectService.getScriptInfoForNormalizedPath(filename); - if (info && (info.isOpen || !requireOpen)) { + if (info && (info.isScriptOpen() || !requireOpen)) { return this.containsScriptInfo(info); } } @@ -476,6 +405,10 @@ namespace ts.server { this.markAsDirty(); } + registerFileUpdate(fileName: string) { + (this.updatedFileNames || (this.updatedFileNames = createMap()))[fileName] = fileName; + } + markAsDirty() { this.projectStateVersion++; } @@ -517,10 +450,6 @@ namespace ts.server { * @returns: true if set of files in the project stays the same and false - otherwise. */ updateGraph(): boolean { - if (!this.languageServiceEnabled) { - return true; - } - this.lsHost.startRecordingFilesWithChangedResolutions(); let hasChanges = this.updateGraphWorker(); @@ -552,6 +481,16 @@ namespace ts.server { if (this.setTypings(cachedTypings)) { hasChanges = this.updateGraphWorker() || hasChanges; } + + // update builder only if language service is enabled + // otherwise tell it to drop its internal state + if (this.languageServiceEnabled) { + this.builder.onProjectUpdateGraph(); + } + else { + this.builder.clear(); + } + if (hasChanges) { this.projectStructureVersion++; } @@ -590,7 +529,6 @@ namespace ts.server { } } } - this.builder.onProjectUpdateGraph(); return hasChanges; } @@ -637,6 +575,7 @@ namespace ts.server { this.lastCachedUnresolvedImportsList = undefined; } this.compilerOptions = compilerOptions; + this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost.setCompilationSettings(compilerOptions); this.markAsDirty(); @@ -660,12 +599,15 @@ namespace ts.server { projectName: this.getProjectName(), version: this.projectStructureVersion, isInferred: this.projectKind === ProjectKind.Inferred, - options: this.getCompilerOptions() + options: this.getCompilerOptions(), + languageServiceDisabled: !this.languageServiceEnabled }; + const updatedFileNames = this.updatedFileNames; + this.updatedFileNames = undefined; // check if requested version is the same that we have reported last time if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { - // if current structure version is the same - return info witout any changes - if (this.projectStructureVersion == this.lastReportedVersion) { + // if current structure version is the same - return info without any changes + if (this.projectStructureVersion == this.lastReportedVersion && !updatedFileNames) { return { info, projectErrors: this.projectErrors }; } // compute and return the difference @@ -674,6 +616,7 @@ namespace ts.server { const added: string[] = []; const removed: string[] = []; + const updated: string[] = getOwnKeys(updatedFileNames); for (const id in currentFiles) { if (!hasProperty(lastReportedFileNames, id)) { added.push(id); @@ -686,7 +629,7 @@ namespace ts.server { } this.lastReportedFileNames = currentFiles; this.lastReportedVersion = this.projectStructureVersion; - return { info, changes: { added, removed }, projectErrors: this.projectErrors }; + return { info, changes: { added, removed, updated }, projectErrors: this.projectErrors }; } else { // unknown version - return everything @@ -817,6 +760,7 @@ namespace ts.server { private directoryWatcher: FileWatcher; private directoriesWatchedForWildcards: Map; private typeRootsWatchers: FileWatcher[]; + readonly canonicalConfigFilePath: NormalizedPath; /** Used for configured projects which may have multiple open roots */ openRefCount = 0; @@ -830,6 +774,7 @@ namespace ts.server { languageServiceEnabled: boolean, public compileOnSaveEnabled: boolean) { super(configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled); + this.canonicalConfigFilePath = asNormalizedPath(projectService.toCanonicalFileName(configFileName)); } getConfigFilePath() { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index e1735f768e4..39012e49fcd 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1,4 +1,4 @@ -/** +/** * Declaration module describing the TypeScript Server protocol */ namespace ts.server.protocol { @@ -904,6 +904,11 @@ namespace ts.server.protocol { * Current set of compiler options for project */ options: ts.CompilerOptions; + + /** + * true if project language service is disabled + */ + languageServiceDisabled: boolean; } /** @@ -918,6 +923,10 @@ namespace ts.server.protocol { * List of removed files */ removed: string[]; + /** + * List of updated files + */ + updated: string[]; } /** @@ -990,6 +999,11 @@ namespace ts.server.protocol { * The format options to use during formatting and other code editing features. */ formatOptions?: FormatCodeSettings; + + /** + * The host's additional supported file extensions + */ + extraFileExtensions?: FileExtensionInfo[]; } /** @@ -2117,6 +2131,40 @@ namespace ts.server.protocol { typingsInstallerVersion: string; } + export type BeginInstallTypesEventName = "beginInstallTypes"; + export type EndInstallTypesEventName = "endInstallTypes"; + + export interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + + export interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + + export interface InstallTypesEventBody { + /** + * correlation id to match begin and end events + */ + eventId: number; + /** + * list of packages to install + */ + packages: ReadonlyArray; + } + + export interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + + export interface EndInstallTypesEventBody extends InstallTypesEventBody { + /** + * true if installation succeeded, otherwise false + */ + success: boolean; + } + export interface NavBarResponse extends Response { body?: NavigationBarItem[]; } diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 84649863a7b..0acd45d0287 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -2,6 +2,161 @@ namespace ts.server { + /* @internal */ + export class TextStorage { + private svc: ScriptVersionCache | undefined; + private svcVersion = 0; + + private text: string; + private lineMap: number[]; + private textVersion = 0; + + constructor(private readonly host: ServerHost, private readonly fileName: NormalizedPath) { + } + + public getVersion() { + return this.svc + ? `SVC-${this.svcVersion}-${this.svc.getSnapshot().version}` + : `Text-${this.textVersion}`; + } + + public hasScriptVersionCache() { + return this.svc !== undefined; + } + + public useScriptVersionCache(newText?: string) { + this.switchToScriptVersionCache(newText); + } + + public useText(newText?: string) { + this.svc = undefined; + this.setText(newText); + } + + public edit(start: number, end: number, newText: string) { + this.switchToScriptVersionCache().edit(start, end - start, newText); + } + + public reload(text: string) { + if (this.svc) { + this.svc.reload(text); + } + else { + this.setText(text); + } + } + + public reloadFromFile(tempFileName?: string) { + if (this.svc || (tempFileName !== this.fileName)) { + this.reload(this.getFileText(tempFileName)) + } + else { + this.setText(undefined); + } + } + + public getSnapshot(): IScriptSnapshot { + return this.svc + ? this.svc.getSnapshot() + : ScriptSnapshot.fromString(this.getOrLoadText()); + } + + public getLineInfo(line: number) { + return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + } + /** + * @param line 0 based index + */ + lineToTextSpan(line: number) { + if (!this.svc) { + const lineMap = this.getLineMap(); + const start = lineMap[line]; // -1 since line is 1-based + const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; + return ts.createTextSpanFromBounds(start, end); + } + const index = this.svc.getSnapshot().index; + const lineInfo = index.lineNumberToInfo(line + 1); + let len: number; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + const nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.offset - lineInfo.offset; + } + return ts.createTextSpan(lineInfo.offset, len); + } + + /** + * @param line 1 based index + * @param offset 1 based index + */ + lineOffsetToPosition(line: number, offset: number): number { + if (!this.svc) { + return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + } + const index = this.svc.getSnapshot().index; + + const lineInfo = index.lineNumberToInfo(line); + // TODO: assert this offset is actually on the line + return (lineInfo.offset + offset - 1); + } + + /** + * @param line 1-based index + * @param offset 1-based index + */ + positionToLineOffset(position: number): ILineInfo { + if (!this.svc) { + const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position); + return { line: line + 1, offset: character + 1 }; + } + const index = this.svc.getSnapshot().index; + const lineOffset = index.charOffsetToLineNumberAndPos(position); + return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + } + + private getFileText(tempFileName?: string) { + return this.host.readFile(tempFileName || this.fileName) || ""; + } + + private ensureNoScriptVersionCache() { + Debug.assert(!this.svc, "ScriptVersionCache should not be set"); + } + + private switchToScriptVersionCache(newText?: string): ScriptVersionCache { + if (!this.svc) { + this.svc = ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svcVersion++; + this.text = undefined; + } + return this.svc; + } + + private getOrLoadText() { + this.ensureNoScriptVersionCache(); + if (this.text === undefined) { + this.setText(this.getFileText()); + } + return this.text; + } + + private getLineMap() { + this.ensureNoScriptVersionCache(); + return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText())); + } + + private setText(newText: string) { + this.ensureNoScriptVersionCache(); + if (newText === undefined || this.text !== newText) { + this.text = newText; + this.lineMap = undefined; + this.textVersion++; + } + } + } + + export class ScriptInfo { /** * All projects that include this file @@ -11,24 +166,46 @@ namespace ts.server { readonly path: Path; private fileWatcher: FileWatcher; - private svc: ScriptVersionCache; + private textStorage: TextStorage; + + private isOpen: boolean; - // TODO: allow to update hasMixedContent from the outside constructor( private readonly host: ServerHost, readonly fileName: NormalizedPath, - content: string, readonly scriptKind: ScriptKind, - public isOpen = false, public hasMixedContent = false) { this.path = toPath(fileName, host.getCurrentDirectory(), createGetCanonicalFileName(host.useCaseSensitiveFileNames)); - this.svc = ScriptVersionCache.fromString(host, content); + this.textStorage = new TextStorage(host, fileName); + if (hasMixedContent) { + this.textStorage.reload(""); + } this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); } + public isScriptOpen() { + return this.isOpen; + } + + public open(newText: string) { + this.isOpen = true; + this.textStorage.useScriptVersionCache(newText); + this.markContainingProjectsAsDirty(); + } + + public close() { + this.isOpen = false; + this.textStorage.useText(this.hasMixedContent ? "" : undefined); + this.markContainingProjectsAsDirty(); + } + + public getSnapshot() { + return this.textStorage.getSnapshot(); + } + getFormatCodeSettings() { return this.formatCodeSettings; } @@ -90,6 +267,12 @@ namespace ts.server { return this.containingProjects[0]; } + registerFileUpdate(): void { + for (const p of this.containingProjects) { + p.registerFileUpdate(this.path); + } + } + setFormatOptions(formatSettings: FormatCodeSettings): void { if (formatSettings) { if (!this.formatCodeSettings) { @@ -112,16 +295,16 @@ namespace ts.server { } getLatestVersion() { - return this.svc.latestVersion().toString(); + return this.textStorage.getVersion(); } reload(script: string) { - this.svc.reload(script); + this.textStorage.reload(script); this.markContainingProjectsAsDirty(); } saveTo(fileName: string) { - const snap = this.snap(); + const snap = this.textStorage.getSnapshot(); this.host.writeFile(fileName, snap.getText(0, snap.getLength())); } @@ -130,22 +313,17 @@ namespace ts.server { this.reload(""); } else { - this.svc.reloadFromFile(tempFileName || this.fileName); + this.textStorage.reloadFromFile(tempFileName); this.markContainingProjectsAsDirty(); } } - snap() { - return this.svc.getSnapshot(); - } - getLineInfo(line: number) { - const snap = this.snap(); - return snap.index.lineNumberToInfo(line); + return this.textStorage.getLineInfo(line); } editContent(start: number, end: number, newText: string): void { - this.svc.edit(start, end - start, newText); + this.textStorage.edit(start, end, newText); this.markContainingProjectsAsDirty(); } @@ -159,17 +337,7 @@ namespace ts.server { * @param line 1 based index */ lineToTextSpan(line: number) { - const index = this.snap().index; - const lineInfo = index.lineNumberToInfo(line + 1); - let len: number; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - const nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.textStorage.lineToTextSpan(line); } /** @@ -177,11 +345,7 @@ namespace ts.server { * @param offset 1 based index */ lineOffsetToPosition(line: number, offset: number): number { - const index = this.snap().index; - - const lineInfo = index.lineNumberToInfo(line); - // TODO: assert this offset is actually on the line - return (lineInfo.offset + offset - 1); + return this.textStorage.lineOffsetToPosition(line, offset); } /** @@ -189,9 +353,7 @@ namespace ts.server { * @param offset 1-based index */ positionToLineOffset(position: number): ILineInfo { - const index = this.snap().index; - const lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.textStorage.positionToLineOffset(position); } } } \ No newline at end of file diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index f094a183610..aaf04d39a1f 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -438,8 +438,9 @@ namespace ts.server { } } getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { - const oldSnap = oldSnapshot; - return this.getTextChangeRangeSinceVersion(oldSnap.version); + if (oldSnapshot instanceof LineIndexSnapshot) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } } } diff --git a/src/server/server.ts b/src/server/server.ts index d5ccea4cd32..a020ef210fe 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -20,34 +20,41 @@ namespace ts.server { } = require("os"); function getGlobalTypingsCacheLocation() { - let basePath: string; switch (process.platform) { - case "win32": - basePath = process.env.LOCALAPPDATA || + case "win32": { + const basePath = process.env.LOCALAPPDATA || process.env.APPDATA || (os.homedir && os.homedir()) || process.env.USERPROFILE || (process.env.HOMEDRIVE && process.env.HOMEPATH && normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) || os.tmpdir(); - break; - case "linux": - case "android": - basePath = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && `/home/${process.env.LOGNAME || process.env.USER}`) || - os.tmpdir(); - break; + return combinePaths(normalizeSlashes(basePath), "Microsoft/TypeScript"); + } case "darwin": - const homeDir = (os.homedir && os.homedir()) || - process.env.HOME || - ((process.env.LOGNAME || process.env.USER) && `/Users/${process.env.LOGNAME || process.env.USER}`) || - os.tmpdir(); - basePath = combinePaths(homeDir, "Library/Application Support/"); - break; + case "linux": + case "android": { + const cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin"); + return combinePaths(cacheLocation, "typescript"); + } + default: + Debug.fail(`unsupported platform '${process.platform}'`); + return; } + } - Debug.assert(basePath !== undefined); - return combinePaths(normalizeSlashes(basePath), "Microsoft/TypeScript"); + function getNonWindowsCacheLocation(platformIsDarwin: boolean) { + if (process.env.XDG_CACHE_HOME) { + return process.env.XDG_CACHE_HOME; + } + const usersDir = platformIsDarwin ? "Users" : "home" + const homePath = (os.homedir && os.homedir()) || + process.env.HOME || + ((process.env.LOGNAME || process.env.USER) && `/${usersDir}/${process.env.LOGNAME || process.env.USER}`) || + os.tmpdir(); + const cacheFolder = platformIsDarwin + ? "Library/Caches" + : ".cache" + return combinePaths(normalizeSlashes(homePath), cacheFolder); } interface NodeChildProcess { @@ -198,7 +205,7 @@ namespace ts.server { private socket: NodeSocket; private projectService: ProjectService; private throttledOperations: ThrottledOperations; - private telemetrySender: EventSender; + private eventSender: EventSender; constructor( private readonly telemetryEnabled: boolean, @@ -231,7 +238,7 @@ namespace ts.server { } setTelemetrySender(telemetrySender: EventSender) { - this.telemetrySender = telemetrySender; + this.eventSender = telemetrySender; } attach(projectService: ProjectService) { @@ -291,12 +298,30 @@ namespace ts.server { }); } - private handleMessage(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent) { + private handleMessage(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes) { if (this.logger.hasLevel(LogLevel.verbose)) { this.logger.info(`Received response: ${JSON.stringify(response)}`); } - if (response.kind === EventInstall) { - if (this.telemetrySender) { + + if (response.kind === EventBeginInstallTypes) { + if (!this.eventSender) { + return; + } + const body: protocol.BeginInstallTypesEventBody = { + eventId: response.eventId, + packages: response.packagesToInstall, + }; + const eventName: protocol.BeginInstallTypesEventName = "beginInstallTypes"; + this.eventSender.event(body, eventName); + + return; + } + + if (response.kind === EventEndInstallTypes) { + if (!this.eventSender) { + return; + } + if (this.telemetryEnabled) { const body: protocol.TypingsInstalledTelemetryEventBody = { telemetryEventName: "typingsInstalled", payload: { @@ -306,10 +331,19 @@ namespace ts.server { } }; const eventName: protocol.TelemetryEventName = "telemetry"; - this.telemetrySender.event(body, eventName); + this.eventSender.event(body, eventName); } + + const body: protocol.EndInstallTypesEventBody = { + eventId: response.eventId, + packages: response.packagesToInstall, + success: response.installSuccess, + }; + const eventName: protocol.EndInstallTypesEventName = "endInstallTypes"; + this.eventSender.event(body, eventName); return; } + this.projectService.updateTypingsForProject(response); if (response.kind == ActionSet && this.socket) { this.sendEvent(0, "setTypings", response); diff --git a/src/server/session.ts b/src/server/session.ts index 36144b3212d..5c382aae7d3 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -709,7 +709,7 @@ namespace ts.server { const displayString = ts.displayPartsToString(nameInfo.displayParts); const nameSpan = nameInfo.textSpan; const nameColStart = scriptInfo.positionToLineOffset(nameSpan.start).offset; - const nameText = scriptInfo.snap().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + const nameText = scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)); const refs = combineProjectOutput( projects, (project: Project) => { @@ -722,7 +722,7 @@ namespace ts.server { const refScriptInfo = project.getScriptInfo(ref.fileName); const start = refScriptInfo.positionToLineOffset(ref.textSpan.start); const refLineSpan = refScriptInfo.lineToTextSpan(start.line - 1); - const lineText = refScriptInfo.snap().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + const lineText = refScriptInfo.getSnapshot().getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { file: ref.fileName, start: start, @@ -1026,6 +1026,9 @@ namespace ts.server { if (!project) { Errors.ThrowNoProject(); } + if (!project.languageServiceEnabled) { + return false; + } const scriptInfo = project.getScriptInfo(file); return project.builder.emitFile(scriptInfo, (path, data, writeByteOrderMark) => this.host.writeFile(path, data, writeByteOrderMark)); } @@ -1326,7 +1329,7 @@ namespace ts.server { highPriorityFiles.push(fileNameInProject); else { const info = this.projectService.getScriptInfo(fileNameInProject); - if (!info.isOpen) { + if (!info.isScriptOpen()) { if (fileNameInProject.indexOf(".d.ts") > 0) veryLowPriorityFiles.push(fileNameInProject); else @@ -1365,14 +1368,12 @@ namespace ts.server { private handlers = createMap<(request: protocol.Request) => { response?: any, responseRequired?: boolean }>({ [CommandNames.OpenExternalProject]: (request: protocol.OpenExternalProjectRequest) => { - this.projectService.openExternalProject(request.arguments); + this.projectService.openExternalProject(request.arguments, /*suppressRefreshOfInferredProjects*/ false); // TODO: report errors return this.requiredResponse(true); }, [CommandNames.OpenExternalProjects]: (request: protocol.OpenExternalProjectsRequest) => { - for (const proj of request.arguments.projects) { - this.projectService.openExternalProject(proj); - } + this.projectService.openExternalProjects(request.arguments.projects); // TODO: report errors return this.requiredResponse(true); }, diff --git a/src/server/shared.ts b/src/server/shared.ts index 81a1f7fb55b..c56d4098e75 100644 --- a/src/server/shared.ts +++ b/src/server/shared.ts @@ -3,7 +3,8 @@ namespace ts.server { export const ActionSet: ActionSet = "action::set"; export const ActionInvalidate: ActionInvalidate = "action::invalidate"; - export const EventInstall: EventInstall = "event::install"; + export const EventBeginInstallTypes: EventBeginInstallTypes = "event::beginInstallTypes"; + export const EventEndInstallTypes: EventEndInstallTypes = "event::endInstallTypes"; export namespace Arguments { export const GlobalCacheLocation = "--globalTypingsCacheLocation"; diff --git a/src/server/types.d.ts b/src/server/types.d.ts index 77e9e762b59..9f53fa8def1 100644 --- a/src/server/types.d.ts +++ b/src/server/types.d.ts @@ -43,10 +43,11 @@ declare namespace ts.server { export type ActionSet = "action::set"; export type ActionInvalidate = "action::invalidate"; - export type EventInstall = "event::install"; + export type EventBeginInstallTypes = "event::beginInstallTypes"; + export type EventEndInstallTypes = "event::endInstallTypes"; export interface TypingInstallerResponse { - readonly kind: ActionSet | ActionInvalidate | EventInstall; + readonly kind: ActionSet | ActionInvalidate | EventBeginInstallTypes | EventEndInstallTypes; } export interface ProjectResponse extends TypingInstallerResponse { @@ -65,11 +66,20 @@ declare namespace ts.server { readonly kind: ActionInvalidate; } - export interface TypingsInstallEvent extends TypingInstallerResponse { - readonly packagesToInstall: ReadonlyArray; - readonly kind: EventInstall; - readonly installSuccess: boolean; + export interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; readonly typingsInstallerVersion: string; + readonly packagesToInstall: ReadonlyArray; + } + + export interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + + export interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; } export interface InstallTypingHost extends JsTyping.TypingResolutionHost { diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 235c2f16dad..19f794ad57c 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -70,13 +70,12 @@ namespace ts.server.typingsInstaller { private readonly npmPath: string; readonly typesRegistry: Map; - constructor(globalTypingsCacheLocation: string, throttleLimit: number, telemetryEnabled: boolean, log: Log) { + constructor(globalTypingsCacheLocation: string, throttleLimit: number, log: Log) { super( sys, globalTypingsCacheLocation, toPath("typingSafeList.json", __dirname, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)), throttleLimit, - telemetryEnabled, log); if (this.log.isEnabled()) { this.log.writeLine(`Process id: ${process.pid}`); @@ -113,7 +112,7 @@ namespace ts.server.typingsInstaller { }); } - protected sendResponse(response: SetTypings | InvalidateCachedTypings) { + protected sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes) { if (this.log.isEnabled()) { this.log.writeLine(`Sending response: ${JSON.stringify(response)}`); } @@ -149,7 +148,6 @@ namespace ts.server.typingsInstaller { const logFilePath = findArgument(server.Arguments.LogFile); const globalTypingsCacheLocation = findArgument(server.Arguments.GlobalCacheLocation); - const telemetryEnabled = hasArgument(server.Arguments.EnableTelemetry); const log = new FileLog(logFilePath); if (log.isEnabled()) { @@ -163,6 +161,6 @@ namespace ts.server.typingsInstaller { } process.exit(0); }); - const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, telemetryEnabled, log); + const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, log); installer.listen(); } \ No newline at end of file diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index 25d53e14e75..7a09c1f6c21 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -97,7 +97,6 @@ namespace ts.server.typingsInstaller { readonly globalCachePath: string, readonly safeListPath: Path, readonly throttleLimit: number, - readonly telemetryEnabled: boolean, protected readonly log = nullLog) { if (this.log.isEnabled()) { this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}'`); @@ -309,47 +308,58 @@ namespace ts.server.typingsInstaller { const requestId = this.installRunCount; this.installRunCount++; + // send progress event + this.sendResponse({ + kind: EventBeginInstallTypes, + eventId: requestId, + typingsInstallerVersion: ts.version, // qualified explicitly to prevent occasional shadowing + projectName: req.projectName + }); + this.installTypingsAsync(requestId, scopedTypings, cachePath, ok => { - if (this.telemetryEnabled) { - this.sendResponse({ - kind: EventInstall, + try { + if (!ok) { + if (this.log.isEnabled()) { + this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); + } + for (const typing of filteredTypings) { + this.missingTypingsSet[typing] = true; + } + return; + } + + // TODO: watch project directory + if (this.log.isEnabled()) { + this.log.writeLine(`Installed typings ${JSON.stringify(scopedTypings)}`); + } + const installedTypingFiles: string[] = []; + for (const packageName of filteredTypings) { + const typingFile = typingToFileName(cachePath, packageName, this.installTypingHost, this.log); + if (!typingFile) { + this.missingTypingsSet[packageName] = true; + continue; + } + if (!this.packageNameToTypingLocation[packageName]) { + this.packageNameToTypingLocation[packageName] = typingFile; + } + installedTypingFiles.push(typingFile); + } + if (this.log.isEnabled()) { + this.log.writeLine(`Installed typing files ${JSON.stringify(installedTypingFiles)}`); + } + + this.sendResponse(this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); + } + finally { + this.sendResponse({ + kind: EventEndInstallTypes, + eventId: requestId, + projectName: req.projectName, packagesToInstall: scopedTypings, installSuccess: ok, typingsInstallerVersion: ts.version // qualified explicitly to prevent occasional shadowing }); } - - if (!ok) { - if (this.log.isEnabled()) { - this.log.writeLine(`install request failed, marking packages as missing to prevent repeated requests: ${JSON.stringify(filteredTypings)}`); - } - for (const typing of filteredTypings) { - this.missingTypingsSet[typing] = true; - } - return; - } - - // TODO: watch project directory - if (this.log.isEnabled()) { - this.log.writeLine(`Installed typings ${JSON.stringify(scopedTypings)}`); - } - const installedTypingFiles: string[] = []; - for (const packageName of filteredTypings) { - const typingFile = typingToFileName(cachePath, packageName, this.installTypingHost, this.log); - if (!typingFile) { - this.missingTypingsSet[packageName] = true; - continue; - } - if (!this.packageNameToTypingLocation[packageName]) { - this.packageNameToTypingLocation[packageName] = typingFile; - } - installedTypingFiles.push(typingFile); - } - if (this.log.isEnabled()) { - this.log.writeLine(`Installed typing files ${JSON.stringify(installedTypingFiles)}`); - } - - this.sendResponse(this.createSetTypings(req, currentlyCachedTypings.concat(installedTypingFiles))); }); } @@ -417,6 +427,6 @@ namespace ts.server.typingsInstaller { } protected abstract installWorker(requestId: number, args: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void; - protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent): void; + protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes): void; } } \ No newline at end of file diff --git a/src/server/utilities.ts b/src/server/utilities.ts index fd370da7fa1..839e79268fa 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts.server { diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 3369ac23223..0e65d3b264e 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,4 +1,4 @@ -/* @internal */ +/* @internal */ namespace ts.JsDoc { const jsDocTagNames = [ "augments", @@ -23,6 +23,7 @@ namespace ts.JsDoc { "lends", "link", "memberOf", + "method", "name", "namespace", "param", @@ -166,6 +167,7 @@ namespace ts.JsDoc { const lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; for (let i = 0, numParams = parameters.length; i < numParams; i++) { @@ -173,8 +175,12 @@ namespace ts.JsDoc { const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : "param" + i; - - docParams += `${indentationStr} * @param ${paramName}${newLine}`; + if (isJavaScriptFile) { + docParams += `${indentationStr} * @param {any} ${paramName}${newLine}`; + } + else { + docParams += `${indentationStr} * @param ${paramName}${newLine}`; + } } // A doc comment consists of the following diff --git a/src/services/services.ts b/src/services/services.ts index d28dd871105..7ad02de56e5 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1725,7 +1725,7 @@ namespace ts { const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (isInString(sourceFile, position) || isInComment(sourceFile, position)) { + if (isInString(sourceFile, position)) { return false; } diff --git a/src/services/types.ts b/src/services/types.ts index 6a0e6e886b5..3865fe7fac9 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -91,7 +91,9 @@ namespace ts { } public getText(start: number, end: number): string { - return this.text.substring(start, end); + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); } public getLength(): number { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index e19fdc0a84a..2f52d747e23 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1137,6 +1137,7 @@ namespace ts { writeSpace: text => writeKind(text, SymbolDisplayPartKind.space), writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral), writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName), + writeProperty: text => writeKind(text, SymbolDisplayPartKind.propertyName), writeSymbol, writeLine, increaseIndent: () => { indent++; }, diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.js b/tests/baselines/reference/awaitInheritedPromise_es2017.js new file mode 100644 index 00000000000..e973d0b166a --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.js @@ -0,0 +1,11 @@ +//// [awaitInheritedPromise_es2017.ts] +interface A extends Promise {} +declare var a: A; +async function f() { + await a; +} + +//// [awaitInheritedPromise_es2017.js] +async function f() { + await a; +} diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.symbols b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols new file mode 100644 index 00000000000..ef68d16b678 --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.symbols @@ -0,0 +1,15 @@ +=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts === +interface A extends Promise {} +>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) + +declare var a: A; +>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11)) +>A : Symbol(A, Decl(awaitInheritedPromise_es2017.ts, 0, 0)) + +async function f() { +>f : Symbol(f, Decl(awaitInheritedPromise_es2017.ts, 1, 17)) + + await a; +>a : Symbol(a, Decl(awaitInheritedPromise_es2017.ts, 1, 11)) +} diff --git a/tests/baselines/reference/awaitInheritedPromise_es2017.types b/tests/baselines/reference/awaitInheritedPromise_es2017.types new file mode 100644 index 00000000000..bed681181b0 --- /dev/null +++ b/tests/baselines/reference/awaitInheritedPromise_es2017.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts === +interface A extends Promise {} +>A : A +>Promise : Promise + +declare var a: A; +>a : A +>A : A + +async function f() { +>f : () => Promise + + await a; +>await a : string +>a : A +} diff --git a/tests/baselines/reference/capturedLetConstInLoop9.js b/tests/baselines/reference/capturedLetConstInLoop9.js index 84f9a021054..8f88855a9ad 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9.js +++ b/tests/baselines/reference/capturedLetConstInLoop9.js @@ -208,6 +208,7 @@ function foo() { } (function () { return b; }); return { value: 100 }; + var _a; }; for (var _c = 0, _d = []; _c < _d.length; _c++) { var b = _d[_c]; @@ -221,6 +222,7 @@ function foo() { } } (function () { return a; }); + var _b; }; var arguments_1 = arguments, x, z, x1, z1; l0: for (var _i = 0, _a = []; _i < _a.length; _i++) { @@ -238,7 +240,6 @@ function foo() { use(z); use(x1); use(z1); - var _b, _a; } function foo2() { for (var _i = 0, _a = []; _i < _a.length; _i++) { diff --git a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt new file mode 100644 index 00000000000..e3076e08b7e --- /dev/null +++ b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(15,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(27,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(28,5): error TS2502: 'y' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error TS2502: 'z' is referenced directly or indirectly in its own type annotation. + + +==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (8 errors) ==== + + type T1 = { + x: T1["x"]; // Error + ~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + }; + + type T2 = { + x: T2[K]; // Error + ~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + y: number; + } + + declare let x2: T2<"x">; + let x2x = x2.x; + + interface T3> { + x: T["x"]; // Error + ~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + interface T4> { + x: T4["x"]; // Error + ~~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + class C1 { + x: C1["x"]; // Error + ~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + } + + class C2 { + x: this["y"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + y: this["z"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'y' is referenced directly or indirectly in its own type annotation. + z: this["x"]; // Error + ~~~~~~~~~~~~~ +!!! error TS2502: 'z' is referenced directly or indirectly in its own type annotation. + } \ No newline at end of file diff --git a/tests/baselines/reference/circularIndexedAccessErrors.js b/tests/baselines/reference/circularIndexedAccessErrors.js new file mode 100644 index 00000000000..46784ae8d18 --- /dev/null +++ b/tests/baselines/reference/circularIndexedAccessErrors.js @@ -0,0 +1,70 @@ +//// [circularIndexedAccessErrors.ts] + +type T1 = { + x: T1["x"]; // Error +}; + +type T2 = { + x: T2[K]; // Error + y: number; +} + +declare let x2: T2<"x">; +let x2x = x2.x; + +interface T3> { + x: T["x"]; // Error +} + +interface T4> { + x: T4["x"]; // Error +} + +class C1 { + x: C1["x"]; // Error +} + +class C2 { + x: this["y"]; // Error + y: this["z"]; // Error + z: this["x"]; // Error +} + +//// [circularIndexedAccessErrors.js] +var x2x = x2.x; +var C1 = (function () { + function C1() { + } + return C1; +}()); +var C2 = (function () { + function C2() { + } + return C2; +}()); + + +//// [circularIndexedAccessErrors.d.ts] +declare type T1 = { + x: T1["x"]; +}; +declare type T2 = { + x: T2[K]; + y: number; +}; +declare let x2: T2<"x">; +declare let x2x: any; +interface T3> { + x: T["x"]; +} +interface T4> { + x: T4["x"]; +} +declare class C1 { + x: C1["x"]; +} +declare class C2 { + x: this["y"]; + y: this["z"]; + z: this["x"]; +} diff --git a/tests/baselines/reference/circularReferenceInImport.js b/tests/baselines/reference/circularReferenceInImport.js new file mode 100644 index 00000000000..a9cf0925c34 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/circularReferenceInImport.ts] //// + +//// [db.d.ts] + +declare namespace Db { + export import Types = Db; +} + +export = Db; + +//// [app.ts] +import * as Db from "./db" + +export function foo() { + return new Object() +} + +//// [app.js] +"use strict"; +function foo() { + return new Object(); +} +exports.foo = foo; + + +//// [app.d.ts] +export declare function foo(): Object; diff --git a/tests/baselines/reference/circularReferenceInImport.symbols b/tests/baselines/reference/circularReferenceInImport.symbols new file mode 100644 index 00000000000..b74ac14b5ab --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) + + export import Types = Db; +>Types : Symbol(Types, Decl(db.d.ts, 1, 22)) +>Db : Symbol(Types, Decl(db.d.ts, 0, 0)) +} + +export = Db; +>Db : Symbol(Db, Decl(db.d.ts, 0, 0)) + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : Symbol(Db, Decl(app.ts, 0, 6)) + +export function foo() { +>foo : Symbol(foo, Decl(app.ts, 0, 26)) + + return new Object() +>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/circularReferenceInImport.types b/tests/baselines/reference/circularReferenceInImport.types new file mode 100644 index 00000000000..d8db7f56231 --- /dev/null +++ b/tests/baselines/reference/circularReferenceInImport.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/db.d.ts === + +declare namespace Db { +>Db : typeof Types + + export import Types = Db; +>Types : typeof Types +>Db : typeof Types +} + +export = Db; +>Db : typeof Db + +=== tests/cases/compiler/app.ts === +import * as Db from "./db" +>Db : typeof Db + +export function foo() { +>foo : () => Object + + return new Object() +>new Object() : Object +>Object : ObjectConstructor +} diff --git a/tests/baselines/reference/classAbstractAccessor.errors.txt b/tests/baselines/reference/classAbstractAccessor.errors.txt new file mode 100644 index 00000000000..b43cfa9d7f1 --- /dev/null +++ b/tests/baselines/reference/classAbstractAccessor.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(4,17): error TS1318: An abstract accessor cannot have an implementation. +tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts(6,17): error TS1318: An abstract accessor cannot have an implementation. + + +==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts (2 errors) ==== + + abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + ~~ +!!! error TS1318: An abstract accessor cannot have an implementation. + abstract set b(x: string); + abstract set bb(x: string) {} // error + ~~ +!!! error TS1318: An abstract accessor cannot have an implementation. + } + \ No newline at end of file diff --git a/tests/baselines/reference/classAbstractAccessor.js b/tests/baselines/reference/classAbstractAccessor.js new file mode 100644 index 00000000000..a1edf0cb88d --- /dev/null +++ b/tests/baselines/reference/classAbstractAccessor.js @@ -0,0 +1,28 @@ +//// [classAbstractAccessor.ts] + +abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + abstract set b(x: string); + abstract set bb(x: string) {} // error +} + + +//// [classAbstractAccessor.js] +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "aa", { + get: function () { return 1; } // error + , + enumerable: true, + configurable: true + }); + Object.defineProperty(A.prototype, "bb", { + set: function (x) { } // error + , + enumerable: true, + configurable: true + }); + return A; +}()); diff --git a/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt new file mode 100644 index 00000000000..ffbfd25fa94 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,13): error TS2304: Cannot find name 'TypeNotFound'. +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(3,13): error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. + + +==== tests/cases/compiler/declarationEmitIndexTypeNotFound.ts (3 errors) ==== + + export interface Test { + [index: TypeNotFound]: any; + ~~~~~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + ~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'TypeNotFound'. + ~~~~~~~~~~~~ +!!! error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitIndexTypeNotFound.js b/tests/baselines/reference/declarationEmitIndexTypeNotFound.js new file mode 100644 index 00000000000..22100e5cb72 --- /dev/null +++ b/tests/baselines/reference/declarationEmitIndexTypeNotFound.js @@ -0,0 +1,9 @@ +//// [declarationEmitIndexTypeNotFound.ts] + +export interface Test { + [index: TypeNotFound]: any; +} + + +//// [declarationEmitIndexTypeNotFound.js] +"use strict"; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index 2b20c7ec168..7ef4369f975 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -14,15 +14,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index 9e8b8693109..994178cbb79 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -13,14 +13,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports.Testing123 = Testing123; var Testing123_1; diff --git a/tests/baselines/reference/decoratedClassExportsSystem1.js b/tests/baselines/reference/decoratedClassExportsSystem1.js index 6f7fcbd144a..2f33feb28fb 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem1.js +++ b/tests/baselines/reference/decoratedClassExportsSystem1.js @@ -17,9 +17,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -29,8 +26,7 @@ System.register([], function (exports_1, context_1) { }; Testing123.prop1 = Testing123_1.prop0; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratedClassExportsSystem2.js b/tests/baselines/reference/decoratedClassExportsSystem2.js index 2a1a394a1f3..2c9c62cadb2 100644 --- a/tests/baselines/reference/decoratedClassExportsSystem2.js +++ b/tests/baselines/reference/decoratedClassExportsSystem2.js @@ -14,9 +14,6 @@ System.register([], function (exports_1, context_1) { else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; - var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); - }; var __moduleName = context_1 && context_1.id; var Testing123, Testing123_1; return { @@ -25,8 +22,7 @@ System.register([], function (exports_1, context_1) { Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ - Something({ v: () => Testing123_1 }), - __metadata("design:paramtypes", []) + Something({ v: () => Testing123_1 }) ], Testing123); exports_1("Testing123", Testing123); } diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js new file mode 100644 index 00000000000..be249800d57 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.js @@ -0,0 +1,112 @@ +//// [tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts] //// + +//// [aux.ts] + +export class SomeClass { + field: string; +} + +//// [aux1.ts] +export class SomeClass1 { + field: string; +} + +//// [aux2.ts] +export class SomeClass2 { + field: string; +} +//// [main.ts] +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} + +//// [aux.js] +"use strict"; +var SomeClass = (function () { + function SomeClass() { + } + return SomeClass; +}()); +exports.SomeClass = SomeClass; +//// [aux1.js] +"use strict"; +var SomeClass1 = (function () { + function SomeClass1() { + } + return SomeClass1; +}()); +exports.SomeClass1 = SomeClass1; +//// [aux2.js] +"use strict"; +var SomeClass2 = (function () { + function SomeClass2() { + } + return SomeClass2; +}()); +exports.SomeClass2 = SomeClass2; +//// [main.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var aux_1 = require("./aux"); +var aux1_1 = require("./aux1"); +function annotation() { + return function (target) { }; +} +function annotation1() { + return function (target) { }; +} +var ClassA = (function () { + function ClassA() { + var init = []; + for (var _i = 0; _i < arguments.length; _i++) { + init[_i] = arguments[_i]; + } + this.array = init; + } + ClassA.prototype.foo = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + }; + return ClassA; +}()); +__decorate([ + annotation1(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [aux1_1.SomeClass1]), + __metadata("design:returntype", void 0) +], ClassA.prototype, "foo", null); +ClassA = __decorate([ + annotation(), + __metadata("design:paramtypes", [aux_1.SomeClass]) +], ClassA); +exports.ClassA = ClassA; diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols new file mode 100644 index 00000000000..9bd293cdfcb --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.symbols @@ -0,0 +1,77 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : Symbol(SomeClass, Decl(aux.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass.field, Decl(aux.ts, 1, 24)) +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : Symbol(SomeClass1, Decl(aux1.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass1.field, Decl(aux1.ts, 0, 25)) +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : Symbol(SomeClass2, Decl(aux2.ts, 0, 0)) + + field: string; +>field : Symbol(SomeClass2.field, Decl(aux2.ts, 0, 25)) +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + +import { SomeClass1 } from './aux1'; +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + +function annotation(): ClassDecorator { +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 4, 12)) +} + +function annotation1(): MethodDecorator { +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) +>MethodDecorator : Symbol(MethodDecorator, Decl(lib.d.ts, --, --)) + + return (target: any): void => { }; +>target : Symbol(target, Decl(main.ts, 8, 12)) +} + +@annotation() +>annotation : Symbol(annotation, Decl(main.ts, 1, 36)) + +export class ClassA { +>ClassA : Symbol(ClassA, Decl(main.ts, 9, 1)) + + array: SomeClass[]; +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + constructor(...init: SomeClass[]) { +>init : Symbol(init, Decl(main.ts, 15, 16)) +>SomeClass : Symbol(SomeClass, Decl(main.ts, 0, 8)) + + this.array = init; +>this.array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>this : Symbol(ClassA, Decl(main.ts, 9, 1)) +>array : Symbol(ClassA.array, Decl(main.ts, 12, 21)) +>init : Symbol(init, Decl(main.ts, 15, 16)) + } + + @annotation1() +>annotation1 : Symbol(annotation1, Decl(main.ts, 5, 1)) + + foo(... args: SomeClass1[]) { +>foo : Symbol(ClassA.foo, Decl(main.ts, 17, 5)) +>args : Symbol(args, Decl(main.ts, 20, 8)) +>SomeClass1 : Symbol(SomeClass1, Decl(main.ts, 1, 8)) + } +} diff --git a/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types new file mode 100644 index 00000000000..6c27aa2c942 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataRestParameterWithImportedType.types @@ -0,0 +1,82 @@ +=== tests/cases/compiler/aux.ts === + +export class SomeClass { +>SomeClass : SomeClass + + field: string; +>field : string +} + +=== tests/cases/compiler/aux1.ts === +export class SomeClass1 { +>SomeClass1 : SomeClass1 + + field: string; +>field : string +} + +=== tests/cases/compiler/aux2.ts === +export class SomeClass2 { +>SomeClass2 : SomeClass2 + + field: string; +>field : string +} +=== tests/cases/compiler/main.ts === +import { SomeClass } from './aux'; +>SomeClass : typeof SomeClass + +import { SomeClass1 } from './aux1'; +>SomeClass1 : typeof SomeClass1 + +function annotation(): ClassDecorator { +>annotation : () => ClassDecorator +>ClassDecorator : ClassDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +function annotation1(): MethodDecorator { +>annotation1 : () => MethodDecorator +>MethodDecorator : MethodDecorator + + return (target: any): void => { }; +>(target: any): void => { } : (target: any) => void +>target : any +} + +@annotation() +>annotation() : ClassDecorator +>annotation : () => ClassDecorator + +export class ClassA { +>ClassA : ClassA + + array: SomeClass[]; +>array : SomeClass[] +>SomeClass : SomeClass + + constructor(...init: SomeClass[]) { +>init : SomeClass[] +>SomeClass : SomeClass + + this.array = init; +>this.array = init : SomeClass[] +>this.array : SomeClass[] +>this : this +>array : SomeClass[] +>init : SomeClass[] + } + + @annotation1() +>annotation1() : MethodDecorator +>annotation1 : () => MethodDecorator + + foo(... args: SomeClass1[]) { +>foo : (...args: SomeClass1[]) => void +>args : SomeClass1[] +>SomeClass1 : SomeClass1 + } +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt b/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt new file mode 100644 index 00000000000..d776297fcf4 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor7.errors.txt @@ -0,0 +1,41 @@ +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(26,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. +tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts(31,5): error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + + +==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts (2 errors) ==== + declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + + class A { + @dec1 get x() { return 0; } + set x(value: number) { } + } + + class B { + get x() { return 0; } + @dec2 set x(value: number) { } + } + + class C { + @dec1 set x(value: number) { } + get x() { return 0; } + } + + class D { + set x(value: number) { } + @dec2 get x() { return 0; } + } + + class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } + ~ +!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + } + + class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } + ~ +!!! error TS1207: Decorators cannot be applied to multiple get/set accessors of the same name. + } \ No newline at end of file diff --git a/tests/baselines/reference/decoratorOnClassAccessor7.js b/tests/baselines/reference/decoratorOnClassAccessor7.js new file mode 100644 index 00000000000..5ae0c29c14b --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor7.js @@ -0,0 +1,125 @@ +//// [decoratorOnClassAccessor7.ts] +declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec1 get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec2 set x(value: number) { } +} + +class C { + @dec1 set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec2 get x() { return 0; } +} + +class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } +} + +class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } +} + +//// [decoratorOnClassAccessor7.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return A; +}()); +__decorate([ + dec1 +], A.prototype, "x", null); +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +__decorate([ + dec2 +], B.prototype, "x", null); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +__decorate([ + dec1 +], C.prototype, "x", null); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return D; +}()); +__decorate([ + dec2 +], D.prototype, "x", null); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return E; +}()); +__decorate([ + dec1 +], E.prototype, "x", null); +var F = (function () { + function F() { + } + Object.defineProperty(F.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return F; +}()); +__decorate([ + dec1 +], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.js b/tests/baselines/reference/decoratorOnClassAccessor8.js new file mode 100644 index 00000000000..7347e630eab --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.js @@ -0,0 +1,135 @@ +//// [decoratorOnClassAccessor8.ts] +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} + +//// [decoratorOnClassAccessor8.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + Object.defineProperty(A.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return A; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], A.prototype, "x", null); +var B = (function () { + function B() { + } + Object.defineProperty(B.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return B; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], B.prototype, "x", null); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return C; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], C.prototype, "x", null); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + get: function () { return 0; }, + set: function (value) { }, + enumerable: true, + configurable: true + }); + return D; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", [Number]) +], D.prototype, "x", null); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "x", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return E; +}()); +__decorate([ + dec, + __metadata("design:type", Object), + __metadata("design:paramtypes", []) +], E.prototype, "x", null); +var F = (function () { + function F() { + } + Object.defineProperty(F.prototype, "x", { + set: function (value) { }, + enumerable: true, + configurable: true + }); + return F; +}()); +__decorate([ + dec, + __metadata("design:type", Number), + __metadata("design:paramtypes", [Number]) +], F.prototype, "x", null); diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.symbols b/tests/baselines/reference/decoratorOnClassAccessor8.symbols new file mode 100644 index 00000000000..d1e22d586fc --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.symbols @@ -0,0 +1,76 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>target : Symbol(target, Decl(decoratorOnClassAccessor8.ts, 0, 24)) +>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassAccessor8.ts, 0, 36)) +>descriptor : Symbol(descriptor, Decl(decoratorOnClassAccessor8.ts, 0, 57)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(decoratorOnClassAccessor8.ts, 0, 21)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassAccessor8.ts, 0, 126)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) + + set x(value: number) { } +>x : Symbol(A.x, Decl(decoratorOnClassAccessor8.ts, 2, 9), Decl(decoratorOnClassAccessor8.ts, 3, 30)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 4, 10)) +} + +class B { +>B : Symbol(B, Decl(decoratorOnClassAccessor8.ts, 5, 1)) + + get x() { return 0; } +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(B.x, Decl(decoratorOnClassAccessor8.ts, 7, 9), Decl(decoratorOnClassAccessor8.ts, 8, 25)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 9, 15)) +} + +class C { +>C : Symbol(C, Decl(decoratorOnClassAccessor8.ts, 10, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 13, 15)) + + get x() { return 0; } +>x : Symbol(C.x, Decl(decoratorOnClassAccessor8.ts, 12, 9), Decl(decoratorOnClassAccessor8.ts, 13, 33)) +} + +class D { +>D : Symbol(D, Decl(decoratorOnClassAccessor8.ts, 15, 1)) + + set x(value: number) { } +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 18, 10)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(D.x, Decl(decoratorOnClassAccessor8.ts, 17, 9), Decl(decoratorOnClassAccessor8.ts, 18, 28)) +} + +class E { +>E : Symbol(E, Decl(decoratorOnClassAccessor8.ts, 20, 1)) + + @dec get x() { return 0; } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(E.x, Decl(decoratorOnClassAccessor8.ts, 22, 9)) +} + +class F { +>F : Symbol(F, Decl(decoratorOnClassAccessor8.ts, 24, 1)) + + @dec set x(value: number) { } +>dec : Symbol(dec, Decl(decoratorOnClassAccessor8.ts, 0, 0)) +>x : Symbol(F.x, Decl(decoratorOnClassAccessor8.ts, 26, 9)) +>value : Symbol(value, Decl(decoratorOnClassAccessor8.ts, 27, 15)) +} diff --git a/tests/baselines/reference/decoratorOnClassAccessor8.types b/tests/baselines/reference/decoratorOnClassAccessor8.types new file mode 100644 index 00000000000..e8f46ee460d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassAccessor8.types @@ -0,0 +1,81 @@ +=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts === +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>T : T +>target : any +>propertyKey : string +>descriptor : TypedPropertyDescriptor +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T +>TypedPropertyDescriptor : TypedPropertyDescriptor +>T : T + +class A { +>A : A + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 + + set x(value: number) { } +>x : number +>value : number +} + +class B { +>B : B + + get x() { return 0; } +>x : number +>0 : 0 + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} + +class C { +>C : C + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number + + get x() { return 0; } +>x : number +>0 : 0 +} + +class D { +>D : D + + set x(value: number) { } +>x : number +>value : number + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class E { +>E : E + + @dec get x() { return 0; } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>0 : 0 +} + +class F { +>F : F + + @dec set x(value: number) { } +>dec : (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor +>x : number +>value : number +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js new file mode 100644 index 00000000000..22414e89e43 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -0,0 +1,58 @@ +//// [decoratorOnClassConstructor4.ts] +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} + +//// [decoratorOnClassConstructor4.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var A = (function () { + function A() { + } + return A; +}()); +A = __decorate([ + dec +], A); +var B = (function () { + function B(x) { + } + return B; +}()); +B = __decorate([ + dec, + __metadata("design:paramtypes", [Number]) +], B); +var C = (function (_super) { + __extends(C, _super); + function C() { + return _super.apply(this, arguments) || this; + } + return C; +}(A)); +C = __decorate([ + dec +], C); diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.symbols b/tests/baselines/reference/decoratorOnClassConstructor4.symbols new file mode 100644 index 00000000000..8a414abd7b1 --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.symbols @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class A { +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class B { +>B : Symbol(B, Decl(decoratorOnClassConstructor4.ts, 4, 1)) + + constructor(x: number) {} +>x : Symbol(x, Decl(decoratorOnClassConstructor4.ts, 8, 16)) +} + +@dec +>dec : Symbol(dec, Decl(decoratorOnClassConstructor4.ts, 0, 11)) + +class C extends A { +>C : Symbol(C, Decl(decoratorOnClassConstructor4.ts, 9, 1)) +>A : Symbol(A, Decl(decoratorOnClassConstructor4.ts, 0, 21)) +} diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.types b/tests/baselines/reference/decoratorOnClassConstructor4.types new file mode 100644 index 00000000000..f4203bd5d7d --- /dev/null +++ b/tests/baselines/reference/decoratorOnClassConstructor4.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts === +declare var dec: any; +>dec : any + +@dec +>dec : any + +class A { +>A : A +} + +@dec +>dec : any + +class B { +>B : B + + constructor(x: number) {} +>x : number +} + +@dec +>dec : any + +class C extends A { +>C : C +>A : A +} diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.js b/tests/baselines/reference/decoratorWithUnderscoreMethod.js new file mode 100644 index 00000000000..bf79890263b --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.js @@ -0,0 +1,37 @@ +//// [decoratorWithUnderscoreMethod.ts] + +declare var console : { log(arg: string): void }; +function dec(): Function { + return function (target: any, propKey: string, descr: PropertyDescriptor): void { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { + @dec() + private __foo(bar: string): void { + // do something with bar + } +} + +//// [decoratorWithUnderscoreMethod.js] +function dec() { + return function (target, propKey, descr) { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} +var A = (function () { + function A() { + } + A.prototype.__foo = function (bar) { + // do something with bar + }; + return A; +}()); +__decorate([ + dec() +], A.prototype, "__foo"); diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols b/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols new file mode 100644 index 00000000000..a512bde71f6 --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.symbols @@ -0,0 +1,42 @@ +=== tests/cases/compiler/decoratorWithUnderscoreMethod.ts === + +declare var console : { log(arg: string): void }; +>console : Symbol(console, Decl(decoratorWithUnderscoreMethod.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>arg : Symbol(arg, Decl(decoratorWithUnderscoreMethod.ts, 1, 28)) + +function dec(): Function { +>dec : Symbol(dec, Decl(decoratorWithUnderscoreMethod.ts, 1, 49)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + + return function (target: any, propKey: string, descr: PropertyDescriptor): void { +>target : Symbol(target, Decl(decoratorWithUnderscoreMethod.ts, 3, 21)) +>propKey : Symbol(propKey, Decl(decoratorWithUnderscoreMethod.ts, 3, 33)) +>descr : Symbol(descr, Decl(decoratorWithUnderscoreMethod.ts, 3, 50)) +>PropertyDescriptor : Symbol(PropertyDescriptor, Decl(lib.d.ts, --, --)) + + console.log(target[propKey]); +>console.log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>console : Symbol(console, Decl(decoratorWithUnderscoreMethod.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorWithUnderscoreMethod.ts, 1, 23)) +>target : Symbol(target, Decl(decoratorWithUnderscoreMethod.ts, 3, 21)) +>propKey : Symbol(propKey, Decl(decoratorWithUnderscoreMethod.ts, 3, 33)) + + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { +>A : Symbol(A, Decl(decoratorWithUnderscoreMethod.ts, 8, 1)) + + @dec() +>dec : Symbol(dec, Decl(decoratorWithUnderscoreMethod.ts, 1, 49)) + + private __foo(bar: string): void { +>__foo : Symbol(A.__foo, Decl(decoratorWithUnderscoreMethod.ts, 10, 9)) +>bar : Symbol(bar, Decl(decoratorWithUnderscoreMethod.ts, 12, 18)) + + // do something with bar + } +} diff --git a/tests/baselines/reference/decoratorWithUnderscoreMethod.types b/tests/baselines/reference/decoratorWithUnderscoreMethod.types new file mode 100644 index 00000000000..1ce08dc8a9e --- /dev/null +++ b/tests/baselines/reference/decoratorWithUnderscoreMethod.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/decoratorWithUnderscoreMethod.ts === + +declare var console : { log(arg: string): void }; +>console : { log(arg: string): void; } +>log : (arg: string) => void +>arg : string + +function dec(): Function { +>dec : () => Function +>Function : Function + + return function (target: any, propKey: string, descr: PropertyDescriptor): void { +>function (target: any, propKey: string, descr: PropertyDescriptor): void { console.log(target[propKey]); //logs undefined //propKey has three underscores as prefix, but the method has only two underscores } : (target: any, propKey: string, descr: PropertyDescriptor) => void +>target : any +>propKey : string +>descr : PropertyDescriptor +>PropertyDescriptor : PropertyDescriptor + + console.log(target[propKey]); +>console.log(target[propKey]) : void +>console.log : (arg: string) => void +>console : { log(arg: string): void; } +>log : (arg: string) => void +>target[propKey] : any +>target : any +>propKey : string + + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { +>A : A + + @dec() +>dec() : Function +>dec : () => Function + + private __foo(bar: string): void { +>__foo : (bar: string) => void +>bar : string + + // do something with bar + } +} diff --git a/tests/baselines/reference/errorSuperCalls.errors.txt b/tests/baselines/reference/errorSuperCalls.errors.txt index 49bcb4b4d45..036367fd44b 100644 --- a/tests/baselines/reference/errorSuperCalls.errors.txt +++ b/tests/baselines/reference/errorSuperCalls.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(26,9): error T tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(30,16): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(34,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(38,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. +tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(46,14): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(58,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(62,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. @@ -14,7 +15,7 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(67,9): error T tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors. -==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (14 errors) ==== +==== tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts (15 errors) ==== //super call in class constructor with no base type class NoBase { constructor() { @@ -79,6 +80,8 @@ tests/cases/conformance/expressions/superCalls/errorSuperCalls.ts(71,9): error T //super call with type arguments constructor() { super(); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. super(); diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js new file mode 100644 index 00000000000..218d760d6c5 --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.js @@ -0,0 +1,39 @@ +//// [exhaustiveSwitchWithWideningLiteralTypes.ts] + +// Repro from #12529 + +class A { + readonly kind = "A"; // (property) A.kind: "A" +} + +class B { + readonly kind = "B"; // (property) B.kind: "B" +} + +function f(value: A | B): number { + switch(value.kind) { + case "A": return 0; + case "B": return 1; + } +} + +//// [exhaustiveSwitchWithWideningLiteralTypes.js] +// Repro from #12529 +var A = (function () { + function A() { + this.kind = "A"; // (property) A.kind: "A" + } + return A; +}()); +var B = (function () { + function B() { + this.kind = "B"; // (property) B.kind: "B" + } + return B; +}()); +function f(value) { + switch (value.kind) { + case "A": return 0; + case "B": return 1; + } +} diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols new file mode 100644 index 00000000000..929a394dc7b --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts === + +// Repro from #12529 + +class A { +>A : Symbol(A, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 0, 0)) + + readonly kind = "A"; // (property) A.kind: "A" +>kind : Symbol(A.kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9)) +} + +class B { +>B : Symbol(B, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 5, 1)) + + readonly kind = "B"; // (property) B.kind: "B" +>kind : Symbol(B.kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) +} + +function f(value: A | B): number { +>f : Symbol(f, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 9, 1)) +>value : Symbol(value, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 11, 11)) +>A : Symbol(A, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 0, 0)) +>B : Symbol(B, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 5, 1)) + + switch(value.kind) { +>value.kind : Symbol(kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9), Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) +>value : Symbol(value, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 11, 11)) +>kind : Symbol(kind, Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 3, 9), Decl(exhaustiveSwitchWithWideningLiteralTypes.ts, 7, 9)) + + case "A": return 0; + case "B": return 1; + } +} diff --git a/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types new file mode 100644 index 00000000000..3955c80ff1e --- /dev/null +++ b/tests/baselines/reference/exhaustiveSwitchWithWideningLiteralTypes.types @@ -0,0 +1,40 @@ +=== tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts === + +// Repro from #12529 + +class A { +>A : A + + readonly kind = "A"; // (property) A.kind: "A" +>kind : "A" +>"A" : "A" +} + +class B { +>B : B + + readonly kind = "B"; // (property) B.kind: "B" +>kind : "B" +>"B" : "B" +} + +function f(value: A | B): number { +>f : (value: A | B) => number +>value : A | B +>A : A +>B : B + + switch(value.kind) { +>value.kind : "A" | "B" +>value : A | B +>kind : "A" | "B" + + case "A": return 0; +>"A" : "A" +>0 : 0 + + case "B": return 1; +>"B" : "B" +>1 : 1 + } +} diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js new file mode 100644 index 00000000000..8715fd9eaca --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.js @@ -0,0 +1,16 @@ +//// [explicitAnyAfterSpreadNoImplicitAnyError.ts] +({ a: [], ...(null as any) }); +let x: any; + + +//// [explicitAnyAfterSpreadNoImplicitAnyError.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +(__assign({ a: [] }, null)); +var x; diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols new file mode 100644 index 00000000000..c53845d99aa --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>a : Symbol(a, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 0, 2)) + +let x: any; +>x : Symbol(x, Decl(explicitAnyAfterSpreadNoImplicitAnyError.ts, 1, 3)) + diff --git a/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types new file mode 100644 index 00000000000..5e463e77bbb --- /dev/null +++ b/tests/baselines/reference/explicitAnyAfterSpreadNoImplicitAnyError.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts === +({ a: [], ...(null as any) }); +>({ a: [], ...(null as any) }) : any +>{ a: [], ...(null as any) } : any +>a : undefined[] +>[] : undefined[] +>(null as any) : any +>null as any : any +>null : null + +let x: any; +>x : any + diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index ae4d3127010..762f0778945 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -111,6 +110,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersDeclarations.symbols b/tests/baselines/reference/importHelpersDeclarations.symbols new file mode 100644 index 00000000000..f578850cc4e --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.symbols @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} +export declare class E extends D { +>E : Symbol(E, Decl(declaration.d.ts, 1, 1)) +>D : Symbol(D, Decl(declaration.d.ts, 0, 0)) +} diff --git a/tests/baselines/reference/importHelpersDeclarations.types b/tests/baselines/reference/importHelpersDeclarations.types new file mode 100644 index 00000000000..4b8c56d7869 --- /dev/null +++ b/tests/baselines/reference/importHelpersDeclarations.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/declaration.d.ts === +export declare class D { +>D : D +} +export declare class E extends D { +>E : E +>D : D +} diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index 28c00f97554..5c395ea0b9f 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -64,8 +64,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] "use strict"; @@ -96,6 +95,5 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoHelpers.errors.txt b/tests/baselines/reference/importHelpersNoHelpers.errors.txt index fa9a935c8d8..a0c089a9ddc 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.errors.txt +++ b/tests/baselines/reference/importHelpersNoHelpers.errors.txt @@ -1,32 +1,38 @@ -error TS2305: Module 'tslib' has no exported member '__assign'. -error TS2305: Module 'tslib' has no exported member '__decorate'. -error TS2305: Module 'tslib' has no exported member '__extends'. -error TS2305: Module 'tslib' has no exported member '__metadata'. -error TS2305: Module 'tslib' has no exported member '__param'. -error TS2305: Module 'tslib' has no exported member '__rest'. +tests/cases/compiler/external.ts(2,16): error TS2343: This syntax requires an imported helper named '__extends', but module 'tslib' has no exported member '__extends'. +tests/cases/compiler/external.ts(6,1): error TS2343: This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'. +tests/cases/compiler/external.ts(6,1): error TS2343: This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'. +tests/cases/compiler/external.ts(8,12): error TS2343: This syntax requires an imported helper named '__param', but module 'tslib' has no exported member '__param'. +tests/cases/compiler/external.ts(13,13): error TS2343: This syntax requires an imported helper named '__assign', but module 'tslib' has no exported member '__assign'. +tests/cases/compiler/external.ts(14,12): error TS2343: This syntax requires an imported helper named '__rest', but module 'tslib' has no exported member '__rest'. -!!! error TS2305: Module 'tslib' has no exported member '__assign'. -!!! error TS2305: Module 'tslib' has no exported member '__decorate'. -!!! error TS2305: Module 'tslib' has no exported member '__extends'. -!!! error TS2305: Module 'tslib' has no exported member '__metadata'. -!!! error TS2305: Module 'tslib' has no exported member '__param'. -!!! error TS2305: Module 'tslib' has no exported member '__rest'. -==== tests/cases/compiler/external.ts (0 errors) ==== +==== tests/cases/compiler/external.ts (6 errors) ==== export class A { } export class B extends A { } + ~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__extends', but module 'tslib' has no exported member '__extends'. declare var dec: any; @dec + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__decorate', but module 'tslib' has no exported member '__decorate'. + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__metadata', but module 'tslib' has no exported member '__metadata'. class C { method(@dec x: number) { + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__param', but module 'tslib' has no exported member '__param'. } } const o = { a: 1 }; const y = { ...o }; + ~~~~ +!!! error TS2343: This syntax requires an imported helper named '__assign', but module 'tslib' has no exported member '__assign'. const { ...x } = y; + ~ +!!! error TS2343: This syntax requires an imported helper named '__rest', but module 'tslib' has no exported member '__rest'. ==== tests/cases/compiler/script.ts (0 errors) ==== class A { } diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index a9c2deb76b6..560e16d1cca 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -63,8 +63,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); var o = { a: 1 }; var y = tslib_1.__assign({}, o); @@ -113,6 +112,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/importHelpersNoModule.errors.txt b/tests/baselines/reference/importHelpersNoModule.errors.txt index d59fd0537ca..b6786ec3635 100644 --- a/tests/baselines/reference/importHelpersNoModule.errors.txt +++ b/tests/baselines/reference/importHelpersNoModule.errors.txt @@ -1,10 +1,11 @@ -error TS2307: Cannot find module 'tslib'. +tests/cases/compiler/external.ts(2,16): error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found. -!!! error TS2307: Cannot find module 'tslib'. -==== tests/cases/compiler/external.ts (0 errors) ==== +==== tests/cases/compiler/external.ts (1 errors) ==== export class A { } export class B extends A { } + ~~~~~~~~~ +!!! error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found. declare var dec: any; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 41df9710f33..65a004eb66c 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -56,8 +56,7 @@ tslib_1.__decorate([ tslib_1.__metadata("design:returntype", void 0) ], C.prototype, "method", null); C = tslib_1.__decorate([ - dec, - tslib_1.__metadata("design:paramtypes", []) + dec ], C); //// [script.js] var __extends = (this && this.__extends) || function (d, b) { @@ -103,6 +102,5 @@ __decorate([ __metadata("design:returntype", void 0) ], C.prototype, "method", null); C = __decorate([ - dec, - __metadata("design:paramtypes", []) + dec ], C); diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 0985157e0da..5aeae5f160e 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,8 +1,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -19,7 +17,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (19 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (17 errors) ==== enum E { a } var x: any; @@ -42,11 +40,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv !!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; - ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; - ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ diff --git a/tests/baselines/reference/intersectionTypeNormalization.js b/tests/baselines/reference/intersectionTypeNormalization.js index 8309b17f198..f6eea23e98e 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.js +++ b/tests/baselines/reference/intersectionTypeNormalization.js @@ -58,6 +58,51 @@ function getValueAsString(value: IntersectionFail): string { return '' + value.num; } return value.str; +} + +// Repro from #12535 + +namespace enums { + export const enum A { + a1, + a2, + a3, + // ... elements omitted for the sake of clarity + a75, + a76, + a77, + } + export const enum B { + b1, + b2, + // ... elements omitted for the sake of clarity + b86, + b87, + } + export const enum C { + c1, + c2, + // ... elements omitted for the sake of clarity + c210, + c211, + } + export type Genre = A | B | C; +} + +type Foo = { + genreId: enums.Genre; +}; + +type Bar = { + genreId: enums.Genre; +}; + +type FooBar = Foo & Bar; + +function foo(so: any) { + const val = so as FooBar; + const isGenre = val.genreId; + return isGenre; } //// [intersectionTypeNormalization.js] @@ -77,3 +122,8 @@ function getValueAsString(value) { } return value.str; } +function foo(so) { + var val = so; + var isGenre = val.genreId; + return isGenre; +} diff --git a/tests/baselines/reference/intersectionTypeNormalization.symbols b/tests/baselines/reference/intersectionTypeNormalization.symbols index a5a00c70407..fd81eac6d18 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.symbols +++ b/tests/baselines/reference/intersectionTypeNormalization.symbols @@ -240,3 +240,113 @@ function getValueAsString(value: IntersectionFail): string { >value : Symbol(value, Decl(intersectionTypeNormalization.ts, 54, 26)) >str : Symbol(str, Decl(intersectionTypeNormalization.ts, 47, 35)) } + +// Repro from #12535 + +namespace enums { +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) + + export const enum A { +>A : Symbol(A, Decl(intersectionTypeNormalization.ts, 63, 17)) + + a1, +>a1 : Symbol(A.a1, Decl(intersectionTypeNormalization.ts, 64, 25)) + + a2, +>a2 : Symbol(A.a2, Decl(intersectionTypeNormalization.ts, 65, 11)) + + a3, +>a3 : Symbol(A.a3, Decl(intersectionTypeNormalization.ts, 66, 11)) + + // ... elements omitted for the sake of clarity + a75, +>a75 : Symbol(A.a75, Decl(intersectionTypeNormalization.ts, 67, 11)) + + a76, +>a76 : Symbol(A.a76, Decl(intersectionTypeNormalization.ts, 69, 12)) + + a77, +>a77 : Symbol(A.a77, Decl(intersectionTypeNormalization.ts, 70, 12)) + } + export const enum B { +>B : Symbol(B, Decl(intersectionTypeNormalization.ts, 72, 5)) + + b1, +>b1 : Symbol(B.b1, Decl(intersectionTypeNormalization.ts, 73, 25)) + + b2, +>b2 : Symbol(B.b2, Decl(intersectionTypeNormalization.ts, 74, 11)) + + // ... elements omitted for the sake of clarity + b86, +>b86 : Symbol(B.b86, Decl(intersectionTypeNormalization.ts, 75, 11)) + + b87, +>b87 : Symbol(B.b87, Decl(intersectionTypeNormalization.ts, 77, 12)) + } + export const enum C { +>C : Symbol(C, Decl(intersectionTypeNormalization.ts, 79, 5)) + + c1, +>c1 : Symbol(C.c1, Decl(intersectionTypeNormalization.ts, 80, 25)) + + c2, +>c2 : Symbol(C.c2, Decl(intersectionTypeNormalization.ts, 81, 11)) + + // ... elements omitted for the sake of clarity + c210, +>c210 : Symbol(C.c210, Decl(intersectionTypeNormalization.ts, 82, 11)) + + c211, +>c211 : Symbol(C.c211, Decl(intersectionTypeNormalization.ts, 84, 13)) + } + export type Genre = A | B | C; +>Genre : Symbol(Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) +>A : Symbol(A, Decl(intersectionTypeNormalization.ts, 63, 17)) +>B : Symbol(B, Decl(intersectionTypeNormalization.ts, 72, 5)) +>C : Symbol(C, Decl(intersectionTypeNormalization.ts, 79, 5)) +} + +type Foo = { +>Foo : Symbol(Foo, Decl(intersectionTypeNormalization.ts, 88, 1)) + + genreId: enums.Genre; +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12)) +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) +>Genre : Symbol(enums.Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) + +}; + +type Bar = { +>Bar : Symbol(Bar, Decl(intersectionTypeNormalization.ts, 92, 2)) + + genreId: enums.Genre; +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 94, 12)) +>enums : Symbol(enums, Decl(intersectionTypeNormalization.ts, 59, 1)) +>Genre : Symbol(enums.Genre, Decl(intersectionTypeNormalization.ts, 86, 5)) + +}; + +type FooBar = Foo & Bar; +>FooBar : Symbol(FooBar, Decl(intersectionTypeNormalization.ts, 96, 2)) +>Foo : Symbol(Foo, Decl(intersectionTypeNormalization.ts, 88, 1)) +>Bar : Symbol(Bar, Decl(intersectionTypeNormalization.ts, 92, 2)) + +function foo(so: any) { +>foo : Symbol(foo, Decl(intersectionTypeNormalization.ts, 98, 24)) +>so : Symbol(so, Decl(intersectionTypeNormalization.ts, 100, 13)) + + const val = so as FooBar; +>val : Symbol(val, Decl(intersectionTypeNormalization.ts, 101, 9)) +>so : Symbol(so, Decl(intersectionTypeNormalization.ts, 100, 13)) +>FooBar : Symbol(FooBar, Decl(intersectionTypeNormalization.ts, 96, 2)) + + const isGenre = val.genreId; +>isGenre : Symbol(isGenre, Decl(intersectionTypeNormalization.ts, 102, 9)) +>val.genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12), Decl(intersectionTypeNormalization.ts, 94, 12)) +>val : Symbol(val, Decl(intersectionTypeNormalization.ts, 101, 9)) +>genreId : Symbol(genreId, Decl(intersectionTypeNormalization.ts, 90, 12), Decl(intersectionTypeNormalization.ts, 94, 12)) + + return isGenre; +>isGenre : Symbol(isGenre, Decl(intersectionTypeNormalization.ts, 102, 9)) +} diff --git a/tests/baselines/reference/intersectionTypeNormalization.types b/tests/baselines/reference/intersectionTypeNormalization.types index 99d0ecb1f3a..3ffe7484afe 100644 --- a/tests/baselines/reference/intersectionTypeNormalization.types +++ b/tests/baselines/reference/intersectionTypeNormalization.types @@ -244,3 +244,114 @@ function getValueAsString(value: IntersectionFail): string { >value : { kind: "string"; str: string; } & ToString >str : string } + +// Repro from #12535 + +namespace enums { +>enums : typeof enums + + export const enum A { +>A : A + + a1, +>a1 : A.a1 + + a2, +>a2 : A.a2 + + a3, +>a3 : A.a3 + + // ... elements omitted for the sake of clarity + a75, +>a75 : A.a75 + + a76, +>a76 : A.a76 + + a77, +>a77 : A.a77 + } + export const enum B { +>B : B + + b1, +>b1 : B.b1 + + b2, +>b2 : B.b2 + + // ... elements omitted for the sake of clarity + b86, +>b86 : B.b86 + + b87, +>b87 : B.b87 + } + export const enum C { +>C : C + + c1, +>c1 : C.c1 + + c2, +>c2 : C.c2 + + // ... elements omitted for the sake of clarity + c210, +>c210 : C.c210 + + c211, +>c211 : C.c211 + } + export type Genre = A | B | C; +>Genre : Genre +>A : A +>B : B +>C : C +} + +type Foo = { +>Foo : Foo + + genreId: enums.Genre; +>genreId : enums.Genre +>enums : any +>Genre : enums.Genre + +}; + +type Bar = { +>Bar : Bar + + genreId: enums.Genre; +>genreId : enums.Genre +>enums : any +>Genre : enums.Genre + +}; + +type FooBar = Foo & Bar; +>FooBar : FooBar +>Foo : Foo +>Bar : Bar + +function foo(so: any) { +>foo : (so: any) => enums.Genre +>so : any + + const val = so as FooBar; +>val : FooBar +>so as FooBar : FooBar +>so : any +>FooBar : FooBar + + const isGenre = val.genreId; +>isGenre : enums.Genre +>val.genreId : enums.Genre +>val : FooBar +>genreId : enums.Genre + + return isGenre; +>isGenre : enums.Genre +} diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.js b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js new file mode 100644 index 00000000000..61b034f1e03 --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.js @@ -0,0 +1,10 @@ +//// [intersectionTypeWithLeadingOperator.ts] +type A = & string; +type B = + & { foo: string } + & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; + + +//// [intersectionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols new file mode 100644 index 00000000000..f6648183bb6 --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols @@ -0,0 +1,20 @@ +=== tests/cases/compiler/intersectionTypeWithLeadingOperator.ts === +type A = & string; +>A : Symbol(A, Decl(intersectionTypeWithLeadingOperator.ts, 0, 0)) + +type B = +>B : Symbol(B, Decl(intersectionTypeWithLeadingOperator.ts, 0, 18)) + + & { foo: string } +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 2, 5)) + + & { bar: number }; +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 3, 5)) + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : Symbol(C, Decl(intersectionTypeWithLeadingOperator.ts, 3, 20)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 13)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 26)) +>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 40)) +>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 53)) + diff --git a/tests/baselines/reference/intersectionTypeWithLeadingOperator.types b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types new file mode 100644 index 00000000000..9961f051f7f --- /dev/null +++ b/tests/baselines/reference/intersectionTypeWithLeadingOperator.types @@ -0,0 +1,20 @@ +=== tests/cases/compiler/intersectionTypeWithLeadingOperator.ts === +type A = & string; +>A : string + +type B = +>B : B + + & { foo: string } +>foo : string + + & { bar: number }; +>bar : number + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; +>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }] +>foo : 1 +>bar : 2 +>foo : 3 +>bar : 4 + diff --git a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt index bf5cf5c0f12..c69cc85ad9d 100644 --- a/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt +++ b/tests/baselines/reference/invalidImportAliasIdentifiers.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(5,12): error TS2503: Cannot find namespace 'V'. tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(11,12): error TS2503: Cannot find namespace 'C'. -tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2693: 'I' only refers to a type, but is being used as a value here. +tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts(23,12): error TS2702: 'I' only refers to a type, but is being used as a namespace here. ==== tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIdentifiers.ts (3 errors) ==== @@ -32,5 +32,5 @@ tests/cases/conformance/internalModules/importDeclarations/invalidImportAliasIde import i = I; ~ -!!! error TS2693: 'I' only refers to a type, but is being used as a value here. +!!! error TS2702: 'I' only refers to a type, but is being used as a namespace here. \ No newline at end of file diff --git a/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt b/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt new file mode 100644 index 00000000000..0353d46d632 --- /dev/null +++ b/tests/baselines/reference/invalidUseOfTypeAsNamespace.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/invalidUseOfTypeAsNamespace.ts(4,16): error TS2702: 'OhNo' only refers to a type, but is being used as a namespace here. + + +==== tests/cases/compiler/invalidUseOfTypeAsNamespace.ts (1 errors) ==== + interface OhNo { + } + + declare let y: OhNo.hello; + ~~~~ +!!! error TS2702: 'OhNo' only refers to a type, but is being used as a namespace here. + \ No newline at end of file diff --git a/tests/baselines/reference/invalidUseOfTypeAsNamespace.js b/tests/baselines/reference/invalidUseOfTypeAsNamespace.js new file mode 100644 index 00000000000..3b598fdea9c --- /dev/null +++ b/tests/baselines/reference/invalidUseOfTypeAsNamespace.js @@ -0,0 +1,8 @@ +//// [invalidUseOfTypeAsNamespace.ts] +interface OhNo { +} + +declare let y: OhNo.hello; + + +//// [invalidUseOfTypeAsNamespace.js] diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.js b/tests/baselines/reference/isomorphicMappedTypeInference.js new file mode 100644 index 00000000000..560c926877a --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.js @@ -0,0 +1,330 @@ +//// [isomorphicMappedTypeInference.ts] + +type Box = { + value: T; +} + +type Boxified = { + [P in keyof T]: Box; +} + +function box(x: T): Box { + return { value: x }; +} + +function unbox(x: Box): T { + return x.value; +} + +function boxify(obj: T): Boxified { + let result = {} as Boxified; + for (let k in obj) { + result[k] = box(obj[k]); + } + return result; +} + +function unboxify(obj: Boxified): T { + let result = {} as T; + for (let k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} + +function assignBoxified(obj: Boxified, values: T) { + for (let k in values) { + obj[k].value = values[k]; + } +} + +function f1() { + let v = { + a: 42, + b: "hello", + c: true + }; + let b = boxify(v); + let x: number = b.a.value; +} + +function f2() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + let v = unboxify(b); + let x: number = v.a; +} + +function f3() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} + +function f4() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} + +function makeRecord(obj: { [P in K]: T }) { + return obj; +} + +function f5(s: string) { + let b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v.a; +} + +function makeDictionary(obj: { [x: string]: T }) { + return obj; +} + +function f6(s: string) { + let b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v[s]; +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; + +type Foo = { + a?: number; + readonly b: string; +} + +function f10(foo: Foo) { + let x = validate(foo); // { a: number, readonly b: string } + let y = clone(foo); // { a?: number, b: string } + let z = validateAndClone(foo); // { a: number, b: string } +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +type Spec = { + [P in keyof T]: Func | Spec ; +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: (a: any) => 3, + nested: { + mul: (b: any) => "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +let o = {a: 5, b: 7}; +foo(o, {b: 9}); +o = foo(o, {b: 9}); + +//// [isomorphicMappedTypeInference.js] +function box(x) { + return { value: x }; +} +function unbox(x) { + return x.value; +} +function boxify(obj) { + var result = {}; + for (var k in obj) { + result[k] = box(obj[k]); + } + return result; +} +function unboxify(obj) { + var result = {}; + for (var k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} +function assignBoxified(obj, values) { + for (var k in values) { + obj[k].value = values[k]; + } +} +function f1() { + var v = { + a: 42, + b: "hello", + c: true + }; + var b = boxify(v); + var x = b.a.value; +} +function f2() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + var v = unboxify(b); + var x = v.a; +} +function f3() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} +function f4() { + var b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} +function makeRecord(obj) { + return obj; +} +function f5(s) { + var b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + var v = unboxify(b); + var x = v.a; +} +function makeDictionary(obj) { + return obj; +} +function f6(s) { + var b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + var v = unboxify(b); + var x = v[s]; +} +function f10(foo) { + var x = validate(foo); // { a: number, readonly b: string } + var y = clone(foo); // { a?: number, b: string } + var z = validateAndClone(foo); // { a: number, b: string } +} +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: function (a) { return 3; }, + nested: { + mul: function (b) { return "n"; } + } +}); +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: function (x) { return true; } } } }); +// Repro from #12633 +var foo = function (object, partial) { return object; }; +var o = { a: 5, b: 7 }; +foo(o, { b: 9 }); +o = foo(o, { b: 9 }); + + +//// [isomorphicMappedTypeInference.d.ts] +declare type Box = { + value: T; +}; +declare type Boxified = { + [P in keyof T]: Box; +}; +declare function box(x: T): Box; +declare function unbox(x: Box): T; +declare function boxify(obj: T): Boxified; +declare function unboxify(obj: Boxified): T; +declare function assignBoxified(obj: Boxified, values: T): void; +declare function f1(): void; +declare function f2(): void; +declare function f3(): void; +declare function f4(): void; +declare function makeRecord(obj: { + [P in K]: T; +}): { + [P in K]: T; +}; +declare function f5(s: string): void; +declare function makeDictionary(obj: { + [x: string]: T; +}): { + [x: string]: T; +}; +declare function f6(s: string): void; +declare function validate(obj: { + [P in keyof T]?: T[P]; +}): T; +declare function clone(obj: { + readonly [P in keyof T]: T[P]; +}): T; +declare function validateAndClone(obj: { + readonly [P in keyof T]?: T[P]; +}): T; +declare type Foo = { + a?: number; + readonly b: string; +}; +declare function f10(foo: Foo): void; +declare type Func = (...args: any[]) => T; +declare type Spec = { + [P in keyof T]: Func | Spec; +}; +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +declare var g1: (...args: any[]) => { + sum: number; + nested: { + mul: string; + }; +}; +declare var g2: (...args: any[]) => { + foo: { + bar: { + baz: boolean; + }; + }; +}; +declare const foo: (object: T, partial: Partial) => T; +declare let o: { + a: number; + b: number; +}; diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.symbols b/tests/baselines/reference/isomorphicMappedTypeInference.symbols new file mode 100644 index 00000000000..93ce825c35d --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.symbols @@ -0,0 +1,489 @@ +=== tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts === + +type Box = { +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 1, 9)) + + value: T; +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 1, 9)) +} + +type Boxified = { +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) + + [P in keyof T]: Box; +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 6, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 5, 14)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 6, 5)) +} + +function box(x: T): Box { +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 9, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 9, 13)) + + return { value: x }; +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 10, 12)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 9, 16)) +} + +function unbox(x: Box): T { +>unbox : Symbol(unbox, Decl(isomorphicMappedTypeInference.ts, 11, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 13, 18)) +>Box : Symbol(Box, Decl(isomorphicMappedTypeInference.ts, 0, 0)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 13, 15)) + + return x.value; +>x.value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 13, 18)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +} + +function boxify(obj: T): Boxified { +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) + + let result = {} as Boxified; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 17, 16)) + + for (let k in obj) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) + + result[k] = box(obj[k]); +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 17, 19)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 19, 12)) + } + return result; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 18, 7)) +} + +function unboxify(obj: Boxified): T { +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) + + let result = {} as T; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 25, 18)) + + for (let k in obj) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) + + result[k] = unbox(obj[k]); +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) +>unbox : Symbol(unbox, Decl(isomorphicMappedTypeInference.ts, 11, 1)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 25, 21)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 27, 12)) + } + return result; +>result : Symbol(result, Decl(isomorphicMappedTypeInference.ts, 26, 7)) +} + +function assignBoxified(obj: Boxified, values: T) { +>assignBoxified : Symbol(assignBoxified, Decl(isomorphicMappedTypeInference.ts, 31, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 33, 27)) +>Boxified : Symbol(Boxified, Decl(isomorphicMappedTypeInference.ts, 3, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 33, 24)) + + for (let k in values) { +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) + + obj[k].value = values[k]; +>obj[k].value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 33, 27)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>values : Symbol(values, Decl(isomorphicMappedTypeInference.ts, 33, 44)) +>k : Symbol(k, Decl(isomorphicMappedTypeInference.ts, 34, 12)) + } +} + +function f1() { +>f1 : Symbol(f1, Decl(isomorphicMappedTypeInference.ts, 37, 1)) + + let v = { +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 40, 7)) + + a: 42, +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 40, 13)) + + b: "hello", +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 41, 14)) + + c: true +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 42, 19)) + + }; + let b = boxify(v); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 45, 7)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 40, 7)) + + let x: number = b.a.value; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 46, 7)) +>b.a.value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +>b.a : Symbol(a) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 45, 7)) +>a : Symbol(a) +>value : Symbol(value, Decl(isomorphicMappedTypeInference.ts, 1, 15)) +} + +function f2() { +>f2 : Symbol(f2, Decl(isomorphicMappedTypeInference.ts, 47, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 50, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 51, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 52, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 55, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 50, 7)) + + let x: number = v.a; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 56, 7)) +>v.a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 55, 7)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 50, 13)) +} + +function f3() { +>f3 : Symbol(f3, Decl(isomorphicMappedTypeInference.ts, 57, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 60, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 60, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 61, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 62, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + assignBoxified(b, { c: false }); +>assignBoxified : Symbol(assignBoxified, Decl(isomorphicMappedTypeInference.ts, 31, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 60, 7)) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 65, 23)) +} + +function f4() { +>f4 : Symbol(f4, Decl(isomorphicMappedTypeInference.ts, 66, 1)) + + let b = { +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 69, 13)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 70, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 71, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }; + b = boxify(unboxify(b)); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) + + b = unboxify(boxify(b)); +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>boxify : Symbol(boxify, Decl(isomorphicMappedTypeInference.ts, 15, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 69, 7)) +} + +function makeRecord(obj: { [P in K]: T }) { +>makeRecord : Symbol(makeRecord, Decl(isomorphicMappedTypeInference.ts, 76, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 78, 20)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 78, 22)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 78, 41)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 78, 49)) +>K : Symbol(K, Decl(isomorphicMappedTypeInference.ts, 78, 22)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 78, 20)) + + return obj; +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 78, 41)) +} + +function f5(s: string) { +>f5 : Symbol(f5, Decl(isomorphicMappedTypeInference.ts, 80, 1)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 82, 12)) + + let b = makeRecord({ +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 83, 7)) +>makeRecord : Symbol(makeRecord, Decl(isomorphicMappedTypeInference.ts, 76, 1)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 83, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 84, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 85, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }); + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 88, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 83, 7)) + + let x: string | number | boolean = v.a; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 89, 7)) +>v.a : Symbol(a) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 88, 7)) +>a : Symbol(a) +} + +function makeDictionary(obj: { [x: string]: T }) { +>makeDictionary : Symbol(makeDictionary, Decl(isomorphicMappedTypeInference.ts, 90, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 92, 24)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 92, 27)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 92, 35)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 92, 24)) + + return obj; +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 92, 27)) +} + +function f6(s: string) { +>f6 : Symbol(f6, Decl(isomorphicMappedTypeInference.ts, 94, 1)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 96, 12)) + + let b = makeDictionary({ +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 97, 7)) +>makeDictionary : Symbol(makeDictionary, Decl(isomorphicMappedTypeInference.ts, 90, 1)) + + a: box(42), +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 97, 28)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + b: box("hello"), +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 98, 19)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + c: box(true) +>c : Symbol(c, Decl(isomorphicMappedTypeInference.ts, 99, 24)) +>box : Symbol(box, Decl(isomorphicMappedTypeInference.ts, 7, 1)) + + }); + let v = unboxify(b); +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 102, 7)) +>unboxify : Symbol(unboxify, Decl(isomorphicMappedTypeInference.ts, 23, 1)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 97, 7)) + + let x: string | number | boolean = v[s]; +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 103, 7)) +>v : Symbol(v, Decl(isomorphicMappedTypeInference.ts, 102, 7)) +>s : Symbol(s, Decl(isomorphicMappedTypeInference.ts, 96, 12)) +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +>validate : Symbol(validate, Decl(isomorphicMappedTypeInference.ts, 104, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 106, 29)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 106, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 106, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 106, 26)) + +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +>clone : Symbol(clone, Decl(isomorphicMappedTypeInference.ts, 106, 64)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 107, 26)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 107, 43)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 107, 43)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 107, 23)) + +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; +>validateAndClone : Symbol(validateAndClone, Decl(isomorphicMappedTypeInference.ts, 107, 69)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 108, 37)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 108, 54)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 108, 54)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 108, 34)) + +type Foo = { +>Foo : Symbol(Foo, Decl(isomorphicMappedTypeInference.ts, 108, 81)) + + a?: number; +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 110, 12)) + + readonly b: string; +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 111, 15)) +} + +function f10(foo: Foo) { +>f10 : Symbol(f10, Decl(isomorphicMappedTypeInference.ts, 113, 1)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) +>Foo : Symbol(Foo, Decl(isomorphicMappedTypeInference.ts, 108, 81)) + + let x = validate(foo); // { a: number, readonly b: string } +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 116, 7)) +>validate : Symbol(validate, Decl(isomorphicMappedTypeInference.ts, 104, 1)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) + + let y = clone(foo); // { a?: number, b: string } +>y : Symbol(y, Decl(isomorphicMappedTypeInference.ts, 117, 7)) +>clone : Symbol(clone, Decl(isomorphicMappedTypeInference.ts, 106, 64)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) + + let z = validateAndClone(foo); // { a: number, b: string } +>z : Symbol(z, Decl(isomorphicMappedTypeInference.ts, 118, 7)) +>validateAndClone : Symbol(validateAndClone, Decl(isomorphicMappedTypeInference.ts, 107, 69)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 115, 13)) +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +>Func : Symbol(Func, Decl(isomorphicMappedTypeInference.ts, 119, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 123, 10)) +>args : Symbol(args, Decl(isomorphicMappedTypeInference.ts, 123, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 123, 10)) + +type Spec = { +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) + + [P in keyof T]: Func | Spec ; +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>Func : Symbol(Func, Decl(isomorphicMappedTypeInference.ts, 119, 1)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 124, 10)) +>P : Symbol(P, Decl(isomorphicMappedTypeInference.ts, 125, 5)) + +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) +>obj : Symbol(obj, Decl(isomorphicMappedTypeInference.ts, 133, 30)) +>Spec : Symbol(Spec, Decl(isomorphicMappedTypeInference.ts, 123, 37)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) +>args : Symbol(args, Decl(isomorphicMappedTypeInference.ts, 133, 46)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 133, 27)) + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ +>g1 : Symbol(g1, Decl(isomorphicMappedTypeInference.ts, 136, 3)) +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) + + sum: (a: any) => 3, +>sum : Symbol(sum, Decl(isomorphicMappedTypeInference.ts, 136, 20)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 137, 10)) + + nested: { +>nested : Symbol(nested, Decl(isomorphicMappedTypeInference.ts, 137, 23)) + + mul: (b: any) => "n" +>mul : Symbol(mul, Decl(isomorphicMappedTypeInference.ts, 138, 13)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 139, 14)) + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); +>g2 : Symbol(g2, Decl(isomorphicMappedTypeInference.ts, 144, 3)) +>applySpec : Symbol(applySpec, Decl(isomorphicMappedTypeInference.ts, 126, 2)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 144, 20)) +>bar : Symbol(bar, Decl(isomorphicMappedTypeInference.ts, 144, 27)) +>baz : Symbol(baz, Decl(isomorphicMappedTypeInference.ts, 144, 34)) +>x : Symbol(x, Decl(isomorphicMappedTypeInference.ts, 144, 41)) + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>object : Symbol(object, Decl(isomorphicMappedTypeInference.ts, 148, 16)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>partial : Symbol(partial, Decl(isomorphicMappedTypeInference.ts, 148, 26)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(isomorphicMappedTypeInference.ts, 148, 13)) +>object : Symbol(object, Decl(isomorphicMappedTypeInference.ts, 148, 16)) + +let o = {a: 5, b: 7}; +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>a : Symbol(a, Decl(isomorphicMappedTypeInference.ts, 149, 9)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 149, 14)) + +foo(o, {b: 9}); +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 150, 8)) + +o = foo(o, {b: 9}); +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>foo : Symbol(foo, Decl(isomorphicMappedTypeInference.ts, 148, 5)) +>o : Symbol(o, Decl(isomorphicMappedTypeInference.ts, 149, 3)) +>b : Symbol(b, Decl(isomorphicMappedTypeInference.ts, 151, 12)) + diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.types b/tests/baselines/reference/isomorphicMappedTypeInference.types new file mode 100644 index 00000000000..ca20e06e113 --- /dev/null +++ b/tests/baselines/reference/isomorphicMappedTypeInference.types @@ -0,0 +1,587 @@ +=== tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts === + +type Box = { +>Box : Box +>T : T + + value: T; +>value : T +>T : T +} + +type Boxified = { +>Boxified : Boxified +>T : T + + [P in keyof T]: Box; +>P : P +>T : T +>Box : Box +>T : T +>P : P +} + +function box(x: T): Box { +>box : (x: T) => Box +>T : T +>x : T +>T : T +>Box : Box +>T : T + + return { value: x }; +>{ value: x } : { value: T; } +>value : T +>x : T +} + +function unbox(x: Box): T { +>unbox : (x: Box) => T +>T : T +>x : Box +>Box : Box +>T : T +>T : T + + return x.value; +>x.value : T +>x : Box +>value : T +} + +function boxify(obj: T): Boxified { +>boxify : (obj: T) => Boxified +>T : T +>obj : T +>T : T +>Boxified : Boxified +>T : T + + let result = {} as Boxified; +>result : Boxified +>{} as Boxified : Boxified +>{} : {} +>Boxified : Boxified +>T : T + + for (let k in obj) { +>k : keyof T +>obj : T + + result[k] = box(obj[k]); +>result[k] = box(obj[k]) : Box +>result[k] : Box +>result : Boxified +>k : keyof T +>box(obj[k]) : Box +>box : (x: T) => Box +>obj[k] : T[keyof T] +>obj : T +>k : keyof T + } + return result; +>result : Boxified +} + +function unboxify(obj: Boxified): T { +>unboxify : (obj: Boxified) => T +>T : T +>obj : Boxified +>Boxified : Boxified +>T : T +>T : T + + let result = {} as T; +>result : T +>{} as T : T +>{} : {} +>T : T + + for (let k in obj) { +>k : keyof T +>obj : Boxified + + result[k] = unbox(obj[k]); +>result[k] = unbox(obj[k]) : T[keyof T] +>result[k] : T[keyof T] +>result : T +>k : keyof T +>unbox(obj[k]) : T[keyof T] +>unbox : (x: Box) => T +>obj[k] : Box +>obj : Boxified +>k : keyof T + } + return result; +>result : T +} + +function assignBoxified(obj: Boxified, values: T) { +>assignBoxified : (obj: Boxified, values: T) => void +>T : T +>obj : Boxified +>Boxified : Boxified +>T : T +>values : T +>T : T + + for (let k in values) { +>k : keyof T +>values : T + + obj[k].value = values[k]; +>obj[k].value = values[k] : T[keyof T] +>obj[k].value : T[keyof T] +>obj[k] : Box +>obj : Boxified +>k : keyof T +>value : T[keyof T] +>values[k] : T[keyof T] +>values : T +>k : keyof T + } +} + +function f1() { +>f1 : () => void + + let v = { +>v : { a: number; b: string; c: boolean; } +>{ a: 42, b: "hello", c: true } : { a: number; b: string; c: boolean; } + + a: 42, +>a : number +>42 : 42 + + b: "hello", +>b : string +>"hello" : "hello" + + c: true +>c : boolean +>true : true + + }; + let b = boxify(v); +>b : Boxified<{ a: number; b: string; c: boolean; }> +>boxify(v) : Boxified<{ a: number; b: string; c: boolean; }> +>boxify : (obj: T) => Boxified +>v : { a: number; b: string; c: boolean; } + + let x: number = b.a.value; +>x : number +>b.a.value : number +>b.a : Box +>b : Boxified<{ a: number; b: string; c: boolean; }> +>a : Box +>value : number +} + +function f2() { +>f2 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + let v = unboxify(b); +>v : { a: number; b: string; c: boolean; } +>unboxify(b) : { a: number; b: string; c: boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box; b: Box; c: Box; } + + let x: number = v.a; +>x : number +>v.a : number +>v : { a: number; b: string; c: boolean; } +>a : number +} + +function f3() { +>f3 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + assignBoxified(b, { c: false }); +>assignBoxified(b, { c: false }) : void +>assignBoxified : (obj: Boxified, values: T) => void +>b : { a: Box; b: Box; c: Box; } +>{ c: false } : { c: false; } +>c : boolean +>false : false +} + +function f4() { +>f4 : () => void + + let b = { +>b : { a: Box; b: Box; c: Box; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }; + b = boxify(unboxify(b)); +>b = boxify(unboxify(b)) : Boxified<{ a: number; b: string; c: boolean; }> +>b : { a: Box; b: Box; c: Box; } +>boxify(unboxify(b)) : Boxified<{ a: number; b: string; c: boolean; }> +>boxify : (obj: T) => Boxified +>unboxify(b) : { a: number; b: string; c: boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box; b: Box; c: Box; } + + b = unboxify(boxify(b)); +>b = unboxify(boxify(b)) : { a: Box; b: Box; c: Box; } +>b : { a: Box; b: Box; c: Box; } +>unboxify(boxify(b)) : { a: Box; b: Box; c: Box; } +>unboxify : (obj: Boxified) => T +>boxify(b) : Boxified<{ a: Box; b: Box; c: Box; }> +>boxify : (obj: T) => Boxified +>b : { a: Box; b: Box; c: Box; } +} + +function makeRecord(obj: { [P in K]: T }) { +>makeRecord : (obj: { [P in K]: T; }) => { [P in K]: T; } +>T : T +>K : K +>obj : { [P in K]: T; } +>P : P +>K : K +>T : T + + return obj; +>obj : { [P in K]: T; } +} + +function f5(s: string) { +>f5 : (s: string) => void +>s : string + + let b = makeRecord({ +>b : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } +>makeRecord({ a: box(42), b: box("hello"), c: box(true) }) : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } +>makeRecord : (obj: { [P in K]: T; }) => { [P in K]: T; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }); + let v = unboxify(b); +>v : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>unboxify(b) : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>unboxify : (obj: Boxified) => T +>b : { a: Box | Box | Box; b: Box | Box | Box; c: Box | Box | Box; } + + let x: string | number | boolean = v.a; +>x : string | number | boolean +>v.a : string | number | boolean +>v : { a: string | number | boolean; b: string | number | boolean; c: string | number | boolean; } +>a : string | number | boolean +} + +function makeDictionary(obj: { [x: string]: T }) { +>makeDictionary : (obj: { [x: string]: T; }) => { [x: string]: T; } +>T : T +>obj : { [x: string]: T; } +>x : string +>T : T + + return obj; +>obj : { [x: string]: T; } +} + +function f6(s: string) { +>f6 : (s: string) => void +>s : string + + let b = makeDictionary({ +>b : { [x: string]: Box | Box | Box; } +>makeDictionary({ a: box(42), b: box("hello"), c: box(true) }) : { [x: string]: Box | Box | Box; } +>makeDictionary : (obj: { [x: string]: T; }) => { [x: string]: T; } +>{ a: box(42), b: box("hello"), c: box(true) } : { a: Box; b: Box; c: Box; } + + a: box(42), +>a : Box +>box(42) : Box +>box : (x: T) => Box +>42 : 42 + + b: box("hello"), +>b : Box +>box("hello") : Box +>box : (x: T) => Box +>"hello" : "hello" + + c: box(true) +>c : Box +>box(true) : Box +>box : (x: T) => Box +>true : true + + }); + let v = unboxify(b); +>v : { [x: string]: string | number | boolean; } +>unboxify(b) : { [x: string]: string | number | boolean; } +>unboxify : (obj: Boxified) => T +>b : { [x: string]: Box | Box | Box; } + + let x: string | number | boolean = v[s]; +>x : string | number | boolean +>v[s] : string | number | boolean +>v : { [x: string]: string | number | boolean; } +>s : string +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +>validate : (obj: { [P in keyof T]?: T[P] | undefined; }) => T +>T : T +>obj : { [P in keyof T]?: T[P] | undefined; } +>P : P +>T : T +>T : T +>P : P +>T : T + +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +>clone : (obj: { readonly [P in keyof T]: T[P]; }) => T +>T : T +>obj : { readonly [P in keyof T]: T[P]; } +>P : P +>T : T +>T : T +>P : P +>T : T + +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; +>validateAndClone : (obj: { readonly [P in keyof T]?: T[P] | undefined; }) => T +>T : T +>obj : { readonly [P in keyof T]?: T[P] | undefined; } +>P : P +>T : T +>T : T +>P : P +>T : T + +type Foo = { +>Foo : Foo + + a?: number; +>a : number | undefined + + readonly b: string; +>b : string +} + +function f10(foo: Foo) { +>f10 : (foo: Foo) => void +>foo : Foo +>Foo : Foo + + let x = validate(foo); // { a: number, readonly b: string } +>x : { a: number; readonly b: string; } +>validate(foo) : { a: number; readonly b: string; } +>validate : (obj: { [P in keyof T]?: T[P] | undefined; }) => T +>foo : Foo + + let y = clone(foo); // { a?: number, b: string } +>y : { a?: number | undefined; b: string; } +>clone(foo) : { a?: number | undefined; b: string; } +>clone : (obj: { readonly [P in keyof T]: T[P]; }) => T +>foo : Foo + + let z = validateAndClone(foo); // { a: number, b: string } +>z : { a: number; b: string; } +>validateAndClone(foo) : { a: number; b: string; } +>validateAndClone : (obj: { readonly [P in keyof T]?: T[P] | undefined; }) => T +>foo : Foo +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +>Func : Func +>T : T +>args : any[] +>T : T + +type Spec = { +>Spec : Spec +>T : T + + [P in keyof T]: Func | Spec ; +>P : P +>T : T +>Func : Func +>T : T +>P : P +>Spec : Spec +>T : T +>P : P + +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; +>applySpec : (obj: Spec) => (...args: any[]) => T +>T : T +>obj : Spec +>Spec : Spec +>T : T +>args : any[] +>T : T + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ +>g1 : (...args: any[]) => { sum: number; nested: { mul: string; }; } +>applySpec({ sum: (a: any) => 3, nested: { mul: (b: any) => "n" }}) : (...args: any[]) => { sum: number; nested: { mul: string; }; } +>applySpec : (obj: Spec) => (...args: any[]) => T +>{ sum: (a: any) => 3, nested: { mul: (b: any) => "n" }} : { sum: (a: any) => number; nested: { mul: (b: any) => string; }; } + + sum: (a: any) => 3, +>sum : (a: any) => number +>(a: any) => 3 : (a: any) => number +>a : any +>3 : 3 + + nested: { +>nested : { mul: (b: any) => string; } +>{ mul: (b: any) => "n" } : { mul: (b: any) => string; } + + mul: (b: any) => "n" +>mul : (b: any) => string +>(b: any) => "n" : (b: any) => string +>b : any +>"n" : "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); +>g2 : (...args: any[]) => { foo: { bar: { baz: boolean; }; }; } +>applySpec({ foo: { bar: { baz: (x: any) => true } } }) : (...args: any[]) => { foo: { bar: { baz: boolean; }; }; } +>applySpec : (obj: Spec) => (...args: any[]) => T +>{ foo: { bar: { baz: (x: any) => true } } } : { foo: { bar: { baz: (x: any) => boolean; }; }; } +>foo : { bar: { baz: (x: any) => boolean; }; } +>{ bar: { baz: (x: any) => true } } : { bar: { baz: (x: any) => boolean; }; } +>bar : { baz: (x: any) => boolean; } +>{ baz: (x: any) => true } : { baz: (x: any) => boolean; } +>baz : (x: any) => boolean +>(x: any) => true : (x: any) => boolean +>x : any +>true : true + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +>foo : (object: T, partial: Partial) => T +>(object: T, partial: Partial) => object : (object: T, partial: Partial) => T +>T : T +>object : T +>T : T +>partial : Partial +>Partial : Partial +>T : T +>object : T + +let o = {a: 5, b: 7}; +>o : { a: number; b: number; } +>{a: 5, b: 7} : { a: number; b: number; } +>a : number +>5 : 5 +>b : number +>7 : 7 + +foo(o, {b: 9}); +>foo(o, {b: 9}) : { a: number; b: number; } +>foo : (object: T, partial: Partial) => T +>o : { a: number; b: number; } +>{b: 9} : { b: number; } +>b : number +>9 : 9 + +o = foo(o, {b: 9}); +>o = foo(o, {b: 9}) : { a: number; b: number; } +>o : { a: number; b: number; } +>foo(o, {b: 9}) : { a: number; b: number; } +>foo : (object: T, partial: Partial) => T +>o : { a: number; b: number; } +>{b: 9} : { b: number; } +>b : number +>9 : 9 + diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js new file mode 100644 index 00000000000..ecf7d13d89d --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.js @@ -0,0 +1,27 @@ +//// [index.tsx] + +import "./jsx"; + +var skate: any; +const React = { createElement: skate.h }; + +class Component { + renderCallback() { + return
test
; + } +}; + +//// [index.js] +"use strict"; +require("./jsx"); +var skate; +var React = { createElement: skate.h }; +var Component = (function () { + function Component() { + } + Component.prototype.renderCallback = function () { + return skate.h("div", null, "test"); + }; + return Component; +}()); +; diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols new file mode 100644 index 00000000000..35879c81ca6 --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.symbols @@ -0,0 +1,23 @@ +=== tests/cases/compiler/index.tsx === + +import "./jsx"; + +var skate: any; +>skate : Symbol(skate, Decl(index.tsx, 3, 3)) + +const React = { createElement: skate.h }; +>React : Symbol(React, Decl(index.tsx, 4, 5)) +>createElement : Symbol(createElement, Decl(index.tsx, 4, 15)) +>skate : Symbol(skate, Decl(index.tsx, 3, 3)) + +class Component { +>Component : Symbol(Component, Decl(index.tsx, 4, 41)) + + renderCallback() { +>renderCallback : Symbol(Component.renderCallback, Decl(index.tsx, 6, 17)) + + return
test
; +>div : Symbol(unknown) +>div : Symbol(unknown) + } +}; diff --git a/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types new file mode 100644 index 00000000000..21fd4bae84b --- /dev/null +++ b/tests/baselines/reference/jsxFactoryQualifiedNameWithEs5.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/index.tsx === + +import "./jsx"; + +var skate: any; +>skate : any + +const React = { createElement: skate.h }; +>React : { createElement: any; } +>{ createElement: skate.h } : { createElement: any; } +>createElement : any +>skate.h : any +>skate : any +>h : any + +class Component { +>Component : Component + + renderCallback() { +>renderCallback : () => any + + return
test
; +>
test
: any +>div : any +>div : any + } +}; diff --git a/tests/baselines/reference/keyofAndForIn.js b/tests/baselines/reference/keyofAndForIn.js new file mode 100644 index 00000000000..0debf28b75e --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.js @@ -0,0 +1,81 @@ +//// [keyofAndForIn.ts] + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { + const b = k in obj; + let k1: keyof T; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +//// [keyofAndForIn.js] +// Repro from #12513 +function f1(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} +function f2(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} +function f3(obj, k) { + var b = k in obj; + var k1; + for (k1 in obj) { + var x1 = obj[k1]; + } + for (var k2 in obj) { + var x2 = obj[k2]; + } +} + + +//// [keyofAndForIn.d.ts] +declare function f1(obj: { + [P in K]: T; +}, k: K): void; +declare function f2(obj: { + [P in keyof T]: T[P]; +}, k: keyof T): void; +declare function f3(obj: { + [P in K]: T[P]; +}, k: K): void; diff --git a/tests/baselines/reference/keyofAndForIn.symbols b/tests/baselines/reference/keyofAndForIn.symbols new file mode 100644 index 00000000000..36b5d3e2d72 --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.symbols @@ -0,0 +1,125 @@ +=== tests/cases/conformance/types/keyof/keyofAndForIn.ts === + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { +>f1 : Symbol(f1, Decl(keyofAndForIn.ts, 0, 0)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 3, 29)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 3, 41)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 3, 29)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 3, 54)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 4, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 3, 54)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let k1: K; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 3, 12)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 7, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 5, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 9, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 10, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 3, 33)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 9, 12)) + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { +>f2 : Symbol(f2, Decl(keyofAndForIn.ts, 12, 1)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 14, 23)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 14, 23)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 14, 45)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 15, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 14, 45)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let k1: keyof T; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 14, 12)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 18, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 16, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 20, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 21, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 14, 15)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 20, 12)) + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { +>f3 : Symbol(f3, Decl(keyofAndForIn.ts, 23, 1)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 25, 42)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) +>T : Symbol(T, Decl(keyofAndForIn.ts, 25, 12)) +>P : Symbol(P, Decl(keyofAndForIn.ts, 25, 42)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 25, 58)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) + + const b = k in obj; +>b : Symbol(b, Decl(keyofAndForIn.ts, 26, 9)) +>k : Symbol(k, Decl(keyofAndForIn.ts, 25, 58)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let k1: K; +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) +>K : Symbol(K, Decl(keyofAndForIn.ts, 25, 14)) + + for (k1 in obj) { +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let x1 = obj[k1]; +>x1 : Symbol(x1, Decl(keyofAndForIn.ts, 29, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>k1 : Symbol(k1, Decl(keyofAndForIn.ts, 27, 7)) + } + for (let k2 in obj) { +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 31, 12)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) + + let x2 = obj[k2]; +>x2 : Symbol(x2, Decl(keyofAndForIn.ts, 32, 11)) +>obj : Symbol(obj, Decl(keyofAndForIn.ts, 25, 34)) +>k2 : Symbol(k2, Decl(keyofAndForIn.ts, 31, 12)) + } +} diff --git a/tests/baselines/reference/keyofAndForIn.types b/tests/baselines/reference/keyofAndForIn.types new file mode 100644 index 00000000000..5e992e5d261 --- /dev/null +++ b/tests/baselines/reference/keyofAndForIn.types @@ -0,0 +1,134 @@ +=== tests/cases/conformance/types/keyof/keyofAndForIn.ts === + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { +>f1 : (obj: { [P in K]: T; }, k: K) => void +>K : K +>T : T +>obj : { [P in K]: T; } +>P : P +>K : K +>T : T +>k : K +>K : K + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : K +>obj : { [P in K]: T; } + + let k1: K; +>k1 : K +>K : K + + for (k1 in obj) { +>k1 : K +>obj : { [P in K]: T; } + + let x1 = obj[k1]; +>x1 : T +>obj[k1] : T +>obj : { [P in K]: T; } +>k1 : K + } + for (let k2 in obj) { +>k2 : K +>obj : { [P in K]: T; } + + let x2 = obj[k2]; +>x2 : T +>obj[k2] : T +>obj : { [P in K]: T; } +>k2 : K + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { +>f2 : (obj: { [P in keyof T]: T[P]; }, k: keyof T) => void +>T : T +>obj : { [P in keyof T]: T[P]; } +>P : P +>T : T +>T : T +>P : P +>k : keyof T +>T : T + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : keyof T +>obj : { [P in keyof T]: T[P]; } + + let k1: keyof T; +>k1 : keyof T +>T : T + + for (k1 in obj) { +>k1 : keyof T +>obj : { [P in keyof T]: T[P]; } + + let x1 = obj[k1]; +>x1 : T[keyof T] +>obj[k1] : T[keyof T] +>obj : { [P in keyof T]: T[P]; } +>k1 : keyof T + } + for (let k2 in obj) { +>k2 : keyof T +>obj : { [P in keyof T]: T[P]; } + + let x2 = obj[k2]; +>x2 : T[keyof T] +>obj[k2] : T[keyof T] +>obj : { [P in keyof T]: T[P]; } +>k2 : keyof T + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { +>f3 : (obj: { [P in K]: T[P]; }, k: K) => void +>T : T +>K : K +>T : T +>obj : { [P in K]: T[P]; } +>P : P +>K : K +>T : T +>P : P +>k : K +>K : K + + const b = k in obj; +>b : boolean +>k in obj : boolean +>k : K +>obj : { [P in K]: T[P]; } + + let k1: K; +>k1 : K +>K : K + + for (k1 in obj) { +>k1 : K +>obj : { [P in K]: T[P]; } + + let x1 = obj[k1]; +>x1 : T[K] +>obj[k1] : T[K] +>obj : { [P in K]: T[P]; } +>k1 : K + } + for (let k2 in obj) { +>k2 : K +>obj : { [P in K]: T[P]; } + + let x2 = obj[k2]; +>x2 : T[K] +>obj[k2] : T[K] +>obj : { [P in K]: T[P]; } +>k2 : K + } +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 1cc8846bbbd..4b93897fdc4 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -21,11 +21,12 @@ class Options { } type Dictionary = { [x: string]: T }; +type NumericallyIndexed = { [x: number]: T }; const enum E { A, B, C } -type K00 = keyof any; // string | number -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K00 = keyof any; // string +type K01 = keyof string; // "toString" | "charAt" | ... type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... type K03 = keyof boolean; // "valueOf" type K04 = keyof void; // never @@ -34,19 +35,20 @@ type K06 = keyof null; // never type K07 = keyof never; // never type K10 = keyof Shape; // "name" | "width" | "height" | "visible" -type K11 = keyof Shape[]; // number | "length" | "toString" | ... -type K12 = keyof Dictionary; // string | number +type K11 = keyof Shape[]; // "length" | "toString" | ... +type K12 = keyof Dictionary; // string type K13 = keyof {}; // never type K14 = keyof Object; // "constructor" | "toString" | ... type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... type K17 = keyof (Shape | Item); // "name" type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" +type K19 = keyof NumericallyIndexed // never type KeyOf = keyof T; type K20 = KeyOf; // "name" | "width" | "height" | "visible" -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string type NAME = "name"; type WIDTH_OR_HEIGHT = "width" | "height"; @@ -217,6 +219,83 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +} + +function f71(func: (x: T, y: U) => Partial) { + let x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} + +function f80(obj: T) { + let a1 = obj.a; // { x: any } + let a2 = obj['a']; // { x: any } + let a3 = obj['a'] as T['a']; // T["a"] + let x1 = obj.a.x; // any + let x2 = obj['a']['x']; // any + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +} + +function f81(obj: T) { + return obj['a']['x'] as T['a']['x']; +} + +function f82() { + let x1 = f81({ a: { x: "hello" } }); // string + let x2 = f81({ a: { x: 42 } }); // number +} + +function f83(obj: T, key: K) { + return obj[key]['x'] as T[K]['x']; +} + +function f84() { + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +} + +class C1 { + x: number; + get(key: K) { + return this[key]; + } + set(key: K, value: this[K]) { + this[key] = value; + } + foo() { + let x1 = this.x; // number + let x2 = this["x"]; // number + let x3 = this.get("x"); // this["x"] + let x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + } +} + // Repros from #12011 class Base { @@ -247,7 +326,110 @@ class OtherPerson { getParts() { return getProperty(this, "parts") } -} +} + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +function path(obj: any, ...keys: (string | number)[]): any; +function path(obj: any, ...keys: (string | number)[]): any { + let result = obj; + for (let k of keys) { + result = result[k]; + } + return result; +} + +type Thing = { + a: { x: number, y: string }, + b: boolean +}; + + +function f1(thing: Thing) { + let x1 = path(thing, 'a'); // { x: number, y: string } + let x2 = path(thing, 'a', 'y'); // string + let x3 = path(thing, 'b'); // boolean + let x4 = path(thing, ...['a', 'x']); // any +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => + (value: T[K1][K2]) => object[key1][key2] = value; + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +var empty = one(() => {}) // inferred as {}, expected + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +declare function on(handlerHash: Handlers): T +var hashOfEmpty1 = on({ test: () => {} }); // {} +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } + +// Repro from #12624 + +interface Options1 { + data?: Data + computed?: Computed; +} + +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} + +let c1 = new Component1({ + data: { + hello: "" + } +}); + +c1.get("hello"); + +// Repro from #12625 + +interface Options2 { + data?: Data + computed?: Computed; +} + +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} + +// Repro from #12641 + +interface R { + p: number; +} + +function f(p: K) { + let a: any; + a[p].add; // any +} + +// Repro from #12651 + +type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; + +type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +} + +let result = dispatchMethod("someMethod", ["hello", 35]); //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || function (d, b) { @@ -394,6 +576,74 @@ function f60(source, target) { target[k] = source[k]; } } +function f70(func) { + func('a', 'a'); + func('a', 'b'); + func('a', 'c'); +} +function f71(func) { + var x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} +function f72(func) { + var a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + var c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} +function f73(func) { + var a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + var c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} +function f74(func) { + var a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + var b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} +function f80(obj) { + var a1 = obj.a; // { x: any } + var a2 = obj['a']; // { x: any } + var a3 = obj['a']; // T["a"] + var x1 = obj.a.x; // any + var x2 = obj['a']['x']; // any + var x3 = obj['a']['x']; // T["a"]["x"] +} +function f81(obj) { + return obj['a']['x']; +} +function f82() { + var x1 = f81({ a: { x: "hello" } }); // string + var x2 = f81({ a: { x: 42 } }); // number +} +function f83(obj, key) { + return obj[key]['x']; +} +function f84() { + var x1 = f83({ foo: { x: "hello" } }, "foo"); // string + var x2 = f83({ bar: { x: 42 } }, "bar"); // number +} +var C1 = (function () { + function C1() { + } + C1.prototype.get = function (key) { + return this[key]; + }; + C1.prototype.set = function (key, value) { + this[key] = value; + }; + C1.prototype.foo = function () { + var x1 = this.x; // number + var x2 = this["x"]; // number + var x3 = this.get("x"); // this["x"] + var x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + }; + return C1; +}()); // Repros from #12011 var Base = (function () { function Base() { @@ -427,6 +677,42 @@ var OtherPerson = (function () { }; return OtherPerson; }()); +function path(obj) { + var keys = []; + for (var _i = 1; _i < arguments.length; _i++) { + keys[_i - 1] = arguments[_i]; + } + var result = obj; + for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { + var k = keys_1[_a]; + result = result[k]; + } + return result; +} +function f1(thing) { + var x1 = path(thing, 'a'); // { x: number, y: string } + var x2 = path(thing, 'a', 'y'); // string + var x3 = path(thing, 'b'); // boolean + var x4 = path.apply(void 0, [thing].concat(['a', 'x'])); // any +} +// Repro from comment in #12114 +var assignTo2 = function (object, key1, key2) { + return function (value) { return object[key1][key2] = value; }; +}; +var empty = one(function () { }); // inferred as {}, expected +var hashOfEmpty1 = on({ test: function () { } }); // {} +var hashOfEmpty2 = on({ test: function (x) { } }); // { test: boolean } +var c1 = new Component1({ + data: { + hello: "" + } +}); +c1.get("hello"); +function f(p) { + var a; + a[p].add; // any +} +var result = dispatchMethod("someMethod", ["hello", 35]); //// [keyofAndIndexedAccess.d.ts] @@ -449,6 +735,9 @@ declare class Options { declare type Dictionary = { [x: string]: T; }; +declare type NumericallyIndexed = { + [x: number]: T; +}; declare const enum E { A = 0, B = 1, @@ -471,6 +760,7 @@ declare type K15 = keyof E; declare type K16 = keyof [string, number]; declare type K17 = keyof (Shape | Item); declare type K18 = keyof (Shape & Item); +declare type K19 = keyof NumericallyIndexed; declare type KeyOf = keyof T; declare type K20 = KeyOf; declare type K21 = KeyOf>; @@ -530,6 +820,34 @@ declare function f53(obj: { declare function f54(obj: T, key: keyof T): void; declare function f55(obj: T, key: K): void; declare function f60(source: T, target: T): void; +declare function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void): void; +declare function f71(func: (x: T, y: U) => Partial): void; +declare function f72(func: (x: T, y: U, k: K) => (T & U)[K]): void; +declare function f73(func: (x: T, y: U, k: K) => (T & U)[K]): void; +declare function f74(func: (x: T, y: U, k: K) => (T | U)[K]): void; +declare function f80(obj: T): void; +declare function f81(obj: T): T["a"]["x"]; +declare function f82(): void; +declare function f83(obj: T, key: K): T[K]["x"]; +declare function f84(): void; +declare class C1 { + x: number; + get(key: K): this[K]; + set(key: K, value: this[K]): void; + foo(): void; +} declare class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; @@ -537,10 +855,68 @@ declare class Base { declare class Person extends Base { parts: number; constructor(parts: number); - getParts(): number; + getParts(): this["parts"]; } declare class OtherPerson { parts: number; constructor(parts: number); - getParts(): number; + getParts(): this["parts"]; } +declare function path(obj: T, key1: K1): T[K1]; +declare function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +declare function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +declare function path(obj: any, ...keys: (string | number)[]): any; +declare type Thing = { + a: { + x: number; + y: string; + }; + b: boolean; +}; +declare function f1(thing: Thing): void; +declare const assignTo2: (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2]; +declare function one(handler: (t: T) => void): T; +declare var empty: {}; +declare type Handlers = { + [K in keyof T]: (t: T[K]) => void; +}; +declare function on(handlerHash: Handlers): T; +declare var hashOfEmpty1: {}; +declare var hashOfEmpty2: { + test: boolean; +}; +interface Options1 { + data?: Data; + computed?: Computed; +} +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} +declare let c1: Component1<{ + hello: string; +}, {}>; +interface Options2 { + data?: Data; + computed?: Computed; +} +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} +interface R { + p: number; +} +declare function f(p: K): void; +declare type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +}; +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +declare type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +}; +declare let result: string[]; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 634dfe09da9..1c69d4959d8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -47,792 +47,1532 @@ type Dictionary = { [x: string]: T }; >x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 21, 24)) >T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 21, 16)) +type NumericallyIndexed = { [x: number]: T }; +>NumericallyIndexed : Symbol(NumericallyIndexed, Decl(keyofAndIndexedAccess.ts, 21, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 22, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 22, 32)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 22, 24)) + const enum E { A, B, C } ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 23, 14)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) ->C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 23, 20)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 24, 14)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) +>C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 24, 20)) -type K00 = keyof any; // string | number ->K00 : Symbol(K00, Decl(keyofAndIndexedAccess.ts, 23, 24)) +type K00 = keyof any; // string +>K00 : Symbol(K00, Decl(keyofAndIndexedAccess.ts, 24, 24)) -type K01 = keyof string; // number | "toString" | "charAt" | ... ->K01 : Symbol(K01, Decl(keyofAndIndexedAccess.ts, 25, 21)) +type K01 = keyof string; // "toString" | "charAt" | ... +>K01 : Symbol(K01, Decl(keyofAndIndexedAccess.ts, 26, 21)) type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... ->K02 : Symbol(K02, Decl(keyofAndIndexedAccess.ts, 26, 24)) +>K02 : Symbol(K02, Decl(keyofAndIndexedAccess.ts, 27, 24)) type K03 = keyof boolean; // "valueOf" ->K03 : Symbol(K03, Decl(keyofAndIndexedAccess.ts, 27, 24)) +>K03 : Symbol(K03, Decl(keyofAndIndexedAccess.ts, 28, 24)) type K04 = keyof void; // never ->K04 : Symbol(K04, Decl(keyofAndIndexedAccess.ts, 28, 25)) +>K04 : Symbol(K04, Decl(keyofAndIndexedAccess.ts, 29, 25)) type K05 = keyof undefined; // never ->K05 : Symbol(K05, Decl(keyofAndIndexedAccess.ts, 29, 22)) +>K05 : Symbol(K05, Decl(keyofAndIndexedAccess.ts, 30, 22)) type K06 = keyof null; // never ->K06 : Symbol(K06, Decl(keyofAndIndexedAccess.ts, 30, 27)) +>K06 : Symbol(K06, Decl(keyofAndIndexedAccess.ts, 31, 27)) type K07 = keyof never; // never ->K07 : Symbol(K07, Decl(keyofAndIndexedAccess.ts, 31, 22)) +>K07 : Symbol(K07, Decl(keyofAndIndexedAccess.ts, 32, 22)) type K10 = keyof Shape; // "name" | "width" | "height" | "visible" ->K10 : Symbol(K10, Decl(keyofAndIndexedAccess.ts, 32, 23)) +>K10 : Symbol(K10, Decl(keyofAndIndexedAccess.ts, 33, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K11 = keyof Shape[]; // number | "length" | "toString" | ... ->K11 : Symbol(K11, Decl(keyofAndIndexedAccess.ts, 34, 23)) +type K11 = keyof Shape[]; // "length" | "toString" | ... +>K11 : Symbol(K11, Decl(keyofAndIndexedAccess.ts, 35, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K12 = keyof Dictionary; // string | number ->K12 : Symbol(K12, Decl(keyofAndIndexedAccess.ts, 35, 25)) +type K12 = keyof Dictionary; // string +>K12 : Symbol(K12, Decl(keyofAndIndexedAccess.ts, 36, 25)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type K13 = keyof {}; // never ->K13 : Symbol(K13, Decl(keyofAndIndexedAccess.ts, 36, 35)) +>K13 : Symbol(K13, Decl(keyofAndIndexedAccess.ts, 37, 35)) type K14 = keyof Object; // "constructor" | "toString" | ... ->K14 : Symbol(K14, Decl(keyofAndIndexedAccess.ts, 37, 20)) +>K14 : Symbol(K14, Decl(keyofAndIndexedAccess.ts, 38, 20)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... ->K15 : Symbol(K15, Decl(keyofAndIndexedAccess.ts, 38, 24)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) +>K15 : Symbol(K15, Decl(keyofAndIndexedAccess.ts, 39, 24)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... ->K16 : Symbol(K16, Decl(keyofAndIndexedAccess.ts, 39, 19)) +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... +>K16 : Symbol(K16, Decl(keyofAndIndexedAccess.ts, 40, 19)) type K17 = keyof (Shape | Item); // "name" ->K17 : Symbol(K17, Decl(keyofAndIndexedAccess.ts, 40, 34)) +>K17 : Symbol(K17, Decl(keyofAndIndexedAccess.ts, 41, 34)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Item : Symbol(Item, Decl(keyofAndIndexedAccess.ts, 10, 1)) type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" ->K18 : Symbol(K18, Decl(keyofAndIndexedAccess.ts, 41, 32)) +>K18 : Symbol(K18, Decl(keyofAndIndexedAccess.ts, 42, 32)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Item : Symbol(Item, Decl(keyofAndIndexedAccess.ts, 10, 1)) -type KeyOf = keyof T; ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 44, 11)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 44, 11)) - -type K20 = KeyOf; // "name" | "width" | "height" | "visible" ->K20 : Symbol(K20, Decl(keyofAndIndexedAccess.ts, 44, 24)) ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) +type K19 = keyof NumericallyIndexed // never +>K19 : Symbol(K19, Decl(keyofAndIndexedAccess.ts, 43, 32)) +>NumericallyIndexed : Symbol(NumericallyIndexed, Decl(keyofAndIndexedAccess.ts, 21, 40)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) -type K21 = KeyOf>; // string | number ->K21 : Symbol(K21, Decl(keyofAndIndexedAccess.ts, 46, 24)) ->KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 42, 32)) +type KeyOf = keyof T; +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 46, 11)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 46, 11)) + +type K20 = KeyOf; // "name" | "width" | "height" | "visible" +>K20 : Symbol(K20, Decl(keyofAndIndexedAccess.ts, 46, 24)) +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) +>Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) + +type K21 = KeyOf>; // string +>K21 : Symbol(K21, Decl(keyofAndIndexedAccess.ts, 48, 24)) +>KeyOf : Symbol(KeyOf, Decl(keyofAndIndexedAccess.ts, 44, 42)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type NAME = "name"; ->NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 47, 36)) +>NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 49, 36)) type WIDTH_OR_HEIGHT = "width" | "height"; ->WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 49, 19)) +>WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 51, 19)) type Q10 = Shape["name"]; // string ->Q10 : Symbol(Q10, Decl(keyofAndIndexedAccess.ts, 50, 42)) +>Q10 : Symbol(Q10, Decl(keyofAndIndexedAccess.ts, 52, 42)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q11 = Shape["width" | "height"]; // number ->Q11 : Symbol(Q11, Decl(keyofAndIndexedAccess.ts, 52, 25)) +>Q11 : Symbol(Q11, Decl(keyofAndIndexedAccess.ts, 54, 25)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q12 = Shape["name" | "visible"]; // string | boolean ->Q12 : Symbol(Q12, Decl(keyofAndIndexedAccess.ts, 53, 37)) +>Q12 : Symbol(Q12, Decl(keyofAndIndexedAccess.ts, 55, 37)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q20 = Shape[NAME]; // string ->Q20 : Symbol(Q20, Decl(keyofAndIndexedAccess.ts, 54, 37)) +>Q20 : Symbol(Q20, Decl(keyofAndIndexedAccess.ts, 56, 37)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 47, 36)) +>NAME : Symbol(NAME, Decl(keyofAndIndexedAccess.ts, 49, 36)) type Q21 = Shape[WIDTH_OR_HEIGHT]; // number ->Q21 : Symbol(Q21, Decl(keyofAndIndexedAccess.ts, 56, 23)) +>Q21 : Symbol(Q21, Decl(keyofAndIndexedAccess.ts, 58, 23)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 49, 19)) +>WIDTH_OR_HEIGHT : Symbol(WIDTH_OR_HEIGHT, Decl(keyofAndIndexedAccess.ts, 51, 19)) type Q30 = [string, number][0]; // string ->Q30 : Symbol(Q30, Decl(keyofAndIndexedAccess.ts, 57, 34)) +>Q30 : Symbol(Q30, Decl(keyofAndIndexedAccess.ts, 59, 34)) type Q31 = [string, number][1]; // number ->Q31 : Symbol(Q31, Decl(keyofAndIndexedAccess.ts, 59, 31)) +>Q31 : Symbol(Q31, Decl(keyofAndIndexedAccess.ts, 61, 31)) type Q32 = [string, number][2]; // string | number ->Q32 : Symbol(Q32, Decl(keyofAndIndexedAccess.ts, 60, 31)) +>Q32 : Symbol(Q32, Decl(keyofAndIndexedAccess.ts, 62, 31)) type Q33 = [string, number][E.A]; // string ->Q33 : Symbol(Q33, Decl(keyofAndIndexedAccess.ts, 61, 31)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 23, 14)) +>Q33 : Symbol(Q33, Decl(keyofAndIndexedAccess.ts, 63, 31)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>A : Symbol(E.A, Decl(keyofAndIndexedAccess.ts, 24, 14)) type Q34 = [string, number][E.B]; // number ->Q34 : Symbol(Q34, Decl(keyofAndIndexedAccess.ts, 62, 33)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) +>Q34 : Symbol(Q34, Decl(keyofAndIndexedAccess.ts, 64, 33)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) type Q35 = [string, number][E.C]; // string | number ->Q35 : Symbol(Q35, Decl(keyofAndIndexedAccess.ts, 63, 33)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 23, 20)) +>Q35 : Symbol(Q35, Decl(keyofAndIndexedAccess.ts, 65, 33)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>C : Symbol(E.C, Decl(keyofAndIndexedAccess.ts, 24, 20)) type Q36 = [string, number]["0"]; // string ->Q36 : Symbol(Q36, Decl(keyofAndIndexedAccess.ts, 64, 33)) +>Q36 : Symbol(Q36, Decl(keyofAndIndexedAccess.ts, 66, 33)) type Q37 = [string, number]["1"]; // string ->Q37 : Symbol(Q37, Decl(keyofAndIndexedAccess.ts, 65, 33)) +>Q37 : Symbol(Q37, Decl(keyofAndIndexedAccess.ts, 67, 33)) type Q40 = (Shape | Options)["visible"]; // boolean | "yes" | "no" ->Q40 : Symbol(Q40, Decl(keyofAndIndexedAccess.ts, 66, 33)) +>Q40 : Symbol(Q40, Decl(keyofAndIndexedAccess.ts, 68, 33)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Options : Symbol(Options, Decl(keyofAndIndexedAccess.ts, 15, 1)) type Q41 = (Shape & Options)["visible"]; // true & "yes" | true & "no" | false & "yes" | false & "no" ->Q41 : Symbol(Q41, Decl(keyofAndIndexedAccess.ts, 68, 40)) +>Q41 : Symbol(Q41, Decl(keyofAndIndexedAccess.ts, 70, 40)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) >Options : Symbol(Options, Decl(keyofAndIndexedAccess.ts, 15, 1)) type Q50 = Dictionary["howdy"]; // Shape ->Q50 : Symbol(Q50, Decl(keyofAndIndexedAccess.ts, 69, 40)) +>Q50 : Symbol(Q50, Decl(keyofAndIndexedAccess.ts, 71, 40)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q51 = Dictionary[123]; // Shape ->Q51 : Symbol(Q51, Decl(keyofAndIndexedAccess.ts, 71, 38)) +>Q51 : Symbol(Q51, Decl(keyofAndIndexedAccess.ts, 73, 38)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) type Q52 = Dictionary[E.B]; // Shape ->Q52 : Symbol(Q52, Decl(keyofAndIndexedAccess.ts, 72, 34)) +>Q52 : Symbol(Q52, Decl(keyofAndIndexedAccess.ts, 74, 34)) >Dictionary : Symbol(Dictionary, Decl(keyofAndIndexedAccess.ts, 19, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 21, 40)) ->B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 23, 17)) +>E : Symbol(E, Decl(keyofAndIndexedAccess.ts, 22, 48)) +>B : Symbol(E.B, Decl(keyofAndIndexedAccess.ts, 24, 17)) declare let cond: boolean; ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) function getProperty(obj: T, key: K) { ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 77, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 77, 43)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 77, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 77, 50)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 77, 23)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 79, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 79, 43)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 79, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 79, 50)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 79, 23)) return obj[key]; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 77, 43)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 77, 50)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 79, 43)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 79, 50)) } function setProperty(obj: T, key: K, value: T[K]) { ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 81, 43)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 81, 50)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 81, 58)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 81, 21)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 81, 23)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 83, 43)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 83, 50)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 83, 58)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 83, 21)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 83, 23)) obj[key] = value; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 81, 43)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 81, 50)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 81, 58)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 83, 43)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 83, 50)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 83, 58)) } function f10(shape: Shape) { ->f10 : Symbol(f10, Decl(keyofAndIndexedAccess.ts, 83, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>f10 : Symbol(f10, Decl(keyofAndIndexedAccess.ts, 85, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let name = getProperty(shape, "name"); // string ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 86, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 88, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) let widthOrHeight = getProperty(shape, cond ? "width" : "height"); // number ->widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 87, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 89, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) let nameOrVisible = getProperty(shape, cond ? "name" : "visible"); // string | boolean ->nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 88, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 90, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) setProperty(shape, "name", "rectangle"); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) setProperty(shape, cond ? "width" : "height", 10); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) setProperty(shape, cond ? "name" : "visible", true); // Technically not safe ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 85, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 87, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function f11(a: Shape[]) { ->f11 : Symbol(f11, Decl(keyofAndIndexedAccess.ts, 92, 1)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) +>f11 : Symbol(f11, Decl(keyofAndIndexedAccess.ts, 94, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let len = getProperty(a, "length"); // number ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 95, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 97, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) setProperty(a, "length", len); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 94, 13)) ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 95, 7)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 96, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 97, 7)) } function f12(t: [Shape, boolean]) { ->f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 97, 1)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>f12 : Symbol(f12, Decl(keyofAndIndexedAccess.ts, 99, 1)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let len = getProperty(t, "length"); ->len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 100, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>len : Symbol(len, Decl(keyofAndIndexedAccess.ts, 102, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) let s2 = getProperty(t, "0"); // Shape ->s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 101, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>s2 : Symbol(s2, Decl(keyofAndIndexedAccess.ts, 103, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) let b2 = getProperty(t, "1"); // boolean ->b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 102, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 99, 13)) +>b2 : Symbol(b2, Decl(keyofAndIndexedAccess.ts, 104, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 101, 13)) } function f13(foo: any, bar: any) { ->f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 103, 1)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) +>f13 : Symbol(f13, Decl(keyofAndIndexedAccess.ts, 105, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 107, 22)) let x = getProperty(foo, "x"); // any ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 106, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 108, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) let y = getProperty(foo, "100"); // any ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 107, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 109, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) let z = getProperty(foo, bar); // any ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 108, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 105, 13)) ->bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 105, 22)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 110, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 107, 13)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 107, 22)) } class Component { ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) props: PropType; ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) getProperty(key: K) { ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 113, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 113, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 115, 16)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 115, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 115, 16)) return this.props[key]; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 113, 42)) +>this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 115, 42)) } setProperty(key: K, value: PropType[K]) { ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 116, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 116, 49)) ->PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 111, 16)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 116, 16)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 118, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 118, 49)) +>PropType : Symbol(PropType, Decl(keyofAndIndexedAccess.ts, 113, 16)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 118, 16)) this.props[key] = value; ->this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) ->props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 111, 27)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 116, 42)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 116, 49)) +>this.props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>this : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) +>props : Symbol(Component.props, Decl(keyofAndIndexedAccess.ts, 113, 27)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 118, 42)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 118, 49)) } } function f20(component: Component) { ->f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 119, 1)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 109, 1)) +>f20 : Symbol(f20, Decl(keyofAndIndexedAccess.ts, 121, 1)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>Component : Symbol(Component, Decl(keyofAndIndexedAccess.ts, 111, 1)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let name = component.getProperty("name"); // string ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 122, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 124, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) let widthOrHeight = component.getProperty(cond ? "width" : "height"); // number ->widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 123, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>widthOrHeight : Symbol(widthOrHeight, Decl(keyofAndIndexedAccess.ts, 125, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) let nameOrVisible = component.getProperty(cond ? "name" : "visible"); // string | boolean ->nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 124, 7)) ->component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 112, 20)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisible : Symbol(nameOrVisible, Decl(keyofAndIndexedAccess.ts, 126, 7)) +>component.getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>getProperty : Symbol(Component.getProperty, Decl(keyofAndIndexedAccess.ts, 114, 20)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) component.setProperty("name", "rectangle"); ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) component.setProperty(cond ? "width" : "height", 10) ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) component.setProperty(cond ? "name" : "visible", true); // Technically not safe ->component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 121, 13)) ->setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 115, 5)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>component.setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>component : Symbol(component, Decl(keyofAndIndexedAccess.ts, 123, 13)) +>setProperty : Symbol(Component.setProperty, Decl(keyofAndIndexedAccess.ts, 117, 5)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function pluck(array: T[], key: K) { ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 130, 17)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 130, 37)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 130, 15)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 130, 48)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 130, 17)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 132, 17)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 132, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 132, 15)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 132, 48)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 132, 17)) return array.map(x => x[key]); >array.map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 130, 37)) +>array : Symbol(array, Decl(keyofAndIndexedAccess.ts, 132, 37)) >map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 131, 21)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 130, 48)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 133, 21)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 133, 21)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 132, 48)) } function f30(shapes: Shape[]) { ->f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 132, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>f30 : Symbol(f30, Decl(keyofAndIndexedAccess.ts, 134, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) let names = pluck(shapes, "name"); // string[] ->names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 135, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>names : Symbol(names, Decl(keyofAndIndexedAccess.ts, 137, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) let widths = pluck(shapes, "width"); // number[] ->widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 136, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) +>widths : Symbol(widths, Decl(keyofAndIndexedAccess.ts, 138, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) let nameOrVisibles = pluck(shapes, cond ? "name" : "visible"); // (string | boolean)[] ->nameOrVisibles : Symbol(nameOrVisibles, Decl(keyofAndIndexedAccess.ts, 137, 7)) ->pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 128, 1)) ->shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 134, 13)) ->cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 75, 11)) +>nameOrVisibles : Symbol(nameOrVisibles, Decl(keyofAndIndexedAccess.ts, 139, 7)) +>pluck : Symbol(pluck, Decl(keyofAndIndexedAccess.ts, 130, 1)) +>shapes : Symbol(shapes, Decl(keyofAndIndexedAccess.ts, 136, 13)) +>cond : Symbol(cond, Decl(keyofAndIndexedAccess.ts, 77, 11)) } function f31(key: K) { ->f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 138, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) +>f31 : Symbol(f31, Decl(keyofAndIndexedAccess.ts, 140, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 142, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 140, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 142, 36)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 142, 13)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 143, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 141, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 141, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 141, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 141, 61)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 143, 26)) +>width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 143, 39)) +>height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 143, 49)) +>visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 143, 61)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 141, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 140, 36)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 143, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 142, 36)) } function f32(key: K) { ->f32 : Symbol(f32, Decl(keyofAndIndexedAccess.ts, 143, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 145, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 145, 43)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 145, 13)) +>f32 : Symbol(f32, Decl(keyofAndIndexedAccess.ts, 145, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 147, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 147, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 147, 13)) const shape: Shape = { name: "foo", width: 5, height: 10, visible: true }; ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 148, 9)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 146, 26)) ->width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 146, 39)) ->height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 146, 49)) ->visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 146, 61)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 148, 26)) +>width : Symbol(width, Decl(keyofAndIndexedAccess.ts, 148, 39)) +>height : Symbol(height, Decl(keyofAndIndexedAccess.ts, 148, 49)) +>visible : Symbol(visible, Decl(keyofAndIndexedAccess.ts, 148, 61)) return shape[key]; // Shape[K] ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 146, 9)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 145, 43)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 148, 9)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 147, 43)) } function f33(shape: S, key: K) { ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 150, 1)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) >Shape : Symbol(Shape, Decl(keyofAndIndexedAccess.ts, 0, 0)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 150, 29)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) ->S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 150, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 150, 58)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 150, 29)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 152, 29)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 152, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 152, 58)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 152, 29)) let name = getProperty(shape, "name"); ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 151, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 153, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) let prop = getProperty(shape, key); ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 150, 49)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 150, 58)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 154, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>shape : Symbol(shape, Decl(keyofAndIndexedAccess.ts, 152, 49)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 152, 58)) return prop; ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 152, 7)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 154, 7)) } function f34(ts: TaggedShape) { ->f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 154, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>f34 : Symbol(f34, Decl(keyofAndIndexedAccess.ts, 156, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) >TaggedShape : Symbol(TaggedShape, Decl(keyofAndIndexedAccess.ts, 6, 1)) let tag1 = f33(ts, "tag"); ->tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 157, 7)) ->f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 148, 1)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>tag1 : Symbol(tag1, Decl(keyofAndIndexedAccess.ts, 159, 7)) +>f33 : Symbol(f33, Decl(keyofAndIndexedAccess.ts, 150, 1)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) let tag2 = getProperty(ts, "tag"); ->tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 158, 7)) ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 156, 13)) +>tag2 : Symbol(tag2, Decl(keyofAndIndexedAccess.ts, 160, 7)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>ts : Symbol(ts, Decl(keyofAndIndexedAccess.ts, 158, 13)) } class C { ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) public x: string; ->x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 161, 9)) +>x : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 163, 9)) protected y: string; ->y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 162, 21)) +>y : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 164, 21)) private z: string; ->z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 163, 24)) +>z : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 165, 24)) } // Indexed access expressions have always permitted access to private and protected members. // For consistency we also permit such access in indexed access types. function f40(c: C) { ->f40 : Symbol(f40, Decl(keyofAndIndexedAccess.ts, 165, 1)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>f40 : Symbol(f40, Decl(keyofAndIndexedAccess.ts, 167, 1)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type X = C["x"]; ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 169, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 171, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type Y = C["y"]; ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 170, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 172, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) type Z = C["z"]; ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 171, 20)) ->C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 159, 1)) +>Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 173, 20)) +>C : Symbol(C, Decl(keyofAndIndexedAccess.ts, 161, 1)) let x: X = c["x"]; ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 173, 7)) ->X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 169, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"x" : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 161, 9)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 175, 7)) +>X : Symbol(X, Decl(keyofAndIndexedAccess.ts, 171, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"x" : Symbol(C.x, Decl(keyofAndIndexedAccess.ts, 163, 9)) let y: Y = c["y"]; ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 174, 7)) ->Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 170, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"y" : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 162, 21)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 176, 7)) +>Y : Symbol(Y, Decl(keyofAndIndexedAccess.ts, 172, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"y" : Symbol(C.y, Decl(keyofAndIndexedAccess.ts, 164, 21)) let z: Z = c["z"]; ->z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 175, 7)) ->Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 171, 20)) ->c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 169, 13)) ->"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 163, 24)) +>z : Symbol(z, Decl(keyofAndIndexedAccess.ts, 177, 7)) +>Z : Symbol(Z, Decl(keyofAndIndexedAccess.ts, 173, 20)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 171, 13)) +>"z" : Symbol(C.z, Decl(keyofAndIndexedAccess.ts, 165, 24)) } function f50(k: keyof T, s: string) { ->f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 176, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 178, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 178, 27)) +>f50 : Symbol(f50, Decl(keyofAndIndexedAccess.ts, 178, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 180, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 180, 27)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 179, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 178, 27)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 178, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 181, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 180, 27)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 180, 13)) const x2 = k as string; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 180, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 178, 16)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 182, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 180, 16)) } function f51(k: K, s: string) { ->f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 181, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 183, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 183, 35)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 183, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 183, 40)) +>f51 : Symbol(f51, Decl(keyofAndIndexedAccess.ts, 183, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 185, 35)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 185, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 185, 40)) const x1 = s as keyof T; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 184, 9)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 183, 40)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 183, 13)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 186, 9)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 185, 40)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 185, 13)) const x2 = k as string; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 185, 9)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 183, 35)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 187, 9)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 185, 35)) } function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) { ->f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 186, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 188, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 188, 24)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 188, 46)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 188, 13)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 188, 58)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 188, 69)) +>f52 : Symbol(f52, Decl(keyofAndIndexedAccess.ts, 188, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 190, 24)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 46)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 190, 13)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 58)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 69)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 189, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 188, 58)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 191, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 190, 58)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 190, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 188, 69)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 192, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 190, 69)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 191, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 188, 16)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 188, 46)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 193, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 190, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 190, 46)) } function f53(obj: { [x: string]: boolean }, k: K, s: string, n: number) { ->f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 192, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 194, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 194, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 194, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 194, 43)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 194, 65)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 194, 15)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 194, 71)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 194, 82)) +>f53 : Symbol(f53, Decl(keyofAndIndexedAccess.ts, 194, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 196, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 196, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 196, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 196, 43)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 196, 65)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 196, 15)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 196, 71)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 196, 82)) const x1 = obj[s]; ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 195, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 194, 71)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 197, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 196, 71)) const x2 = obj[n]; ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 196, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 194, 82)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 198, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>n : Symbol(n, Decl(keyofAndIndexedAccess.ts, 196, 82)) const x3 = obj[k]; ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 197, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 194, 35)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 194, 65)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 199, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 196, 35)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 196, 65)) } function f54(obj: T, key: keyof T) { ->f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 198, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 200, 13)) +>f54 : Symbol(f54, Decl(keyofAndIndexedAccess.ts, 200, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 202, 13)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 201, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 203, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 203, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 200, 16)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 200, 23)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 205, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 202, 16)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 202, 23)) } function f55(obj: T, key: K) { ->f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 204, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 206, 15)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 206, 13)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 206, 15)) +>f55 : Symbol(f55, Decl(keyofAndIndexedAccess.ts, 206, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 208, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 208, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 208, 15)) for (let s in obj[key]) { ->s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 207, 12)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) +>s : Symbol(s, Decl(keyofAndIndexedAccess.ts, 209, 12)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) } const b = "foo" in obj[key]; ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 209, 9)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 206, 35)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 206, 42)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 211, 9)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 208, 35)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 208, 42)) } function f60(source: T, target: T) { ->f60 : Symbol(f60, Decl(keyofAndIndexedAccess.ts, 210, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) ->target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 212, 26)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 212, 13)) +>f60 : Symbol(f60, Decl(keyofAndIndexedAccess.ts, 212, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) +>target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 214, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 214, 13)) for (let k in source) { ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) target[k] = source[k]; ->target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 212, 26)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) ->source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 212, 16)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 213, 12)) +>target : Symbol(target, Decl(keyofAndIndexedAccess.ts, 214, 26)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) +>source : Symbol(source, Decl(keyofAndIndexedAccess.ts, 214, 16)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 215, 12)) + } +} + +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { +>f70 : Symbol(f70, Decl(keyofAndIndexedAccess.ts, 218, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) +>k1 : Symbol(k1, Decl(keyofAndIndexedAccess.ts, 220, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) +>k2 : Symbol(k2, Decl(keyofAndIndexedAccess.ts, 220, 44)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 220, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 220, 22)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 221, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 221, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 221, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 221, 38)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 222, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 222, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 222, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 222, 38)) + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 220, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 223, 10)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 223, 18)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 223, 30)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 223, 38)) +} + +function f71(func: (x: T, y: U) => Partial) { +>f71 : Symbol(f71, Decl(keyofAndIndexedAccess.ts, 224, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 226, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 226, 26)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 226, 31)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 226, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 226, 22)) + + let x = func({ a: 1, b: "hello" }, { c: true }); +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 226, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 227, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 227, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 227, 40)) + + x.a; // number | undefined +>x.a : Symbol(a) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>a : Symbol(a) + + x.b; // string | undefined +>x.b : Symbol(b) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>b : Symbol(b) + + x.c; // boolean | undefined +>x.c : Symbol(c) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 227, 7)) +>c : Symbol(c) +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f72 : Symbol(f72, Decl(keyofAndIndexedAccess.ts, 231, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 233, 55)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 233, 60)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 233, 66)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 233, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 233, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 233, 25)) + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 234, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 234, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 234, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 234, 40)) + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 235, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 235, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 235, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 235, 40)) + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 236, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 233, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 236, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 236, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 236, 40)) +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f73 : Symbol(f73, Decl(keyofAndIndexedAccess.ts, 237, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 239, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 239, 56)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 239, 62)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 239, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 239, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 239, 25)) + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 240, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 240, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 240, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 240, 40)) + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 241, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 241, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 241, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 241, 40)) + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 242, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 239, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 242, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 242, 24)) +>c : Symbol(c, Decl(keyofAndIndexedAccess.ts, 242, 40)) +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { +>f74 : Symbol(f74, Decl(keyofAndIndexedAccess.ts, 243, 1)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 245, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 245, 56)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 245, 62)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 245, 20)) +>U : Symbol(U, Decl(keyofAndIndexedAccess.ts, 245, 22)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 245, 25)) + + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 246, 24)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 246, 40)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 246, 46)) + + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 7)) +>func : Symbol(func, Decl(keyofAndIndexedAccess.ts, 245, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 247, 18)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 24)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 247, 40)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 247, 46)) +} + +function f80(obj: T) { +>f80 : Symbol(f80, Decl(keyofAndIndexedAccess.ts, 248, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) + + let a1 = obj.a; // { x: any } +>a1 : Symbol(a1, Decl(keyofAndIndexedAccess.ts, 251, 7)) +>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) + + let a2 = obj['a']; // { x: any } +>a2 : Symbol(a2, Decl(keyofAndIndexedAccess.ts, 252, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) + + let a3 = obj['a'] as T['a']; // T["a"] +>a3 : Symbol(a3, Decl(keyofAndIndexedAccess.ts, 253, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) + + let x1 = obj.a.x; // any +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 254, 7)) +>obj.a.x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>obj.a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) + + let x2 = obj['a']['x']; // any +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 255, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) + + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 256, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 250, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 250, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 250, 29)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 250, 13)) +} + +function f81(obj: T) { +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) + + return obj['a']['x'] as T['a']['x']; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 259, 42)) +>'a' : Symbol(a, Decl(keyofAndIndexedAccess.ts, 259, 24)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 259, 29)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 259, 13)) +} + +function f82() { +>f82 : Symbol(f82, Decl(keyofAndIndexedAccess.ts, 261, 1)) + + let x1 = f81({ a: { x: "hello" } }); // string +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 264, 7)) +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 264, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 264, 23)) + + let x2 = f81({ a: { x: 42 } }); // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 265, 7)) +>f81 : Symbol(f81, Decl(keyofAndIndexedAccess.ts, 257, 1)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 265, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 265, 23)) +} + +function f83(obj: T, key: K) { +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 26)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) + + return obj[key]['x'] as T[K]['x']; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 268, 71)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 268, 78)) +>'x' : Symbol(x, Decl(keyofAndIndexedAccess.ts, 268, 39)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 268, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 268, 51)) +} + +function f84() { +>f84 : Symbol(f84, Decl(keyofAndIndexedAccess.ts, 270, 1)) + + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 273, 7)) +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>foo : Symbol(foo, Decl(keyofAndIndexedAccess.ts, 273, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 273, 25)) + + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 274, 7)) +>f83 : Symbol(f83, Decl(keyofAndIndexedAccess.ts, 266, 1)) +>bar : Symbol(bar, Decl(keyofAndIndexedAccess.ts, 274, 18)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 274, 25)) +} + +class C1 { +>C1 : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) + + x: number; +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + get(key: K) { +>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 279, 8)) + + return this[key]; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 279, 30)) + } + set(key: K, value: this[K]) { +>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 282, 8)) + + this[key] = value; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 282, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 282, 37)) + } + foo() { +>foo : Symbol(C1.foo, Decl(keyofAndIndexedAccess.ts, 284, 5)) + + let x1 = this.x; // number +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 286, 11)) +>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + let x2 = this["x"]; // number +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 287, 11)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + let x3 = this.get("x"); // this["x"] +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 288, 11)) +>this.get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>get : Symbol(C1.get, Decl(keyofAndIndexedAccess.ts, 278, 14)) + + let x4 = getProperty(this, "x"); // this["x"] +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 289, 11)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) + + this.x = 42; +>this.x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>x : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + this["x"] = 42; +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>"x" : Symbol(C1.x, Decl(keyofAndIndexedAccess.ts, 277, 10)) + + this.set("x", 42); +>this.set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) +>set : Symbol(C1.set, Decl(keyofAndIndexedAccess.ts, 281, 5)) + + setProperty(this, "x", 42); +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>this : Symbol(C1, Decl(keyofAndIndexedAccess.ts, 275, 1)) } } // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 221, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 221, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 221, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 221, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 224, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 224, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 224, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 224, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 224, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 229, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 308, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 231, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 216, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 223, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 231, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 234, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 313, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 227, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 220, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 240, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 319, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) setProperty(this, "parts", parts); ->setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 79, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 242, 16)) +>setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 244, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 323, 5)) return getProperty(this, "parts") ->getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 75, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 238, 1)) +>getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) } } + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 331, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 331, 44)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) + +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 332, 61)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 332, 68)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 332, 78)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) + +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 333, 89)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 333, 96)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 333, 106)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 333, 116)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) + +function path(obj: any, ...keys: (string | number)[]): any; +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 334, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 334, 23)) + +function path(obj: any, ...keys: (string | number)[]): any { +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) + + let result = obj; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) + + for (let k of keys) { +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) + + result = result[k]; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) + } + return result; +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +} + +type Thing = { +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) + + a: { x: number, y: string }, +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 343, 14)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 344, 8)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 344, 19)) + + b: boolean +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 344, 32)) + +}; + + +function f1(thing: Thing) { +>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 346, 2)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) + + let x1 = path(thing, 'a'); // { x: number, y: string } +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 350, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x2 = path(thing, 'a', 'y'); // string +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 351, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x3 = path(thing, 'b'); // boolean +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 352, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) + + let x4 = path(thing, ...['a', 'x']); // any +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 353, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => +>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 358, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) + + (value: T[K1][K2]) => object[key1][key2] = value; +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 363, 24)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 363, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) + +var empty = one(() => {}) // inferred as {}, expected +>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 364, 3)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 366, 38)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) + +declare function on(handlerHash: Handlers): T +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) +>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 367, 23)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) + +var hashOfEmpty1 = on({ test: () => {} }); // {} +>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 368, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 368, 23)) + +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } +>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 369, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 369, 23)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 369, 31)) + +// Repro from #12624 + +interface Options1 { +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) + + data?: Data +>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 373, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) + + computed?: Computed; +>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 374, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) +} + +declare class Component1 { +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) + + constructor(options: Options1); +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 379, 16)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) + + get(key: K): (Data & Computed)[K]; +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 380, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +} + +let c1 = new Component1({ +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) + + data: { +>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 383, 25)) + + hello: "" +>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 384, 11)) + } +}); + +c1.get("hello"); +>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) + +// Repro from #12625 + +interface Options2 { +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) + + data?: Data +>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 393, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) + + computed?: Computed; +>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 394, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) +} + +declare class Component2 { +>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 396, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) + + constructor(options: Options2); +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 399, 16)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) + + get(key: K): (Data & Computed)[K]; +>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 399, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 400, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +} + +// Repro from #12641 + +interface R { +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) + + p: number; +>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 405, 13)) +} + +function f(p: K) { +>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 407, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) + + let a: any; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) + + a[p].add; // any +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) +} + +// Repro from #12651 + +type MethodDescriptor = { +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) + + name: string; +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 416, 25)) + + args: any[]; +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 417, 14)) + + returnValue: any; +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 418, 13)) +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 422, 60)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 422, 76)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) + +type SomeMethodDescriptor = { +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) + + name: "someMethod"; +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 424, 29)) + + args: [string, number]; +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 425, 20)) + + returnValue: string[]; +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 426, 24)) +} + +let result = dispatchMethod("someMethod", ["hello", 35]); +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 430, 3)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) + diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 916b82aaf40..f94249806f6 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -47,16 +47,22 @@ type Dictionary = { [x: string]: T }; >x : string >T : T +type NumericallyIndexed = { [x: number]: T }; +>NumericallyIndexed : NumericallyIndexed +>T : T +>x : number +>T : T + const enum E { A, B, C } >E : E >A : E.A >B : E.B >C : E.C -type K00 = keyof any; // string | number +type K00 = keyof any; // string >K00 : string -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K01 = keyof string; // "toString" | "charAt" | ... >K01 : "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | "valueOf" type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... @@ -82,11 +88,11 @@ type K10 = keyof Shape; // "name" | "width" | "height" | "visible" >K10 : "name" | "width" | "height" | "visible" >Shape : Shape -type K11 = keyof Shape[]; // number | "length" | "toString" | ... +type K11 = keyof Shape[]; // "length" | "toString" | ... >K11 : "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" >Shape : Shape -type K12 = keyof Dictionary; // string | number +type K12 = keyof Dictionary; // string >K12 : string >Dictionary : Dictionary >Shape : Shape @@ -102,7 +108,7 @@ type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... >K15 : "toString" | "toLocaleString" | "valueOf" | "toFixed" | "toExponential" | "toPrecision" >E : E -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... >K16 : "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" type K17 = keyof (Shape | Item); // "name" @@ -115,6 +121,11 @@ type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | " >Shape : Shape >Item : Item +type K19 = keyof NumericallyIndexed // never +>K19 : never +>NumericallyIndexed : NumericallyIndexed +>Shape : Shape + type KeyOf = keyof T; >KeyOf : keyof T >T : T @@ -125,7 +136,7 @@ type K20 = KeyOf; // "name" | "width" | "height" | "visible" >KeyOf : keyof T >Shape : Shape -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string >K21 : string >KeyOf : keyof T >Dictionary : Dictionary @@ -615,8 +626,8 @@ function f33(shape: S, key: K) { >K : K let name = getProperty(shape, "name"); ->name : string ->getProperty(shape, "name") : string +>name : S["name"] +>getProperty(shape, "name") : S["name"] >getProperty : (obj: T, key: K) => T[K] >shape : S >"name" : "name" @@ -769,8 +780,8 @@ function f52(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) >n : number const x3 = obj[k]; ->x3 : boolean ->obj[k] : boolean +>x3 : { [x: string]: boolean; }[keyof T] +>obj[k] : { [x: string]: boolean; }[keyof T] >obj : { [x: string]: boolean; } >k : keyof T } @@ -815,7 +826,7 @@ function f54(obj: T, key: keyof T) { >T : T for (let s in obj[key]) { ->s : string +>s : keyof T[keyof T] >obj[key] : T[keyof T] >obj : T >key : keyof T @@ -840,7 +851,7 @@ function f55(obj: T, key: K) { >K : K for (let s in obj[key]) { ->s : string +>s : keyof T[K] >obj[key] : T[K] >obj : T >key : K @@ -877,6 +888,503 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { +>f70 : (func: (k1: keyof (T | U), k2: keyof (T & U)) => void) => void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>T : T +>U : U +>k1 : keyof (T | U) +>T : T +>U : U +>k2 : keyof (T & U) +>T : T +>U : U + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'a') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'a' : "a" + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'b') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'b' : "b" + + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +>func<{ a: any, b: any }, { a: any, c: any }>('a', 'c') : void +>func : (k1: keyof (T | U), k2: keyof (T & U)) => void +>a : any +>b : any +>a : any +>c : any +>'a' : "a" +>'c' : "c" +} + +function f71(func: (x: T, y: U) => Partial) { +>f71 : (func: (x: T, y: U) => Partial) => void +>func : (x: T, y: U) => Partial +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>Partial : Partial +>T : T +>U : U + + let x = func({ a: 1, b: "hello" }, { c: true }); +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>func({ a: 1, b: "hello" }, { c: true }) : Partial<{ a: number; b: string; } & { c: boolean; }> +>func : (x: T, y: U) => Partial +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true + + x.a; // number | undefined +>x.a : number | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>a : number | undefined + + x.b; // string | undefined +>x.b : string | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>b : string | undefined + + x.c; // boolean | undefined +>x.c : boolean | undefined +>x : Partial<{ a: number; b: string; } & { c: boolean; }> +>c : boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f72 : (func: (x: T, y: U, k: K) => (T & U)[K]) => void +>func : (x: T, y: U, k: K) => (T & U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { c: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : string +>func({ a: 1, b: "hello" }, { c: true }, 'b') : string +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'b' : "b" + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : boolean +>func({ a: 1, b: "hello" }, { c: true }, 'c') : boolean +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'c' : "c" +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { +>f73 : (func: (x: T, y: U, k: K) => (T & U)[K]) => void +>func : (x: T, y: U, k: K) => (T & U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { c: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string +>b : string +>func({ a: 1, b: "hello" }, { c: true }, 'b') : string +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'b' : "b" + + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +>c : boolean +>func({ a: 1, b: "hello" }, { c: true }, 'c') : boolean +>func : (x: T, y: U, k: K) => (T & U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ c: true } : { c: true; } +>c : boolean +>true : true +>'c' : "c" +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { +>f74 : (func: (x: T, y: U, k: K) => (T | U)[K]) => void +>func : (x: T, y: U, k: K) => (T | U)[K] +>T : T +>U : U +>K : K +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>k : K +>K : K +>T : T +>U : U +>K : K + + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number +>a : number +>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a') : number +>func : (x: T, y: U, k: K) => (T | U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ a: 2, b: true } : { a: number; b: true; } +>a : number +>2 : 2 +>b : boolean +>true : true +>'a' : "a" + + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +>b : string | boolean +>func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b') : string | boolean +>func : (x: T, y: U, k: K) => (T | U)[K] +>{ a: 1, b: "hello" } : { a: number; b: string; } +>a : number +>1 : 1 +>b : string +>"hello" : "hello" +>{ a: 2, b: true } : { a: number; b: true; } +>a : number +>2 : 2 +>b : boolean +>true : true +>'b' : "b" +} + +function f80(obj: T) { +>f80 : (obj: T) => void +>T : T +>a : { x: any; } +>x : any +>obj : T +>T : T + + let a1 = obj.a; // { x: any } +>a1 : { x: any; } +>obj.a : { x: any; } +>obj : T +>a : { x: any; } + + let a2 = obj['a']; // { x: any } +>a2 : { x: any; } +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" + + let a3 = obj['a'] as T['a']; // T["a"] +>a3 : T["a"] +>obj['a'] as T['a'] : T["a"] +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>T : T + + let x1 = obj.a.x; // any +>x1 : any +>obj.a.x : any +>obj.a : { x: any; } +>obj : T +>a : { x: any; } +>x : any + + let x2 = obj['a']['x']; // any +>x2 : any +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" + + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +>x3 : T["a"]["x"] +>obj['a']['x'] as T['a']['x'] : T["a"]["x"] +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" +>T : T +} + +function f81(obj: T) { +>f81 : (obj: T) => T["a"]["x"] +>T : T +>a : { x: any; } +>x : any +>obj : T +>T : T + + return obj['a']['x'] as T['a']['x']; +>obj['a']['x'] as T['a']['x'] : T["a"]["x"] +>obj['a']['x'] : any +>obj['a'] : { x: any; } +>obj : T +>'a' : "a" +>'x' : "x" +>T : T +} + +function f82() { +>f82 : () => void + + let x1 = f81({ a: { x: "hello" } }); // string +>x1 : string +>f81({ a: { x: "hello" } }) : string +>f81 : (obj: T) => T["a"]["x"] +>{ a: { x: "hello" } } : { a: { x: string; }; } +>a : { x: string; } +>{ x: "hello" } : { x: string; } +>x : string +>"hello" : "hello" + + let x2 = f81({ a: { x: 42 } }); // number +>x2 : number +>f81({ a: { x: 42 } }) : number +>f81 : (obj: T) => T["a"]["x"] +>{ a: { x: 42 } } : { a: { x: number; }; } +>a : { x: number; } +>{ x: 42 } : { x: number; } +>x : number +>42 : 42 +} + +function f83(obj: T, key: K) { +>f83 : (obj: T, key: K) => T[K]["x"] +>T : T +>x : string +>x : any +>K : K +>T : T +>obj : T +>T : T +>key : K +>K : K + + return obj[key]['x'] as T[K]['x']; +>obj[key]['x'] as T[K]['x'] : T[K]["x"] +>obj[key]['x'] : any +>obj[key] : T[K] +>obj : T +>key : K +>'x' : "x" +>T : T +>K : K +} + +function f84() { +>f84 : () => void + + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string +>x1 : string +>f83({ foo: { x: "hello" } }, "foo") : string +>f83 : (obj: T, key: K) => T[K]["x"] +>{ foo: { x: "hello" } } : { foo: { x: string; }; } +>foo : { x: string; } +>{ x: "hello" } : { x: string; } +>x : string +>"hello" : "hello" +>"foo" : "foo" + + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +>x2 : number +>f83({ bar: { x: 42 } }, "bar") : number +>f83 : (obj: T, key: K) => T[K]["x"] +>{ bar: { x: 42 } } : { bar: { x: number; }; } +>bar : { x: number; } +>{ x: 42 } : { x: number; } +>x : number +>42 : 42 +>"bar" : "bar" +} + +class C1 { +>C1 : C1 + + x: number; +>x : number + + get(key: K) { +>get : (key: K) => this[K] +>K : K +>key : K +>K : K + + return this[key]; +>this[key] : this[K] +>this : this +>key : K + } + set(key: K, value: this[K]) { +>set : (key: K, value: this[K]) => void +>K : K +>key : K +>K : K +>value : this[K] +>K : K + + this[key] = value; +>this[key] = value : this[K] +>this[key] : this[K] +>this : this +>key : K +>value : this[K] + } + foo() { +>foo : () => void + + let x1 = this.x; // number +>x1 : number +>this.x : number +>this : this +>x : number + + let x2 = this["x"]; // number +>x2 : number +>this["x"] : number +>this : this +>"x" : "x" + + let x3 = this.get("x"); // this["x"] +>x3 : this["x"] +>this.get("x") : this["x"] +>this.get : (key: K) => this[K] +>this : this +>get : (key: K) => this[K] +>"x" : "x" + + let x4 = getProperty(this, "x"); // this["x"] +>x4 : this["x"] +>getProperty(this, "x") : this["x"] +>getProperty : (obj: T, key: K) => T[K] +>this : this +>"x" : "x" + + this.x = 42; +>this.x = 42 : 42 +>this.x : number +>this : this +>x : number +>42 : 42 + + this["x"] = 42; +>this["x"] = 42 : 42 +>this["x"] : number +>this : this +>"x" : "x" +>42 : 42 + + this.set("x", 42); +>this.set("x", 42) : void +>this.set : (key: K, value: this[K]) => void +>this : this +>set : (key: K, value: this[K]) => void +>"x" : "x" +>42 : 42 + + setProperty(this, "x", 42); +>setProperty(this, "x", 42) : void +>setProperty : (obj: T, key: K, value: T[K]) => void +>this : this +>"x" : "x" +>42 : 42 + } +} + // Repros from #12011 class Base { @@ -933,10 +1441,10 @@ class Person extends Base { >parts : number } getParts() { ->getParts : () => number +>getParts : () => this["parts"] return this.get("parts") ->this.get("parts") : number +>this.get("parts") : this["parts"] >this.get : (prop: K) => this[K] >this : this >get : (prop: K) => this[K] @@ -961,12 +1469,409 @@ class OtherPerson { >parts : number } getParts() { ->getParts : () => number +>getParts : () => this["parts"] return getProperty(this, "parts") ->getProperty(this, "parts") : number +>getProperty(this, "parts") : this["parts"] >getProperty : (obj: T, key: K) => T[K] >this : this >"parts" : "parts" } } + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>T : T +>K1 : K1 + +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 +>T : T +>K1 : K1 +>K2 : K2 + +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>K3 : K3 +>T : T +>K1 : K1 +>K2 : K2 +>obj : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 +>key3 : K3 +>K3 : K3 +>T : T +>K1 : K1 +>K2 : K2 +>K3 : K3 + +function path(obj: any, ...keys: (string | number)[]): any; +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>obj : any +>keys : (string | number)[] + +function path(obj: any, ...keys: (string | number)[]): any { +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>obj : any +>keys : (string | number)[] + + let result = obj; +>result : any +>obj : any + + for (let k of keys) { +>k : string | number +>keys : (string | number)[] + + result = result[k]; +>result = result[k] : any +>result : any +>result[k] : any +>result : any +>k : string | number + } + return result; +>result : any +} + +type Thing = { +>Thing : Thing + + a: { x: number, y: string }, +>a : { x: number; y: string; } +>x : number +>y : string + + b: boolean +>b : boolean + +}; + + +function f1(thing: Thing) { +>f1 : (thing: Thing) => void +>thing : Thing +>Thing : Thing + + let x1 = path(thing, 'a'); // { x: number, y: string } +>x1 : { x: number; y: string; } +>path(thing, 'a') : { x: number; y: string; } +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'a' : "a" + + let x2 = path(thing, 'a', 'y'); // string +>x2 : string +>path(thing, 'a', 'y') : string +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'a' : "a" +>'y' : "y" + + let x3 = path(thing, 'b'); // boolean +>x3 : boolean +>path(thing, 'b') : boolean +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>'b' : "b" + + let x4 = path(thing, ...['a', 'x']); // any +>x4 : any +>path(thing, ...['a', 'x']) : any +>path : { (obj: T, key1: K1): T[K1]; (obj: T, key1: K1, key2: K2): T[K1][K2]; (obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; (obj: any, ...keys: (string | number)[]): any; } +>thing : Thing +>...['a', 'x'] : string +>['a', 'x'] : string[] +>'a' : "a" +>'x' : "x" +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => +>assignTo2 : (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2] +>(object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => object[key1][key2] = value : (object: T, key1: K1, key2: K2) => (value: T[K1][K2]) => T[K1][K2] +>T : T +>K1 : K1 +>T : T +>K2 : K2 +>T : T +>K1 : K1 +>object : T +>T : T +>key1 : K1 +>K1 : K1 +>key2 : K2 +>K2 : K2 + + (value: T[K1][K2]) => object[key1][key2] = value; +>(value: T[K1][K2]) => object[key1][key2] = value : (value: T[K1][K2]) => T[K1][K2] +>value : T[K1][K2] +>T : T +>K1 : K1 +>K2 : K2 +>object[key1][key2] = value : T[K1][K2] +>object[key1][key2] : T[K1][K2] +>object[key1] : T[K1] +>object : T +>key1 : K1 +>key2 : K2 +>value : T[K1][K2] + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +>one : (handler: (t: T) => void) => T +>T : T +>handler : (t: T) => void +>t : T +>T : T +>T : T + +var empty = one(() => {}) // inferred as {}, expected +>empty : {} +>one(() => {}) : {} +>one : (handler: (t: T) => void) => T +>() => {} : () => void + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +>Handlers : Handlers +>T : T +>K : K +>T : T +>t : T[K] +>T : T +>K : K + +declare function on(handlerHash: Handlers): T +>on : (handlerHash: Handlers) => T +>T : T +>handlerHash : Handlers +>Handlers : Handlers +>T : T +>T : T + +var hashOfEmpty1 = on({ test: () => {} }); // {} +>hashOfEmpty1 : {} +>on({ test: () => {} }) : {} +>on : (handlerHash: Handlers) => T +>{ test: () => {} } : { test: () => void; } +>test : () => void +>() => {} : () => void + +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } +>hashOfEmpty2 : { test: boolean; } +>on({ test: (x: boolean) => {} }) : { test: boolean; } +>on : (handlerHash: Handlers) => T +>{ test: (x: boolean) => {} } : { test: (x: boolean) => void; } +>test : (x: boolean) => void +>(x: boolean) => {} : (x: boolean) => void +>x : boolean + +// Repro from #12624 + +interface Options1 { +>Options1 : Options1 +>Data : Data +>Computed : Computed + + data?: Data +>data : Data | undefined +>Data : Data + + computed?: Computed; +>computed : Computed | undefined +>Computed : Computed +} + +declare class Component1 { +>Component1 : Component1 +>Data : Data +>Computed : Computed + + constructor(options: Options1); +>options : Options1 +>Options1 : Options1 +>Data : Data +>Computed : Computed + + get(key: K): (Data & Computed)[K]; +>get : (key: K) => (Data & Computed)[K] +>K : K +>Data : Data +>Computed : Computed +>key : K +>K : K +>Data : Data +>Computed : Computed +>K : K +} + +let c1 = new Component1({ +>c1 : Component1<{ hello: string; }, {}> +>new Component1({ data: { hello: "" }}) : Component1<{ hello: string; }, {}> +>Component1 : typeof Component1 +>{ data: { hello: "" }} : { data: { hello: string; }; } + + data: { +>data : { hello: string; } +>{ hello: "" } : { hello: string; } + + hello: "" +>hello : string +>"" : "" + } +}); + +c1.get("hello"); +>c1.get("hello") : string +>c1.get : (key: K) => ({ hello: string; } & {})[K] +>c1 : Component1<{ hello: string; }, {}> +>get : (key: K) => ({ hello: string; } & {})[K] +>"hello" : "hello" + +// Repro from #12625 + +interface Options2 { +>Options2 : Options2 +>Data : Data +>Computed : Computed + + data?: Data +>data : Data | undefined +>Data : Data + + computed?: Computed; +>computed : Computed | undefined +>Computed : Computed +} + +declare class Component2 { +>Component2 : Component2 +>Data : Data +>Computed : Computed + + constructor(options: Options2); +>options : Options2 +>Options2 : Options2 +>Data : Data +>Computed : Computed + + get(key: K): (Data & Computed)[K]; +>get : (key: K) => (Data & Computed)[K] +>K : K +>Data : Data +>Computed : Computed +>key : K +>K : K +>Data : Data +>Computed : Computed +>K : K +} + +// Repro from #12641 + +interface R { +>R : R + + p: number; +>p : number +} + +function f(p: K) { +>f : (p: K) => void +>K : K +>R : R +>p : K +>K : K + + let a: any; +>a : any + + a[p].add; // any +>a[p].add : any +>a[p] : any +>a : any +>p : K +>add : any +} + +// Repro from #12651 + +type MethodDescriptor = { +>MethodDescriptor : MethodDescriptor + + name: string; +>name : string + + args: any[]; +>args : any[] + + returnValue: any; +>returnValue : any +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; +>dispatchMethod : (name: M["name"], args: M["args"]) => M["returnValue"] +>M : M +>MethodDescriptor : MethodDescriptor +>name : M["name"] +>M : M +>args : M["args"] +>M : M +>M : M + +type SomeMethodDescriptor = { +>SomeMethodDescriptor : SomeMethodDescriptor + + name: "someMethod"; +>name : "someMethod" + + args: [string, number]; +>args : [string, number] + + returnValue: string[]; +>returnValue : string[] +} + +let result = dispatchMethod("someMethod", ["hello", 35]); +>result : string[] +>dispatchMethod("someMethod", ["hello", 35]) : string[] +>dispatchMethod : (name: M["name"], args: M["args"]) => M["returnValue"] +>SomeMethodDescriptor : SomeMethodDescriptor +>"someMethod" : "someMethod" +>["hello", 35] : [string, number] +>"hello" : "hello" +>35 : 35 + diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 23b79c16627..1e88e2abc43 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -21,9 +21,14 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(64,33): error tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(66,24): error TS2345: Argument of type '"size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(67,24): error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. Type '"size"' is not assignable to type '"name" | "width" | "height" | "visible"'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(72,5): error TS2536: Type 'keyof (T & U)' cannot be used to index type 'T | U'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(76,5): error TS2322: Type 'T | U' is not assignable to type 'T & U'. + Type 'T' is not assignable to type 'T & U'. + Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(77,5): error TS2322: Type 'keyof (T & U)' is not assignable to type 'keyof (T | U)'. -==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (21 errors) ==== +==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (24 errors) ==== class Shape { name: string; width: number; @@ -135,4 +140,23 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(67,24): error ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '"name" | "size"' is not assignable to parameter of type '"name" | "width" | "height" | "visible"'. !!! error TS2345: Type '"size"' is not assignable to type '"name" | "width" | "height" | "visible"'. + } + + function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + ~~~~~~ +!!! error TS2536: Type 'keyof (T & U)' cannot be used to index type 'T | U'. + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + ~~ +!!! error TS2322: Type 'T | U' is not assignable to type 'T & U'. +!!! error TS2322: Type 'T' is not assignable to type 'T & U'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. + k1 = k2; // Error + ~~ +!!! error TS2322: Type 'keyof (T & U)' is not assignable to type 'keyof (T | U)'. + k2 = k1; } \ No newline at end of file diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.js b/tests/baselines/reference/keyofAndIndexedAccessErrors.js index 145d8e3f148..556aca12971 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.js +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.js @@ -66,6 +66,17 @@ function f10(shape: Shape) { setProperty(shape, "name", "rectangle"); setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error +} + +function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; } //// [keyofAndIndexedAccessErrors.js] @@ -88,3 +99,13 @@ function f10(shape) { setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error } +function f20(k1, k2, o1, o2) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; +} diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt new file mode 100644 index 00000000000..c19a13209c9 --- /dev/null +++ b/tests/baselines/reference/keyofIsLiteralContexualType.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/keyofIsLiteralContexualType.ts(5,9): error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'. + Type '"a" | "b" | "c"' is not assignable to type 'keyof T'. + Type '"c"' is not assignable to type 'keyof T'. + Type '"c"' is not assignable to type '"a" | "b"'. +tests/cases/compiler/keyofIsLiteralContexualType.ts(13,11): error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. + + +==== tests/cases/compiler/keyofIsLiteralContexualType.ts (2 errors) ==== + // keyof T is a literal contextual type + + function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; + ~ +!!! error TS2322: Type '("a" | "b" | "c")[]' is not assignable to type 'keyof T[]'. +!!! error TS2322: Type '"a" | "b" | "c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"c"' is not assignable to type 'keyof T'. +!!! error TS2322: Type '"c"' is not assignable to type '"a" | "b"'. + } + + // Repro from #12455 + + declare function pick(obj: T, propNames: K[]): Pick; + + let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); + let b = x.b; // Error + ~ +!!! error TS2339: Property 'b' does not exist on type 'Pick<{ a: number; b: number; c: number; }, "a" | "c">'. \ No newline at end of file diff --git a/tests/baselines/reference/keyofIsLiteralContexualType.js b/tests/baselines/reference/keyofIsLiteralContexualType.js new file mode 100644 index 00000000000..5325b976174 --- /dev/null +++ b/tests/baselines/reference/keyofIsLiteralContexualType.js @@ -0,0 +1,23 @@ +//// [keyofIsLiteralContexualType.ts] +// keyof T is a literal contextual type + +function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; +} + +// Repro from #12455 + +declare function pick(obj: T, propNames: K[]): Pick; + +let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +let b = x.b; // Error + +//// [keyofIsLiteralContexualType.js] +// keyof T is a literal contextual type +function foo() { + var a = ["a", "b"]; + var b = ["a", "b", "c"]; +} +var x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +var b = x.b; // Error diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index b3cba7eb54d..17c77fa50a0 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -16,13 +16,29 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(38,24): error TS2344: T Type 'T' is not assignable to type '"visible"'. Type 'string | number' is not assignable to type '"visible"'. Type 'string' is not assignable to type '"visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(62,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(62,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(76,45): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. + Property 'y' is missing in type '{ x: number; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(78,59): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. + Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(84,58): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'. + Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(106,15): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. + Types of property 'a' are incompatible. + Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(107,17): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. + Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(124,12): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. + Types of property 'a' are incompatible. + Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(125,14): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. + Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. -==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (14 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (21 errors) ==== interface Shape { name: string; @@ -112,13 +128,13 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Su var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. var x: { readonly [P in keyof T]: T[P] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. var x: { readonly [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. } function f12() { @@ -126,4 +142,85 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Su var x: { [P in keyof T]: T[P][] }; // Error ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. - } \ No newline at end of file + } + + // Check that inferences to mapped types are secondary + + declare function objAndReadonly(primary: T, secondary: Readonly): T; + declare function objAndPartial(primary: T, secondary: Partial): T; + + function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + ~~~~~~~~ +!!! error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. +!!! error TS2345: Property 'y' is missing in type '{ x: number; }'. + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error + ~~~~ +!!! error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. +!!! error TS2345: Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'. + } + + function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error + ~~~~ +!!! error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'. +!!! error TS2345: Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'. + } + + // Verify use of Pick for setState functions (#12793) + + interface Foo { + a: string; + b?: number; + } + + function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } + } + + let foo: Foo = { a: "hello", b: 42 }; + setState(foo, { a: "test", b: 43 }) + setState(foo, { a: "hi" }); + setState(foo, { b: undefined }); + setState(foo, { }); + setState(foo, foo); + setState(foo, { a: undefined }); // Error + ~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Types of property 'a' are incompatible. +!!! error TS2345: Type 'undefined' is not assignable to type 'string'. + setState(foo, { c: true }); // Error + ~~~~~~~ +!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. + + class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } + } + + let c = new C(); + c.setState({ a: "test", b: 43 }); + c.setState({ a: "hi" }); + c.setState({ b: undefined }); + c.setState({ }); + c.setState(foo); + c.setState({ a: undefined }); // Error + ~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Types of property 'a' are incompatible. +!!! error TS2345: Type 'undefined' is not assignable to type 'string'. + c.setState({ c: true }); // Error + ~~~~~~~ +!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick'. +!!! error TS2345: Object literal may only specify known properties, and 'c' does not exist in type 'Pick'. + \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.js b/tests/baselines/reference/mappedTypeErrors.js index cb840da32f7..e1b458565bb 100644 --- a/tests/baselines/reference/mappedTypeErrors.js +++ b/tests/baselines/reference/mappedTypeErrors.js @@ -66,7 +66,65 @@ function f11() { function f12() { var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]: T[P][] }; // Error -} +} + +// Check that inferences to mapped types are secondary + +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; + +function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +// Verify use of Pick for setState functions (#12793) + +interface Foo { + a: string; + b?: number; +} + +function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } +} + +let foo: Foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }) +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, { }); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error + +class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } +} + +let c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({ }); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error + //// [mappedTypeErrors.js] function f1(x) { @@ -97,6 +155,47 @@ function f12() { var x; var x; // Error } +function f20() { + var x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + var x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + var x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} +function f21() { + var x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + var x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + var x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} +function setState(obj, props) { + for (var k in props) { + obj[k] = props[k]; + } +} +var foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }); +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, {}); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error +var C = (function () { + function C() { + } + C.prototype.setState = function (props) { + for (var k in props) { + this.state[k] = props[k]; + } + }; + return C; +}()); +var c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({}); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error //// [mappedTypeErrors.d.ts] @@ -137,3 +236,18 @@ declare function f4(x: T): void; declare function f10(): void; declare function f11(): void; declare function f12(): void; +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; +declare function f20(): void; +declare function f21(): void; +interface Foo { + a: string; + b?: number; +} +declare function setState(obj: T, props: Pick): void; +declare let foo: Foo; +declare class C { + state: T; + setState(props: Pick): void; +} +declare let c: C; diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.js b/tests/baselines/reference/mappedTypeInferenceCircularity.js new file mode 100644 index 00000000000..d5918d342f6 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.js @@ -0,0 +1,12 @@ +//// [mappedTypeInferenceCircularity.ts] +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +type Block

= (func: HTML) => {}; + +declare var h: HTML; +h.div(h); + +//// [mappedTypeInferenceCircularity.js] +// Repro from #12511 +h.div(h); diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.symbols b/tests/baselines/reference/mappedTypeInferenceCircularity.symbols new file mode 100644 index 00000000000..33dceb5cd76 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/mappedTypeInferenceCircularity.ts === +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) +>K : Symbol(K, Decl(mappedTypeInferenceCircularity.ts, 2, 15)) +>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +type Block

= (func: HTML) => {}; +>Block : Symbol(Block, Decl(mappedTypeInferenceCircularity.ts, 2, 42)) +>P : Symbol(P, Decl(mappedTypeInferenceCircularity.ts, 3, 11)) +>T : Symbol(T, Decl(mappedTypeInferenceCircularity.ts, 3, 17)) +>func : Symbol(func, Decl(mappedTypeInferenceCircularity.ts, 3, 20)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +declare var h: HTML; +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) +>HTML : Symbol(HTML, Decl(mappedTypeInferenceCircularity.ts, 0, 0)) + +h.div(h); +>h.div : Symbol(div) +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) +>div : Symbol(div) +>h : Symbol(h, Decl(mappedTypeInferenceCircularity.ts, 5, 11)) + diff --git a/tests/baselines/reference/mappedTypeInferenceCircularity.types b/tests/baselines/reference/mappedTypeInferenceCircularity.types new file mode 100644 index 00000000000..451da474756 --- /dev/null +++ b/tests/baselines/reference/mappedTypeInferenceCircularity.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/mappedTypeInferenceCircularity.ts === +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +>HTML : HTML +>K : K +>Block : Block

+>HTML : HTML + +type Block

= (func: HTML) => {}; +>Block : Block

; + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/keyofIsLiteralContexualType.ts b/tests/cases/compiler/keyofIsLiteralContexualType.ts new file mode 100644 index 00000000000..dd14de92289 --- /dev/null +++ b/tests/cases/compiler/keyofIsLiteralContexualType.ts @@ -0,0 +1,13 @@ +// keyof T is a literal contextual type + +function foo() { + let a: (keyof T)[] = ["a", "b"]; + let b: (keyof T)[] = ["a", "b", "c"]; +} + +// Repro from #12455 + +declare function pick(obj: T, propNames: K[]): Pick; + +let x = pick({ a: 10, b: 20, c: 30 }, ["a", "c"]); +let b = x.b; // Error \ No newline at end of file diff --git a/tests/cases/compiler/mappedTypeInferenceCircularity.ts b/tests/cases/compiler/mappedTypeInferenceCircularity.ts new file mode 100644 index 00000000000..56fe08c5fe2 --- /dev/null +++ b/tests/cases/compiler/mappedTypeInferenceCircularity.ts @@ -0,0 +1,7 @@ +// Repro from #12511 + +type HTML = { [K in 'div']: Block }; +type Block
{`${someBoolean}${someString}`}); + +goTo.marker("1"); +verify.quickInfoExists(); diff --git a/tests/cases/fourslash/server/completions01.ts b/tests/cases/fourslash/server/completions01.ts index a837a74849d..38fdbab4eda 100644 --- a/tests/cases/fourslash/server/completions01.ts +++ b/tests/cases/fourslash/server/completions01.ts @@ -6,11 +6,11 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear goTo.marker('2'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); diff --git a/tests/cases/fourslash/server/jsdocTypedefTag.ts b/tests/cases/fourslash/server/jsdocTypedefTag.ts index 968e30a412d..9e980114835 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTag.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTag.ts @@ -52,37 +52,37 @@ //// d.dogAge./*dogAge*/; goTo.marker('numberLike'); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); goTo.marker('person'); -verify.memberListContains('personName'); -verify.memberListContains('personAge'); +verify.completionListContains('personName'); +verify.completionListContains('personAge'); goTo.marker('personName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('personAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('animal'); -verify.memberListContains('animalName'); -verify.memberListContains('animalAge'); +verify.completionListContains('animalName'); +verify.completionListContains('animalAge'); goTo.marker('animalName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('animalAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('dog'); -verify.memberListContains('dogName'); -verify.memberListContains('dogAge'); +verify.completionListContains('dogName'); +verify.completionListContains('dogAge'); goTo.marker('dogName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('dogAge'); -verify.memberListContains('toExponential'); +verify.completionListContains('toExponential'); goTo.marker('cat'); -verify.memberListContains('catName'); -verify.memberListContains('catAge'); +verify.completionListContains('catName'); +verify.completionListContains('catAge'); goTo.marker('catName'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); goTo.marker('catAge'); -verify.memberListContains('toExponential'); \ No newline at end of file +verify.completionListContains('toExponential'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts index 1d7a0bf318a..29330a73d3c 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagNamespace.ts @@ -16,12 +16,12 @@ //// var x1; x1./*3*/; goTo.marker("1"); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); goTo.marker("2"); -verify.memberListContains('age'); +verify.completionListContains('age'); goTo.marker("3"); -verify.memberListContains('charAt'); -verify.memberListContains('toExponential'); \ No newline at end of file +verify.completionListContains('charAt'); +verify.completionListContains('toExponential'); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxCompletion10.ts b/tests/cases/fourslash/tsxCompletion10.ts index f10e014c282..d36b2369218 100644 --- a/tests/cases/fourslash/tsxCompletion10.ts +++ b/tests/cases/fourslash/tsxCompletion10.ts @@ -10,5 +10,5 @@ //// var x1 =
goTo.marker("1"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('div'); goTo.marker("2"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts index 742009b487e..7719e04a9ef 100644 --- a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts +++ b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX1.ts @@ -4,5 +4,5 @@ //// var x1 =
goTo.marker("1"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('div'); goTo.marker("2"); -verify.memberListCount(1); +verify.completionListCount(1); verify.completionListContains('h1') diff --git a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts index d0ef579f401..f208b0a44a4 100644 --- a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts +++ b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts @@ -4,4 +4,4 @@ //// var x = Date: Wed, 14 Dec 2016 08:14:06 -0800 Subject: [PATCH 134/289] abstract class expr instantiation and abstract fix works with class expr --- src/compiler/checker.ts | 3 + ...sDoesntImplementInheritedAbstractMember.ts | 82 +++++++++++-------- ...prExtendsAbstractExpressionWithTypeArgs.ts | 14 ++++ ...ssExtendsAbstractExpressionWithTypeArgs.ts | 14 ++++ 4 files changed, 78 insertions(+), 35 deletions(-) create mode 100644 tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 41ebab86c64..40a3de7553f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19710,6 +19710,9 @@ namespace ts { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } + else if (node.kind === SyntaxKind.ClassKeyword && node.parent.kind === SyntaxKind.ClassExpression) { + return getSymbolOfNode(node.parent); + } else if (isLiteralComputedPropertyDeclarationName(node)) { return getSymbolOfNode(node.parent.parent); } diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 86463b60f35..22546e55ecc 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -2,46 +2,58 @@ namespace ts.codefix { registerCodeFix({ errorCodes: [Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - const checker = context.program.getTypeChecker(); + getCodeActions: getActionForClassLikeMissingAbstractMember + }); - if (token.kind === SyntaxKind.Identifier && isClassLike(token.parent)) { - const classDecl = token.parent; - const startPos = classDecl.members.pos; + registerCodeFix({ + errorCodes: [Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); - const InstantiatedExtendsType = checker.getTypeFromTypeReference(getClassExtendsHeritageClauseElement(classDecl)) as InterfaceType; - // Note that this is ultimately derived from a map indexed by symbol names, - // so duplicates cannot occur. - const extendsSymbols = checker.getPropertiesOfType(InstantiatedExtendsType); - const abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + function getActionForClassLikeMissingAbstractMember(context: CodeFixContext): CodeAction[] | undefined { + const sourceFile = context.sourceFile; + const start = context.span.start; + // This is the identifier in the case of a class declaration + // or the class keyword token in the case of a class expression. + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); - const insertion = getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + if (isClassLike(token.parent)) { + const classDecl = token.parent as ClassLikeDeclaration; + const startPos = classDecl.members.pos; - if (insertion.length) { - return [{ - description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ - span: { start: startPos, length: 0 }, - newText: insertion - }] + const classType = checker.getTypeAtLocation(classDecl) as InterfaceType; + const instantiatedExtendsType = checker.getBaseTypes(classType)[0]; + + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + const extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + const abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + + const insertion = getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + + if (insertion.length) { + return [{ + description: getLocaleSpecificMessage(Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion }] - }]; - } - } - - return undefined; - - function symbolPointsToNonPrivateAndAbstractMember(symbol: Symbol): boolean { - const decls = symbol.getDeclarations(); - Debug.assert(!!(decls && decls.length > 0)); - const flags = getModifierFlags(decls[0]); - return !(flags & ModifierFlags.Private) && !!(flags & ModifierFlags.Abstract); + }] + }]; } } - }); + + return undefined; + + } + + function symbolPointsToNonPrivateAndAbstractMember(symbol: Symbol): boolean { + const decls = symbol.getDeclarations(); + Debug.assert(!!(decls && decls.length > 0)); + const flags = getModifierFlags(decls[0]); + return !(flags & ModifierFlags.Private) && !!(flags & ModifierFlags.Abstract); + } } \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts new file mode 100644 index 00000000000..a7690b4f5bf --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExprExtendsAbstractExpressionWithTypeArgs.ts @@ -0,0 +1,14 @@ +/// + +//// function foo(a: T) { +//// abstract class C { +//// abstract a: T | U; +//// } +//// return C; +//// } +//// +//// let B = class extends foo("s") {[| |]} + +verify.rangeAfterCodeFix(` +a: string | number; +`); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts new file mode 100644 index 00000000000..dfb91841333 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts @@ -0,0 +1,14 @@ +/// + +//// function foo(a: T) { +//// abstract class C { +//// abstract a: T | U; +//// } +//// return C; +//// } +//// +//// class B extends foo("s") {[| |]} + +verify.rangeAfterCodeFix(` +a: string | number; +`); From 467381273effe8d9bfd359f11fb9faf44e3894b6 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 08:41:55 -0800 Subject: [PATCH 135/289] refactor fix --- .../fixClassIncorrectlyImplementsInterface.ts | 122 +++++++++--------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 900b2c21720..7afbbbfd6a1 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -2,73 +2,75 @@ namespace ts.codefix { registerCodeFix({ errorCodes: [Diagnostics.Class_0_incorrectly_implements_interface_1.code], - getCodeActions: (context: CodeFixContext) => { - const sourceFile = context.sourceFile; - const start = context.span.start; - const token = getTokenAtPosition(sourceFile, start); - const checker = context.program.getTypeChecker(); + getCodeActions: getActionForClassLikeIncorrectImplementsInterface + }); - const classDecl = getContainingClass(token); - if (!classDecl) { - return undefined; - } + function getActionForClassLikeIncorrectImplementsInterface(context: CodeFixContext): CodeAction[] | undefined { + const sourceFile = context.sourceFile; + const start = context.span.start; + const token = getTokenAtPosition(sourceFile, start); + const checker = context.program.getTypeChecker(); - const startPos: number = classDecl.members.pos; - const classType = checker.getTypeAtLocation(classDecl); - const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - const result: CodeAction[] = []; + const classDecl = getContainingClass(token); + if (!classDecl) { + return undefined; + } - const hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.Number); - const hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.String); + const startPos: number = classDecl.members.pos; + const classType = checker.getTypeAtLocation(classDecl); + const implementedTypeNodes = getClassImplementsHeritageClauseElements(classDecl); - for (const implementedTypeNode of implementedTypeNodes) { - const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceType; - // Note that this is ultimately derived from a map indexed by symbol names, - // so duplicates cannot occur. - const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); - const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); + const hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.Number); + const hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, IndexKind.String); - let insertion = getMissingIndexSignatureInsertion(implementedType, IndexKind.Number, classDecl, hasNumericIndexSignature); - insertion += getMissingIndexSignatureInsertion(implementedType, IndexKind.String, classDecl, hasStringIndexSignature); - insertion += getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + const result: CodeAction[] = []; + for (const implementedTypeNode of implementedTypeNodes) { + const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceType; + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); - const message = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); - if (insertion) { - pushAction(result, insertion, message); - } - } + let insertion = getMissingIndexSignatureInsertion(implementedType, IndexKind.Number, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, IndexKind.String, classDecl, hasStringIndexSignature); + insertion += getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); - return result; - - function getMissingIndexSignatureInsertion(type: InterfaceType, kind: IndexKind, enclosingDeclaration: ClassLikeDeclaration, hasIndexSigOfKind: boolean) { - if (!hasIndexSigOfKind) { - const IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); - if (IndexInfoOfKind) { - return checker.indexSignatureToString(IndexInfoOfKind, kind, enclosingDeclaration); - } - } - return ""; - } - - function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { - const decls = symbol.getDeclarations(); - Debug.assert(!!(decls && decls.length > 0)); - return !(getModifierFlags(decls[0]) & ModifierFlags.Private); - } - - function pushAction(result: CodeAction[], insertion: string, description: string): void { - const newAction: CodeAction = { - description: description, - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ - span: { start: startPos, length: 0 }, - newText: insertion - }] - }] - }; - result.push(newAction); + const message = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); } } - }); + + return result; + + function getMissingIndexSignatureInsertion(type: InterfaceType, kind: IndexKind, enclosingDeclaration: ClassLikeDeclaration, hasIndexSigOfKind: boolean) { + if (!hasIndexSigOfKind) { + const IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + return checker.indexSignatureToString(IndexInfoOfKind, kind, enclosingDeclaration); + } + } + return ""; + } + + function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { + const decls = symbol.getDeclarations(); + Debug.assert(!!(decls && decls.length > 0)); + return !(getModifierFlags(decls[0]) & ModifierFlags.Private); + } + + function pushAction(result: CodeAction[], insertion: string, description: string): void { + const newAction: CodeAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }; + result.push(newAction); + } + } } \ No newline at end of file From 4b02099372813d1586486464b8bf11b0242ae5a8 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 08:42:05 -0800 Subject: [PATCH 136/289] add tests --- ...UnImplementedClassMissingFunctionVoidInferred.ts | 13 +++++++++++++ ...FixClassExtendsAbstractExpressionWithTypeArgs.ts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts diff --git a/tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts b/tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts new file mode 100644 index 00000000000..bdf8ea3bd25 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts @@ -0,0 +1,13 @@ +/// + +//// class A { +//// f() {} +//// } +//// +//// let B = class implements A {[| |]} + +verify.rangeAfterCodeFix(` +f(): void{ + throw new Error('Method not implemented.'); +} +`); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts index dfb91841333..5796bea6fb4 100644 --- a/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts @@ -11,4 +11,4 @@ verify.rangeAfterCodeFix(` a: string | number; -`); +`); \ No newline at end of file From 8be881916b181299f2f34d45aaee35f41262d62d Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 09:10:51 -0800 Subject: [PATCH 137/289] simplify and inline methods --- src/compiler/checker.ts | 10 ---------- src/compiler/types.ts | 1 - .../fixClassIncorrectlyImplementsInterface.ts | 15 +++++++-------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 40a3de7553f..ef2c589c393 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -96,7 +96,6 @@ namespace ts { getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment, signatureToString, - indexSignatureToString, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -2037,15 +2036,6 @@ namespace ts { return result; } - function indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string { - const writer = getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration); - const result = writer.string(); - releaseStringWriter(writer); - - return result; - } - function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { const writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d93aea8d26a..2a04916d45d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2353,7 +2353,6 @@ namespace ts { getTypeAtLocation(node: Node): Type; getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; - indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; createSymbol(flags: SymbolFlags, name: string): Symbol; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 7afbbbfd6a1..915b23f050b 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -29,7 +29,7 @@ namespace ts.codefix { // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); - const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); + const nonPrivateMembers = implementedTypeSymbols.filter(symbol => !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private)); let insertion = getMissingIndexSignatureInsertion(implementedType, IndexKind.Number, classDecl, hasNumericIndexSignature); insertion += getMissingIndexSignatureInsertion(implementedType, IndexKind.String, classDecl, hasStringIndexSignature); @@ -47,18 +47,17 @@ namespace ts.codefix { if (!hasIndexSigOfKind) { const IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); if (IndexInfoOfKind) { - return checker.indexSignatureToString(IndexInfoOfKind, kind, enclosingDeclaration); + const writer = getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + const result = writer.string(); + releaseStringWriter(writer); + + return result; } } return ""; } - function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { - const decls = symbol.getDeclarations(); - Debug.assert(!!(decls && decls.length > 0)); - return !(getModifierFlags(decls[0]) & ModifierFlags.Private); - } - function pushAction(result: CodeAction[], insertion: string, description: string): void { const newAction: CodeAction = { description: description, From d75d548470979c217e7ce9ab74eccee5e558c114 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 09:24:19 -0800 Subject: [PATCH 138/289] implicit any for synthesized signature --- src/services/codefixes/helpers.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 1bc4278144f..9827ec14f3b 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -108,35 +108,27 @@ namespace ts.codefix { } const maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(symbol => symbol.getName()); - const anyTypeNode: TypeNode = createNode(SyntaxKind.AnyKeyword) as TypeNode; const optionalToken = createToken(SyntaxKind.QuestionToken); newSignatureDeclaration.parameters = createNodeArray(); for (let i = 0; i < maxNonRestArgs; i++) { - const newParameter = createParameterDeclaration(i, minArgumentCount, anyTypeNode, newSignatureDeclaration); + const newParameter = createParameterDeclarationWithoutType(i, minArgumentCount, newSignatureDeclaration); newSignatureDeclaration.parameters.push(newParameter); } if (hasRestParameter) { - const anyArrayTypeNode = createNode(SyntaxKind.ArrayType) as ArrayTypeNode; - anyArrayTypeNode.elementType = anyTypeNode; - - const restParameter = createParameterDeclaration(maxNonRestArgs, minArgumentCount, anyArrayTypeNode, newSignatureDeclaration); + const restParameter = createParameterDeclarationWithoutType(maxNonRestArgs, minArgumentCount, newSignatureDeclaration); restParameter.dotDotDotToken = createToken(SyntaxKind.DotDotDotToken); newSignatureDeclaration.parameters.push(restParameter); } - newSignatureDeclaration.type = anyTypeNode; - newSignatureDeclaration.type.parent = newSignatureDeclaration; - return checker.getSignatureFromDeclaration(newSignatureDeclaration); - function createParameterDeclaration(index: number, minArgCount: number, typeNode: TypeNode, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { + function createParameterDeclarationWithoutType(index: number, minArgCount: number, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; - newParameter.type = typeNode; newParameter.parent = enclosingSignatureDeclaration; if (index >= minArgCount) { newParameter.questionToken = optionalToken; From 97f18c9bf5f29e548291a8eb4a707d5a23d3fde1 Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 10:28:18 -0800 Subject: [PATCH 139/289] Cleanup --- src/compiler/checker.ts | 8 +------- src/compiler/diagnosticMessages.json | 4 ---- src/compiler/types.ts | 5 +---- .../codefixes/fixClassIncorrectlyImplementsInterface.ts | 2 +- src/services/codefixes/helpers.ts | 6 ++++-- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9de448f4236..e90e40967d3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -83,13 +83,10 @@ namespace ts { getSignaturesOfType, getIndexTypeOfType, getBaseTypes, - getUnionType, - getIntersectionType, - getTypeFromTypeReference, + getTypeFromTypeNode, getReturnTypeOfSignature, getNonNullableType, getSymbolsInScope, - createSymbol, getSymbolAtLocation, getShorthandAssignmentValueSymbol, getExportSpecifierLocalTargetSymbol, @@ -19743,9 +19740,6 @@ namespace ts { // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } - else if (node.kind === SyntaxKind.ClassKeyword && node.parent.kind === SyntaxKind.ClassExpression) { - return getSymbolOfNode(node.parent); - } else if (isLiteralComputedPropertyDeclarationName(node)) { return getSymbolOfNode(node.parent.parent); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a6f40041f3c..a9faae5004e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3203,10 +3203,6 @@ "category": "Message", "code": 90004 }, - "Implement interface on reference": { - "category": "Message", - "code": 90005 - }, "Implement interface '{0}'.": { "category": "Message", "code": 90006 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2a04916d45d..e035b4d3919 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2341,8 +2341,6 @@ namespace ts { getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; getNonNullableType(type: Type): Type; - getIntersectionType(types: Type[], aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; - getUnionType(types: Type[], subtypeReduction?: boolean, aliasSymbol?: Symbol, aliasTypeArguments?: Type[]): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; @@ -2351,11 +2349,10 @@ namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; - getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; + getTypeFromTypeNode(node: TypeNode): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; - createSymbol(flags: SymbolFlags, name: string): Symbol; getSymbolDisplayBuilder(): SymbolDisplayBuilder; getFullyQualifiedName(symbol: Symbol): string; getAugmentedPropertiesOfType(type: Type): Symbol[]; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 915b23f050b..42488dc2aed 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -25,7 +25,7 @@ namespace ts.codefix { const result: CodeAction[] = []; for (const implementedTypeNode of implementedTypeNodes) { - const implementedType = checker.getTypeFromTypeReference(implementedTypeNode) as InterfaceType; + const implementedType = checker.getTypeFromTypeNode(implementedTypeNode) as InterfaceType; // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index 9827ec14f3b..d539ef0d68b 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -87,7 +87,6 @@ namespace ts.codefix { } function createBodySignatureWithAnyTypes(signatures: Signature[], enclosingDeclaration: ClassLikeDeclaration, checker: TypeChecker): Signature { - const newSignatureDeclaration = createNode(SyntaxKind.CallSignature) as SignatureDeclaration; newSignatureDeclaration.parent = enclosingDeclaration; newSignatureDeclaration.name = signatures[0].getDeclaration().name; @@ -126,7 +125,8 @@ namespace ts.codefix { function createParameterDeclarationWithoutType(index: number, minArgCount: number, enclosingSignatureDeclaration: SignatureDeclaration): ParameterDeclaration { const newParameter = createNode(SyntaxKind.Parameter) as ParameterDeclaration; - newParameter.symbol = checker.createSymbol(SymbolFlags.FunctionScopedVariable, maxArgsParameterSymbolNames[index] || "rest"); + + newParameter.symbol = new SymbolConstructor(SymbolFlags.FunctionScopedVariable, maxArgsParameterSymbolNames[index] || "rest"); newParameter.symbol.valueDeclaration = newParameter; newParameter.symbol.declarations = [newParameter]; newParameter.parent = enclosingSignatureDeclaration; @@ -151,4 +151,6 @@ namespace ts.codefix { } return ""; } + + const SymbolConstructor = objectAllocator.getSymbolConstructor(); } \ No newline at end of file From 3fc94bbd3b03470b98934536c5aa5b9c8bebe4ca Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Wed, 14 Dec 2016 10:38:00 -0800 Subject: [PATCH 140/289] Rename Tests --- ...=> codeFixClassExprClassImplementClassFunctionVoidInferred.ts} | 0 ...rgs.ts => codeFixClassExtendAbstractExpressionWithTypeArgs.ts} | 0 ...tendsAbstractGetter.ts => codeFixClassExtendAbstractGetter.ts} | 0 ...tGetterSetter.ts => codeFixClassExtendAbstractGetterSetter.ts} | 0 ...tendsAbstractMethod.ts => codeFixClassExtendAbstractMethod.ts} | 0 ...odeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts} | 0 ... => codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts} | 0 ...teProperty.ts => codeFixClassExtendAbstractPrivateProperty.ts} | 0 ...sAbstractProperty.ts => codeFixClassExtendAbstractProperty.ts} | 0 ...Property.ts => codeFixClassExtendAbstractProtectedProperty.ts} | 0 ...licProperty.ts => codeFixClassExtendAbstractPublicProperty.ts} | 0 ...tendsAbstractSetter.ts => codeFixClassExtendAbstractSetter.ts} | 0 ...sent.ts => codeFixClassExtendAbstractSomePropertiesPresent.ts} | 0 ....ts => codeFixClassImplementClassAbstractGettersAndSetters.ts} | 0 ...erred.ts => codeFixClassImplementClassFunctionVoidInferred.ts} | 0 ...Heritage.ts => codeFixClassImplementClassMethodViaHeritage.ts} | 0 ...tures1.ts => codeFixClassImplementClassMultipleSignatures1.ts} | 0 ...tures2.ts => codeFixClassImplementClassMultipleSignatures2.ts} | 0 ...odifiers.ts => codeFixClassImplementClassPropertyModifiers.ts} | 0 ...DeepInheritance.ts => codeFixClassImplementDeepInheritance.ts} | 0 ...mentedDefaultClass.ts => codeFixClassImplementDefaultClass.ts} | 0 ...lementedInterface36.ts => codeFixClassImplementInterface36.ts} | 0 ...lementedInterface39.ts => codeFixClassImplementInterface39.ts} | 0 ...ession.ts => codeFixClassImplementInterfaceClassExpression.ts} | 0 ... => codeFixClassImplementInterfaceComputedPropertyLiterals.ts} | 0 ...lassImplementInterfaceComputedPropertyNameWellKnownSymbols.ts} | 0 ...mber1.ts => codeFixClassImplementInterfaceDuplicateMember1.ts} | 0 ...mber2.ts => codeFixClassImplementInterfaceDuplicateMember2.ts} | 0 ...th.ts => codeFixClassImplementInterfaceIndexSignaturesBoth.ts} | 0 ...x.ts => codeFixClassImplementInterfaceIndexSignaturesNoFix.ts} | 0 ....ts => codeFixClassImplementInterfaceIndexSignaturesNumber.ts} | 0 ....ts => codeFixClassImplementInterfaceIndexSignaturesString.ts} | 0 ...arams.ts => codeFixClassImplementInterfaceMethodWithParams.ts} | 0 ...s1.ts => codeFixClassImplementInterfaceMultipleImplements1.ts} | 0 ...s2.ts => codeFixClassImplementInterfaceMultipleImplements2.ts} | 0 ...eFixClassImplementInterfaceMultipleImplementsIntersection1.ts} | 0 ...eFixClassImplementInterfaceMultipleImplementsIntersection2.ts} | 0 ...odeFixClassImplementInterfaceMultipleMembersAndPunctuation.ts} | 0 ...res.ts => codeFixClassImplementInterfaceMultipleSignatures.ts} | 0 ...s => codeFixClassImplementInterfaceMultipleSignaturesRest1.ts} | 0 ...s => codeFixClassImplementInterfaceMultipleSignaturesRest2.ts} | 0 ...lict.ts => codeFixClassImplementInterfaceNamespaceConflict.ts} | 0 ...assImplementInterfacePropertyFromParentConstructorFunction.ts} | 0 ....ts => codeFixClassImplementInterfaceSomePropertiesPresent.ts} | 0 ...> codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts} | 0 ...=> codeFixClassImplementInterfaceTypeParamInstantiateError.ts} | 0 ...> codeFixClassImplementInterfaceTypeParamInstantiateNumber.ts} | 0 ....ts => codeFixClassImplementInterfaceTypeParamInstantiateT.ts} | 0 ....ts => codeFixClassImplementInterfaceTypeParamInstantiateU.ts} | 0 ...ts => codeFixClassImplementInterfaceTypeParamInstantiation.ts} | 0 ...Method.ts => codeFixClassImplementInterfaceTypeParamMethod.ts} | 0 ...ymbol.ts => codeFixClassImplementInterfaceUndeclaredSymbol.ts} | 0 .../fourslash/{codeFixSuperCallMissing.ts => codeFixSuperCall.ts} | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename tests/cases/fourslash/{codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts => codeFixClassExprClassImplementClassFunctionVoidInferred.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractExpressionWithTypeArgs.ts => codeFixClassExtendAbstractExpressionWithTypeArgs.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractGetter.ts => codeFixClassExtendAbstractGetter.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractGetterSetter.ts => codeFixClassExtendAbstractGetterSetter.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractMethod.ts => codeFixClassExtendAbstractMethod.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts => codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts => codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractPrivateProperty.ts => codeFixClassExtendAbstractPrivateProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractProperty.ts => codeFixClassExtendAbstractProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractProtectedProperty.ts => codeFixClassExtendAbstractProtectedProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractPublicProperty.ts => codeFixClassExtendAbstractPublicProperty.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractSetter.ts => codeFixClassExtendAbstractSetter.ts} (100%) rename tests/cases/fourslash/{codeFixClassExtendsAbstractSomePropertiesPresent.ts => codeFixClassExtendAbstractSomePropertiesPresent.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts => codeFixClassImplementClassAbstractGettersAndSetters.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingFunctionVoidInferred.ts => codeFixClassImplementClassFunctionVoidInferred.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingMethodViaHeritage.ts => codeFixClassImplementClassMethodViaHeritage.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMultipleSignatures1.ts => codeFixClassImplementClassMultipleSignatures1.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMultipleSignatures2.ts => codeFixClassImplementClassMultipleSignatures2.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedClassMissingPropertyModifiers.ts => codeFixClassImplementClassPropertyModifiers.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedDeepInheritance.ts => codeFixClassImplementDeepInheritance.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedDefaultClass.ts => codeFixClassImplementDefaultClass.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterface36.ts => codeFixClassImplementInterface36.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterface39.ts => codeFixClassImplementInterface39.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceClassExpression.ts => codeFixClassImplementInterfaceClassExpression.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceComputedPropertyLiterals.ts => codeFixClassImplementInterfaceComputedPropertyLiterals.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts => codeFixClassImplementInterfaceComputedPropertyNameWellKnownSymbols.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceDuplicateMember1.ts => codeFixClassImplementInterfaceDuplicateMember1.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceDuplicateMember2.ts => codeFixClassImplementInterfaceDuplicateMember2.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceIndexSignaturesBoth.ts => codeFixClassImplementInterfaceIndexSignaturesBoth.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts => codeFixClassImplementInterfaceIndexSignaturesNoFix.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceIndexSignaturesNumber.ts => codeFixClassImplementInterfaceIndexSignaturesNumber.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceIndexSignaturesString.ts => codeFixClassImplementInterfaceIndexSignaturesString.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMethodWithParams.ts => codeFixClassImplementInterfaceMethodWithParams.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMultipleImplements1.ts => codeFixClassImplementInterfaceMultipleImplements1.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMultipleImplements2.ts => codeFixClassImplementInterfaceMultipleImplements2.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts => codeFixClassImplementInterfaceMultipleImplementsIntersection1.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts => codeFixClassImplementInterfaceMultipleImplementsIntersection2.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts => codeFixClassImplementInterfaceMultipleMembersAndPunctuation.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMultipleSignatures.ts => codeFixClassImplementInterfaceMultipleSignatures.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts => codeFixClassImplementInterfaceMultipleSignaturesRest1.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts => codeFixClassImplementInterfaceMultipleSignaturesRest2.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceNamespaceConflict.ts => codeFixClassImplementInterfaceNamespaceConflict.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts => codeFixClassImplementInterfacePropertyFromParentConstructorFunction.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceSomePropertiesPresent.ts => codeFixClassImplementInterfaceSomePropertiesPresent.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts => codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiateError.ts => codeFixClassImplementInterfaceTypeParamInstantiateError.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts => codeFixClassImplementInterfaceTypeParamInstantiateNumber.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiateT.ts => codeFixClassImplementInterfaceTypeParamInstantiateT.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiateU.ts => codeFixClassImplementInterfaceTypeParamInstantiateU.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts => codeFixClassImplementInterfaceTypeParamInstantiation.ts} (100%) rename tests/cases/fourslash/{codeFixUnImplementedInterfaceTypeParamMethod.ts => codeFixClassImplementInterfaceTypeParamMethod.ts} (100%) rename tests/cases/fourslash/{codeFixUnimplementedInterfaceUndeclaredSymbol.ts => codeFixClassImplementInterfaceUndeclaredSymbol.ts} (100%) rename tests/cases/fourslash/{codeFixSuperCallMissing.ts => codeFixSuperCall.ts} (100%) diff --git a/tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts b/tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExprUnImplementedClassMissingFunctionVoidInferred.ts rename to tests/cases/fourslash/codeFixClassExprClassImplementClassFunctionVoidInferred.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts b/tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractExpressionWithTypeArgs.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractExpressionWithTypeArgs.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts b/tests/cases/fourslash/codeFixClassExtendAbstractGetter.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractGetter.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractGetter.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts b/tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractGetterSetter.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractGetterSetter.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractMethod.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractMethod.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateNumber.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts b/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractMethodTypeParamsInstantiateU.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateU.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts b/tests/cases/fourslash/codeFixClassExtendAbstractPrivateProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractPrivateProperty.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractPrivateProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts b/tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractProperty.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts b/tests/cases/fourslash/codeFixClassExtendAbstractProtectedProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractProtectedProperty.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractProtectedProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts b/tests/cases/fourslash/codeFixClassExtendAbstractPublicProperty.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractPublicProperty.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractPublicProperty.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts b/tests/cases/fourslash/codeFixClassExtendAbstractSetter.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractSetter.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractSetter.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixClassExtendAbstractSomePropertiesPresent.ts similarity index 100% rename from tests/cases/fourslash/codeFixClassExtendsAbstractSomePropertiesPresent.ts rename to tests/cases/fourslash/codeFixClassExtendAbstractSomePropertiesPresent.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts b/tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts rename to tests/cases/fourslash/codeFixClassImplementClassAbstractGettersAndSetters.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts b/tests/cases/fourslash/codeFixClassImplementClassFunctionVoidInferred.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingFunctionVoidInferred.ts rename to tests/cases/fourslash/codeFixClassImplementClassFunctionVoidInferred.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts b/tests/cases/fourslash/codeFixClassImplementClassMethodViaHeritage.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingMethodViaHeritage.ts rename to tests/cases/fourslash/codeFixClassImplementClassMethodViaHeritage.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts b/tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures1.ts rename to tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures1.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts b/tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMultipleSignatures2.ts rename to tests/cases/fourslash/codeFixClassImplementClassMultipleSignatures2.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyModifiers.ts b/tests/cases/fourslash/codeFixClassImplementClassPropertyModifiers.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedClassMissingPropertyModifiers.ts rename to tests/cases/fourslash/codeFixClassImplementClassPropertyModifiers.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedDeepInheritance.ts b/tests/cases/fourslash/codeFixClassImplementDeepInheritance.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedDeepInheritance.ts rename to tests/cases/fourslash/codeFixClassImplementDeepInheritance.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts b/tests/cases/fourslash/codeFixClassImplementDefaultClass.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedDefaultClass.ts rename to tests/cases/fourslash/codeFixClassImplementDefaultClass.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface36.ts b/tests/cases/fourslash/codeFixClassImplementInterface36.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterface36.ts rename to tests/cases/fourslash/codeFixClassImplementInterface36.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39.ts b/tests/cases/fourslash/codeFixClassImplementInterface39.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterface39.ts rename to tests/cases/fourslash/codeFixClassImplementInterface39.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceClassExpression.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceClassExpression.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceClassExpression.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyLiterals.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyNameWellKnownSymbols.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceComputedPropertyNameWellKnownSymbols.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyNameWellKnownSymbols.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember1.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember1.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember2.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceDuplicateMember2.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceDuplicateMember2.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesBoth.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesBoth.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesBoth.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNoFix.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNoFix.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNoFix.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNumber.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesNumber.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesNumber.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesString.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceIndexSignaturesString.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceIndexSignaturesString.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMethodWithParams.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMethodWithParams.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMethodWithParams.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMethodWithParams.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements1.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplements1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements1.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplements1.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements2.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplements2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplements2.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplements2.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection1.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection1.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleImplementsIntersection2.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleImplementsIntersection2.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleMembersAndPunctuation.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceMultipleMembersAndPunctuation.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleMembersAndPunctuation.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignatures.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignatures.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest1.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest1.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest1.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest2.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignaturesRest2.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceMultipleSignaturesRest2.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceNamespaceConflict.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceNamespaceConflict.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceNamespaceConflict.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts b/tests/cases/fourslash/codeFixClassImplementInterfacePropertyFromParentConstructorFunction.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfacePropertyFromParentConstructorFunction.ts rename to tests/cases/fourslash/codeFixClassImplementInterfacePropertyFromParentConstructorFunction.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceSomePropertiesPresent.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceSomePropertiesPresent.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceSomePropertiesPresent.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateDeeply.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateDeeply.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateError.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateError.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateError.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateNumber.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateNumber.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateNumber.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateT.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateT.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateT.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateU.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiateU.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiateU.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiation.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceTypeParamInstantiationMissing.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamInstantiation.ts diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamMethod.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnImplementedInterfaceTypeParamMethod.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceTypeParamMethod.ts diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceUndeclaredSymbol.ts similarity index 100% rename from tests/cases/fourslash/codeFixUnimplementedInterfaceUndeclaredSymbol.ts rename to tests/cases/fourslash/codeFixClassImplementInterfaceUndeclaredSymbol.ts diff --git a/tests/cases/fourslash/codeFixSuperCallMissing.ts b/tests/cases/fourslash/codeFixSuperCall.ts similarity index 100% rename from tests/cases/fourslash/codeFixSuperCallMissing.ts rename to tests/cases/fourslash/codeFixSuperCall.ts From 27a60e4580076b544fa7f822df84414b7ea2c357 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 18 Dec 2016 15:44:54 +0900 Subject: [PATCH 141/289] fix linting errors --- src/compiler/binder.ts | 4 ++-- src/compiler/checker.ts | 21 ++++++++++++------- src/compiler/commandLineParser.ts | 4 ++-- src/compiler/core.ts | 18 ++++++++++------ src/compiler/parser.ts | 7 ++++--- src/compiler/program.ts | 12 ++++++----- src/compiler/scanner.ts | 9 ++++---- src/compiler/sys.ts | 2 +- src/compiler/utilities.ts | 12 +++++------ src/harness/harness.ts | 14 +++++++------ src/harness/unittests/incrementalParser.ts | 3 ++- .../unittests/services/colorization.ts | 11 ++++------ .../unittests/services/patternMatcher.ts | 3 ++- src/harness/unittests/versionCache.ts | 3 ++- src/server/scriptVersionCache.ts | 15 +++++++------ src/server/server.ts | 3 ++- src/services/breakpoints.ts | 12 +++++------ src/services/classifier.ts | 11 +++++----- src/services/formatting/formatting.ts | 3 ++- src/services/jsDoc.ts | 6 ++++-- src/services/navigationBar.ts | 2 +- src/services/patternMatcher.ts | 9 +++++--- src/services/services.ts | 3 ++- src/services/shims.ts | 3 ++- src/services/utilities.ts | 6 +++--- tests/webTestServer.ts | 2 +- 26 files changed, 112 insertions(+), 86 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a6f5993f6c8..a00c2f0efc7 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -283,8 +283,8 @@ namespace ts { // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType); - let functionType = node.parent; - let index = indexOf(functionType.parameters, node); + const functionType = node.parent; + const index = indexOf(functionType.parameters, node); return "arg" + index; case SyntaxKind.JSDocTypedefTag: const parentNode = node.parent && node.parent.parent; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5246bbfc700..c1e2f4fbc91 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5019,7 +5019,8 @@ namespace ts { // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + const n = declaration.parameters.length; + for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) { const param = declaration.parameters[i]; let paramSymbol = param.symbol; @@ -5118,7 +5119,8 @@ namespace ts { function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; const result: Signature[] = []; - for (let i = 0, len = symbol.declarations.length; i < len; i++) { + const len = symbol.declarations.length; + for (let i = 0; i < len; i++) { const node = symbol.declarations[i]; switch (node.kind) { case SyntaxKind.FunctionType: @@ -5768,8 +5770,8 @@ namespace ts { } function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { - for (let i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (const type of types) { + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -7911,7 +7913,8 @@ namespace ts { return Ternary.False; } let result = Ternary.True; - for (let i = 0, len = sourceSignatures.length; i < len; i++) { + const len = sourceSignatures.length; + for (let i = 0; i < len; i++) { const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; @@ -18044,7 +18047,8 @@ namespace ts { /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { - for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { + const n = typeParameterDeclarations.length; + for (let i = 0; i < n; i++) { const node = typeParameterDeclarations[i]; checkTypeParameter(node); @@ -18324,7 +18328,8 @@ namespace 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 (let i = 0, len = list1.length; i < len; i++) { + const len = list1.length; + for (let i = 0; i < len; i++) { const tp1 = list1[i]; const tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -20761,7 +20766,7 @@ namespace ts { case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: - let text = visibilityToString(modifierToFlag(modifier.kind)); + const text = visibilityToString(modifierToFlag(modifier.kind)); if (modifier.kind === SyntaxKind.ProtectedKeyword) { lastProtected = modifier; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a4257a610e1..25b5f5416dd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -620,7 +620,7 @@ namespace ts { break; case "boolean": // boolean flag has optional value true, false, others - let optValue = args[i]; + const optValue = args[i]; options[opt.name] = optValue !== "false"; // consume next argument as boolean flag value if (optValue === "false" || optValue === "true") { @@ -778,7 +778,7 @@ namespace ts { break; default: const value = options[name]; - let optionDefinition = optionsNameMap[name.toLowerCase()]; + const optionDefinition = optionsNameMap[name.toLowerCase()]; if (optionDefinition) { const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ceff1359579..a94b36c602d 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -119,7 +119,8 @@ namespace ts { */ export function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const result = callback(array[i], i); if (result) { return result; @@ -143,7 +144,8 @@ namespace ts { */ export function every(array: T[], callback: (element: T, index: number) => boolean): boolean { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (!callback(array[i], i)) { return false; } @@ -155,7 +157,8 @@ namespace ts { /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ export function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const value = array[i]; if (predicate(value, i)) { return value; @@ -169,7 +172,8 @@ namespace ts { * This is like `forEach`, but never returns undefined. */ export function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { const result = callback(array[i], i); if (result) { return result; @@ -191,7 +195,8 @@ namespace ts { export function indexOf(array: T[], value: T): number { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (array[i] === value) { return i; } @@ -201,7 +206,8 @@ namespace ts { } export function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number { - for (let i = start || 0, len = text.length; i < len; i++) { + const len = text.length; + for (let i = start || 0; i < len; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2f0d6a4d975..38e967b86d0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1678,8 +1678,8 @@ namespace ts { // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. - let methodDeclaration = node; - let nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier && + const methodDeclaration = node; + const nameIsConstructor = methodDeclaration.name.kind === SyntaxKind.Identifier && (methodDeclaration.name).originalKeywordKind === SyntaxKind.ConstructorKeyword; return !nameIsConstructor; @@ -7404,7 +7404,8 @@ namespace 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 (let i = 0, n = array.length; i < n; i++) { + const n = array.length; + for (let i = 0; i < n; i++) { const child = array[i]; if (child) { if (child.pos === position) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 73976d5d02e..5cf573bae4c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -40,7 +40,8 @@ namespace ts { return; } - for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + const n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (let i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -695,7 +696,8 @@ namespace ts { } // update fileName -> file mapping - for (let i = 0, len = newSourceFiles.length; i < len; i++) { + const len = newSourceFiles.length; + for (let i = 0; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } @@ -952,7 +954,7 @@ namespace ts { } break; case SyntaxKind.HeritageClause: - let heritageClause = node; + const heritageClause = node; if (heritageClause.token === SyntaxKind.ImplementsKeyword) { diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; @@ -971,7 +973,7 @@ namespace ts { diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case SyntaxKind.TypeAssertionExpression: - let typeAssertionExpression = node; + const typeAssertionExpression = node; diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; } @@ -1170,7 +1172,7 @@ namespace ts { case SyntaxKind.ImportDeclaration: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.ExportDeclaration: - let moduleNameExpr = getExternalModuleName(node); + const moduleNameExpr = getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) { break; } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 82302e98e37..24ee38b5c4d 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -531,7 +531,7 @@ namespace ts { const ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (let i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (let i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -643,7 +643,7 @@ namespace ts { pos++; continue; case CharacterCodes.slash: - let nextChar = text.charCodeAt(pos + 1); + const nextChar = text.charCodeAt(pos + 1); let hasTrailingNewLine = false; if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) { const kind = nextChar === CharacterCodes.slash ? SyntaxKind.SingleLineCommentTrivia : SyntaxKind.MultiLineCommentTrivia; @@ -766,7 +766,8 @@ namespace ts { return false; } - for (let i = 1, n = name.length; i < n; i++) { + const n = name.length; + for (let i = 1; i < n; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -1563,7 +1564,7 @@ namespace ts { pos++; return token = SyntaxKind.AtToken; case CharacterCodes.backslash: - let cookedChar = peekUnicodeEscape(); + const cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { pos += 6; tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index a1e82a66595..8e140375dd0 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -160,7 +160,7 @@ namespace ts { function getNames(collection: any): string[] { const result: string[] = []; - for (let e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + for (const e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { result.push(e.item().Name); } return result.sort(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6f491f6708f..56664517176 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -550,7 +550,7 @@ namespace ts { let errorNode = node; switch (node.kind) { case SyntaxKind.SourceFile: - let pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); + const pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos === sourceFile.text.length) { // file is empty - return span for the beginning of the file return createTextSpan(0, 0); @@ -682,7 +682,7 @@ namespace ts { case SyntaxKind.QualifiedName: case SyntaxKind.PropertyAccessExpression: case SyntaxKind.ThisKeyword: - let parent = node.parent; + const parent = node.parent; if (parent.kind === SyntaxKind.TypeQuery) { return false; } @@ -770,7 +770,7 @@ namespace ts { switch (node.kind) { case SyntaxKind.YieldExpression: visitor(node); - let operand = (node).expression; + const operand = (node).expression; if (operand) { traverse(operand); } @@ -1222,7 +1222,7 @@ namespace ts { case SyntaxKind.NumericLiteral: case SyntaxKind.StringLiteral: case SyntaxKind.ThisKeyword: - let parent = node.parent; + const parent = node.parent; switch (parent.kind) { case SyntaxKind.VariableDeclaration: case SyntaxKind.Parameter: @@ -1244,13 +1244,13 @@ namespace ts { case SyntaxKind.SwitchStatement: return (parent).expression === node; case SyntaxKind.ForStatement: - let forStatement = parent; + const forStatement = parent; return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forStatement.condition === node || forStatement.incrementor === node; case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: - let forInStatement = parent; + const forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 26a4a6f963d..3c4e452095f 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -85,7 +85,7 @@ namespace Utils { eval(fileContents); break; case ExecutionEnvironment.Node: - let vm = require("vm"); + const vm = require("vm"); if (nodeContext) { vm.runInNewContext(fileContents, nodeContext, fileName); } @@ -175,9 +175,9 @@ namespace Utils { assert.isFalse(array.end > node.end, "array.end > node.end"); assert.isFalse(array.pos < currentPos, "array.pos < currentPos"); - for (let i = 0, n = array.length; i < n; i++) { - assert.isFalse(array[i].pos < currentPos, "array[i].pos < currentPos"); - currentPos = array[i].end; + for (const item of array) { + assert.isFalse(item.pos < currentPos, "array[i].pos < currentPos"); + currentPos = item.end; } currentPos = array.end; @@ -344,7 +344,8 @@ namespace Utils { assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { const d1 = array1[i]; const d2 = array2[i]; @@ -400,7 +401,8 @@ namespace Utils { assert.equal(array1.end, array2.end, "array1.end !== array2.end"); assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { assertStructuralEquals(array1[i], array2[i]); } } diff --git a/src/harness/unittests/incrementalParser.ts b/src/harness/unittests/incrementalParser.ts index 6088e5fe082..214ac3a1a58 100644 --- a/src/harness/unittests/incrementalParser.ts +++ b/src/harness/unittests/incrementalParser.ts @@ -28,7 +28,8 @@ namespace ts { const diagnostics2 = file2.parseDiagnostics; assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); - for (let i = 0, n = diagnostics1.length; i < n; i++) { + const n = diagnostics1.length; + for (let i = 0; i < n; i++) { const d1 = diagnostics1[i]; const d2 = diagnostics2[i]; diff --git a/src/harness/unittests/services/colorization.ts b/src/harness/unittests/services/colorization.ts index 0fe63f4ff07..70592ea4151 100644 --- a/src/harness/unittests/services/colorization.ts +++ b/src/harness/unittests/services/colorization.ts @@ -13,8 +13,7 @@ describe("Colorization", function () { function getEntryAtPosition(result: ts.ClassificationResult, position: number) { let entryPosition = 0; - for (let i = 0, n = result.entries.length; i < n; i++) { - const entry = result.entries[i]; + for (const entry of result.entries) { if (entryPosition === position) { return entry; } @@ -43,9 +42,7 @@ describe("Colorization", function () { function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void { const result = classifier.getClassificationsForLine(text, initialEndOfLineState, /*syntacticClassifierAbsent*/ false); - for (let i = 0, n = expectedEntries.length; i < n; i++) { - const expectedEntry = expectedEntries[i]; - + for (const expectedEntry of expectedEntries) { if (expectedEntry.classification === undefined) { assert.equal(result.finalLexState, expectedEntry.value, "final endOfLineState does not match expected."); } @@ -352,9 +349,9 @@ describe("Colorization", function () { // Adjusts 'pos' by accounting for the length of each portion of the string, // but only return the last given string function track(...vals: string[]): string { - for (let i = 0, n = vals.length; i < n; i++) { + for (const val of vals) { pos += lastLength; - lastLength = vals[i].length; + lastLength = val.length; } return ts.lastOrUndefined(vals); } diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts index 8a70b38ab5e..3052aa77720 100644 --- a/src/harness/unittests/services/patternMatcher.ts +++ b/src/harness/unittests/services/patternMatcher.ts @@ -502,7 +502,8 @@ describe("PatternMatcher", function () { function assertArrayEquals(array1: T[], array2: T[]) { assert.equal(array1.length, array2.length); - for (let i = 0, n = array1.length; i < n; i++) { + const n = array1.length; + for (let i = 0; i < n; i++) { assert.equal(array1[i], array2[i]); } } diff --git a/src/harness/unittests/versionCache.ts b/src/harness/unittests/versionCache.ts index 7fb01ee770a..b38ac527f51 100644 --- a/src/harness/unittests/versionCache.ts +++ b/src/harness/unittests/versionCache.ts @@ -307,7 +307,8 @@ and grew 1cm per day`; it("Start pos from line", () => { for (let i = 0; i < iterationCount; i++) { - for (let j = 0, llen = lines.length; j < llen; j++) { + const llen = lines.length; + for (let j = 0; j < llen; j++) { const lineInfo = lineIndex.lineNumberToInfo(j + 1); const lineIndexOffset = lineInfo.offset; const lineMapOffset = lineMap[j]; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index e087c3b6dde..0365dfd5e41 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -113,7 +113,8 @@ namespace ts.server { if (len > 1) { let insertedNodes = new Array(len - 1); let startNode = leafNode; - for (let i = 1, len = lines.length; i < len; i++) { + const n = lines.length + for (let i = 1; i < n; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } let pathIndex = this.startPath.length - 2; @@ -341,8 +342,7 @@ namespace ts.server { let snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { let snapIndex = snap.index; - for (let i = 0, len = this.changes.length; i < len; i++) { - const change = this.changes[i]; + for (const change of this.changes) { snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } snap = new LineIndexSnapshot(this.currentVersion + 1, this); @@ -366,8 +366,7 @@ namespace ts.server { const textChangeRanges: ts.TextChangeRange[] = []; for (let i = oldVersion + 1; i <= newVersion; i++) { const snap = this.versions[this.versionToIndex(i)]; - for (let j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - const textChange = snap.changesSincePreviousVersion[j]; + for (const textChange of snap.changesSincePreviousVersion) { textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); } } @@ -471,7 +470,8 @@ namespace ts.server { load(lines: string[]) { if (lines.length > 0) { const leaves: LineLeaf[] = []; - for (let i = 0, len = lines.length; i < len; i++) { + const len = lines.length; + for (let i = 0; i < len; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); @@ -643,8 +643,7 @@ namespace ts.server { updateCounts() { this.totalChars = 0; this.totalLines = 0; - for (let i = 0, len = this.children.length; i < len; i++) { - const child = this.children[i]; + for (const child of this.children) { this.totalChars += child.charCount(); this.totalLines += child.lineCount(); } diff --git a/src/server/server.ts b/src/server/server.ts index a020ef210fe..0e6f8a85cf1 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -409,7 +409,8 @@ namespace ts.server { function parseLoggingEnvironmentString(logEnvStr: string): LogOptions { const logEnv: LogOptions = { logToFile: true }; const args = logEnvStr.split(" "); - for (let i = 0, len = args.length; i < (len - 1); i += 2) { + const len = args.length; + for (let i = 0; i < (len - 1); i += 2) { const option = args[i]; const value = args[i + 1]; if (option && value) { diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 6825ccb6371..c751cf3871b 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -560,11 +560,11 @@ namespace ts.BreakpointResolver { function spanInOpenBraceToken(node: Node): TextSpan { switch (node.parent.kind) { case SyntaxKind.EnumDeclaration: - let enumDeclaration = node.parent; + const enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); case SyntaxKind.ClassDeclaration: - let classDeclaration = node.parent; + const classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); case SyntaxKind.CaseBlock: @@ -600,8 +600,8 @@ namespace ts.BreakpointResolver { case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause - let caseBlock = node.parent; - let lastClause = lastOrUndefined(caseBlock.clauses); + const caseBlock = node.parent; + const lastClause = lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(lastOrUndefined(lastClause.statements)); } @@ -609,7 +609,7 @@ namespace ts.BreakpointResolver { case SyntaxKind.ObjectBindingPattern: // Breakpoint in last binding element or binding pattern if it contains no elements - let bindingPattern = node.parent; + const bindingPattern = node.parent; return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); // Default to parent node @@ -627,7 +627,7 @@ namespace ts.BreakpointResolver { switch (node.parent.kind) { case SyntaxKind.ArrayBindingPattern: // Breakpoint in last binding element or binding pattern if it contains no elements - let bindingPattern = node.parent; + const bindingPattern = node.parent; return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: diff --git a/src/services/classifier.ts b/src/services/classifier.ts index c22aec6a786..249511e2aad 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -71,7 +71,8 @@ namespace ts { const dense = classifications.spans; let lastEnd = 0; - for (let i = 0, n = dense.length; i < n; i += 3) { + const n = dense.length; + for (let i = 0; i < n; i += 3) { const start = dense[i]; const length = dense[i + 1]; const type = dense[i + 2]; @@ -605,7 +606,9 @@ namespace ts { Debug.assert(classifications.spans.length % 3 === 0); const dense = classifications.spans; const result: ClassifiedSpan[] = []; - for (let i = 0, n = dense.length; i < n; i += 3) { + + const n = dense.length; + for (let i = 0; i < n; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -972,9 +975,7 @@ namespace ts { if (decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - const children = element.getChildren(sourceFile); - for (let i = 0, n = children.length; i < n; i++) { - const child = children[i]; + for (const child of element.getChildren(sourceFile)) { if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index bcd8cebb017..5d7dc665790 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -950,7 +950,8 @@ namespace ts.formatting { // shift all parts on the delta size const delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (let i = startIndex, len = parts.length; i < len; i++ , startLine++) { + const len = parts.length; + for (let i = startIndex; i < len; i++ , startLine++) { const startLinePos = getStartPositionOfLine(startLine, sourceFile); const nonWhitespaceCharacterAndColumn = i === 0 diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 0e65d3b264e..2f08af3127a 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -76,7 +76,8 @@ namespace ts.JsDoc { */ function forEachUnique(array: T[], callback: (element: T, index: number) => U): U { if (array) { - for (let i = 0, len = array.length; i < len; i++) { + const len = array.length; + for (let i = 0; i < len; i++) { if (indexOf(array, array[i]) === i) { const result = callback(array[i], i); if (result) { @@ -170,7 +171,8 @@ namespace ts.JsDoc { const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; - for (let i = 0, numParams = parameters.length; i < numParams; i++) { + const numParams = parameters.length; + for (let i = 0; i < numParams; i++) { const currentName = parameters[i].name; const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 1cbaa3d640f..4e5986abc01 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -146,7 +146,7 @@ namespace ts.NavigationBar { break; case SyntaxKind.ImportClause: - let importClause = node; + const importClause = node; // Handle default import case e.g.: // import d from "mod"; if (importClause.name) { diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index b4f67ca056d..d07e9191309 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -516,7 +516,8 @@ namespace ts { // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string: string, value: string): number { - for (let i = 0, n = string.length - value.length; i <= n; i++) { + const n = string.length - value.length; + for (let i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -527,7 +528,8 @@ namespace ts { // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string: string, value: string, start: number): boolean { - for (let i = 0, n = value.length; i < n; i++) { + const n = value.length; + for (let i = 0; i < n; i++) { const ch1 = toLowerCase(string.charCodeAt(i + start)); const ch2 = value.charCodeAt(i); @@ -613,7 +615,8 @@ namespace ts { const result: TextSpan[] = []; let wordStart = 0; - for (let i = 1, n = identifier.length; i < n; i++) { + const n = identifier.length; + for (let i = 1; i < n; i++) { const lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); const currentIsDigit = isDigit(identifier.charCodeAt(i)); diff --git a/src/services/services.ts b/src/services/services.ts index cf6df71d45b..43903cec1ff 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1793,7 +1793,8 @@ namespace ts { } let descriptor: TodoCommentDescriptor = undefined; - for (let i = 0, n = descriptors.length; i < n; i++) { + const n = descriptors.length; + for (let i = 0; i < n; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } diff --git a/src/services/shims.ts b/src/services/shims.ts index 6184f1e2ff3..bd13843f751 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1239,7 +1239,8 @@ namespace ts { } public unregisterShim(shim: Shim): void { - for (let i = 0, n = this._shims.length; i < n; i++) { + const n = this._shims.length; + for (let i = 0; i < n; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 2f52d747e23..d3354dc5466 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -675,8 +675,7 @@ namespace ts { } // find the child that contains 'position' - for (let i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - const child = current.getChildAt(i); + for (const child of current.getChildren()) { // all jsDocComment nodes were already visited if (isJSDocNode(child)) { continue; @@ -766,7 +765,8 @@ namespace ts { } const children = n.getChildren(); - for (let i = 0, len = children.length; i < len; i++) { + const len = children.length; + for (let i = 0; i < len; i++) { const child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 3d23ef3e961..9063d909b15 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -48,7 +48,7 @@ function log(msg: string) { } -let directorySeparator = "/"; +const directorySeparator = "/"; function getRootLength(path: string): number { if (path.charAt(0) === directorySeparator) { From 27ed5b85047845cb06ca47e0b982ee6e1aa8375b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 19 Dec 2016 13:30:32 +0900 Subject: [PATCH 142/289] remove preferConstRule.ts --- Jakefile.js | 1 - scripts/tslint/preferConstRule.ts | 204 ------------------------------ 2 files changed, 205 deletions(-) delete mode 100644 scripts/tslint/preferConstRule.ts diff --git a/Jakefile.js b/Jakefile.js index 275303dda13..6cde8ac3c14 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -1179,7 +1179,6 @@ task("update-sublime", ["local", serverFile], function () { var tslintRuleDir = "scripts/tslint"; var tslintRules = [ "nextLineRule", - "preferConstRule", "booleanTriviaRule", "typeOperatorSpacingRule", "noInOperatorRule", diff --git a/scripts/tslint/preferConstRule.ts b/scripts/tslint/preferConstRule.ts deleted file mode 100644 index 28d7446b290..00000000000 --- a/scripts/tslint/preferConstRule.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as Lint from "tslint/lib"; -import * as ts from "typescript"; - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING_FACTORY = (identifier: string) => `Identifier '${identifier}' never appears on the LHS of an assignment - use const instead of let for its declaration.`; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new PreferConstWalker(sourceFile, this.getOptions())); - } -} - -function isLet(node: ts.Node) { - return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let); -} - -function isExported(node: ts.Node) { - return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export); -} - -function isAssignmentOperator(token: ts.SyntaxKind): boolean { - return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment; -} - -function isBindingLiteralExpression(node: ts.Node): node is (ts.ArrayLiteralExpression | ts.ObjectLiteralExpression) { - return (!!node) && (node.kind === ts.SyntaxKind.ObjectLiteralExpression || node.kind === ts.SyntaxKind.ArrayLiteralExpression); -} - -interface DeclarationUsages { - declaration: ts.VariableDeclaration; - usages: number; -} - -class PreferConstWalker extends Lint.RuleWalker { - private inScopeLetDeclarations: ts.MapLike[] = []; - private errors: Lint.RuleFailure[] = []; - private markAssignment(identifier: ts.Identifier) { - const name = identifier.text; - for (let i = this.inScopeLetDeclarations.length - 1; i >= 0; i--) { - const declarations = this.inScopeLetDeclarations[i]; - if (declarations[name]) { - declarations[name].usages++; - break; - } - } - } - - visitSourceFile(node: ts.SourceFile) { - super.visitSourceFile(node); - // Sort errors by position because tslint doesn't - this.errors.sort((a, b) => a.getStartPosition().getPosition() - b.getStartPosition().getPosition()).forEach(e => this.addFailure(e)); - } - - visitBinaryExpression(node: ts.BinaryExpression) { - if (isAssignmentOperator(node.operatorToken.kind)) { - this.visitLeftHandSideExpression(node.left); - } - super.visitBinaryExpression(node); - } - - private visitLeftHandSideExpression(node: ts.Expression) { - while (node.kind === ts.SyntaxKind.ParenthesizedExpression) { - node = (node as ts.ParenthesizedExpression).expression; - } - if (node.kind === ts.SyntaxKind.Identifier) { - this.markAssignment(node as ts.Identifier); - } - else if (isBindingLiteralExpression(node)) { - this.visitBindingLiteralExpression(node as (ts.ArrayLiteralExpression | ts.ObjectLiteralExpression)); - } - } - - private visitBindingLiteralExpression(node: ts.ArrayLiteralExpression | ts.ObjectLiteralExpression) { - if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) { - const pattern = node as ts.ObjectLiteralExpression; - for (const element of pattern.properties) { - const kind = element.kind; - - if (kind === ts.SyntaxKind.ShorthandPropertyAssignment) { - this.markAssignment((element as ts.ShorthandPropertyAssignment).name); - } - else if (kind === ts.SyntaxKind.PropertyAssignment) { - this.visitLeftHandSideExpression((element as ts.PropertyAssignment).initializer); - } - } - } - else if (node.kind === ts.SyntaxKind.ArrayLiteralExpression) { - const pattern = node as ts.ArrayLiteralExpression; - for (const element of pattern.elements) { - this.visitLeftHandSideExpression(element); - } - } - } - - private visitBindingPatternIdentifiers(pattern: ts.BindingPattern) { - for (const element of pattern.elements) { - if (element.kind !== ts.SyntaxKind.BindingElement) { - continue; - } - - const name = (element).name; - if (name.kind === ts.SyntaxKind.Identifier) { - this.markAssignment(name as ts.Identifier); - } - else { - this.visitBindingPatternIdentifiers(name as ts.BindingPattern); - } - } - } - - visitPrefixUnaryExpression(node: ts.PrefixUnaryExpression) { - this.visitAnyUnaryExpression(node); - super.visitPrefixUnaryExpression(node); - } - - visitPostfixUnaryExpression(node: ts.PostfixUnaryExpression) { - this.visitAnyUnaryExpression(node); - super.visitPostfixUnaryExpression(node); - } - - private visitAnyUnaryExpression(node: ts.PrefixUnaryExpression | ts.PostfixUnaryExpression) { - if (node.operator === ts.SyntaxKind.PlusPlusToken || node.operator === ts.SyntaxKind.MinusMinusToken) { - this.visitLeftHandSideExpression(node.operand); - } - } - - visitModuleDeclaration(node: ts.ModuleDeclaration) { - if (node.body.kind === ts.SyntaxKind.ModuleBlock) { - // For some reason module blocks are left out of the visit block traversal - this.visitBlock(node.body as any as ts.Block); - } - super.visitModuleDeclaration(node); - } - - visitForOfStatement(node: ts.ForOfStatement) { - this.visitAnyForStatement(node); - super.visitForOfStatement(node); - this.popDeclarations(); - } - - visitForInStatement(node: ts.ForInStatement) { - this.visitAnyForStatement(node); - super.visitForInStatement(node); - this.popDeclarations(); - } - - private visitAnyForStatement(node: ts.ForOfStatement | ts.ForInStatement) { - const names: ts.MapLike = {}; - if (isLet(node.initializer)) { - if (node.initializer.kind === ts.SyntaxKind.VariableDeclarationList) { - this.collectLetIdentifiers(node.initializer as ts.VariableDeclarationList, names); - } - } - this.inScopeLetDeclarations.push(names); - } - - private popDeclarations() { - const completed = this.inScopeLetDeclarations.pop(); - for (const name in completed) { - if (Object.hasOwnProperty.call(completed, name)) { - const element = completed[name]; - if (element.usages === 0) { - this.errors.push(this.createFailure(element.declaration.getStart(this.getSourceFile()), element.declaration.getWidth(this.getSourceFile()), Rule.FAILURE_STRING_FACTORY(name))); - } - } - } - } - - visitBlock(node: ts.Block) { - const names: ts.MapLike = {}; - for (const statement of node.statements) { - if (statement.kind === ts.SyntaxKind.VariableStatement) { - this.collectLetIdentifiers((statement as ts.VariableStatement).declarationList, names); - } - } - this.inScopeLetDeclarations.push(names); - super.visitBlock(node); - this.popDeclarations(); - } - - private collectLetIdentifiers(list: ts.VariableDeclarationList, ret: ts.MapLike) { - for (const node of list.declarations) { - if (isLet(node) && !isExported(node)) { - this.collectNameIdentifiers(node, node.name, ret); - } - } - } - - private collectNameIdentifiers(declaration: ts.VariableDeclaration, node: ts.Identifier | ts.BindingPattern, table: ts.MapLike) { - if (node.kind === ts.SyntaxKind.Identifier) { - table[(node as ts.Identifier).text] = { declaration, usages: 0 }; - } - else { - this.collectBindingPatternIdentifiers(declaration, node as ts.BindingPattern, table); - } - } - - private collectBindingPatternIdentifiers(value: ts.VariableDeclaration, pattern: ts.BindingPattern, table: ts.MapLike) { - for (const element of pattern.elements) { - if (element.kind === ts.SyntaxKind.BindingElement) { - this.collectNameIdentifiers(value, (element).name, table); - } - } - } -} From 2a941a722285495253e40a0ff0ffb77cf17f37f3 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:12:35 +0900 Subject: [PATCH 143/289] inline length --- src/compiler/checker.ts | 15 +++++---------- src/compiler/core.ts | 18 ++++++------------ src/compiler/parser.ts | 3 +-- src/compiler/program.ts | 3 +-- src/compiler/scanner.ts | 3 +-- src/harness/harness.ts | 6 ++---- src/harness/unittests/incrementalParser.ts | 3 +-- .../unittests/services/patternMatcher.ts | 3 +-- src/harness/unittests/versionCache.ts | 3 +-- src/server/scriptVersionCache.ts | 6 ++---- src/server/server.ts | 4 ++-- src/services/classifier.ts | 6 ++---- src/services/formatting/formatting.ts | 3 +-- src/services/jsDoc.ts | 6 ++---- src/services/patternMatcher.ts | 6 ++---- src/services/services.ts | 3 +-- src/services/shims.ts | 3 +-- src/services/utilities.ts | 3 +-- 18 files changed, 33 insertions(+), 64 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c1e2f4fbc91..e7e53c9e7ac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5019,8 +5019,7 @@ namespace ts { // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - const n = declaration.parameters.length; - for (let i = isJSConstructSignature ? 1 : 0; i < n; i++) { + for (let i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { const param = declaration.parameters[i]; let paramSymbol = param.symbol; @@ -5119,8 +5118,7 @@ namespace ts { function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; const result: Signature[] = []; - const len = symbol.declarations.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < symbol.declarations.length; i++) { const node = symbol.declarations[i]; switch (node.kind) { case SyntaxKind.FunctionType: @@ -7913,8 +7911,7 @@ namespace ts { return Ternary.False; } let result = Ternary.True; - const len = sourceSignatures.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < sourceSignatures.length; i++) { const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; @@ -18047,8 +18044,7 @@ namespace ts { /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { - const n = typeParameterDeclarations.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < typeParameterDeclarations.length; i++) { const node = typeParameterDeclarations[i]; checkTypeParameter(node); @@ -18328,8 +18324,7 @@ namespace 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. - const len = list1.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < list1.length; i++) { const tp1 = list1[i]; const tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a94b36c602d..2daf5c4e564 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -119,8 +119,7 @@ namespace ts { */ export function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const result = callback(array[i], i); if (result) { return result; @@ -144,8 +143,7 @@ namespace ts { */ export function every(array: T[], callback: (element: T, index: number) => boolean): boolean { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -157,8 +155,7 @@ namespace ts { /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ export function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const value = array[i]; if (predicate(value, i)) { return value; @@ -172,8 +169,7 @@ namespace ts { * This is like `forEach`, but never returns undefined. */ export function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { const result = callback(array[i], i); if (result) { return result; @@ -195,8 +191,7 @@ namespace ts { export function indexOf(array: T[], value: T): number { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -206,8 +201,7 @@ namespace ts { } export function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number { - const len = text.length; - for (let i = start || 0; i < len; i++) { + for (let i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 38e967b86d0..56dd42a1045 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -7404,8 +7404,7 @@ namespace 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. - const n = array.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array.length; i++) { const child = array[i]; if (child) { if (child.pos === position) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5cf573bae4c..99160a1e5e6 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -696,8 +696,7 @@ namespace ts { } // update fileName -> file mapping - const len = newSourceFiles.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 24ee38b5c4d..a2ca6057845 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -766,8 +766,7 @@ namespace ts { return false; } - const n = name.length; - for (let i = 1; i < n; i++) { + for (let i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 3c4e452095f..4094fc773ea 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -344,8 +344,7 @@ namespace Utils { assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { const d1 = array1[i]; const d2 = array2[i]; @@ -401,8 +400,7 @@ namespace Utils { assert.equal(array1.end, array2.end, "array1.end !== array2.end"); assert.equal(array1.length, array2.length, "array1.length !== array2.length"); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { assertStructuralEquals(array1[i], array2[i]); } } diff --git a/src/harness/unittests/incrementalParser.ts b/src/harness/unittests/incrementalParser.ts index 214ac3a1a58..fbd8a60da92 100644 --- a/src/harness/unittests/incrementalParser.ts +++ b/src/harness/unittests/incrementalParser.ts @@ -28,8 +28,7 @@ namespace ts { const diagnostics2 = file2.parseDiagnostics; assert.equal(diagnostics1.length, diagnostics2.length, "diagnostics1.length !== diagnostics2.length"); - const n = diagnostics1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < diagnostics1.length; i++) { const d1 = diagnostics1[i]; const d2 = diagnostics2[i]; diff --git a/src/harness/unittests/services/patternMatcher.ts b/src/harness/unittests/services/patternMatcher.ts index 3052aa77720..728636e9af2 100644 --- a/src/harness/unittests/services/patternMatcher.ts +++ b/src/harness/unittests/services/patternMatcher.ts @@ -502,8 +502,7 @@ describe("PatternMatcher", function () { function assertArrayEquals(array1: T[], array2: T[]) { assert.equal(array1.length, array2.length); - const n = array1.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < array1.length; i++) { assert.equal(array1[i], array2[i]); } } diff --git a/src/harness/unittests/versionCache.ts b/src/harness/unittests/versionCache.ts index b38ac527f51..17a70f59d59 100644 --- a/src/harness/unittests/versionCache.ts +++ b/src/harness/unittests/versionCache.ts @@ -307,8 +307,7 @@ and grew 1cm per day`; it("Start pos from line", () => { for (let i = 0; i < iterationCount; i++) { - const llen = lines.length; - for (let j = 0; j < llen; j++) { + for (let j = 0; j < lines.length; j++) { const lineInfo = lineIndex.lineNumberToInfo(j + 1); const lineIndexOffset = lineInfo.offset; const lineMapOffset = lineMap[j]; diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 0365dfd5e41..7f09bcd549b 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -113,8 +113,7 @@ namespace ts.server { if (len > 1) { let insertedNodes = new Array(len - 1); let startNode = leafNode; - const n = lines.length - for (let i = 1; i < n; i++) { + for (let i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } let pathIndex = this.startPath.length - 2; @@ -470,8 +469,7 @@ namespace ts.server { load(lines: string[]) { if (lines.length > 0) { const leaves: LineLeaf[] = []; - const len = lines.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < lines.length; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); diff --git a/src/server/server.ts b/src/server/server.ts index 0e6f8a85cf1..e689a2fc782 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -409,8 +409,8 @@ namespace ts.server { function parseLoggingEnvironmentString(logEnvStr: string): LogOptions { const logEnv: LogOptions = { logToFile: true }; const args = logEnvStr.split(" "); - const len = args.length; - for (let i = 0; i < (len - 1); i += 2) { + const len = args.length - 1; + for (let i = 0; i < len; i += 2) { const option = args[i]; const value = args[i + 1]; if (option && value) { diff --git a/src/services/classifier.ts b/src/services/classifier.ts index 249511e2aad..e8a29977802 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -71,8 +71,7 @@ namespace ts { const dense = classifications.spans; let lastEnd = 0; - const n = dense.length; - for (let i = 0; i < n; i += 3) { + for (let i = 0; i < dense.length; i += 3) { const start = dense[i]; const length = dense[i + 1]; const type = dense[i + 2]; @@ -607,8 +606,7 @@ namespace ts { const dense = classifications.spans; const result: ClassifiedSpan[] = []; - const n = dense.length; - for (let i = 0; i < n; i += 3) { + for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 5d7dc665790..ba47c420817 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -950,8 +950,7 @@ namespace ts.formatting { // shift all parts on the delta size const delta = indentation - nonWhitespaceColumnInFirstPart.column; - const len = parts.length; - for (let i = startIndex; i < len; i++ , startLine++) { + for (let i = startIndex; i < parts.length; i++ , startLine++) { const startLinePos = getStartPositionOfLine(startLine, sourceFile); const nonWhitespaceCharacterAndColumn = i === 0 diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 2f08af3127a..08a51a63e63 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -76,8 +76,7 @@ namespace ts.JsDoc { */ function forEachUnique(array: T[], callback: (element: T, index: number) => U): U { if (array) { - const len = array.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < array.length; i++) { if (indexOf(array, array[i]) === i) { const result = callback(array[i], i); if (result) { @@ -171,8 +170,7 @@ namespace ts.JsDoc { const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName); let docParams = ""; - const numParams = parameters.length; - for (let i = 0; i < numParams; i++) { + for (let i = 0; i < parameters.length; i++) { const currentName = parameters[i].name; const paramName = currentName.kind === SyntaxKind.Identifier ? (currentName).text : diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index d07e9191309..ad638099695 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -528,8 +528,7 @@ namespace ts { // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string: string, value: string, start: number): boolean { - const n = value.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < value.length; i++) { const ch1 = toLowerCase(string.charCodeAt(i + start)); const ch2 = value.charCodeAt(i); @@ -615,8 +614,7 @@ namespace ts { const result: TextSpan[] = []; let wordStart = 0; - const n = identifier.length; - for (let i = 1; i < n; i++) { + for (let i = 1; i < identifier.length; i++) { const lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); const currentIsDigit = isDigit(identifier.charCodeAt(i)); diff --git a/src/services/services.ts b/src/services/services.ts index 43903cec1ff..4ca983529be 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1793,8 +1793,7 @@ namespace ts { } let descriptor: TodoCommentDescriptor = undefined; - const n = descriptors.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } diff --git a/src/services/shims.ts b/src/services/shims.ts index bd13843f751..cf6bceb816c 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1239,8 +1239,7 @@ namespace ts { } public unregisterShim(shim: Shim): void { - const n = this._shims.length; - for (let i = 0; i < n; i++) { + for (let i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index d3354dc5466..c66ff6a8059 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -765,8 +765,7 @@ namespace ts { } const children = n.getChildren(); - const len = children.length; - for (let i = 0; i < len; i++) { + for (let i = 0; i < children.length; i++) { const child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' From 1f79741732f5bf517c1fd232ca9036815f3764bb Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:14:50 +0900 Subject: [PATCH 144/289] needless newline --- src/services/classifier.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/classifier.ts b/src/services/classifier.ts index e8a29977802..4f553924b99 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -605,7 +605,6 @@ namespace ts { Debug.assert(classifications.spans.length % 3 === 0); const dense = classifications.spans; const result: ClassifiedSpan[] = []; - for (let i = 0; i < dense.length; i += 3) { result.push({ textSpan: createTextSpan(dense[i], dense[i + 1]), From 67e1fd8403095b3181a4a34507f5ca728b0c47ba Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 20 Dec 2016 03:47:55 +0900 Subject: [PATCH 145/289] next again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2de37b712ab..fdb85ea764b 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "through2": "latest", "travis-fold": "latest", "ts-node": "latest", - "tslint": "4.0.0-dev.3", + "tslint": "next", "typescript": "next" }, "scripts": { From 97f48e8fe75f52dc4e01efbccf3496329c27ecc2 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 19 Dec 2016 11:29:52 -0800 Subject: [PATCH 146/289] PR cleanup --- src/compiler/core.ts | 2 -- src/compiler/utilities.ts | 13 ------------- 2 files changed, 15 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 72c09e490c3..89057dd2939 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -568,8 +568,6 @@ namespace ts { * is created if `value` was appended. * @param value The value to append to the array. If `value` is `undefined`, nothing is * appended. - * @param copyOnWrite Indicates whether to return a fresh array rather than modify the - * existing array. */ export function append(to: T[] | undefined, value: T | undefined): T[] | undefined { if (value === undefined) return to; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ff619f07020..f3b98794762 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -883,19 +883,6 @@ namespace ts { return false; } - export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } { - switch (node.statement.kind) { - case SyntaxKind.LabeledStatement: - const result = getAllLabeledStatements(node.statement); - if (result) { - result.labeledStatements.push(node); - } - return result; - default: - return { statement: node.statement, labeledStatements: [node] }; - } - } - export function isFunctionBlock(node: Node) { return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent); } From fa53eb150e73dd666edf13137baac5031199bc9a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 19 Dec 2016 17:03:59 -0800 Subject: [PATCH 147/289] Improve hierarchy fact tracking --- src/compiler/factory.ts | 24 ++- src/compiler/transformers/es2015.ts | 323 +++++++++++++--------------- src/compiler/utilities.ts | 19 +- 3 files changed, 178 insertions(+), 188 deletions(-) diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 3bd88d78447..761253439fa 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1754,17 +1754,21 @@ namespace ts { // Utilities - export function restoreEnclosingLabels(node: Statement, enclosingLabeledStatements: LabeledStatement[]) { - if (enclosingLabeledStatements) { - for (const labeledStatement of enclosingLabeledStatements) { - node = updateLabel( - labeledStatement, - labeledStatement.label, - node - ); - } + export function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement { + if (!outermostLabeledStatement) { + return node; } - return node; + const updated = updateLabel( + outermostLabeledStatement, + outermostLabeledStatement.label, + outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node + ); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; } export interface CallBinding { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 5f91063beb8..774c6db2cc4 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -164,9 +164,14 @@ namespace ts { type LoopConverter = (node: IterationStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]) => Statement; - // Facts we track as we descend the tree - const enum AncestorFacts { + // Facts we track as we traverse the tree + const enum HierarchyFacts { None = 0, + + // + // Ancestor facts + // + Function = 1 << 0, // Enclosed in a non-arrow function ArrowFunction = 1 << 1, // Enclosed in an arrow function AsyncFunctionBody = 1 << 2, // Enclosed in an async function body @@ -180,6 +185,14 @@ namespace ts { ForStatement = 1 << 10, // Enclosing block-scoped container is a ForStatement ForInOrForOfStatement = 1 << 11, // Enclosing block-scoped container is a ForInStatement or ForOfStatement ConstructorWithCapturedSuper = 1 << 12, // Enclosed in a constructor that captures 'this' for use with 'super' + ComputedPropertyName = 1 << 13, // Enclosed in a computed property name + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + + // + // Ancestor masks + // + + AncestorFactsMask = (ComputedPropertyName << 1) - 1, // We are always in *some* kind of block scope, but only specific block-scope containers are // top-level or Blocks. @@ -192,11 +205,14 @@ namespace ts { // Functions, methods, and accessors are both new lexical scopes and new block scopes. FunctionIncludes = Function | TopLevel, - FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper, + FunctionExcludes = BlockScopeExcludes & ~TopLevel | ArrowFunction | AsyncFunctionBody | CapturesThis | NonStaticClassElement | ConstructorWithCapturedSuper | ComputedPropertyName, + + AsyncFunctionBodyIncludes = FunctionIncludes | AsyncFunctionBody, + AsyncFunctionBodyExcludes = FunctionExcludes & ~NonStaticClassElement, // Arrow functions are lexically scoped to their container, but are new block scopes. ArrowFunctionIncludes = ArrowFunction | TopLevel, - ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper, + ArrowFunctionExcludes = BlockScopeExcludes & ~TopLevel | ConstructorWithCapturedSuper | ComputedPropertyName, // Constructors are both new lexical scopes and new block scopes. Constructors are also // always considered non-static members of a class. @@ -221,6 +237,25 @@ namespace ts { // Blocks (other than function bodies) are new block scopes. BlockIncludes = Block, BlockExcludes = BlockScopeExcludes & ~Block, + + IterationStatementBlockIncludes = IterationStatementBlock, + IterationStatementBlockExcludes = BlockScopeExcludes, + + // Computed property names track subtree flags differently than their containing members. + ComputedPropertyNameIncludes = ComputedPropertyName, + ComputedPropertyNameExcludes = None, + + // + // Subtree facts + // + + // NOTE: To be added in a later PR + + // + // Subtree masks + // + + SubtreeFactsMask = ~AncestorFactsMask, } export function transformES2015(context: TransformationContext) { @@ -239,7 +274,7 @@ namespace ts { let currentSourceFile: SourceFile; let currentText: string; - let ancestorFacts: AncestorFacts; + let hierarchyFacts: HierarchyFacts; /** * Used to track if we are emitting body of the converted loop @@ -268,49 +303,34 @@ namespace ts { currentSourceFile = undefined; currentText = undefined; - ancestorFacts = AncestorFacts.None; + hierarchyFacts = HierarchyFacts.None; return visited; } - function setAncestorFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node?: Node, container?: Node) { - if (node) { - switch (node.kind) { - case SyntaxKind.MethodDeclaration: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - if (container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static)) { - includeFacts |= AncestorFacts.NonStaticClassElement; - } - break; + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + **/ + function enterSubtree(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) { + const ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & HierarchyFacts.AncestorFactsMask; + return ancestorFacts; + } - case SyntaxKind.FunctionExpression: - const emitFlags = getEmitFlags(node); - if (emitFlags & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; - } - if (emitFlags & EmitFlags.AsyncFunctionBody) { - excludeFacts &= ~AncestorFacts.NonStaticClassElement; - includeFacts |= AncestorFacts.AsyncFunctionBody; - } - break; - case SyntaxKind.FunctionDeclaration: - if (getEmitFlags(node) & EmitFlags.CapturesThis) { - includeFacts |= AncestorFacts.CapturesThis; - } - break; - case SyntaxKind.Block: - if (ancestorFacts & AncestorFacts.IterationStatement) { - includeFacts = includeFacts & ~AncestorFacts.Block | AncestorFacts.IterationStatementBlock; - excludeFacts |= AncestorFacts.Block; - } - break; - } - } - ancestorFacts = ancestorFacts & ~excludeFacts | includeFacts; + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + **/ + function exitSubtree(ancestorFacts: HierarchyFacts, excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & HierarchyFacts.SubtreeFactsMask | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node: Node): boolean { - return ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper + return hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && node.kind === SyntaxKind.ReturnStatement && !(node).expression; } @@ -318,7 +338,7 @@ namespace ts { function shouldVisitNode(node: Node): boolean { return (node.transformFlags & TransformFlags.ContainsES2015) !== 0 || convertedLoopState !== undefined - || (ancestorFacts & AncestorFacts.ConstructorWithCapturedSuper && isStatement(node)) + || (hierarchyFacts & HierarchyFacts.ConstructorWithCapturedSuper && isStatement(node)) || (isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } @@ -479,15 +499,14 @@ namespace ts { } function visitSourceFile(node: SourceFile): SourceFile { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.SourceFileExcludes, AncestorFacts.SourceFileIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.SourceFileExcludes, HierarchyFacts.SourceFileIncludes); const statements: Statement[] = []; startLexicalEnvironment(); const statementOffset = addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset)); addRange(statements, endLexicalEnvironment()); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updateSourceFileNode( node, createNodeArray(statements, node.statements) @@ -507,10 +526,9 @@ namespace ts { } function visitCaseBlock(node: CaseBlock): CaseBlock { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -545,7 +563,7 @@ namespace ts { function visitThisKeyword(node: Node): Node { if (convertedLoopState) { - if (ancestorFacts & AncestorFacts.ArrowFunction) { + if (hierarchyFacts & HierarchyFacts.ArrowFunction) { // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. convertedLoopState.containsLexicalThis = true; return node; @@ -826,12 +844,9 @@ namespace ts { * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements: Statement[], node: ClassExpression | ClassDeclaration, extendsClauseElement: ExpressionWithTypeArguments): void { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.ConstructorExcludes, AncestorFacts.ConstructorIncludes); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.ConstructorExcludes, HierarchyFacts.ConstructorIncludes); const constructor = getFirstConstructorWithBody(node); const hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); const constructorFunction = @@ -852,8 +867,7 @@ namespace ts { } statements.push(constructorFunction); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; } @@ -915,7 +929,7 @@ namespace ts { if (constructor) { if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture) { - ancestorFacts |= AncestorFacts.ConstructorWithCapturedSuper; + hierarchyFacts |= HierarchyFacts.ConstructorWithCapturedSuper; } addRange(statements, visitNodes(constructor.body.statements, visitor, isStatement, /*start*/ statementOffset)); @@ -1431,6 +1445,7 @@ namespace ts { * @param member The MethodDeclaration node. */ function transformClassMethodDeclarationToStatement(receiver: LeftHandSideExpression, member: MethodDeclaration, container: Node) { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); const commentRange = getCommentRange(member); const sourceMapRange = getSourceMapRange(member); const memberName = createMemberAccessForPropertyName(receiver, visitNode(member.name, visitor, isPropertyName), /*location*/ member.name); @@ -1450,6 +1465,8 @@ namespace ts { // No source map should be emitted for this statement to align with the // old emitter. setEmitFlags(statement, EmitFlags.NoSourceMap); + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return statement; } @@ -1479,6 +1496,8 @@ namespace ts { * @param receiver The receiver for the member. */ function transformAccessorsToExpression(receiver: LeftHandSideExpression, { firstAccessor, getAccessor, setAccessor }: AllAccessorDeclarations, container: Node, startsOnNewLine: boolean): Expression { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); + // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. const target = getMutableClone(receiver); @@ -1525,6 +1544,8 @@ namespace ts { if (startsOnNewLine) { call.startsOnNewLine = true; } + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return call; } @@ -1537,13 +1558,9 @@ namespace ts { if (node.transformFlags & TransformFlags.ContainsLexicalThis) { enableSubstitutionsForCapturedThis(); } - - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.ArrowFunctionExcludes, AncestorFacts.ArrowFunctionIncludes); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.ArrowFunctionExcludes, HierarchyFacts.ArrowFunctionIncludes); const func = createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -1554,10 +1571,9 @@ namespace ts { transformFunctionBody(node), node ); - setOriginalNode(func, node); setEmitFlags(func, EmitFlags.CapturesThis); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return func; } @@ -1568,12 +1584,11 @@ namespace ts { * @param node a FunctionExpression node. */ function visitFunctionExpression(node: FunctionExpression): Expression { - const savedAncestorFacts = ancestorFacts; + const ancestorFacts = getEmitFlags(node) & EmitFlags.AsyncFunctionBody + ? enterSubtree(HierarchyFacts.AsyncFunctionBodyExcludes, HierarchyFacts.AsyncFunctionBodyIncludes) + : enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - const updated = updateFunctionExpression( node, /*modifiers*/ undefined, @@ -1585,8 +1600,7 @@ namespace ts { ? transformFunctionBody(node) : visitFunctionBody(node.body, functionBodyVisitor, context) ); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -1597,12 +1611,9 @@ namespace ts { * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node: FunctionDeclaration): FunctionDeclaration { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const updated = updateFunctionDeclaration( node, /*decorators*/ undefined, @@ -1616,7 +1627,7 @@ namespace ts { : visitFunctionBody(node.body, functionBodyVisitor, context) ); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -1629,12 +1640,11 @@ namespace ts { * @param name The name of the new FunctionExpression. */ function transformFunctionLikeToExpression(node: FunctionLikeDeclaration, location: TextRange, name: Identifier, container: Node): FunctionExpression { - const savedAncestorFacts = ancestorFacts; const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node, container); convertedLoopState = undefined; - + const ancestorFacts = container && isClassLike(container) && !hasModifier(node, ModifierFlags.Static) + ? enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes | HierarchyFacts.NonStaticClassElement) + : enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const expression = setOriginalNode( createFunctionExpression( /*modifiers*/ undefined, @@ -1648,8 +1658,7 @@ namespace ts { ), /*original*/ node ); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return expression; } @@ -1745,16 +1754,16 @@ namespace ts { } function visitBlock(node: Block, isFunctionBody: boolean): Block { - if (!isFunctionBody) { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockExcludes, AncestorFacts.BlockIncludes, node); - const updated = visitEachChild(node, visitor, context); - ancestorFacts = savedAncestorFacts; - return updated; + if (isFunctionBody) { + // A function body is not a block scope. + return visitEachChild(node, visitor, context); } - - // A function body is not a block scope. - return visitEachChild(node, visitor, context); + const ancestorFacts = hierarchyFacts & HierarchyFacts.IterationStatement + ? enterSubtree(HierarchyFacts.IterationStatementBlockExcludes, HierarchyFacts.IterationStatementBlockIncludes) + : enterSubtree(HierarchyFacts.BlockExcludes, HierarchyFacts.BlockIncludes); + const updated = visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); + return updated; } /** @@ -1814,13 +1823,9 @@ namespace ts { } function visitVariableStatement(node: VariableStatement): Statement { - const savedAncestorFacts = ancestorFacts; - if (hasModifier(node, ModifierFlags.Export)) { - ancestorFacts |= AncestorFacts.ExportedVariableStatement; - } - + const ancestorFacts = enterSubtree(HierarchyFacts.None, hasModifier(node, ModifierFlags.Export) ? HierarchyFacts.ExportedVariableStatement : HierarchyFacts.None); let updated: Statement; - if (convertedLoopState && (getCombinedNodeFlags(node.declarationList) & NodeFlags.BlockScoped) == 0) { + if (convertedLoopState && (node.declarationList.flags & NodeFlags.BlockScoped) === 0) { // we are inside a converted loop - hoist variable declarations let assignments: Expression[]; for (const decl of node.declarationList.declarations) { @@ -1853,7 +1858,7 @@ namespace ts { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -1942,18 +1947,18 @@ namespace ts { const isCapturedInFunction = flags & NodeCheckFlags.CapturedBlockScopedBinding; const isDeclaredInLoop = flags & NodeCheckFlags.BlockScopedBindingInLoop; const emittedAsTopLevel = - (ancestorFacts & AncestorFacts.TopLevel) !== 0 + (hierarchyFacts & HierarchyFacts.TopLevel) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && (ancestorFacts & AncestorFacts.IterationStatementBlock) !== 0); + && (hierarchyFacts & HierarchyFacts.IterationStatementBlock) !== 0); const emitExplicitInitializer = !emittedAsTopLevel - && (ancestorFacts & AncestorFacts.ForInOrForOfStatement) === 0 + && (hierarchyFacts & HierarchyFacts.ForInOrForOfStatement) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && (ancestorFacts & (AncestorFacts.ForStatement | AncestorFacts.ForInOrForOfStatement)) === 0)); + && (hierarchyFacts & (HierarchyFacts.ForStatement | HierarchyFacts.ForInOrForOfStatement)) === 0)); return emitExplicitInitializer; } @@ -1987,9 +1992,7 @@ namespace ts { * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node: VariableDeclaration): VisitResult { - const savedAncestorFacts = ancestorFacts; - ancestorFacts &= ~AncestorFacts.ExportedVariableStatement; - + const ancestorFacts = enterSubtree(HierarchyFacts.ExportedVariableStatement, HierarchyFacts.None); let updated: VisitResult; if (isBindingPattern(node.name)) { updated = flattenDestructuringBinding( @@ -1998,91 +2001,70 @@ namespace ts { context, FlattenLevel.All, /*value*/ undefined, - (savedAncestorFacts & AncestorFacts.ExportedVariableStatement) !== 0 + (ancestorFacts & HierarchyFacts.ExportedVariableStatement) !== 0 ); } else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } - function visitLabeledStatement(node: LabeledStatement): VisitResult { - const statement = unwrapInnermostStatmentOfLabel(node); - return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) - ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) - : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node); + function recordLabel(node: LabeledStatement) { + convertedLoopState.labels[node.label.text] = node.label.text; } - function unwrapInnermostStatmentOfLabel(node: LabeledStatement) { + function resetLabel(node: LabeledStatement) { + convertedLoopState.labels[node.label.text] = undefined; + } + + function visitLabeledStatement(node: LabeledStatement): VisitResult { if (convertedLoopState && !convertedLoopState.labels) { convertedLoopState.labels = createMap(); } - while (true) { - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = node.label.text; - } - if (node.statement.kind !== SyntaxKind.LabeledStatement) { - return node.statement; - } - node = node.statement; - } + const statement = unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node, convertedLoopState && resetLabel); } - function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement): Statement { - if (!outermostLabeledStatement) { - return node; - } - if (convertedLoopState) { - convertedLoopState.labels[outermostLabeledStatement.label.text] = undefined; - } - return updateLabel( - outermostLabeledStatement, - outermostLabeledStatement.label, - outermostLabeledStatement.statement.kind === SyntaxKind.LabeledStatement - ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) - : node - ); - } - - function visitIterationStatementWithFacts(excludeFacts: AncestorFacts, includeFacts: AncestorFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(excludeFacts, includeFacts, node); + function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) { + const ancestorFacts = enterSubtree(excludeFacts, includeFacts); const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } function visitDoOrWhileStatement(node: DoStatement | WhileStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.DoOrWhileStatementExcludes, - AncestorFacts.DoOrWhileStatementIncludes, + HierarchyFacts.DoOrWhileStatementExcludes, + HierarchyFacts.DoOrWhileStatementIncludes, node, outermostLabeledStatement); } function visitForStatement(node: ForStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForStatementExcludes, - AncestorFacts.ForStatementIncludes, + HierarchyFacts.ForStatementExcludes, + HierarchyFacts.ForStatementIncludes, node, outermostLabeledStatement); } function visitForInStatement(node: ForInStatement, outermostLabeledStatement: LabeledStatement) { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement); } function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult { return visitIterationStatementWithFacts( - AncestorFacts.ForInOrForOfStatementExcludes, - AncestorFacts.ForInOrForOfStatementIncludes, + HierarchyFacts.ForInOrForOfStatementExcludes, + HierarchyFacts.ForInOrForOfStatementIncludes, node, outermostLabeledStatement, convertForOfToFor); @@ -2255,7 +2237,7 @@ namespace ts { // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. setEmitFlags(forStatement, EmitFlags.NoTokenTrailingSourceMaps); - return restoreEnclosingLabel(forStatement, outermostLabeledStatement); + return restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) { @@ -2288,7 +2270,7 @@ namespace ts { let numInitialPropertiesWithoutYield = numProperties; for (let i = 0; i < numProperties; i++) { const property = properties[i]; - if ((property.transformFlags & TransformFlags.ContainsYield && ancestorFacts & AncestorFacts.AsyncFunctionBody) + if ((property.transformFlags & TransformFlags.ContainsYield && hierarchyFacts & HierarchyFacts.AsyncFunctionBody) && i < numInitialPropertiesWithoutYield) { numInitialPropertiesWithoutYield = i; } @@ -2377,7 +2359,7 @@ namespace ts { const result = convert ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) - : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement); + : restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; @@ -2453,7 +2435,7 @@ namespace ts { } const isAsyncBlockContainingAwait = - ancestorFacts & AncestorFacts.AsyncFunctionBody + hierarchyFacts & HierarchyFacts.AsyncFunctionBody && (node.statement.transformFlags & TransformFlags.ContainsYield) !== 0; let loopBodyFlags: EmitFlags = 0; @@ -2592,7 +2574,7 @@ namespace ts { // reset and re-aggregate the transform flags clone.transformFlags = 0; aggregateTransformFlags(clone); - loop = restoreEnclosingLabel(clone, outermostLabeledStatement); + loop = restoreEnclosingLabel(clone, outermostLabeledStatement, convertedLoopState && resetLabel); } statements.push(loop); @@ -2839,6 +2821,7 @@ namespace ts { * @param receiver The receiver for the assignment. */ function transformObjectLiteralMethodDeclarationToExpression(method: MethodDeclaration, receiver: Expression, container: Node, startsOnNewLine: boolean) { + const ancestorFacts = enterSubtree(HierarchyFacts.None, HierarchyFacts.None); const expression = createAssignment( createMemberAccessForPropertyName( receiver, @@ -2850,12 +2833,12 @@ namespace ts { if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return expression; } function visitCatchClause(node: CatchClause): CatchClause { - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.BlockScopeExcludes, AncestorFacts.BlockScopeIncludes); + const ancestorFacts = enterSubtree(HierarchyFacts.BlockScopeExcludes, HierarchyFacts.BlockScopeIncludes); let updated: CatchClause; if (isBindingPattern(node.variableDeclaration.name)) { const temp = createTempVariable(undefined); @@ -2874,7 +2857,8 @@ namespace ts { else { updated = visitEachChild(node, visitor, context); } - ancestorFacts = savedAncestorFacts; + + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return updated; } @@ -2909,15 +2893,12 @@ namespace ts { * @param node An AccessorDeclaration node. */ function visitAccessorDeclaration(node: AccessorDeclaration): AccessorDeclaration { - const savedAncestorFacts = ancestorFacts; + Debug.assert(!isComputedPropertyName(node.name)); const savedConvertedLoopState = convertedLoopState; - - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); convertedLoopState = undefined; - + const ancestorFacts = enterSubtree(HierarchyFacts.FunctionExcludes, HierarchyFacts.FunctionIncludes); const updated = visitEachChild(node, visitor, context); - - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); convertedLoopState = savedConvertedLoopState; return updated; } @@ -2936,7 +2917,10 @@ namespace ts { } function visitComputedPropertyName(node: ComputedPropertyName) { - return visitEachChild(node, visitor, context); + const ancestorFacts = enterSubtree(HierarchyFacts.ComputedPropertyNameExcludes, HierarchyFacts.ComputedPropertyNameIncludes); + const updated = visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); + return updated; } /** @@ -3308,7 +3292,7 @@ namespace ts { * Visits the `super` keyword */ function visitSuperKeyword(isExpressionOfCall: boolean): LeftHandSideExpression { - return ancestorFacts & AncestorFacts.NonStaticClassElement + return hierarchyFacts & HierarchyFacts.NonStaticClassElement && !isExpressionOfCall ? createPropertyAccess(createIdentifier("_super"), "prototype") : createIdentifier("_super"); @@ -3322,10 +3306,13 @@ namespace ts { function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis && isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - const savedAncestorFacts = ancestorFacts; - setAncestorFacts(AncestorFacts.FunctionExcludes, AncestorFacts.FunctionIncludes, node); + const ancestorFacts = enterSubtree( + HierarchyFacts.FunctionExcludes, + getEmitFlags(node) & EmitFlags.CapturesThis + ? HierarchyFacts.FunctionIncludes | HierarchyFacts.CapturesThis + : HierarchyFacts.FunctionIncludes); previousOnEmitNode(emitContext, node, emitCallback); - ancestorFacts = savedAncestorFacts; + exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None); return; } previousOnEmitNode(emitContext, node, emitCallback); @@ -3456,7 +3443,7 @@ namespace ts { */ function substituteThisKeyword(node: PrimaryExpression): PrimaryExpression { if (enabledSubstitutions & ES2015SubstitutionFlags.CapturedThis - && ancestorFacts & AncestorFacts.CapturesThis) { + && hierarchyFacts & HierarchyFacts.CapturesThis) { return createIdentifier("_this", /*location*/ node); } return node; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d068a303cb4..3e10ffdddd4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -900,16 +900,15 @@ namespace ts { return false; } - export function getAllLabeledStatements(node: LabeledStatement): { statement: Statement; labeledStatements: LabeledStatement[]; } { - switch (node.statement.kind) { - case SyntaxKind.LabeledStatement: - const result = getAllLabeledStatements(node.statement); - if (result) { - result.labeledStatements.push(node); - } - return result; - default: - return { statement: node.statement, labeledStatements: [node] }; + export function unwrapInnermostStatmentOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== SyntaxKind.LabeledStatement) { + return node.statement; + } + node = node.statement; } } From a4ec7d66eb94a651b739b057fd6e2b39552e8137 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:50:45 +0900 Subject: [PATCH 148/289] unindent dangling closing token --- src/services/formatting/formatting.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 78ddfa5c6e9..41630a77935 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -496,10 +496,19 @@ namespace ts.formatting { case SyntaxKind.WhileKeyword: case SyntaxKind.AtToken: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case SyntaxKind.SlashToken: + case SyntaxKind.GreaterThanToken: { + if (container.kind === SyntaxKind.JsxOpeningElement || + container.kind === SyntaxKind.JsxClosingElement || + container.kind === SyntaxKind.JsxSelfClosingElement + ) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: () => indentation, getDelta: child => getEffectiveDelta(delta, child), From ba7c1a13c3b9ea49d034ca07f42317e6a2bb158d Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 21:54:40 +0900 Subject: [PATCH 149/289] do not insert space after function expressions --- src/services/formatting/rules.ts | 9 ++++++++- .../cases/fourslash/formatVariableDeclarationList.ts | 2 +- tests/cases/fourslash/formattingJsxElements.ts | 11 ++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2095f062bd1..f29890806b5 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -705,11 +705,18 @@ namespace ts.formatting { case SyntaxKind.ClassDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: - case SyntaxKind.Block: case SyntaxKind.CatchClause: case SyntaxKind.ModuleBlock: case SyntaxKind.SwitchStatement: return true; + case SyntaxKind.Block: { + const blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== SyntaxKind.ArrowFunction && + blockParent.kind !== SyntaxKind.FunctionExpression) + { + return true; + } + } } return false; } diff --git a/tests/cases/fourslash/formatVariableDeclarationList.ts b/tests/cases/fourslash/formatVariableDeclarationList.ts index 37392d38c62..089eceb1684 100644 --- a/tests/cases/fourslash/formatVariableDeclarationList.ts +++ b/tests/cases/fourslash/formatVariableDeclarationList.ts @@ -37,4 +37,4 @@ verify.currentLineContentIs(" x = 'Foo';"); goTo.marker("11"); verify.currentLineContentIs(" return fun;"); goTo.marker("12"); -verify.currentLineContentIs(" } (fun1));"); +verify.currentLineContentIs(" }(fun1));"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingJsxElements.ts b/tests/cases/fourslash/formattingJsxElements.ts index 2b3b396ed4c..a27bc809456 100644 --- a/tests/cases/fourslash/formattingJsxElements.ts +++ b/tests/cases/fourslash/formattingJsxElements.ts @@ -72,6 +72,8 @@ ////) ;/*closingParenInJsxElement2*/ ////;/*jsxExpressionSpaces*/ ////;/*jsxExpressionSpaces2*/ +//// {}}/*jsxExpressionSpaces3*/ +/////>;/*jsxDanglingSelfClosingToken*/ format.document(); goTo.marker("autoformat"); @@ -120,8 +122,7 @@ goTo.marker("expressionIndent"); verify.indentationIs(12); goTo.marker("danglingBracketAutoformat") -// TODO: verify.currentLineContentIs(" >"); -verify.currentLineContentIs(" >"); +verify.currentLineContentIs(" >"); goTo.marker("closingTagAutoformat"); verify.currentLineContentIs("
"); @@ -145,4 +146,8 @@ verify.currentLineContentIs(") ;"); goTo.marker("jsxExpressionSpaces"); verify.currentLineContentIs(";"); goTo.marker("jsxExpressionSpaces2"); -verify.currentLineContentIs(";"); \ No newline at end of file +verify.currentLineContentIs(";"); +goTo.marker("jsxExpressionSpaces3"); +verify.currentLineContentIs(" { }}"); +goTo.marker("jsxDanglingSelfClosingToken"); +verify.currentLineContentIs("/>;"); \ No newline at end of file From 2576ea1cf5d03f9ffa6471539f338c69279156e9 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 21 Dec 2016 22:16:00 +0900 Subject: [PATCH 150/289] fix linter alert --- src/services/formatting/rules.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index f29890806b5..18125932a11 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -712,8 +712,8 @@ namespace ts.formatting { case SyntaxKind.Block: { const blockParent = context.currentTokenParent.parent; if (blockParent.kind !== SyntaxKind.ArrowFunction && - blockParent.kind !== SyntaxKind.FunctionExpression) - { + blockParent.kind !== SyntaxKind.FunctionExpression + ) { return true; } } From 32568b3fc2f6a33b739db0251b034fb36a893e17 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 09:45:04 -0800 Subject: [PATCH 151/289] Test case when module member is object spread pattern --- .../unusedLocalsAndObjectSpread2.errors.txt | 35 ++++++++++++++++++ .../reference/unusedLocalsAndObjectSpread2.js | 37 +++++++++++++++++++ .../compiler/unusedLocalsAndObjectSpread2.ts | 18 +++++++++ 3 files changed, 90 insertions(+) create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread2.js create mode 100644 tests/cases/compiler/unusedLocalsAndObjectSpread2.ts diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt new file mode 100644 index 00000000000..0908f5ce3b9 --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(4,5): error TS6133: 'children' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,13): error TS6133: '_a' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(6,6): error TS6133: 'rest' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(9,10): error TS6133: 'foo' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(13,8): error TS6133: 'rest' is declared but never used. + + +==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (5 errors) ==== + + declare let props: any; + const { + children, // here! + ~~~~~~~~ +!!! error TS6133: 'children' is declared but never used. + active: _a, // here! + ~~ +!!! error TS6133: '_a' is declared but never used. + ...rest, + ~~~~ +!!! error TS6133: 'rest' is declared but never used. + } = props; + + function foo() { + ~~~ +!!! error TS6133: 'foo' is declared but never used. + const { + children, + active: _a, + ...rest, + ~~~~ +!!! error TS6133: 'rest' is declared but never used. + } = props; + } + + export const asdf = 123; \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.js b/tests/baselines/reference/unusedLocalsAndObjectSpread2.js new file mode 100644 index 00000000000..e6cd890abb7 --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.js @@ -0,0 +1,37 @@ +//// [unusedLocalsAndObjectSpread2.ts] + +declare let props: any; +const { + children, // here! + active: _a, // here! + ...rest, +} = props; + +function foo() { + const { + children, + active: _a, + ...rest, + } = props; +} + +export const asdf = 123; + +//// [unusedLocalsAndObjectSpread2.js] +"use strict"; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var children = props.children, // here! +_a = props.active, // here! +rest = __rest(props, ["children", "active"]); +function foo() { + var children = props.children, _a = props.active, rest = __rest(props, ["children", "active"]); +} +exports.asdf = 123; diff --git a/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts b/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts new file mode 100644 index 00000000000..e55c2042a41 --- /dev/null +++ b/tests/cases/compiler/unusedLocalsAndObjectSpread2.ts @@ -0,0 +1,18 @@ +//@noUnusedLocals:true + +declare let props: any; +const { + children, // here! + active: _a, // here! + ...rest, +} = props; + +function foo() { + const { + children, + active: _a, + ...rest, + } = props; +} + +export const asdf = 123; \ No newline at end of file From 14cce292506b29aa88d26c0ad9ca94d7fb32e6d8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 09:45:33 -0800 Subject: [PATCH 152/289] Do not report error on unused removed property from object spread Fixes #13076 --- src/compiler/checker.ts | 2 +- .../reference/unusedLocalsAndObjectSpread2.errors.txt | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 36b952dd046..d25c010ccfb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16891,7 +16891,7 @@ namespace ts { if (!local.isReferenced && !local.exportSymbol) { for (const declaration of local.declarations) { if (!isAmbientModule(declaration)) { - error(declaration.name, Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt index 0908f5ce3b9..2d1c36d3cbf 100644 --- a/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread2.errors.txt @@ -1,20 +1,14 @@ -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(4,5): error TS6133: 'children' is declared but never used. -tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(5,13): error TS6133: '_a' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(6,6): error TS6133: 'rest' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(9,10): error TS6133: 'foo' is declared but never used. tests/cases/compiler/unusedLocalsAndObjectSpread2.ts(13,8): error TS6133: 'rest' is declared but never used. -==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (5 errors) ==== +==== tests/cases/compiler/unusedLocalsAndObjectSpread2.ts (3 errors) ==== declare let props: any; const { children, // here! - ~~~~~~~~ -!!! error TS6133: 'children' is declared but never used. active: _a, // here! - ~~ -!!! error TS6133: '_a' is declared but never used. ...rest, ~~~~ !!! error TS6133: 'rest' is declared but never used. From 32c477a4486341b0023ac318ec45539d5a4df321 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 12:28:29 -0800 Subject: [PATCH 153/289] Test case for metadata type of class from a module --- .../reference/metadataOfClassFromModule.js | 44 +++++++++++++++++++ .../metadataOfClassFromModule.symbols | 22 ++++++++++ .../reference/metadataOfClassFromModule.types | 22 ++++++++++ .../compiler/metadataOfClassFromModule.ts | 14 ++++++ 4 files changed, 102 insertions(+) create mode 100644 tests/baselines/reference/metadataOfClassFromModule.js create mode 100644 tests/baselines/reference/metadataOfClassFromModule.symbols create mode 100644 tests/baselines/reference/metadataOfClassFromModule.types create mode 100644 tests/cases/compiler/metadataOfClassFromModule.ts diff --git a/tests/baselines/reference/metadataOfClassFromModule.js b/tests/baselines/reference/metadataOfClassFromModule.js new file mode 100644 index 00000000000..8d9f97489f2 --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.js @@ -0,0 +1,44 @@ +//// [metadataOfClassFromModule.ts] +module MyModule { + + export function inject(target: any, key: string): void { } + + export class Leg { } + + export class Person { + @inject leftLeg: Leg; + } + +} + +//// [metadataOfClassFromModule.js] +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var MyModule; +(function (MyModule) { + function inject(target, key) { } + MyModule.inject = inject; + var Leg = (function () { + function Leg() { + } + return Leg; + }()); + MyModule.Leg = Leg; + var Person = (function () { + function Person() { + } + return Person; + }()); + __decorate([ + inject, + __metadata("design:type", Object) + ], Person.prototype, "leftLeg", void 0); + MyModule.Person = Person; +})(MyModule || (MyModule = {})); diff --git a/tests/baselines/reference/metadataOfClassFromModule.symbols b/tests/baselines/reference/metadataOfClassFromModule.symbols new file mode 100644 index 00000000000..f430677f0fa --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.symbols @@ -0,0 +1,22 @@ +=== tests/cases/compiler/metadataOfClassFromModule.ts === +module MyModule { +>MyModule : Symbol(MyModule, Decl(metadataOfClassFromModule.ts, 0, 0)) + + export function inject(target: any, key: string): void { } +>inject : Symbol(inject, Decl(metadataOfClassFromModule.ts, 0, 17)) +>target : Symbol(target, Decl(metadataOfClassFromModule.ts, 2, 27)) +>key : Symbol(key, Decl(metadataOfClassFromModule.ts, 2, 39)) + + export class Leg { } +>Leg : Symbol(Leg, Decl(metadataOfClassFromModule.ts, 2, 62)) + + export class Person { +>Person : Symbol(Person, Decl(metadataOfClassFromModule.ts, 4, 24)) + + @inject leftLeg: Leg; +>inject : Symbol(inject, Decl(metadataOfClassFromModule.ts, 0, 17)) +>leftLeg : Symbol(Person.leftLeg, Decl(metadataOfClassFromModule.ts, 6, 25)) +>Leg : Symbol(Leg, Decl(metadataOfClassFromModule.ts, 2, 62)) + } + +} diff --git a/tests/baselines/reference/metadataOfClassFromModule.types b/tests/baselines/reference/metadataOfClassFromModule.types new file mode 100644 index 00000000000..eeb24bf82aa --- /dev/null +++ b/tests/baselines/reference/metadataOfClassFromModule.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/metadataOfClassFromModule.ts === +module MyModule { +>MyModule : typeof MyModule + + export function inject(target: any, key: string): void { } +>inject : (target: any, key: string) => void +>target : any +>key : string + + export class Leg { } +>Leg : Leg + + export class Person { +>Person : Person + + @inject leftLeg: Leg; +>inject : (target: any, key: string) => void +>leftLeg : Leg +>Leg : Leg + } + +} diff --git a/tests/cases/compiler/metadataOfClassFromModule.ts b/tests/cases/compiler/metadataOfClassFromModule.ts new file mode 100644 index 00000000000..aca356f2247 --- /dev/null +++ b/tests/cases/compiler/metadataOfClassFromModule.ts @@ -0,0 +1,14 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +// @target: es5 +module MyModule { + + export function inject(target: any, key: string): void { } + + export class Leg { } + + export class Person { + @inject leftLeg: Leg; + } + +} \ No newline at end of file From 08e6b1bc4872374f13acf5d75c3c54643c6137b9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Dec 2016 12:29:52 -0800 Subject: [PATCH 154/289] Update current scope when visiting namespace elements Fixes #13098 --- src/compiler/transformers/ts.ts | 2 +- tests/baselines/reference/metadataOfClassFromModule.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index f791025807a..775f60355d8 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -2731,7 +2731,7 @@ namespace ts { let blockLocation: TextRange; const body = node.body; if (body.kind === SyntaxKind.ModuleBlock) { - addRange(statements, visitNodes((body).statements, namespaceElementVisitor, isStatement)); + saveStateAndInvoke(body, body => addRange(statements, visitNodes((body).statements, namespaceElementVisitor, isStatement))); statementsLocation = (body).statements; blockLocation = body; } diff --git a/tests/baselines/reference/metadataOfClassFromModule.js b/tests/baselines/reference/metadataOfClassFromModule.js index 8d9f97489f2..8ef120600df 100644 --- a/tests/baselines/reference/metadataOfClassFromModule.js +++ b/tests/baselines/reference/metadataOfClassFromModule.js @@ -38,7 +38,7 @@ var MyModule; }()); __decorate([ inject, - __metadata("design:type", Object) + __metadata("design:type", Leg) ], Person.prototype, "leftLeg", void 0); MyModule.Person = Person; })(MyModule || (MyModule = {})); From db1fda5e7755d3838f3131fc5f15175dc04197f4 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Tue, 20 Dec 2016 17:55:14 +0300 Subject: [PATCH 155/289] Improve diagnostic message for negative old style literals --- src/compiler/checker.ts | 12 +++++++++--- src/compiler/diagnosticMessages.json | 6 +++--- src/compiler/utilities.ts | 5 +++++ tests/baselines/reference/literals.errors.txt | 6 +++--- .../reference/oldStyleOctalLiteralTypes.errors.txt | 6 +++--- .../reference/scannerNumericLiteral8.errors.txt | 6 +++--- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 16b8c119b63..2b815c40aba 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21857,11 +21857,17 @@ namespace ts { function checkGrammarNumericLiteral(node: NumericLiteral): boolean { // Grammar checking if (node.isOctalLiteral) { + let diagnosticMessage: DiagnosticMessage | undefined; if (languageVersion >= ScriptTarget.ES5) { - return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0o_0, node.text); + diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - if (isChildOfLiteralType(node)) { - return grammarErrorOnNode(node, Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0o_0, node.text); + else if (isChildOfLiteralType(node)) { + diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + if (diagnosticMessage) { + const withMinus = isMinusPrefixUnaryExpression(node.parent); + const literal = `${withMinus ? "-" : ""}0o${node.text}`; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6d19826e951..7b2208e4ca1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -227,7 +227,7 @@ "category": "Error", "code": 1084 }, - "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o{0}'.": { + "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'.": { "category": "Error", "code": 1085 }, @@ -2952,7 +2952,7 @@ "Resolution for module '{0}' was found in cache": { "category": "Message", "code": 6147 - }, + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -3243,7 +3243,7 @@ "category": "Message", "code": 90015 }, - "Octal literal types must use ES2015 syntax. Use the syntax '0o{0}'.": { + "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { "category": "Error", "code": 8017 } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c542fdb74f8..f272805ced2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -742,6 +742,11 @@ namespace ts { return false; } + export function isMinusPrefixUnaryExpression(node: Node): boolean { + return node.kind === SyntaxKind.PrefixUnaryExpression && + (node as PrefixUnaryExpression).operator === SyntaxKind.MinusToken; + } + // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. export function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T { diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index 2920498bde4..6fa1d7d3abd 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: Th tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. -tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. +tests/cases/conformance/expressions/literals/literals.ts(25,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. ==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ==== @@ -42,8 +42,8 @@ tests/cases/conformance/expressions/literals/literals.ts(25,10): error TS1085: O var n = -1.0; var n = -1e-4; var n = -003; // Error in ES5 - ~~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. + ~~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. var n = -0x1; var s: string; diff --git a/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt index 4dc81f370a4..7d42963b05d 100644 --- a/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt +++ b/tests/baselines/reference/oldStyleOctalLiteralTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. -tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. +tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. ==== tests/cases/compiler/oldStyleOctalLiteralTypes.ts (2 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/oldStyleOctalLiteralTypes.ts(2,9): error TS8017: Octal lite ~~~ !!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. let y: -020; - ~~~ -!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o20'. + ~~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. \ No newline at end of file diff --git a/tests/baselines/reference/scannerNumericLiteral8.errors.txt b/tests/baselines/reference/scannerNumericLiteral8.errors.txt index 5aad01449f2..6545050afc2 100644 --- a/tests/baselines/reference/scannerNumericLiteral8.errors.txt +++ b/tests/baselines/reference/scannerNumericLiteral8.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,2): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. +tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts(1,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. ==== tests/cases/conformance/scanner/ecmascript5/scannerNumericLiteral8.ts (1 errors) ==== -03 - ~~ -!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o3'. \ No newline at end of file + ~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. \ No newline at end of file From 23faaff03284d1414ce5374fddf59df4686cc06a Mon Sep 17 00:00:00 2001 From: arusakov Date: Thu, 22 Dec 2016 00:56:39 +0300 Subject: [PATCH 156/289] isMinusPrefixUnaryExpression() -> isPrefixUnaryExpression() after code review --- src/compiler/checker.ts | 2 +- src/compiler/utilities.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2b815c40aba..425d149db39 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21865,7 +21865,7 @@ namespace ts { diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } if (diagnosticMessage) { - const withMinus = isMinusPrefixUnaryExpression(node.parent); + const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken; const literal = `${withMinus ? "-" : ""}0o${node.text}`; return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f272805ced2..edfbe639d25 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -742,9 +742,8 @@ namespace ts { return false; } - export function isMinusPrefixUnaryExpression(node: Node): boolean { - return node.kind === SyntaxKind.PrefixUnaryExpression && - (node as PrefixUnaryExpression).operator === SyntaxKind.MinusToken; + export function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression { + return node.kind === SyntaxKind.PrefixUnaryExpression; } // Warning: This has the same semantics as the forEach family of functions, From 4620fbd551eb659d68cbb475f242d436ffd8a9ea Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 21 Dec 2016 15:14:34 -0800 Subject: [PATCH 157/289] PR Feedback --- src/compiler/transformers/es2015.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 2f00f66767f..e295ba11526 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -569,7 +569,7 @@ namespace ts { function visitThisKeyword(node: Node): Node { if (convertedLoopState) { if (hierarchyFacts & HierarchyFacts.ArrowFunction) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. + // if the enclosing function is an ArrowFunction then we use the captured 'this' keyword. convertedLoopState.containsLexicalThis = true; return node; } @@ -1445,6 +1445,10 @@ namespace ts { createVoidZero() ); break; + + default: + Debug.failBadSyntaxKind(node); + break; } const captureNewTargetStatement = createVariableStatement( From 82be6d1746011f3a5e7a5fb0a2efa85a2a12226e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 11:03:20 +0900 Subject: [PATCH 158/289] Format destructuring by brace format option --- src/services/formatting/rules.ts | 12 ++++++++---- tests/cases/fourslash/formattingOptionsChange.ts | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index a6bec97ed53..7cb682e2ffa 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -292,10 +292,10 @@ namespace ts.formatting { this.SpaceBeforeOpenBraceInControl = new Rule(RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); - this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space)); - this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Delete)); + this.SpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space)); + this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Space)); + this.NoSpaceAfterOpenBrace = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsBraceWrappedContext), RuleAction.Delete)); this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete)); // Insert new line after { and before } in multi-line contexts. @@ -615,6 +615,10 @@ namespace ts.formatting { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); } + static IsBraceWrappedContext(context: FormattingContext): boolean { + return context.contextNode.kind === SyntaxKind.ObjectBindingPattern || Rules.IsSingleLineBlockContext(context); + } + // This check is done before an open brace in a control construct, a function, or a typescript block declaration static IsBeforeMultilineBlockContext(context: FormattingContext): boolean { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index 63d51eec0ca..5726a57da57 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -13,7 +13,7 @@ ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' }; runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); @@ -26,7 +26,7 @@ runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }` runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 };", "{var t = 1};"); +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' };", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'};"); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { From ebe2fdb4c831bbd43a7873e869f072aff6dcaaaf Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Fri, 25 Nov 2016 18:54:01 +0800 Subject: [PATCH 159/289] Fix #1809, introduce non primitive type --- src/compiler/binder.ts | 2 ++ src/compiler/checker.ts | 13 +++++++++++++ src/compiler/scanner.ts | 1 + src/compiler/types.ts | 3 +++ 4 files changed, 19 insertions(+) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a6f5993f6c8..4b7d1d7b274 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3145,6 +3145,7 @@ namespace ts { case SyntaxKind.AnyKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.NeverKeyword: + case SyntaxKind.ObjectKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: @@ -3343,6 +3344,7 @@ namespace ts { case SyntaxKind.NumberKeyword: case SyntaxKind.NeverKeyword: case SyntaxKind.StringKeyword: + case SyntaxKind.ObjectKeyword: case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a27e8ba524d..39832dfcb35 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -146,6 +146,7 @@ namespace ts { const silentNeverType = createIntrinsicType(TypeFlags.Never, "never"); const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const nonPrimitiveType = createNonPrimitiveType(); const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral | SymbolFlags.Transient, "__type"); emptyTypeLiteralSymbol.members = createMap(); @@ -1684,6 +1685,14 @@ namespace ts { return type; } + function createNonPrimitiveType(): NonPrimitiveType { + const type = setStructuredTypeMembers( + createObjectType(ObjectFlags.NonPrimitive, undefined), + emptySymbols, emptyArray, emptyArray, undefined, undefined); + type.intrinsicName = "object"; + return type; + } + function createObjectType(objectFlags: ObjectFlags, symbol?: Symbol): ObjectType { const type = createType(TypeFlags.Object); type.objectFlags = objectFlags; @@ -4178,6 +4187,7 @@ namespace ts { case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: + case SyntaxKind.ObjectKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NullKeyword: @@ -6384,6 +6394,8 @@ namespace ts { return nullType; case SyntaxKind.NeverKeyword: return neverType; + case SyntaxKind.ObjectKeyword: + return nonPrimitiveType; case SyntaxKind.JSDocNullKeyword: return nullType; case SyntaxKind.JSDocUndefinedKeyword: @@ -7139,6 +7151,7 @@ namespace ts { if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum && isEnumTypeRelatedTo(source, target, errorReporter)) return true; if (source.flags & TypeFlags.Undefined && (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void))) return true; if (source.flags & TypeFlags.Null && (!strictNullChecks || target.flags & TypeFlags.Null)) return true; + if (source.flags & TypeFlags.Object && (source).objectFlags & ObjectFlags.NonPrimitive && target.flags & TypeFlags.Primitive) return false; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & TypeFlags.Any) return true; if ((source.flags & TypeFlags.Number | source.flags & TypeFlags.NumberLiteral) && target.flags & TypeFlags.EnumLike) return true; diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 82302e98e37..ad8781aecec 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -98,6 +98,7 @@ namespace ts { "new": SyntaxKind.NewKeyword, "null": SyntaxKind.NullKeyword, "number": SyntaxKind.NumberKeyword, + "object": SyntaxKind.ObjectKeyword, "package": SyntaxKind.PackageKeyword, "private": SyntaxKind.PrivateKeyword, "protected": SyntaxKind.ProtectedKeyword, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1ee59149b2c..db919b56449 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -175,6 +175,7 @@ namespace ts { ReadonlyKeyword, RequireKeyword, NumberKeyword, + ObjectKeyword, SetKeyword, StringKeyword, SymbolKeyword, @@ -816,6 +817,7 @@ namespace ts { export interface KeywordTypeNode extends TypeNode { kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword + | SyntaxKind.ObjectKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword @@ -2857,6 +2859,7 @@ namespace ts { ObjectLiteral = 1 << 7, // Originates in an object literal EvolvingArray = 1 << 8, // Evolving array type ObjectLiteralPatternWithComputedProperties = 1 << 9, // Object literal pattern with computed properties + NonPrimitive = 1 << 10, // NonPrimitive object type ClassOrInterface = Class | Interface } From db9dd387b169475239a22dac398bcc8dc2cf887a Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Fri, 25 Nov 2016 20:20:15 +0800 Subject: [PATCH 160/289] enable parsing --- src/compiler/parser.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 2f0d6a4d975..5bf9ce789c1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2507,6 +2507,7 @@ namespace ts { case SyntaxKind.SymbolKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NeverKeyword: + case SyntaxKind.ObjectKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. const node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -2565,6 +2566,7 @@ namespace ts { case SyntaxKind.NumericLiteral: case SyntaxKind.TrueKeyword: case SyntaxKind.FalseKeyword: + case SyntaxKind.ObjectKeyword: return true; case SyntaxKind.MinusToken: return lookAhead(nextTokenIsNumericLiteral); @@ -6026,6 +6028,7 @@ namespace ts { case SyntaxKind.NullKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NeverKeyword: + case SyntaxKind.ObjectKeyword: return parseTokenNode(); case SyntaxKind.StringLiteral: case SyntaxKind.NumericLiteral: From ce4c95f332975ea5c2fd18e5c17bf4443056b5b1 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Fri, 25 Nov 2016 22:24:31 +0800 Subject: [PATCH 161/289] fix error reporting --- src/compiler/checker.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 39832dfcb35..c863e2fd2c7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1685,11 +1685,10 @@ namespace ts { return type; } - function createNonPrimitiveType(): NonPrimitiveType { - const type = setStructuredTypeMembers( + function createNonPrimitiveType(): ResolvedType { + const type = setStructuredTypeMembers( createObjectType(ObjectFlags.NonPrimitive, undefined), emptySymbols, emptyArray, emptyArray, undefined, undefined); - type.intrinsicName = "object"; return type; } @@ -2321,6 +2320,9 @@ namespace ts { else if (type.flags & TypeFlags.UnionOrIntersection) { writeUnionOrIntersectionType(type, nextFlags); } + else if (getObjectFlags(type) & ObjectFlags.NonPrimitive) { + writer.writeKeyword("object"); + } else if (getObjectFlags(type) & (ObjectFlags.Anonymous | ObjectFlags.Mapped)) { writeAnonymousType(type, nextFlags); } @@ -3087,6 +3089,10 @@ namespace ts { return type && (type.flags & TypeFlags.Never) !== 0; } + function isTypeNonPrimitive(type: Type) { + return type === nonPrimitiveType; + } + // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node: VariableLikeDeclaration) { @@ -7151,7 +7157,6 @@ namespace ts { if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum && isEnumTypeRelatedTo(source, target, errorReporter)) return true; if (source.flags & TypeFlags.Undefined && (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void))) return true; if (source.flags & TypeFlags.Null && (!strictNullChecks || target.flags & TypeFlags.Null)) return true; - if (source.flags & TypeFlags.Object && (source).objectFlags & ObjectFlags.NonPrimitive && target.flags & TypeFlags.Primitive) return false; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & TypeFlags.Any) return true; if ((source.flags & TypeFlags.Number | source.flags & TypeFlags.NumberLiteral) && target.flags & TypeFlags.EnumLike) return true; @@ -7470,7 +7475,7 @@ namespace ts { } } } - else { + else if (!(source.flags & TypeFlags.Primitive && isTypeNonPrimitive(target))) { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { @@ -18085,6 +18090,7 @@ namespace ts { case "string": case "symbol": case "void": + case "object": error(name, message, (name).text); } } From b8648fa9f63e7fd55e1793a96ab9bfaf4d483451 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Sat, 26 Nov 2016 00:32:55 +0800 Subject: [PATCH 162/289] add tests for non primitive type --- .../reference/assignObjectToNonPrimitive.js | 14 ++++++ .../assignObjectToNonPrimitive.symbols | 19 ++++++++ .../assignObjectToNonPrimitive.types | 24 ++++++++++ .../nonPriimitiveInFunction.errors.txt | 31 +++++++++++++ .../reference/nonPriimitiveInFunction.js | 36 +++++++++++++++ .../nonPrimitiveAsProperty.errors.txt | 18 ++++++++ .../reference/nonPrimitiveAsProperty.js | 13 ++++++ .../nonPrimitiveAssignError.errors.txt | 44 +++++++++++++++++++ .../reference/nonPrimitiveAssignError.js | 35 +++++++++++++++ .../nonPrimitiveInGeneric.errors.txt | 31 +++++++++++++ .../reference/nonPrimitiveInGeneric.js | 31 +++++++++++++ .../nonPrimitiveUnionIntersection.errors.txt | 18 ++++++++ .../nonPrimitiveUnionIntersection.js | 12 +++++ .../reservedNamesInAliases.errors.txt | 9 +++- .../reference/reservedNamesInAliases.js | 4 +- .../assignObjectToNonPrimitive.ts | 5 +++ .../nonPrimitive/nonPriimitiveInFunction.ts | 18 ++++++++ .../nonPrimitive/nonPrimitiveAsProperty.ts | 7 +++ .../nonPrimitive/nonPrimitiveAssignError.ts | 17 +++++++ .../nonPrimitive/nonPrimitiveInGeneric.ts | 15 +++++++ .../nonPrimitiveUnionIntersection.ts | 4 ++ .../typeAliases/reservedNamesInAliases.ts | 3 +- 22 files changed, 404 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/assignObjectToNonPrimitive.js create mode 100644 tests/baselines/reference/assignObjectToNonPrimitive.symbols create mode 100644 tests/baselines/reference/assignObjectToNonPrimitive.types create mode 100644 tests/baselines/reference/nonPriimitiveInFunction.errors.txt create mode 100644 tests/baselines/reference/nonPriimitiveInFunction.js create mode 100644 tests/baselines/reference/nonPrimitiveAsProperty.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveAsProperty.js create mode 100644 tests/baselines/reference/nonPrimitiveAssignError.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveAssignError.js create mode 100644 tests/baselines/reference/nonPrimitiveInGeneric.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveInGeneric.js create mode 100644 tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveUnionIntersection.js create mode 100644 tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts diff --git a/tests/baselines/reference/assignObjectToNonPrimitive.js b/tests/baselines/reference/assignObjectToNonPrimitive.js new file mode 100644 index 00000000000..ec0015fba8a --- /dev/null +++ b/tests/baselines/reference/assignObjectToNonPrimitive.js @@ -0,0 +1,14 @@ +//// [assignObjectToNonPrimitive.ts] +var x = {}; +var y = {foo: "bar"}; +var a: object; +a = x; +a = y; + + +//// [assignObjectToNonPrimitive.js] +var x = {}; +var y = { foo: "bar" }; +var a; +a = x; +a = y; diff --git a/tests/baselines/reference/assignObjectToNonPrimitive.symbols b/tests/baselines/reference/assignObjectToNonPrimitive.symbols new file mode 100644 index 00000000000..5c806e09b94 --- /dev/null +++ b/tests/baselines/reference/assignObjectToNonPrimitive.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts === +var x = {}; +>x : Symbol(x, Decl(assignObjectToNonPrimitive.ts, 0, 3)) + +var y = {foo: "bar"}; +>y : Symbol(y, Decl(assignObjectToNonPrimitive.ts, 1, 3)) +>foo : Symbol(foo, Decl(assignObjectToNonPrimitive.ts, 1, 9)) + +var a: object; +>a : Symbol(a, Decl(assignObjectToNonPrimitive.ts, 2, 3)) + +a = x; +>a : Symbol(a, Decl(assignObjectToNonPrimitive.ts, 2, 3)) +>x : Symbol(x, Decl(assignObjectToNonPrimitive.ts, 0, 3)) + +a = y; +>a : Symbol(a, Decl(assignObjectToNonPrimitive.ts, 2, 3)) +>y : Symbol(y, Decl(assignObjectToNonPrimitive.ts, 1, 3)) + diff --git a/tests/baselines/reference/assignObjectToNonPrimitive.types b/tests/baselines/reference/assignObjectToNonPrimitive.types new file mode 100644 index 00000000000..f16c2287155 --- /dev/null +++ b/tests/baselines/reference/assignObjectToNonPrimitive.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts === +var x = {}; +>x : {} +>{} : {} + +var y = {foo: "bar"}; +>y : { foo: string; } +>{foo: "bar"} : { foo: string; } +>foo : string +>"bar" : "bar" + +var a: object; +>a : object + +a = x; +>a = x : {} +>a : object +>x : {} + +a = y; +>a = y : { foo: string; } +>a : object +>y : { foo: string; } + diff --git a/tests/baselines/reference/nonPriimitiveInFunction.errors.txt b/tests/baselines/reference/nonPriimitiveInFunction.errors.txt new file mode 100644 index 00000000000..4b244cfcd04 --- /dev/null +++ b/tests/baselines/reference/nonPriimitiveInFunction.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(12,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(13,1): error TS2322: Type 'object' is not assignable to type 'boolean'. +tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(17,12): error TS2322: Type 'number' is not assignable to type 'object'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts (3 errors) ==== + function takeObject(o: object) {} + function returnObject(): object { + return {}; + } + + var nonPrimitive: object; + var primitive: boolean; + + takeObject(nonPrimitive); + nonPrimitive = returnObject(); + + takeObject(primitive); // expect error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object'. + primitive = returnObject(); // expect error + ~~~~~~~~~ +!!! error TS2322: Type 'object' is not assignable to type 'boolean'. + + function returnError(): object { + var ret = 123; + return ret; // expect error + ~~~ +!!! error TS2322: Type 'number' is not assignable to type 'object'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/nonPriimitiveInFunction.js b/tests/baselines/reference/nonPriimitiveInFunction.js new file mode 100644 index 00000000000..a534ea7c84e --- /dev/null +++ b/tests/baselines/reference/nonPriimitiveInFunction.js @@ -0,0 +1,36 @@ +//// [nonPriimitiveInFunction.ts] +function takeObject(o: object) {} +function returnObject(): object { + return {}; +} + +var nonPrimitive: object; +var primitive: boolean; + +takeObject(nonPrimitive); +nonPrimitive = returnObject(); + +takeObject(primitive); // expect error +primitive = returnObject(); // expect error + +function returnError(): object { + var ret = 123; + return ret; // expect error +} + + +//// [nonPriimitiveInFunction.js] +function takeObject(o) { } +function returnObject() { + return {}; +} +var nonPrimitive; +var primitive; +takeObject(nonPrimitive); +nonPrimitive = returnObject(); +takeObject(primitive); // expect error +primitive = returnObject(); // expect error +function returnError() { + var ret = 123; + return ret; // expect error +} diff --git a/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt b/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt new file mode 100644 index 00000000000..8d4042c92f0 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAsProperty.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts(7,5): error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'. + Types of property 'foo' are incompatible. + Type 'string' is not assignable to type 'object'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts (1 errors) ==== + interface WithNonPrimitive { + foo: object + } + + var a: WithNonPrimitive = { foo: {bar: "bar"} }; + + var b: WithNonPrimitive = {foo: "bar"}; // expect error + ~ +!!! error TS2322: Type '{ foo: string; }' is not assignable to type 'WithNonPrimitive'. +!!! error TS2322: Types of property 'foo' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'object'. + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveAsProperty.js b/tests/baselines/reference/nonPrimitiveAsProperty.js new file mode 100644 index 00000000000..f51a9b35435 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAsProperty.js @@ -0,0 +1,13 @@ +//// [nonPrimitiveAsProperty.ts] +interface WithNonPrimitive { + foo: object +} + +var a: WithNonPrimitive = { foo: {bar: "bar"} }; + +var b: WithNonPrimitive = {foo: "bar"}; // expect error + + +//// [nonPrimitiveAsProperty.js] +var a = { foo: { bar: "bar" } }; +var b = { foo: "bar" }; // expect error diff --git a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt new file mode 100644 index 00000000000..4fdd4649824 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt @@ -0,0 +1,44 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(5,1): error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. + Property 'foo' is missing in type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(11,1): error TS2322: Type 'number' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(12,1): error TS2322: Type 'true' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(13,1): error TS2322: Type 'string' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(15,1): error TS2322: Type 'object' is not assignable to type 'number'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(16,1): error TS2322: Type 'object' is not assignable to type 'boolean'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): error TS2322: Type 'object' is not assignable to type 'string'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts (7 errors) ==== + var x = {}; + var y = {foo: "bar"}; + var a: object; + x = a; + y = a; // expect error + ~ +!!! error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. +!!! error TS2322: Property 'foo' is missing in type 'object'. + + var n = 123; + var b = true; + var s = "fooo"; + + a = n; // expect error + ~ +!!! error TS2322: Type 'number' is not assignable to type 'object'. + a = b; // expect error + ~ +!!! error TS2322: Type 'true' is not assignable to type 'object'. + a = s; // expect error + ~ +!!! error TS2322: Type 'string' is not assignable to type 'object'. + + n = a; // expect error + ~ +!!! error TS2322: Type 'object' is not assignable to type 'number'. + b = a; // expect error + ~ +!!! error TS2322: Type 'object' is not assignable to type 'boolean'. + s = a; // expect error + ~ +!!! error TS2322: Type 'object' is not assignable to type 'string'. + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveAssignError.js b/tests/baselines/reference/nonPrimitiveAssignError.js new file mode 100644 index 00000000000..67f21bcf178 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAssignError.js @@ -0,0 +1,35 @@ +//// [nonPrimitiveAssignError.ts] +var x = {}; +var y = {foo: "bar"}; +var a: object; +x = a; +y = a; // expect error + +var n = 123; +var b = true; +var s = "fooo"; + +a = n; // expect error +a = b; // expect error +a = s; // expect error + +n = a; // expect error +b = a; // expect error +s = a; // expect error + + +//// [nonPrimitiveAssignError.js] +var x = {}; +var y = { foo: "bar" }; +var a; +x = a; +y = a; // expect error +var n = 123; +var b = true; +var s = "fooo"; +a = n; // expect error +a = b; // expect error +a = s; // expect error +n = a; // expect error +b = a; // expect error +s = a; // expect error diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt new file mode 100644 index 00000000000..db359cd43af --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(7,17): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(8,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(14,7): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (4 errors) ==== + function generic(t: T) {} + var a = {}; + var b = "42"; + + generic({}); + generic(a); + generic(123); // expect error + ~~~ +!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. + generic(b); // expect error + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. + + function bound(t: T) {} + + bound({}); + bound(a); + bound(123); // expect error + ~~~ +!!! error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. + bound(b); // expect error + ~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.js b/tests/baselines/reference/nonPrimitiveInGeneric.js new file mode 100644 index 00000000000..82439509234 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveInGeneric.js @@ -0,0 +1,31 @@ +//// [nonPrimitiveInGeneric.ts] +function generic(t: T) {} +var a = {}; +var b = "42"; + +generic({}); +generic(a); +generic(123); // expect error +generic(b); // expect error + +function bound(t: T) {} + +bound({}); +bound(a); +bound(123); // expect error +bound(b); // expect error + + +//// [nonPrimitiveInGeneric.js] +function generic(t) { } +var a = {}; +var b = "42"; +generic({}); +generic(a); +generic(123); // expect error +generic(b); // expect error +function bound(t) { } +bound({}); +bound(a); +bound(123); // expect error +bound(b); // expect error diff --git a/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt b/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt new file mode 100644 index 00000000000..5fb1e89c2e3 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveUnionIntersection.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(1,5): error TS2322: Type '""' is not assignable to type 'object & string'. + Type '""' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts(3,1): error TS2322: Type 'string' is not assignable to type 'object & string'. + Type 'string' is not assignable to type 'object'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts (2 errors) ==== + var a: object & string = ""; // error + ~ +!!! error TS2322: Type '""' is not assignable to type 'object & string'. +!!! error TS2322: Type '""' is not assignable to type 'object'. + var b: object | string = ""; // ok + a = b; // error + ~ +!!! error TS2322: Type 'string' is not assignable to type 'object & string'. +!!! error TS2322: Type 'string' is not assignable to type 'object'. + b = a; // ok + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveUnionIntersection.js b/tests/baselines/reference/nonPrimitiveUnionIntersection.js new file mode 100644 index 00000000000..c50a2330018 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveUnionIntersection.js @@ -0,0 +1,12 @@ +//// [nonPrimitiveUnionIntersection.ts] +var a: object & string = ""; // error +var b: object | string = ""; // ok +a = b; // error +b = a; // ok + + +//// [nonPrimitiveUnionIntersection.js] +var a = ""; // error +var b = ""; // ok +a = b; // error +b = a; // ok diff --git a/tests/baselines/reference/reservedNamesInAliases.errors.txt b/tests/baselines/reference/reservedNamesInAliases.errors.txt index b6565427395..22894f8f6a6 100644 --- a/tests/baselines/reference/reservedNamesInAliases.errors.txt +++ b/tests/baselines/reference/reservedNamesInAliases.errors.txt @@ -6,9 +6,10 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,1): error tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,6): error TS1005: ';' expected. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,11): error TS1109: Expression expected. tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error TS2693: 'I' only refers to a type, but is being used as a value here. +tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(7,6): error TS2457: Type alias name cannot be 'object' -==== tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts (8 errors) ==== +==== tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts (9 errors) ==== interface I {} type any = I; ~~~ @@ -30,4 +31,8 @@ tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts(6,13): error ~ !!! error TS1109: Expression expected. ~ -!!! error TS2693: 'I' only refers to a type, but is being used as a value here. \ No newline at end of file +!!! error TS2693: 'I' only refers to a type, but is being used as a value here. + type object = I; + ~~~~~~ +!!! error TS2457: Type alias name cannot be 'object' + \ No newline at end of file diff --git a/tests/baselines/reference/reservedNamesInAliases.js b/tests/baselines/reference/reservedNamesInAliases.js index 4ebc3bdb95f..368331d3114 100644 --- a/tests/baselines/reference/reservedNamesInAliases.js +++ b/tests/baselines/reference/reservedNamesInAliases.js @@ -4,7 +4,9 @@ type any = I; type number = I; type boolean = I; type string = I; -type void = I; +type void = I; +type object = I; + //// [reservedNamesInAliases.js] type; diff --git a/tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts b/tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts new file mode 100644 index 00000000000..e9dcb5671c5 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/assignObjectToNonPrimitive.ts @@ -0,0 +1,5 @@ +var x = {}; +var y = {foo: "bar"}; +var a: object; +a = x; +a = y; diff --git a/tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts b/tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts new file mode 100644 index 00000000000..c38693dbfb1 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts @@ -0,0 +1,18 @@ +function takeObject(o: object) {} +function returnObject(): object { + return {}; +} + +var nonPrimitive: object; +var primitive: boolean; + +takeObject(nonPrimitive); +nonPrimitive = returnObject(); + +takeObject(primitive); // expect error +primitive = returnObject(); // expect error + +function returnError(): object { + var ret = 123; + return ret; // expect error +} diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts new file mode 100644 index 00000000000..ee4011ecf7d --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts @@ -0,0 +1,7 @@ +interface WithNonPrimitive { + foo: object +} + +var a: WithNonPrimitive = { foo: {bar: "bar"} }; + +var b: WithNonPrimitive = {foo: "bar"}; // expect error diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts new file mode 100644 index 00000000000..f177b5cd255 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts @@ -0,0 +1,17 @@ +var x = {}; +var y = {foo: "bar"}; +var a: object; +x = a; +y = a; // expect error + +var n = 123; +var b = true; +var s = "fooo"; + +a = n; // expect error +a = b; // expect error +a = s; // expect error + +n = a; // expect error +b = a; // expect error +s = a; // expect error diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts new file mode 100644 index 00000000000..0e7914ab715 --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts @@ -0,0 +1,15 @@ +function generic(t: T) {} +var a = {}; +var b = "42"; + +generic({}); +generic(a); +generic(123); // expect error +generic(b); // expect error + +function bound(t: T) {} + +bound({}); +bound(a); +bound(123); // expect error +bound(b); // expect error diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts new file mode 100644 index 00000000000..c1667c7a32e --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts @@ -0,0 +1,4 @@ +var a: object & string = ""; // error +var b: object | string = ""; // ok +a = b; // error +b = a; // ok diff --git a/tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts b/tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts index 3b115573830..f2c6476bd8e 100644 --- a/tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts +++ b/tests/cases/conformance/types/typeAliases/reservedNamesInAliases.ts @@ -3,4 +3,5 @@ type any = I; type number = I; type boolean = I; type string = I; -type void = I; \ No newline at end of file +type void = I; +type object = I; From 2fb51e71125a9100c69c8673f3adb65ecbb5be81 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Sat, 26 Nov 2016 12:49:55 +0800 Subject: [PATCH 163/289] address code review feedback --- src/compiler/checker.ts | 6 +-- .../nonPrimitiveAccessProperty.ts | 3 ++ .../nonPrimitive/nonPrimitiveAssignError.ts | 8 ++++ .../nonPrimitive/nonPrimitiveInGeneric.ts | 7 +++ .../types/nonPrimitive/nonPrimitiveNarrow.ts | 22 +++++++++ .../nonPrimitive/nonPrimitiveStrictNull.ts | 48 +++++++++++++++++++ 6 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts create mode 100644 tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c863e2fd2c7..a1fae5ebbd3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3089,10 +3089,6 @@ namespace ts { return type && (type.flags & TypeFlags.Never) !== 0; } - function isTypeNonPrimitive(type: Type) { - return type === nonPrimitiveType; - } - // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node: VariableLikeDeclaration) { @@ -7475,7 +7471,7 @@ namespace ts { } } } - else if (!(source.flags & TypeFlags.Primitive && isTypeNonPrimitive(target))) { + else if (!(source.flags & TypeFlags.Primitive && target === nonPrimitiveType)) { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts new file mode 100644 index 00000000000..2febbb1e2ca --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts @@ -0,0 +1,3 @@ +var a: object; +a.toString(); +a.nonExist(); // error diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts index f177b5cd255..8fe8c8a3ebb 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts @@ -15,3 +15,11 @@ a = s; // expect error n = a; // expect error b = a; // expect error s = a; // expect error + +var numObj: Number = 123; +var boolObj: Boolean = true; +var strObj: String = "string"; + +a = numObj; // ok +a = boolObj; // ok +a = strObj; // ok diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts index 0e7914ab715..0de4771a5ef 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts @@ -13,3 +13,10 @@ bound({}); bound(a); bound(123); // expect error bound(b); // expect error + +function bound2() {} + +bound2<{}>(); +bound2(); +bound2(); // expect error +bound2(); // expect error diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts new file mode 100644 index 00000000000..04f7351290e --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts @@ -0,0 +1,22 @@ +class Narrow { + narrowed: boolean +} + +var a: object + +if (a instanceof Narrow) { + a.narrowed; // ok + a = 123; // error +} + +if (typeof a === 'number') { + a.toFixed(); // error, never +} + +var b: object | null + +if (typeof b === 'object') { + b.toString(); // error, object | null +} else { + b.toString(); // error, never +} diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts new file mode 100644 index 00000000000..5fbf85dc01b --- /dev/null +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts @@ -0,0 +1,48 @@ +// @strictNullChecks: true + +var a: object +declare var b: object | null +declare var c: object | undefined +declare var d: object | null | undefined +var e: object | null +a.toString; // error +a = undefined; // error +a = null; // error +a = b; // error +a = c; // error +a = d; // error + +e = a; // ok +a = e; // ok + +if (typeof b !== 'object') { + b.toString(); // error, never +} + +if (typeof b === 'object') { + a = b; // error, b is not narrowed +} + +if (typeof d === 'object') { + b = d; // ok +} else { + d; // undefined +} + +if (d == null) { + d; // null | undefined +} else { + d.toString(); // object +} + +if (d === null) { + d; // null +} else { + d.toString(); // error, object | undefined +} + +if (typeof d === 'undefined') { + d; // undefined +} else { + d.toString(); // error, object | null +} From c19221cb3e90dc8064a240731ca77e05d3eb5fae Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Sat, 26 Nov 2016 13:09:20 +0800 Subject: [PATCH 164/289] accept new baselines --- .../nonPrimitiveAccessProperty.errors.txt | 10 ++ .../reference/nonPrimitiveAccessProperty.js | 10 ++ .../nonPrimitiveAssignError.errors.txt | 8 ++ .../reference/nonPrimitiveAssignError.js | 14 +++ .../nonPrimitiveInGeneric.errors.txt | 15 ++- .../reference/nonPrimitiveInGeneric.js | 12 ++ .../reference/nonPrimitiveNarrow.errors.txt | 35 ++++++ .../baselines/reference/nonPrimitiveNarrow.js | 46 +++++++ .../nonPrimitiveStrictNull.errors.txt | 117 ++++++++++++++++++ .../reference/nonPrimitiveStrictNull.js | 93 ++++++++++++++ .../types/nonPrimitive/nonPrimitiveNarrow.ts | 2 +- .../nonPrimitive/nonPrimitiveStrictNull.ts | 9 +- 12 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/nonPrimitiveAccessProperty.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveAccessProperty.js create mode 100644 tests/baselines/reference/nonPrimitiveNarrow.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveNarrow.js create mode 100644 tests/baselines/reference/nonPrimitiveStrictNull.errors.txt create mode 100644 tests/baselines/reference/nonPrimitiveStrictNull.js diff --git a/tests/baselines/reference/nonPrimitiveAccessProperty.errors.txt b/tests/baselines/reference/nonPrimitiveAccessProperty.errors.txt new file mode 100644 index 00000000000..8ef94c64448 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAccessProperty.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts(3,3): error TS2339: Property 'nonExist' does not exist on type 'object'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAccessProperty.ts (1 errors) ==== + var a: object; + a.toString(); + a.nonExist(); // error + ~~~~~~~~ +!!! error TS2339: Property 'nonExist' does not exist on type 'object'. + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveAccessProperty.js b/tests/baselines/reference/nonPrimitiveAccessProperty.js new file mode 100644 index 00000000000..a71b2aba865 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveAccessProperty.js @@ -0,0 +1,10 @@ +//// [nonPrimitiveAccessProperty.ts] +var a: object; +a.toString(); +a.nonExist(); // error + + +//// [nonPrimitiveAccessProperty.js] +var a; +a.toString(); +a.nonExist(); // error diff --git a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt index 4fdd4649824..093445570fe 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt @@ -41,4 +41,12 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): err s = a; // expect error ~ !!! error TS2322: Type 'object' is not assignable to type 'string'. + + var numObj: Number = 123; + var boolObj: Boolean = true; + var strObj: String = "string"; + + a = numObj; // ok + a = boolObj; // ok + a = strObj; // ok \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveAssignError.js b/tests/baselines/reference/nonPrimitiveAssignError.js index 67f21bcf178..e7bb56746ca 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.js +++ b/tests/baselines/reference/nonPrimitiveAssignError.js @@ -16,6 +16,14 @@ a = s; // expect error n = a; // expect error b = a; // expect error s = a; // expect error + +var numObj: Number = 123; +var boolObj: Boolean = true; +var strObj: String = "string"; + +a = numObj; // ok +a = boolObj; // ok +a = strObj; // ok //// [nonPrimitiveAssignError.js] @@ -33,3 +41,9 @@ a = s; // expect error n = a; // expect error b = a; // expect error s = a; // expect error +var numObj = 123; +var boolObj = true; +var strObj = "string"; +a = numObj; // ok +a = boolObj; // ok +a = strObj; // ok diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt index db359cd43af..ab8786c37bc 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt @@ -2,9 +2,11 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(7,17): error tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(8,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(14,7): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(21,8): error TS2344: Type 'number' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(22,8): error TS2344: Type 'string' does not satisfy the constraint 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (4 errors) ==== +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (6 errors) ==== function generic(t: T) {} var a = {}; var b = "42"; @@ -28,4 +30,15 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(15,7): error bound(b); // expect error ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. + + function bound2() {} + + bound2<{}>(); + bound2(); + bound2(); // expect error + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'object'. + bound2(); // expect error + ~~~~~~ +!!! error TS2344: Type 'string' does not satisfy the constraint 'object'. \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.js b/tests/baselines/reference/nonPrimitiveInGeneric.js index 82439509234..c2e19dde1e4 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.js +++ b/tests/baselines/reference/nonPrimitiveInGeneric.js @@ -14,6 +14,13 @@ bound({}); bound(a); bound(123); // expect error bound(b); // expect error + +function bound2() {} + +bound2<{}>(); +bound2(); +bound2(); // expect error +bound2(); // expect error //// [nonPrimitiveInGeneric.js] @@ -29,3 +36,8 @@ bound({}); bound(a); bound(123); // expect error bound(b); // expect error +function bound2() { } +bound2(); +bound2(); +bound2(); // expect error +bound2(); // expect error diff --git a/tests/baselines/reference/nonPrimitiveNarrow.errors.txt b/tests/baselines/reference/nonPrimitiveNarrow.errors.txt new file mode 100644 index 00000000000..1b3cf55b4b2 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveNarrow.errors.txt @@ -0,0 +1,35 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(9,5): error TS2322: Type '123' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(13,7): error TS2339: Property 'toFixed' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts(21,6): error TS2339: Property 'toString' does not exist on type 'never'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts (3 errors) ==== + class Narrow { + narrowed: boolean + } + + var a: object + + if (a instanceof Narrow) { + a.narrowed; // ok + a = 123; // error + ~ +!!! error TS2322: Type '123' is not assignable to type 'object'. + } + + if (typeof a === 'number') { + a.toFixed(); // error, never + ~~~~~~~ +!!! error TS2339: Property 'toFixed' does not exist on type 'never'. + } + + var b: object | null + + if (typeof b === 'object') { + b.toString(); // ok, object | null + } else { + b.toString(); // error, never + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveNarrow.js b/tests/baselines/reference/nonPrimitiveNarrow.js new file mode 100644 index 00000000000..607206eecfc --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveNarrow.js @@ -0,0 +1,46 @@ +//// [nonPrimitiveNarrow.ts] +class Narrow { + narrowed: boolean +} + +var a: object + +if (a instanceof Narrow) { + a.narrowed; // ok + a = 123; // error +} + +if (typeof a === 'number') { + a.toFixed(); // error, never +} + +var b: object | null + +if (typeof b === 'object') { + b.toString(); // ok, object | null +} else { + b.toString(); // error, never +} + + +//// [nonPrimitiveNarrow.js] +var Narrow = (function () { + function Narrow() { + } + return Narrow; +}()); +var a; +if (a instanceof Narrow) { + a.narrowed; // ok + a = 123; // error +} +if (typeof a === 'number') { + a.toFixed(); // error, never +} +var b; +if (typeof b === 'object') { + b.toString(); // ok, object | null +} +else { + b.toString(); // error, never +} diff --git a/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt new file mode 100644 index 00000000000..cf09994888b --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt @@ -0,0 +1,117 @@ +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(7,1): error TS2454: Variable 'a' is used before being assigned. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(8,1): error TS2322: Type 'undefined' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(9,1): error TS2322: Type 'null' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(10,1): error TS2322: Type 'object | null' is not assignable to type 'object'. + Type 'null' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(11,1): error TS2322: Type 'object | undefined' is not assignable to type 'object'. + Type 'undefined' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(12,1): error TS2322: Type 'object | null | undefined' is not assignable to type 'object'. + Type 'undefined' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(18,7): error TS2339: Property 'toString' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(22,5): error TS2322: Type 'object | null' is not assignable to type 'object'. + Type 'null' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(27,5): error TS2531: Object is possibly 'null'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(29,5): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(29,7): error TS2339: Property 'toString' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(33,5): error TS2533: Object is possibly 'null' or 'undefined'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(33,7): error TS2339: Property 'toString' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(39,5): error TS2531: Object is possibly 'null'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(39,7): error TS2339: Property 'toString' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(41,5): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,5): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,7): error TS2339: Property 'toString' does not exist on type 'never'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(47,5): error TS2531: Object is possibly 'null'. + + +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts (19 errors) ==== + + var a: object + declare var b: object | null + declare var c: object | undefined + declare var d: object | null | undefined + var e: object | null + a.toString; // error + ~ +!!! error TS2454: Variable 'a' is used before being assigned. + a = undefined; // error + ~ +!!! error TS2322: Type 'undefined' is not assignable to type 'object'. + a = null; // error + ~ +!!! error TS2322: Type 'null' is not assignable to type 'object'. + a = b; // error + ~ +!!! error TS2322: Type 'object | null' is not assignable to type 'object'. +!!! error TS2322: Type 'null' is not assignable to type 'object'. + a = c; // error + ~ +!!! error TS2322: Type 'object | undefined' is not assignable to type 'object'. +!!! error TS2322: Type 'undefined' is not assignable to type 'object'. + a = d; // error + ~ +!!! error TS2322: Type 'object | null | undefined' is not assignable to type 'object'. +!!! error TS2322: Type 'undefined' is not assignable to type 'object'. + + e = a; // ok + a = e; // ok + + if (typeof b !== 'object') { + b.toString(); // error, never + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } + + if (typeof b === 'object') { + a = b; // error, b is not narrowed + ~ +!!! error TS2322: Type 'object | null' is not assignable to type 'object'. +!!! error TS2322: Type 'null' is not assignable to type 'object'. + } + + if (typeof d === 'object') { + b = d; // ok + d.toString(); // error, object | null + ~ +!!! error TS2531: Object is possibly 'null'. + } else { + d.toString(); // error, undefined + ~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } + + if (d == null) { + d.toString(); // error, undefined | null + ~ +!!! error TS2533: Object is possibly 'null' or 'undefined'. + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } else { + d.toString(); // object + } + + if (d === null) { + d.toString(); // error, null + ~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } else { + d.toString(); // error, object | undefined + ~ +!!! error TS2532: Object is possibly 'undefined'. + } + + if (typeof d === 'undefined') { + d.toString(); // error, undefined + ~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~ +!!! error TS2339: Property 'toString' does not exist on type 'never'. + } else { + d.toString(); // error, object | null + ~ +!!! error TS2531: Object is possibly 'null'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveStrictNull.js b/tests/baselines/reference/nonPrimitiveStrictNull.js new file mode 100644 index 00000000000..c91097de960 --- /dev/null +++ b/tests/baselines/reference/nonPrimitiveStrictNull.js @@ -0,0 +1,93 @@ +//// [nonPrimitiveStrictNull.ts] + +var a: object +declare var b: object | null +declare var c: object | undefined +declare var d: object | null | undefined +var e: object | null +a.toString; // error +a = undefined; // error +a = null; // error +a = b; // error +a = c; // error +a = d; // error + +e = a; // ok +a = e; // ok + +if (typeof b !== 'object') { + b.toString(); // error, never +} + +if (typeof b === 'object') { + a = b; // error, b is not narrowed +} + +if (typeof d === 'object') { + b = d; // ok + d.toString(); // error, object | null +} else { + d.toString(); // error, undefined +} + +if (d == null) { + d.toString(); // error, undefined | null +} else { + d.toString(); // object +} + +if (d === null) { + d.toString(); // error, null +} else { + d.toString(); // error, object | undefined +} + +if (typeof d === 'undefined') { + d.toString(); // error, undefined +} else { + d.toString(); // error, object | null +} + + +//// [nonPrimitiveStrictNull.js] +var a; +var e; +a.toString; // error +a = undefined; // error +a = null; // error +a = b; // error +a = c; // error +a = d; // error +e = a; // ok +a = e; // ok +if (typeof b !== 'object') { + b.toString(); // error, never +} +if (typeof b === 'object') { + a = b; // error, b is not narrowed +} +if (typeof d === 'object') { + b = d; // ok + d.toString(); // error, object | null +} +else { + d.toString(); // error, undefined +} +if (d == null) { + d.toString(); // error, undefined | null +} +else { + d.toString(); // object +} +if (d === null) { + d.toString(); // error, null +} +else { + d.toString(); // error, object | undefined +} +if (typeof d === 'undefined') { + d.toString(); // error, undefined +} +else { + d.toString(); // error, object | null +} diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts index 04f7351290e..2df691958de 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveNarrow.ts @@ -16,7 +16,7 @@ if (typeof a === 'number') { var b: object | null if (typeof b === 'object') { - b.toString(); // error, object | null + b.toString(); // ok, object | null } else { b.toString(); // error, never } diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts index 5fbf85dc01b..78f2d5ff7ba 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts @@ -25,24 +25,25 @@ if (typeof b === 'object') { if (typeof d === 'object') { b = d; // ok + d.toString(); // error, object | null } else { - d; // undefined + d.toString(); // error, undefined } if (d == null) { - d; // null | undefined + d.toString(); // error, undefined | null } else { d.toString(); // object } if (d === null) { - d; // null + d.toString(); // error, null } else { d.toString(); // error, object | undefined } if (typeof d === 'undefined') { - d; // undefined + d.toString(); // error, undefined } else { d.toString(); // error, object | null } From 186ce38c180ed0670cccd4b60be06ee6b110b533 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Sat, 26 Nov 2016 13:19:04 +0800 Subject: [PATCH 165/289] add tests for generic type argument under strict null checks --- .../nonPrimitiveInGeneric.errors.txt | 18 ++++++++++++++- .../reference/nonPrimitiveInGeneric.js | 17 ++++++++++++++ .../nonPrimitiveStrictNull.errors.txt | 23 ++++++++++++++++++- .../reference/nonPrimitiveStrictNull.js | 16 +++++++++++++ .../nonPrimitive/nonPrimitiveInGeneric.ts | 13 +++++++++++ .../nonPrimitive/nonPrimitiveStrictNull.ts | 12 ++++++++++ 6 files changed, 97 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt index ab8786c37bc..04d4ee4a1a7 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt @@ -4,9 +4,10 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(14,7): error tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(21,8): error TS2344: Type 'number' does not satisfy the constraint 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(22,8): error TS2344: Type 'string' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,14): error TS2344: Type 'number' does not satisfy the constraint 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (6 errors) ==== +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (7 errors) ==== function generic(t: T) {} var a = {}; var b = "42"; @@ -41,4 +42,19 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(22,8): error bound2(); // expect error ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'object'. + + interface Proxy {} + + var x: Proxy; // error + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'object'. + var y: Proxy; // ok + var z: Proxy ; // ok + + + interface Blah { + foo: number; + } + + var u: Proxy; // ok \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.js b/tests/baselines/reference/nonPrimitiveInGeneric.js index c2e19dde1e4..b7080e149b4 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.js +++ b/tests/baselines/reference/nonPrimitiveInGeneric.js @@ -21,6 +21,19 @@ bound2<{}>(); bound2(); bound2(); // expect error bound2(); // expect error + +interface Proxy {} + +var x: Proxy; // error +var y: Proxy; // ok +var z: Proxy ; // ok + + +interface Blah { + foo: number; +} + +var u: Proxy; // ok //// [nonPrimitiveInGeneric.js] @@ -41,3 +54,7 @@ bound2(); bound2(); bound2(); // expect error bound2(); // expect error +var x; // error +var y; // ok +var z; // ok +var u; // ok diff --git a/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt index cf09994888b..de6fbfcf698 100644 --- a/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt +++ b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt @@ -21,9 +21,12 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(41,5): erro tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,5): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,7): error TS2339: Property 'toString' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(47,5): error TS2531: Object is possibly 'null'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(52,14): error TS2344: Type 'number' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(53,14): error TS2344: Type 'null' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(54,14): error TS2344: Type 'undefined' does not satisfy the constraint 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts (19 errors) ==== +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts (22 errors) ==== var a: object declare var b: object | null @@ -114,4 +117,22 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(47,5): erro ~ !!! error TS2531: Object is possibly 'null'. } + + interface Proxy {} + + var x: Proxy; // error + ~~~~~~ +!!! error TS2344: Type 'number' does not satisfy the constraint 'object'. + var y: Proxy; // error + ~~~~ +!!! error TS2344: Type 'null' does not satisfy the constraint 'object'. + var z: Proxy; // error + ~~~~~~~~~ +!!! error TS2344: Type 'undefined' does not satisfy the constraint 'object'. + + interface Blah { + foo: number; + } + + var u: Proxy; // ok \ No newline at end of file diff --git a/tests/baselines/reference/nonPrimitiveStrictNull.js b/tests/baselines/reference/nonPrimitiveStrictNull.js index c91097de960..754ca8cac7d 100644 --- a/tests/baselines/reference/nonPrimitiveStrictNull.js +++ b/tests/baselines/reference/nonPrimitiveStrictNull.js @@ -47,6 +47,18 @@ if (typeof d === 'undefined') { } else { d.toString(); // error, object | null } + +interface Proxy {} + +var x: Proxy; // error +var y: Proxy; // error +var z: Proxy; // error + +interface Blah { + foo: number; +} + +var u: Proxy; // ok //// [nonPrimitiveStrictNull.js] @@ -91,3 +103,7 @@ if (typeof d === 'undefined') { else { d.toString(); // error, object | null } +var x; // error +var y; // error +var z; // error +var u; // ok diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts index 0de4771a5ef..a19271a59d3 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts @@ -20,3 +20,16 @@ bound2<{}>(); bound2(); bound2(); // expect error bound2(); // expect error + +interface Proxy {} + +var x: Proxy; // error +var y: Proxy; // ok +var z: Proxy ; // ok + + +interface Blah { + foo: number; +} + +var u: Proxy; // ok diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts index 78f2d5ff7ba..3c2b9646c7e 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts @@ -47,3 +47,15 @@ if (typeof d === 'undefined') { } else { d.toString(); // error, object | null } + +interface Proxy {} + +var x: Proxy; // error +var y: Proxy; // error +var z: Proxy; // error + +interface Blah { + foo: number; +} + +var u: Proxy; // ok From 8b411effa637c5cd345471da485fa4c37868aec3 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Fri, 16 Dec 2016 10:26:49 +0800 Subject: [PATCH 166/289] address CR feedback --- .../reference/nonPrimitiveAssignError.errors.txt | 14 ++++++++------ .../baselines/reference/nonPrimitiveAssignError.js | 4 ++++ ...rrors.txt => nonPrimitiveInFunction.errors.txt} | 8 ++++---- ...tiveInFunction.js => nonPrimitiveInFunction.js} | 4 ++-- .../types/nonPrimitive/nonPrimitiveAssignError.ts | 2 ++ ...tiveInFunction.ts => nonPrimitiveInFunction.ts} | 0 6 files changed, 20 insertions(+), 12 deletions(-) rename tests/baselines/reference/{nonPriimitiveInFunction.errors.txt => nonPrimitiveInFunction.errors.txt} (56%) rename tests/baselines/reference/{nonPriimitiveInFunction.js => nonPrimitiveInFunction.js} (88%) rename tests/cases/conformance/types/nonPrimitive/{nonPriimitiveInFunction.ts => nonPrimitiveInFunction.ts} (100%) diff --git a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt index 093445570fe..bb62d494d74 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(5,1): error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. Property 'foo' is missing in type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(11,1): error TS2322: Type 'number' is not assignable to type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(12,1): error TS2322: Type 'true' is not assignable to type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(13,1): error TS2322: Type 'string' is not assignable to type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(15,1): error TS2322: Type 'object' is not assignable to type 'number'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(16,1): error TS2322: Type 'object' is not assignable to type 'boolean'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): error TS2322: Type 'object' is not assignable to type 'string'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(13,1): error TS2322: Type 'number' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(14,1): error TS2322: Type 'true' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(15,1): error TS2322: Type 'string' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): error TS2322: Type 'object' is not assignable to type 'number'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(18,1): error TS2322: Type 'object' is not assignable to type 'boolean'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(19,1): error TS2322: Type 'object' is not assignable to type 'string'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts (7 errors) ==== @@ -17,6 +17,8 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(17,1): err ~ !!! error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. !!! error TS2322: Property 'foo' is missing in type 'object'. + a = x; + a = y; var n = 123; var b = true; diff --git a/tests/baselines/reference/nonPrimitiveAssignError.js b/tests/baselines/reference/nonPrimitiveAssignError.js index e7bb56746ca..c37836a91c6 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.js +++ b/tests/baselines/reference/nonPrimitiveAssignError.js @@ -4,6 +4,8 @@ var y = {foo: "bar"}; var a: object; x = a; y = a; // expect error +a = x; +a = y; var n = 123; var b = true; @@ -32,6 +34,8 @@ var y = { foo: "bar" }; var a; x = a; y = a; // expect error +a = x; +a = y; var n = 123; var b = true; var s = "fooo"; diff --git a/tests/baselines/reference/nonPriimitiveInFunction.errors.txt b/tests/baselines/reference/nonPrimitiveInFunction.errors.txt similarity index 56% rename from tests/baselines/reference/nonPriimitiveInFunction.errors.txt rename to tests/baselines/reference/nonPrimitiveInFunction.errors.txt index 4b244cfcd04..5ca231b61c8 100644 --- a/tests/baselines/reference/nonPriimitiveInFunction.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInFunction.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(12,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(13,1): error TS2322: Type 'object' is not assignable to type 'boolean'. -tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts(17,12): error TS2322: Type 'number' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(12,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(13,1): error TS2322: Type 'object' is not assignable to type 'boolean'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(17,12): error TS2322: Type 'number' is not assignable to type 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts (3 errors) ==== +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts (3 errors) ==== function takeObject(o: object) {} function returnObject(): object { return {}; diff --git a/tests/baselines/reference/nonPriimitiveInFunction.js b/tests/baselines/reference/nonPrimitiveInFunction.js similarity index 88% rename from tests/baselines/reference/nonPriimitiveInFunction.js rename to tests/baselines/reference/nonPrimitiveInFunction.js index a534ea7c84e..a67b68542dd 100644 --- a/tests/baselines/reference/nonPriimitiveInFunction.js +++ b/tests/baselines/reference/nonPrimitiveInFunction.js @@ -1,4 +1,4 @@ -//// [nonPriimitiveInFunction.ts] +//// [nonPrimitiveInFunction.ts] function takeObject(o: object) {} function returnObject(): object { return {}; @@ -19,7 +19,7 @@ function returnError(): object { } -//// [nonPriimitiveInFunction.js] +//// [nonPrimitiveInFunction.js] function takeObject(o) { } function returnObject() { return {}; diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts index 8fe8c8a3ebb..83801652865 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts @@ -3,6 +3,8 @@ var y = {foo: "bar"}; var a: object; x = a; y = a; // expect error +a = x; +a = y; var n = 123; var b = true; diff --git a/tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts similarity index 100% rename from tests/cases/conformance/types/nonPrimitive/nonPriimitiveInFunction.ts rename to tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts From 66069fc382ca71e703c9a953db7215151490b6c5 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Mon, 19 Dec 2016 13:36:49 +0800 Subject: [PATCH 167/289] update implementation to use intrinsic type --- src/compiler/checker.ts | 20 ++++++++----------- src/compiler/types.ts | 7 ++++--- .../nonPrimitiveAssignError.errors.txt | 4 ++-- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a1fae5ebbd3..b7d8ccf7f16 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -144,9 +144,9 @@ namespace ts { const voidType = createIntrinsicType(TypeFlags.Void, "void"); const neverType = createIntrinsicType(TypeFlags.Never, "never"); const silentNeverType = createIntrinsicType(TypeFlags.Never, "never"); + const nonPrimitiveType = createIntrinsicType(TypeFlags.NonPrimitive, "object"); const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const nonPrimitiveType = createNonPrimitiveType(); const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral | SymbolFlags.Transient, "__type"); emptyTypeLiteralSymbol.members = createMap(); @@ -1685,13 +1685,6 @@ namespace ts { return type; } - function createNonPrimitiveType(): ResolvedType { - const type = setStructuredTypeMembers( - createObjectType(ObjectFlags.NonPrimitive, undefined), - emptySymbols, emptyArray, emptyArray, undefined, undefined); - return type; - } - function createObjectType(objectFlags: ObjectFlags, symbol?: Symbol): ObjectType { const type = createType(TypeFlags.Object); type.objectFlags = objectFlags; @@ -2320,9 +2313,6 @@ namespace ts { else if (type.flags & TypeFlags.UnionOrIntersection) { writeUnionOrIntersectionType(type, nextFlags); } - else if (getObjectFlags(type) & ObjectFlags.NonPrimitive) { - writer.writeKeyword("object"); - } else if (getObjectFlags(type) & (ObjectFlags.Anonymous | ObjectFlags.Mapped)) { writeAnonymousType(type, nextFlags); } @@ -4771,6 +4761,7 @@ namespace ts { t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType() : + t.flags & TypeFlags.NonPrimitive ? globalObjectType : t; } @@ -7153,6 +7144,8 @@ namespace ts { if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum && isEnumTypeRelatedTo(source, target, errorReporter)) return true; if (source.flags & TypeFlags.Undefined && (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void))) return true; if (source.flags & TypeFlags.Null && (!strictNullChecks || target.flags & TypeFlags.Null)) return true; + if (source.flags & TypeFlags.Object && target === nonPrimitiveType) return true; + if (source.flags & TypeFlags.Primitive && target === nonPrimitiveType) return false; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & TypeFlags.Any) return true; if ((source.flags & TypeFlags.Number | source.flags & TypeFlags.NumberLiteral) && target.flags & TypeFlags.EnumLike) return true; @@ -7471,7 +7464,7 @@ namespace ts { } } } - else if (!(source.flags & TypeFlags.Primitive && target === nonPrimitiveType)) { + else { if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { @@ -9224,6 +9217,9 @@ namespace ts { } function getTypeFacts(type: Type): TypeFacts { + if (type === nonPrimitiveType) { + return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts; + } const flags = type.flags; if (flags & TypeFlags.String) { return strictNullChecks ? TypeFacts.StringStrictFacts : TypeFacts.StringFacts; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index db919b56449..5b411ffea30 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2781,6 +2781,7 @@ namespace ts { ContainsObjectLiteral = 1 << 22, // Type is or contains object literal type /* @internal */ ContainsAnyFunctionType = 1 << 23, // Type is or contains object literal type + NonPrimitive = 1 << 24, // intrinsic object type /* @internal */ Nullable = Undefined | Null, @@ -2790,7 +2791,7 @@ namespace ts { DefinitelyFalsy = StringLiteral | NumberLiteral | BooleanLiteral | Void | Undefined | Null, PossiblyFalsy = DefinitelyFalsy | String | Number | Boolean, /* @internal */ - Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never, + Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never | NonPrimitive, /* @internal */ Primitive = String | Number | Boolean | Enum | ESSymbol | Void | Undefined | Null | Literal, StringLike = String | StringLiteral | Index, @@ -2798,14 +2799,14 @@ namespace ts { BooleanLike = Boolean | BooleanLiteral, EnumLike = Enum | EnumLiteral, UnionOrIntersection = Union | Intersection, - StructuredType = Object | Union | Intersection, + StructuredType = Object | Union | Intersection | NonPrimitive, StructuredOrTypeParameter = StructuredType | TypeParameter | Index, TypeVariable = TypeParameter | IndexedAccess, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol, - NotUnionOrUnit = Any | ESSymbol | Object, + NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive, /* @internal */ RequiresWidening = ContainsWideningType | ContainsObjectLiteral, /* @internal */ diff --git a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt index bb62d494d74..a9bfaaa4a8a 100644 --- a/tests/baselines/reference/nonPrimitiveAssignError.errors.txt +++ b/tests/baselines/reference/nonPrimitiveAssignError.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(5,1): error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. - Property 'foo' is missing in type 'object'. + Property 'foo' is missing in type 'Object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(13,1): error TS2322: Type 'number' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(14,1): error TS2322: Type 'true' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(15,1): error TS2322: Type 'string' is not assignable to type 'object'. @@ -16,7 +16,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveAssignError.ts(19,1): err y = a; // expect error ~ !!! error TS2322: Type 'object' is not assignable to type '{ foo: string; }'. -!!! error TS2322: Property 'foo' is missing in type 'object'. +!!! error TS2322: Property 'foo' is missing in type 'Object'. a = x; a = y; From 899387706fb11d48c6b6a5f4f986d6723a3026f3 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Thu, 22 Dec 2016 10:02:26 +0800 Subject: [PATCH 168/289] classify nonPrimitive type as narrowable rather than structured --- src/compiler/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5b411ffea30..03cbd252924 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2799,13 +2799,13 @@ namespace ts { BooleanLike = Boolean | BooleanLiteral, EnumLike = Enum | EnumLiteral, UnionOrIntersection = Union | Intersection, - StructuredType = Object | Union | Intersection | NonPrimitive, + StructuredType = Object | Union | Intersection, StructuredOrTypeParameter = StructuredType | TypeParameter | Index, TypeVariable = TypeParameter | IndexedAccess, // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol, + Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | NonPrimitive, NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive, /* @internal */ RequiresWidening = ContainsWideningType | ContainsObjectLiteral, From 273a0dbdfe4c609151c05b8c3efbc3ab060bdd44 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:33:50 +0900 Subject: [PATCH 169/289] add getOption --- src/harness/fourslash.ts | 4 ++++ tests/cases/fourslash/formattingOptionsChange.ts | 8 +++++--- tests/cases/fourslash/fourslash.ts | 7 ++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 653b87236fd..35fa7734a58 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3530,6 +3530,10 @@ namespace FourSlashInterface { public setOption(name: string, value: any): void { (this.state.formatCodeSettings)[name] = value; } + + public getOption(name: keyof ts.FormatCodeSettings) { + return this.state.formatCodeSettings[name]; + } } export class Cancellation { diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index 5726a57da57..b8d128acb79 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -13,7 +13,7 @@ ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' }; +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); @@ -26,9 +26,9 @@ runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }` runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' };", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'};"); - +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); +const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { // Go to the correct file goTo.marker(propertyName); @@ -52,4 +52,6 @@ function runTest(propertyName: string, expectedStringWhenTrue: string, expectedS // Verify goTo.marker(propertyName); verify.currentLineContentIs(expectedStringWhenTrue); + + format.setOption(propertyName, defaultFormatOption[propertyName]) } \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 745a746db11..dcb8ca47200 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -294,9 +294,10 @@ declare namespace FourSlashInterface { setFormatOptions(options: FormatCodeOptions): any; selection(startMarker: string, endMarker: string): void; onType(posMarker: string, key: string): void; - setOption(name: string, value: number): any; - setOption(name: string, value: string): any; - setOption(name: string, value: boolean): any; + setOption(name: string, value: number): void; + setOption(name: string, value: string): void; + setOption(name: string, value: boolean): void; + getOption(name: string): number|string|boolean; } class cancellation { resetCancelled(): void; From ebf46a77e96b39291897f9787bcd92b8ef92b4f2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 17 Dec 2016 13:21:34 +0900 Subject: [PATCH 170/289] merge conflict --- src/harness/fourslash.ts | 10 ++-- .../fourslash/formattingOptionsChange.ts | 48 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 35fa7734a58..0be7ecffc34 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3524,11 +3524,11 @@ namespace FourSlashInterface { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - public setOption(name: string, value: number): void; - public setOption(name: string, value: string): void; - public setOption(name: string, value: boolean): void; - public setOption(name: string, value: any): void { - (this.state.formatCodeSettings)[name] = value; + public setOption(name: keyof ts.FormatCodeSettings, value: number): void; + public setOption(name: keyof ts.FormatCodeSettings, value: string): void; + public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void; + public setOption(name: keyof ts.FormatCodeSettings, value: any): void { + this.state.formatCodeSettings[name] = value; } public getOption(name: keyof ts.FormatCodeSettings) { diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index b8d128acb79..f8f7c270cd8 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -1,32 +1,32 @@ /// -/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; -/////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); -/////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 -/////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } -/////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; -/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` -/////*InsertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); -/////*PlaceOpenBraceOnNewLineForFunctions*/class foo { +/////*insertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; +/////*insertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); +/////*insertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 +/////*insertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } +/////*insertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; +/////*insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` +/////*insertSpaceAfterTypeAssertion*/const bar = Thing.getFoo(); +/////*placeOpenBraceOnNewLineForFunctions*/class foo { ////} -/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { +/////*placeOpenBraceOnNewLineForControlBlocks*/if (true) { ////} -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } -runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); -runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); -runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); -runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); -runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); -runTest("InsertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); -runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); -runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); +runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); +runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); +runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); +runTest("insertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); +runTest("insertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); +runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); +runTest("insertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); +runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); +runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { From 6b48f3b551d56c0d88d4e94834f9ad9c0d555fd6 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:41:35 +0900 Subject: [PATCH 171/289] cancel getOption --- src/harness/fourslash.ts | 4 ---- tests/cases/fourslash/fourslash.ts | 5 +---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 0be7ecffc34..c28843327da 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3530,10 +3530,6 @@ namespace FourSlashInterface { public setOption(name: keyof ts.FormatCodeSettings, value: any): void { this.state.formatCodeSettings[name] = value; } - - public getOption(name: keyof ts.FormatCodeSettings) { - return this.state.formatCodeSettings[name]; - } } export class Cancellation { diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index dcb8ca47200..63b38c337d7 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -294,10 +294,7 @@ declare namespace FourSlashInterface { setFormatOptions(options: FormatCodeOptions): any; selection(startMarker: string, endMarker: string): void; onType(posMarker: string, key: string): void; - setOption(name: string, value: number): void; - setOption(name: string, value: string): void; - setOption(name: string, value: boolean): void; - getOption(name: string): number|string|boolean; + setOption(name: string, value: number | string | boolean): void; } class cancellation { resetCancelled(): void; From 5fb82496fb5a62fd7891d1604397455c77aa5e50 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 12:54:23 +0900 Subject: [PATCH 172/289] reposition defaultFormatOption --- src/server/utilities.ts | 1 + tests/cases/fourslash/formattingOptionsChange.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 641ca128e63..d0790b93dba 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -86,6 +86,7 @@ namespace ts.server { insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, insertSpaceBeforeFunctionParenthesis: false, diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index f8f7c270cd8..0e731412ede 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -15,6 +15,8 @@ ////} /////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } +const defaultFormatOption = format.copyFormatOptions(); + runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); @@ -25,10 +27,9 @@ runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[]; runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); runTest("insertSpaceAfterTypeAssertion", "const bar = Thing.getFoo();", "const bar = Thing.getFoo();"); runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); -runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); +runTest("placeOpenBraceOnNewLineForControlBlocks", "if (true)", "if (true) {"); runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); -const defaultFormatOption = format.copyFormatOptions(); function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) { // Go to the correct file goTo.marker(propertyName); From 76c88b59cf0cedf959dbf7db6dda291a82227253 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 13:04:37 +0900 Subject: [PATCH 173/289] union --- src/harness/fourslash.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c28843327da..4c1a716bc0b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3523,11 +3523,8 @@ namespace FourSlashInterface { public onType(posMarker: string, key: string) { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - - public setOption(name: keyof ts.FormatCodeSettings, value: number): void; - public setOption(name: keyof ts.FormatCodeSettings, value: string): void; - public setOption(name: keyof ts.FormatCodeSettings, value: boolean): void; - public setOption(name: keyof ts.FormatCodeSettings, value: any): void { + + public setOption(name: keyof ts.FormatCodeSettings, value: number | string | boolean): void { this.state.formatCodeSettings[name] = value; } } From a1f88d2fcd52aaef52b5060f35b47c9738f7f2e2 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 22 Dec 2016 15:23:50 +0900 Subject: [PATCH 174/289] format fourslash.ts --- src/harness/fourslash.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 4c1a716bc0b..2a0d37d190b 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -479,7 +479,7 @@ namespace FourSlash { endPos = endMarker.position; } - errors.forEach(function(error: ts.Diagnostic) { + errors.forEach(function (error: ts.Diagnostic) { if (predicate(error.start, error.start + error.length, startPos, endPos)) { exists = true; } @@ -496,7 +496,7 @@ namespace FourSlash { Harness.IO.log("Unexpected error(s) found. Error list is:"); } - errors.forEach(function(error: ts.Diagnostic) { + errors.forEach(function (error: ts.Diagnostic) { Harness.IO.log(" minChar: " + error.start + ", limChar: " + (error.start + error.length) + ", message: " + ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine()) + "\n"); @@ -3523,7 +3523,7 @@ namespace FourSlashInterface { public onType(posMarker: string, key: string) { this.state.formatOnType(this.state.getMarkerByName(posMarker).position, key); } - + public setOption(name: keyof ts.FormatCodeSettings, value: number | string | boolean): void { this.state.formatCodeSettings[name] = value; } From 4886b4248aaa933153617e2fb7619b7c68d525eb Mon Sep 17 00:00:00 2001 From: flowmemo Date: Thu, 22 Dec 2016 23:18:12 +0800 Subject: [PATCH 175/289] fix issue #13114 --- src/services/formatting/rules.ts | 4 +-- .../formattingSpaceBeforeCloseParen.ts | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 2fac6c05555..e0268675e5a 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -264,12 +264,12 @@ namespace ts.formatting { this.SpaceAfterSemicolon = new Rule(RuleDescriptor.create3(SyntaxKind.SemicolonToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); // Space after }. - this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); + this.SpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromRange(SyntaxKind.FirstToken, SyntaxKind.LastToken, [SyntaxKind.CloseParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), RuleAction.Space)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.ElseKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space)); - this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); // No space for dot this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); diff --git a/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts b/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts new file mode 100644 index 00000000000..fb2d648e211 --- /dev/null +++ b/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts @@ -0,0 +1,33 @@ +/// + +/////*1*/({}); +/////*2*/( {}); +/////*3*/({foo:42}); +/////*4*/( {foo:42} ); +/////*5*/var bar = (function (a) { }); + +format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", true); +format.document(); +goTo.marker('1'); +verify.currentLineContentIs('( {} );'); +goTo.marker('2'); +verify.currentLineContentIs('( {} );'); +goTo.marker('3'); +verify.currentLineContentIs('( { foo: 42 } );'); +goTo.marker('4'); +verify.currentLineContentIs('( { foo: 42 } );'); +goTo.marker('5'); +verify.currentLineContentIs('var bar = ( function( a ) { } );'); + +format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", false); +format.document(); +goTo.marker('1'); +verify.currentLineContentIs('({});'); +goTo.marker('2'); +verify.currentLineContentIs('({});'); +goTo.marker('3'); +verify.currentLineContentIs('({ foo: 42 });'); +goTo.marker('4'); +verify.currentLineContentIs('({ foo: 42 });'); +goTo.marker('5'); +verify.currentLineContentIs('var bar = (function(a) { });'); \ No newline at end of file From 31abc59d11e0056cac1e28f3a0af072b465a20a5 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Thu, 22 Dec 2016 19:21:38 +0300 Subject: [PATCH 176/289] Disallow old style octal literals in enums --- src/compiler/checker.ts | 6 +++++- src/compiler/diagnosticMessages.json | 4 ++++ src/compiler/utilities.ts | 4 ++-- .../es3-oldStyleOctalLiteralInEnums.errors.txt | 13 +++++++++++++ .../reference/es3-oldStyleOctalLiteralInEnums.js | 12 ++++++++++++ .../es3-oldStyleOctalLiteralTypes.errors.txt | 12 ++++++++++++ .../reference/es3-oldStyleOctalLiteralTypes.js | 8 ++++++++ .../es5-oldStyleOctalLiteralInEnums.errors.txt | 13 +++++++++++++ .../reference/es5-oldStyleOctalLiteralInEnums.js | 12 ++++++++++++ .../compiler/es3-oldStyleOctalLiteralInEnums.ts | 5 +++++ ...ralTypes.ts => es3-oldStyleOctalLiteralTypes.ts} | 0 .../compiler/es5-oldStyleOctalLiteralInEnums.ts | 5 +++++ 12 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt create mode 100644 tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js create mode 100644 tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt create mode 100644 tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js create mode 100644 tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts rename tests/cases/compiler/{oldStyleOctalLiteralTypes.ts => es3-oldStyleOctalLiteralTypes.ts} (100%) create mode 100644 tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a27e8ba524d..6a1edbf3cc6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18582,6 +18582,7 @@ namespace ts { } return undefined; case SyntaxKind.NumericLiteral: + checkGrammarNumericLiteral(e); return +(e).text; case SyntaxKind.ParenthesizedExpression: return evalConstant((e).expression); @@ -21885,9 +21886,12 @@ namespace ts { if (languageVersion >= ScriptTarget.ES5) { diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (isChildOfLiteralType(node)) { + else if (isChildOfNodeWithKind(node, SyntaxKind.LiteralType)) { diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } + else if (isChildOfNodeWithKind(node, SyntaxKind.EnumMember)) { + diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } if (diagnosticMessage) { const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === SyntaxKind.MinusToken; const literal = `${withMinus ? "-" : ""}0o${node.text}`; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7b2208e4ca1..8cf1313264f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3246,5 +3246,9 @@ "Octal literal types must use ES2015 syntax. Use the syntax '{0}'.": { "category": "Error", "code": 8017 + }, + "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'.": { + "category": "Error", + "code": 8018 } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index edfbe639d25..3c64c4d4a34 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -732,9 +732,9 @@ namespace ts { return false; } - export function isChildOfLiteralType(node: Node): boolean { + export function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean { while (node) { - if (node.kind === SyntaxKind.LiteralType) { + if (node.kind === kind) { return true; } node = node.parent; diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt new file mode 100644 index 00000000000..137b76f660d --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(2,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'. +tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(3,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'. + + +==== tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts (2 errors) ==== + enum E { + x = -01, + ~~~ +!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'. + y = 02, + ~~ +!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js new file mode 100644 index 00000000000..0098d841f2a --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralInEnums.js @@ -0,0 +1,12 @@ +//// [es3-oldStyleOctalLiteralInEnums.ts] +enum E { + x = -01, + y = 02, +} + +//// [es3-oldStyleOctalLiteralInEnums.js] +var E; +(function (E) { + E[E["x"] = -1] = "x"; + E[E["y"] = 2] = "y"; +})(E || (E = {})); diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt new file mode 100644 index 00000000000..5fc9843989c --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. +tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(2,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. + + +==== tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts (2 errors) ==== + let x: 010; + ~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'. + let y: -020; + ~~~~ +!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'. + \ No newline at end of file diff --git a/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js new file mode 100644 index 00000000000..5ac915400cd --- /dev/null +++ b/tests/baselines/reference/es3-oldStyleOctalLiteralTypes.js @@ -0,0 +1,8 @@ +//// [es3-oldStyleOctalLiteralTypes.ts] +let x: 010; +let y: -020; + + +//// [es3-oldStyleOctalLiteralTypes.js] +var x; +var y; diff --git a/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt new file mode 100644 index 00000000000..a504568ce20 --- /dev/null +++ b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts(2,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'. +tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts(3,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'. + + +==== tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts (2 errors) ==== + enum E { + x = -01, + ~~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'. + y = 02, + ~~ +!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js new file mode 100644 index 00000000000..71f718054fe --- /dev/null +++ b/tests/baselines/reference/es5-oldStyleOctalLiteralInEnums.js @@ -0,0 +1,12 @@ +//// [es5-oldStyleOctalLiteralInEnums.ts] +enum E { + x = -01, + y = 02, +} + +//// [es5-oldStyleOctalLiteralInEnums.js] +var E; +(function (E) { + E[E["x"] = -1] = "x"; + E[E["y"] = 2] = "y"; +})(E || (E = {})); diff --git a/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts b/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts new file mode 100644 index 00000000000..93489ee4820 --- /dev/null +++ b/tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts @@ -0,0 +1,5 @@ +// @target: ES3 +enum E { + x = -01, + y = 02, +} \ No newline at end of file diff --git a/tests/cases/compiler/oldStyleOctalLiteralTypes.ts b/tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts similarity index 100% rename from tests/cases/compiler/oldStyleOctalLiteralTypes.ts rename to tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts diff --git a/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts b/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts new file mode 100644 index 00000000000..42a95eff2a2 --- /dev/null +++ b/tests/cases/compiler/es5-oldStyleOctalLiteralInEnums.ts @@ -0,0 +1,5 @@ +// @target: ES5 +enum E { + x = -01, + y = 02, +} \ No newline at end of file From decc7c220e43777d6d5acfe32ccee5014a6ef94e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Dec 2016 14:05:03 -0800 Subject: [PATCH 177/289] Fix non-thenable check for IndexedAccess types --- src/compiler/checker.ts | 17 +- .../reference/asyncFunctionReturnType.js | 142 ++++++++- .../reference/asyncFunctionReturnType.symbols | 271 +++++++++++++++++ .../reference/asyncFunctionReturnType.types | 284 ++++++++++++++++++ .../cases/compiler/asyncFunctionReturnType.ts | 66 ++++ 5 files changed, 773 insertions(+), 7 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6a1edbf3cc6..d0923be003b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3074,10 +3074,6 @@ namespace ts { return type && (type.flags & TypeFlags.Any) !== 0; } - function isTypeNever(type: Type) { - return type && (type.flags & TypeFlags.Never) !== 0; - } - // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node: VariableLikeDeclaration) { @@ -16285,9 +16281,18 @@ namespace ts { } } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage) { + function isTypeOrConstraintAnyOrNever(type: Type) { + while (type.flags & TypeFlags.TypeVariable) { + const constraint = getConstraintOfTypeVariable(type); + if (!constraint) break; + type = getWidenedType(constraint); + } + return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0; + } + + function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; diff --git a/tests/baselines/reference/asyncFunctionReturnType.js b/tests/baselines/reference/asyncFunctionReturnType.js index dcdead47c6b..6e39e72ae4c 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.js +++ b/tests/baselines/reference/asyncFunctionReturnType.js @@ -8,7 +8,72 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { // This is contextually typed as a tuple. return [1, true]; } - + +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { + stringProp: string; + anyProp: any; +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { + return obj.stringProp; +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { + return obj.anyProp; +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { + return obj.stringProp; +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { + return obj.anyProp; +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { + return obj[key]; +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} //// [asyncFunctionReturnType.js] var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -31,3 +96,78 @@ function fAsyncExplicit() { return [1, true]; }); } +function fIndexedTypeForStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.stringProp; + }); +} +function fIndexedTypeForPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fIndexedTypeForExplicitPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fIndexedTypeForAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.anyProp; + }); +} +function fIndexedTypeForPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fIndexedTypeForExplicitPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.stringProp; + }); +} +function fGenericIndexedTypeForPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.stringProp); + }); +} +function fGenericIndexedTypeForAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return obj.anyProp; + }); +} +function fGenericIndexedTypeForPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj.anyProp); + }); +} +function fGenericIndexedTypeForKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return obj[key]; + }); +} +function fGenericIndexedTypeForPromiseOfKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj[key]); + }); +} +function fGenericIndexedTypeForExplicitPromiseOfKProp(obj, key) { + return __awaiter(this, void 0, void 0, function* () { + return Promise.resolve(obj[key]); + }); +} diff --git a/tests/baselines/reference/asyncFunctionReturnType.symbols b/tests/baselines/reference/asyncFunctionReturnType.symbols index 75e456b6a8b..d5aa71c9e51 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.symbols +++ b/tests/baselines/reference/asyncFunctionReturnType.symbols @@ -14,3 +14,274 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { return [1, true]; } +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + stringProp: string; +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) + + anyProp: any; +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { +>fIndexedTypeForStringProp : Symbol(fIndexedTypeForStringProp, Decl(asyncFunctionReturnType.ts, 14, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 16, 41)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return obj.stringProp; +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 16, 41)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfStringProp : Symbol(fIndexedTypeForPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 18, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 20, 50)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfStringProp : Symbol(fIndexedTypeForExplicitPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 22, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 24, 58)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 24, 58)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { +>fIndexedTypeForAnyProp : Symbol(fIndexedTypeForAnyProp, Decl(asyncFunctionReturnType.ts, 26, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 28, 38)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return obj.anyProp; +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 28, 38)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfAnyProp : Symbol(fIndexedTypeForPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 30, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 32, 47)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfAnyProp : Symbol(fIndexedTypeForExplicitPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 34, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 36, 55)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 36, 55)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForStringProp : Symbol(fGenericIndexedTypeForStringProp, Decl(asyncFunctionReturnType.ts, 38, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 40, 66)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 40, 48)) + + return obj.stringProp; +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 40, 66)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfStringProp : Symbol(fGenericIndexedTypeForPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 42, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 44, 57)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 44, 75)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfStringProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfStringProp, Decl(asyncFunctionReturnType.ts, 46, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 48, 83)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) + + return Promise.resolve(obj.stringProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 48, 65)) +>obj.stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 48, 83)) +>stringProp : Symbol(Obj.stringProp, Decl(asyncFunctionReturnType.ts, 11, 15)) +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForAnyProp : Symbol(fGenericIndexedTypeForAnyProp, Decl(asyncFunctionReturnType.ts, 50, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 52, 63)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 52, 45)) + + return obj.anyProp; +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 52, 63)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfAnyProp : Symbol(fGenericIndexedTypeForPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 54, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 56, 54)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 56, 72)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfAnyProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfAnyProp, Decl(asyncFunctionReturnType.ts, 58, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 60, 80)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) + + return Promise.resolve(obj.anyProp); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 60, 62)) +>obj.anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 60, 80)) +>anyProp : Symbol(Obj.anyProp, Decl(asyncFunctionReturnType.ts, 12, 23)) +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForKProp : Symbol(fGenericIndexedTypeForKProp, Decl(asyncFunctionReturnType.ts, 62, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 64, 83)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 64, 93)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 64, 43)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 64, 60)) + + return obj[key]; +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 64, 83)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 64, 93)) +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForPromiseOfKProp : Symbol(fGenericIndexedTypeForPromiseOfKProp, Decl(asyncFunctionReturnType.ts, 66, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 68, 92)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 68, 52)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 68, 69)) + + return Promise.resolve(obj[key]); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 68, 92)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 68, 102)) +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForExplicitPromiseOfKProp : Symbol(fGenericIndexedTypeForExplicitPromiseOfKProp, Decl(asyncFunctionReturnType.ts, 70, 1)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>Obj : Symbol(Obj, Decl(asyncFunctionReturnType.ts, 8, 1)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 72, 100)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 72, 110)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) + + return Promise.resolve(obj[key]); +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>TObj : Symbol(TObj, Decl(asyncFunctionReturnType.ts, 72, 60)) +>K : Symbol(K, Decl(asyncFunctionReturnType.ts, 72, 77)) +>obj : Symbol(obj, Decl(asyncFunctionReturnType.ts, 72, 100)) +>key : Symbol(key, Decl(asyncFunctionReturnType.ts, 72, 110)) +} diff --git a/tests/baselines/reference/asyncFunctionReturnType.types b/tests/baselines/reference/asyncFunctionReturnType.types index db9f8e42d52..d1dab14ba87 100644 --- a/tests/baselines/reference/asyncFunctionReturnType.types +++ b/tests/baselines/reference/asyncFunctionReturnType.types @@ -20,3 +20,287 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { >true : true } +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { +>Obj : Obj + + stringProp: string; +>stringProp : string + + anyProp: any; +>anyProp : any +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { +>fIndexedTypeForStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return obj.stringProp; +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfStringProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Obj : Obj +>obj.stringProp : string +>obj : Obj +>stringProp : string +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { +>fIndexedTypeForAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return obj.anyProp; +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForPromiseOfAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { +>fIndexedTypeForExplicitPromiseOfAnyProp : (obj: Obj) => Promise +>obj : Obj +>Obj : Obj +>Promise : Promise +>Obj : Obj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Obj : Obj +>obj.anyProp : any +>obj : Obj +>anyProp : any +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return obj.stringProp; +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfStringProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.stringProp); +>Promise.resolve(obj.stringProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>obj.stringProp : string +>obj : TObj +>stringProp : string +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return obj.anyProp; +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForPromiseOfAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { +>fGenericIndexedTypeForExplicitPromiseOfAnyProp : (obj: TObj) => Promise +>TObj : TObj +>Obj : Obj +>obj : TObj +>TObj : TObj +>Promise : Promise +>TObj : TObj + + return Promise.resolve(obj.anyProp); +>Promise.resolve(obj.anyProp) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>obj.anyProp : any +>obj : TObj +>anyProp : any +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return obj[key]; +>obj[key] : TObj[K] +>obj : TObj +>key : K +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForPromiseOfKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return Promise.resolve(obj[key]); +>Promise.resolve(obj[key]) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>obj[key] : TObj[K] +>obj : TObj +>key : K +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { +>fGenericIndexedTypeForExplicitPromiseOfKProp : (obj: TObj, key: K) => Promise +>TObj : TObj +>Obj : Obj +>K : K +>TObj : TObj +>obj : TObj +>TObj : TObj +>key : K +>K : K +>Promise : Promise +>TObj : TObj +>K : K + + return Promise.resolve(obj[key]); +>Promise.resolve(obj[key]) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>TObj : TObj +>K : K +>obj[key] : TObj[K] +>obj : TObj +>key : K +} diff --git a/tests/cases/compiler/asyncFunctionReturnType.ts b/tests/cases/compiler/asyncFunctionReturnType.ts index a1bcde38079..3bd7a0e998a 100644 --- a/tests/cases/compiler/asyncFunctionReturnType.ts +++ b/tests/cases/compiler/asyncFunctionReturnType.ts @@ -8,3 +8,69 @@ async function fAsyncExplicit(): Promise<[number, boolean]> { // This is contextually typed as a tuple. return [1, true]; } + +// https://github.com/Microsoft/TypeScript/issues/13128 +interface Obj { + stringProp: string; + anyProp: any; +} + +async function fIndexedTypeForStringProp(obj: Obj): Promise { + return obj.stringProp; +} + +async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fIndexedTypeForAnyProp(obj: Obj): Promise { + return obj.anyProp; +} + +async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForStringProp(obj: TObj): Promise { + return obj.stringProp; +} + +async function fGenericIndexedTypeForPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfStringProp(obj: TObj): Promise { + return Promise.resolve(obj.stringProp); +} + +async function fGenericIndexedTypeForAnyProp(obj: TObj): Promise { + return obj.anyProp; +} + +async function fGenericIndexedTypeForPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForExplicitPromiseOfAnyProp(obj: TObj): Promise { + return Promise.resolve(obj.anyProp); +} + +async function fGenericIndexedTypeForKProp(obj: TObj, key: K): Promise { + return obj[key]; +} + +async function fGenericIndexedTypeForPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} + +async function fGenericIndexedTypeForExplicitPromiseOfKProp(obj: TObj, key: K): Promise { + return Promise.resolve(obj[key]); +} \ No newline at end of file From 9a0d9d77aa00d74183ff5079528deaa5e5baa2b5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 22 Dec 2016 15:14:13 -0800 Subject: [PATCH 178/289] Check trace enabled befoe tracing --- src/compiler/moduleNameResolver.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index be8f4d6f0cb..da3630765a2 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { @@ -824,7 +824,9 @@ namespace ts { if (resolved) { return resolved; } - trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + if (state.traceEnabled) { + trace(state.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } const resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures, state); if (resolved) { From d0b7d4a93f07bfcb17161eb2c2aecab178c42932 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 22 Dec 2016 15:21:43 -0800 Subject: [PATCH 179/289] Switch to getApparentType --- src/compiler/checker.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0923be003b..dcbd842cee3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16281,18 +16281,10 @@ namespace ts { } } - function isTypeOrConstraintAnyOrNever(type: Type) { - while (type.flags & TypeFlags.TypeVariable) { - const constraint = getConstraintOfTypeVariable(type); - if (!constraint) break; - type = getWidenedType(constraint); - } - return (type.flags & (TypeFlags.Any | TypeFlags.Never)) !== 0; - } - function checkNonThenableType(type: Type, location?: Node, message?: DiagnosticMessage): Type { type = getWidenedType(type); - if (!isTypeOrConstraintAnyOrNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + const apparentType = getApparentType(type); + if ((apparentType.flags & (TypeFlags.Any | TypeFlags.Never)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; From 20097d7961de7b7b1924bf8b05a92e5a405fcf85 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 22 Dec 2016 18:35:41 -0800 Subject: [PATCH 180/289] mark 'failedLookupLocations' as internal (#13139) --- src/compiler/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ee432b13240..f9b416fc4de 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3544,6 +3544,7 @@ namespace ts { export interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; + /* @internal */ failedLookupLocations: string[]; } From e32c62039e443b19ccfa23533c4a0cbccb6ff9b0 Mon Sep 17 00:00:00 2001 From: flowmemo Date: Sat, 24 Dec 2016 00:20:46 +0800 Subject: [PATCH 181/289] fix #11676 --- src/services/formatting/rules.ts | 11 +++++++++++ .../formattingNonNullAssertionOperator.ts | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/cases/fourslash/formattingNonNullAssertionOperator.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 5b1543b79f0..b9cf85b5b60 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -245,6 +245,9 @@ namespace ts.formatting { public NoSpaceAfterTypeAssertion: Rule; public SpaceAfterTypeAssertion: Rule; + // No space before non-null assertion operator + public NoSpaceBeforeNonNullAssertionOperator: Rule; + constructor() { /// /// Common Rules @@ -410,6 +413,9 @@ namespace ts.formatting { this.NoSpaceBeforeEqualInJsxAttribute = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.EqualsToken), RuleOperation.create2(new RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); this.NoSpaceAfterEqualInJsxAttribute = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.ExclamationToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), RuleAction.Delete)); + // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -456,6 +462,7 @@ namespace ts.formatting { this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. @@ -882,5 +889,9 @@ namespace ts.formatting { static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean { return context.contextNode.kind === SyntaxKind.YieldExpression && (context.contextNode).expression !== undefined; } + + static IsNonNullAssertionContext(context: FormattingContext): boolean { + return context.contextNode.kind === SyntaxKind.NonNullExpression; + } } } \ No newline at end of file diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts new file mode 100644 index 00000000000..3318ca7f4d6 --- /dev/null +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -0,0 +1,19 @@ +/// + +/////*1*/'bar'!; +/////*2*/('bar')!; +/////*3*/'bar'[1]!; +/////*4*/var bar = 'bar'.foo!; +/////*5*/var foo = bar!; + +format.document(); +goTo.marker('1'); +verify.currentLineContentIs("'bar'!;"); +goTo.marker('2'); +verify.currentLineContentIs("('bar')!;"); +goTo.marker('3'); +verify.currentLineContentIs("'bar'[1]!;"); +goTo.marker('4'); +verify.currentLineContentIs("var bar = 'bar'.foo!;"); +goTo.marker('5'); +verify.currentLineContentIs("var foo = bar!;"); \ No newline at end of file From eb188d0e24ae3f2c720c16e333a7066942718be0 Mon Sep 17 00:00:00 2001 From: flowmemo Date: Sat, 24 Dec 2016 09:25:14 +0800 Subject: [PATCH 182/289] fix #11676 - lint test --- .../fourslash/formattingNonNullAssertionOperator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts index 3318ca7f4d6..c6e79629998 100644 --- a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -7,13 +7,13 @@ /////*5*/var foo = bar!; format.document(); -goTo.marker('1'); +goTo.marker("1"); verify.currentLineContentIs("'bar'!;"); -goTo.marker('2'); +goTo.marker("2"); verify.currentLineContentIs("('bar')!;"); -goTo.marker('3'); +goTo.marker("3"); verify.currentLineContentIs("'bar'[1]!;"); -goTo.marker('4'); +goTo.marker("4"); verify.currentLineContentIs("var bar = 'bar'.foo!;"); -goTo.marker('5'); +goTo.marker("5"); verify.currentLineContentIs("var foo = bar!;"); \ No newline at end of file From f0ad56d86eec4f95270c0f9a93df116623beeadf Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 26 Dec 2016 11:36:27 -0800 Subject: [PATCH 183/289] Ensure test input is unformatted --- .../fourslash/formattingNonNullAssertionOperator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts index c6e79629998..2d8b96daaff 100644 --- a/tests/cases/fourslash/formattingNonNullAssertionOperator.ts +++ b/tests/cases/fourslash/formattingNonNullAssertionOperator.ts @@ -1,10 +1,10 @@ /// -/////*1*/'bar'!; -/////*2*/('bar')!; -/////*3*/'bar'[1]!; -/////*4*/var bar = 'bar'.foo!; -/////*5*/var foo = bar!; +/////*1*/ 'bar' ! ; +/////*2*/ ( 'bar' ) ! ; +/////*3*/ 'bar' [ 1 ] ! ; +/////*4*/ var bar = 'bar' . foo ! ; +/////*5*/ var foo = bar ! ; format.document(); goTo.marker("1"); From 8386d491abacdf2f43aacace0efcaa37b27b748d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 27 Dec 2016 11:17:33 -0800 Subject: [PATCH 184/289] Use sparse arrays for number-keyed maps --- src/compiler/checker.ts | 9 +- src/compiler/core.ts | 36 +++--- src/compiler/factory.ts | 30 ++--- src/compiler/sourcemap.ts | 2 +- src/compiler/transformer.ts | 22 ++-- src/compiler/transformers/generators.ts | 28 ++--- src/compiler/transformers/module/module.ts | 55 ++++----- src/compiler/transformers/module/system.ts | 53 +++++---- src/compiler/transformers/ts.ts | 14 +-- src/compiler/tsc.ts | 16 +-- src/compiler/types.ts | 22 ++-- src/compiler/utilities.ts | 6 +- src/compiler/visitor.ts | 104 +++++++++--------- src/harness/unittests/session.ts | 10 +- .../unittests/tsserverProjectSystem.ts | 22 ++-- src/services/codefixes/codeFixProvider.ts | 10 +- src/services/codefixes/importFixes.ts | 22 ++-- 17 files changed, 240 insertions(+), 221 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2394d5017a3..47a7db16986 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4054,16 +4054,15 @@ namespace ts { enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { const memberTypeList: Type[] = []; - const memberTypes = createMap(); + const memberTypes = sparseArray(); for (const declaration of enumType.symbol.declarations) { if (declaration.kind === SyntaxKind.EnumDeclaration) { computeEnumMemberValues(declaration); for (const member of (declaration).members) { const memberSymbol = getSymbolOfNode(member); const value = getEnumMemberValue(member); - if (!memberTypes.has(value)) { - const memberType = createEnumLiteralType(memberSymbol, enumType, "" + value); - memberTypes.set(value, memberType); + if (!memberTypes[value]) { + const memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, "" + value); memberTypeList.push(memberType); } } @@ -4085,7 +4084,7 @@ namespace ts { if (!links.declaredType) { const enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); links.declaredType = enumType.flags & TypeFlags.Union ? - enumType.memberTypes.get(getEnumMemberValue(symbol.valueDeclaration)) : + enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] : enumType; } return links.declaredType; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 6239dc93146..36847796b6e 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -39,6 +39,8 @@ namespace ts { return map; } + export const sparseArray: () => SparseArray = createMapLike; + /** Create a new map. If a template object is provided, the map will copy entries from it. */ export function createMap(template?: MapLike): Map { const map: Map = new MapCtr(); @@ -52,17 +54,6 @@ namespace ts { return map; } - /** Create a map from [key, value] pairs. This avoids casting keys to strings. */ - export function createMapFromPairs(...pairs: [number, T][]): Map { - const map: Map = new MapCtr(); - - for (const [key, value] of pairs) { - map.set(key, value); - } - - return map; - } - /** Methods on native maps but not on shim maps. Only used in this file. */ interface ES6Map extends Map { entries(): Iterator<[string, T]>; @@ -92,21 +83,21 @@ namespace ts { return class implements ShimMap { private data = createMapLike(); - get(key: MapKey): T { + get(key: string): T { return this.data[key]; } - set(key: MapKey, value: T): this { + set(key: string, value: T): this { this.data[key] = value; return this; } - has(key: MapKey): boolean { + has(key: string): boolean { // tslint:disable-next-line:no-in-operator return key in this.data; } - delete(key: MapKey): boolean { + delete(key: string): boolean { const had = this.has(key); if (had) { delete this.data[key]; @@ -890,7 +881,7 @@ namespace ts { * Array of every key in a map. * May not actually return string[] if numbers were put into the map. */ - export function keysOfMap(map: Map): string[] { + export function keysOfMap(map: Map<{}>): string[] { const keys: string[] = []; forEachKeyInMap(map, key => { keys.push(key); @@ -1040,7 +1031,7 @@ namespace ts { * Adds the value to an array of values associated with the key, and returns the array. * Creates the array if it does not already exist. */ - export function multiMapAdd(map: Map, key: string | number, value: V): V[] { + export function multiMapAdd(map: Map, key: string, value: V): V[] { let values = map.get(key); if (values) { values.push(value); @@ -1051,6 +1042,17 @@ namespace ts { return values; } + export function multiMapSparseArrayAdd(map: SparseArray, key: number, value: V): V[] { + let values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } + /** * Removes a value from an array of values associated with the key. * Does not preserve the order of those values. diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 2ef73dea727..15a946648b1 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1,4 +1,4 @@ -/// +/// /// /* @internal */ @@ -2641,9 +2641,11 @@ namespace ts { return destEmitNode; } - function mergeTokenSourceMapRanges(sourceRanges: Map, destRanges: Map) { - if (!destRanges) destRanges = createMap(); - copyMapEntries(sourceRanges, destRanges); + function mergeTokenSourceMapRanges(sourceRanges: SparseArray, destRanges: SparseArray) { + if (!destRanges) destRanges = []; + for (const key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } return destRanges; } @@ -2745,7 +2747,7 @@ namespace ts { export function getTokenSourceMapRange(node: Node, token: SyntaxKind) { const emitNode = node.emitNode; const tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges.get(token); + return tokenSourceMapRanges && tokenSourceMapRanges[token]; } /** @@ -2757,8 +2759,8 @@ namespace ts { */ export function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange) { const emitNode = getOrCreateEmitNode(node); - const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = createMap()); - tokenSourceMapRanges.set(token, range); + const tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; return node; } @@ -3270,7 +3272,7 @@ namespace ts { externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; // imports of other external modules externalHelpersImportDeclaration: ImportDeclaration | undefined; // import of external helpers exportSpecifiers: Map; // export specifiers by name - exportedBindings: Map; // exported names of local declarations + exportedBindings: SparseArray; // exported names of local declarations exportedNames: Identifier[]; // all exported names local to module exportEquals: ExportAssignment | undefined; // an export= declaration if one was present hasExportStarsToExportValues: boolean; // whether this module contains export* @@ -3279,7 +3281,7 @@ namespace ts { export function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo { const externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[] = []; const exportSpecifiers = createMap(); - const exportedBindings = createMap(); + const exportedBindings = sparseArray(); const uniqueExports = createMap(); let exportedNames: Identifier[]; let hasExportDefault = false; @@ -3338,7 +3340,7 @@ namespace ts { || resolver.getReferencedValueDeclaration(name); if (decl) { - multiMapAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); } uniqueExports.set(specifier.name.text, true); @@ -3368,7 +3370,7 @@ namespace ts { if (hasModifier(node, ModifierFlags.Default)) { // export default function() { } if (!hasExportDefault) { - multiMapAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } @@ -3376,7 +3378,7 @@ namespace ts { // export function x() { } const name = (node).name; if (!uniqueExports.get(name.text)) { - multiMapAdd(exportedBindings, getOriginalNodeId(node), name); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); uniqueExports.set(name.text, true); exportedNames = append(exportedNames, name); } @@ -3389,7 +3391,7 @@ namespace ts { if (hasModifier(node, ModifierFlags.Default)) { // export default class { } if (!hasExportDefault) { - multiMapAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), getDeclarationName(node)); hasExportDefault = true; } } @@ -3397,7 +3399,7 @@ namespace ts { // export class x { } const name = (node).name; if (!uniqueExports.get(name.text)) { - multiMapAdd(exportedBindings, getOriginalNodeId(node), name); + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); uniqueExports.set(name.text, true); exportedNames = append(exportedNames, name); } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index a814a91c355..650b9b0ef02 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -362,7 +362,7 @@ namespace ts { const emitNode = node && node.emitNode; const emitFlags = emitNode && emitNode.flags; - const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges.get(token); + const range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; tokenPos = skipTrivia(currentSourceText, range ? range.pos : tokenPos); if ((emitFlags & EmitFlags.NoTokenLeadingSourceMaps) === 0 && tokenPos >= 0) { diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 1440481d38e..cef8c701455 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -13,14 +13,16 @@ /* @internal */ namespace ts { - const moduleTransformerMap = createMapFromPairs( - [ModuleKind.ES2015, transformES2015Module], - [ModuleKind.System, transformSystemModule], - [ModuleKind.AMD, transformModule], - [ModuleKind.CommonJS, transformModule], - [ModuleKind.UMD, transformModule], - [ModuleKind.None, transformModule], - ); + function getModuleTransformer(moduleKind: ModuleKind): Transformer { + switch (moduleKind) { + case ModuleKind.ES2015: + return transformES2015Module; + case ModuleKind.System: + return transformSystemModule; + default: + return transformModule; + } + } const enum SyntaxKindFeatureFlags { Substitution = 1 << 0, @@ -56,7 +58,7 @@ namespace ts { transformers.push(transformGenerators); } - transformers.push(moduleTransformerMap.get(moduleKind) || moduleTransformerMap.get(ModuleKind.None)); + transformers.push(getModuleTransformer(moduleKind)); // The ES5 transformer is last so that it can substitute expressions like `exports.default` // for ES3. diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 0b853649e81..85aba96387b 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,4 +1,4 @@ -/// +/// /// // Transforms generator functions into a compatible ES5 representation with similar runtime @@ -217,13 +217,15 @@ namespace ts { Endfinally = 7, } - const instructionNames = createMapFromPairs( - [Instruction.Return, "return"], - [Instruction.Break, "break"], - [Instruction.Yield, "yield"], - [Instruction.YieldStar, "yield*"], - [Instruction.Endfinally, "endfinally"], - ); + function getInstructionName(instruction: Instruction): string { + switch (instruction) { + case Instruction.Return: return "return"; + case Instruction.Break: return "break"; + case Instruction.Yield: return "yield"; + case Instruction.YieldStar: return "yield*"; + case Instruction.Endfinally: return "endfinally"; + } + } export function transformGenerators(context: TransformationContext) { const { @@ -241,7 +243,7 @@ namespace ts { let currentSourceFile: SourceFile; let renamedCatchVariables: Map; - let renamedCatchVariableDeclarations: Map; + let renamedCatchVariableDeclarations: SparseArray; let inGeneratorFunctionBody: boolean; let inStatementContainingYield: boolean; @@ -1926,7 +1928,7 @@ namespace ts { if (isIdentifier(original) && original.parent) { const declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - const name = renamedCatchVariableDeclarations.get(getOriginalNodeId(declaration)); + const name = renamedCatchVariableDeclarations[getOriginalNodeId(declaration)]; if (name) { const clone = getMutableClone(name); setSourceMapRange(clone, node); @@ -2092,12 +2094,12 @@ namespace ts { if (!renamedCatchVariables) { renamedCatchVariables = createMap(); - renamedCatchVariableDeclarations = createMap(); + renamedCatchVariableDeclarations = sparseArray(); context.enableSubstitution(SyntaxKind.Identifier); } renamedCatchVariables.set(text, true); - renamedCatchVariableDeclarations.set(getOriginalNodeId(variable), name); + renamedCatchVariableDeclarations[getOriginalNodeId(variable)] = name; const exception = peekBlock(); Debug.assert(exception.state < ExceptionBlockState.Catch); @@ -2401,7 +2403,7 @@ namespace ts { */ function createInstruction(instruction: Instruction): NumericLiteral { const literal = createLiteral(instruction); - literal.trailingComment = instructionNames.get(instruction); + literal.trailingComment = getInstructionName(instruction); return literal; } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 5d05667e4c2..e5e27c8360d 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,4 +1,4 @@ -/// +/// /// /*@internal*/ @@ -10,12 +10,13 @@ namespace ts { importAliasNames: ParameterDeclaration[]; } - const transformModuleDelegates = createMapFromPairs<(node: SourceFile) => SourceFile>( - [ModuleKind.None, transformCommonJSModule], - [ModuleKind.CommonJS, transformCommonJSModule], - [ModuleKind.AMD, transformAMDModule], - [ModuleKind.UMD, transformUMDModule], - ); + function getTransformModuleDelegate(moduleKind: ModuleKind): (node: SourceFile) => SourceFile { + switch (moduleKind) { + case ModuleKind.AMD: return transformAMDModule; + case ModuleKind.UMD: return transformUMDModule; + default: return transformCommonJSModule; + } + } const { startLexicalEnvironment, @@ -38,12 +39,12 @@ namespace ts { context.enableSubstitution(SyntaxKind.ShorthandPropertyAssignment); // Substitutes shorthand property assignments for imported/exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap = createMap(); // The ExternalModuleInfo for each file. - const deferredExports = createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + const moduleInfoMap = sparseArray(); // The ExternalModuleInfo for each file. + const deferredExports = sparseArray(); // Exports to defer until an EndOfDeclarationMarker is found. let currentSourceFile: SourceFile; // The current file. let currentModuleInfo: ExternalModuleInfo; // The ExternalModuleInfo for the current file. - let noSubstitution: Map; // Set of nodes for which substitution rules should be ignored. + let noSubstitution: SparseArray; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; @@ -61,10 +62,10 @@ namespace ts { currentSourceFile = node; currentModuleInfo = collectExternalModuleInfo(node, resolver, compilerOptions); - moduleInfoMap.set(getOriginalNodeId(node), currentModuleInfo); + moduleInfoMap[getOriginalNodeId(node)] = currentModuleInfo; // Perform the transformation. - const transformModule = transformModuleDelegates.get(moduleKind) || transformModuleDelegates.get(ModuleKind.None); + const transformModule = getTransformModuleDelegate(moduleKind); const updated = transformModule(node); currentSourceFile = undefined; @@ -445,7 +446,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfImportDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); } else { statements = appendExportsOfImportDeclaration(statements, node); @@ -524,7 +525,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfImportEqualsDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); } else { statements = appendExportsOfImportEqualsDeclaration(statements, node); @@ -611,7 +612,7 @@ namespace ts { if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportStatement(deferredExports.get(id), createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true)); + deferredExports[id] = appendExportStatement(deferredExports[id], createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); } else { statements = appendExportStatement(statements, createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); @@ -652,7 +653,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -691,7 +692,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -742,7 +743,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); } else { statements = appendExportsOfVariableStatement(statements, node); @@ -795,7 +796,7 @@ namespace ts { // statement. if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === SyntaxKind.VariableStatement) { const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node.original)); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } return node; @@ -821,9 +822,9 @@ namespace ts { // end of the transformed declaration. We use this marker to emit any deferred exports // of the declaration. const id = getOriginalNodeId(node); - const statements = deferredExports.get(id); + const statements = deferredExports[id]; if (statements) { - deferredExports.delete(id); + delete deferredExports[id]; return append(statements, node); } @@ -1103,8 +1104,8 @@ namespace ts { function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void { if (node.kind === SyntaxKind.SourceFile) { currentSourceFile = node; - currentModuleInfo = moduleInfoMap.get(getOriginalNodeId(currentSourceFile)); - noSubstitution = createMap(); + currentModuleInfo = moduleInfoMap[getOriginalNodeId(currentSourceFile)]; + noSubstitution = sparseArray(); previousOnEmitNode(emitContext, node, emitCallback); @@ -1129,7 +1130,7 @@ namespace ts { */ function onSubstituteNode(emitContext: EmitContext, node: Node) { node = previousOnSubstituteNode(emitContext, node); - if (node.id && noSubstitution.get(node.id)) { + if (node.id && noSubstitution[node.id]) { return node; } @@ -1255,7 +1256,7 @@ namespace ts { let expression: Expression = node; for (const exportName of exportedNames) { // Mark the node to prevent triggering this rule again. - noSubstitution.set(getNodeId(expression), true); + noSubstitution[getNodeId(expression)] = true; expression = createExportExpression(exportName, expression, /*location*/ node); } @@ -1297,7 +1298,7 @@ namespace ts { : node; for (const exportName of exportedNames) { // Mark the node to prevent triggering this rule again. - noSubstitution.set(getNodeId(expression), true); + noSubstitution[getNodeId(expression)] = true; expression = createExportExpression(exportName, expression); } @@ -1319,7 +1320,7 @@ namespace ts { || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { return currentModuleInfo - && currentModuleInfo.exportedBindings.get(getOriginalNodeId(valueDeclaration)); + && currentModuleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]; } } } diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index bc613bcfaf6..c20e6b5cf32 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,4 +1,4 @@ -/// +/// /// /*@internal*/ @@ -28,10 +28,10 @@ namespace ts { context.enableSubstitution(SyntaxKind.PostfixUnaryExpression); // Substitutes updates to exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap = createMap(); // The ExternalModuleInfo for each file. - const deferredExports = createMap(); // Exports to defer until an EndOfDeclarationMarker is found. - const exportFunctionsMap = createMap(); // The export function associated with a source file. - const noSubstitutionMap = createMap>(); // Set of nodes for which substitution rules should be ignored for each file. + const moduleInfoMap = sparseArray(); // The ExternalModuleInfo for each file. + const deferredExports = sparseArray(); // Exports to defer until an EndOfDeclarationMarker is found. + const exportFunctionsMap = sparseArray(); // The export function associated with a source file. + const noSubstitutionMap = sparseArray>(); // Set of nodes for which substitution rules should be ignored for each file. let currentSourceFile: SourceFile; // The current file. let moduleInfo: ExternalModuleInfo; // ExternalModuleInfo for the current file. @@ -39,7 +39,7 @@ namespace ts { let contextObject: Identifier; // The context object for the current file. let hoistedStatements: Statement[]; let enclosingBlockScopedContainer: Node; - let noSubstitution: Map; // Set of nodes for which substitution rules should be ignored. + let noSubstitution: SparseArray; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; @@ -73,13 +73,12 @@ namespace ts { // see comment to 'substitutePostfixUnaryExpression' for more details // Collect information about the external module and dependency groups. - moduleInfo = collectExternalModuleInfo(node, resolver, compilerOptions); - moduleInfoMap.set(id, moduleInfo); + moduleInfo = moduleInfoMap[id] = collectExternalModuleInfo(node, resolver, compilerOptions); // Make sure that the name of the 'exports' function does not conflict with // existing identifiers. exportFunction = createUniqueName("exports"); - exportFunctionsMap.set(id, exportFunction); + exportFunctionsMap[id] = exportFunction; contextObject = createUniqueName("context"); // Add the body of the module. @@ -123,7 +122,7 @@ namespace ts { } if (noSubstitution) { - noSubstitutionMap.set(id, noSubstitution); + noSubstitutionMap[id] = noSubstitution; noSubstitution = undefined; } @@ -610,7 +609,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfImportDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); } else { statements = appendExportsOfImportDeclaration(statements, node); @@ -633,7 +632,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfImportEqualsDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); } else { statements = appendExportsOfImportEqualsDeclaration(statements, node); @@ -658,7 +657,7 @@ namespace ts { if (original && hasAssociatedEndOfDeclarationMarker(original)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportStatement(deferredExports.get(id), createIdentifier("default"), expression, /*allowComments*/ true)); + deferredExports[id] = appendExportStatement(deferredExports[id], createIdentifier("default"), expression, /*allowComments*/ true); } else { return createExportStatement(createIdentifier("default"), expression, /*allowComments*/ true); @@ -690,7 +689,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); @@ -732,7 +731,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node)) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfHoistedDeclaration(deferredExports.get(id), node)); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else { statements = appendExportsOfHoistedDeclaration(statements, node); @@ -772,7 +771,7 @@ namespace ts { if (isMarkedDeclaration) { // Defer exports until we encounter an EndOfDeclarationMarker node const id = getOriginalNodeId(node); - deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node, isExportedDeclaration)); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); } else { statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); @@ -885,7 +884,7 @@ namespace ts { if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === SyntaxKind.VariableStatement) { const id = getOriginalNodeId(node); const isExportedDeclaration = hasModifier(node.original, ModifierFlags.Export); - deferredExports.set(id, appendExportsOfVariableStatement(deferredExports.get(id), node.original, isExportedDeclaration)); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); } return node; @@ -911,9 +910,9 @@ namespace ts { // end of the transformed declaration. We use this marker to emit any deferred exports // of the declaration. const id = getOriginalNodeId(node); - const statements = deferredExports.get(id); + const statements = deferredExports[id]; if (statements) { - deferredExports.delete(id); + delete deferredExports[id]; return append(statements, node); } @@ -1556,12 +1555,12 @@ namespace ts { if (node.kind === SyntaxKind.SourceFile) { const id = getOriginalNodeId(node); currentSourceFile = node; - moduleInfo = moduleInfoMap.get(id); - exportFunction = exportFunctionsMap.get(id); - noSubstitution = noSubstitutionMap.get(id); + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; if (noSubstitution) { - noSubstitutionMap.delete(id); + delete noSubstitutionMap[id]; } previousOnEmitNode(emitContext, node, emitCallback); @@ -1758,7 +1757,7 @@ namespace ts { exportedNames = append(exportedNames, getDeclarationName(valueDeclaration)); } - exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings.get(getOriginalNodeId(valueDeclaration))); + exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]); } } @@ -1771,8 +1770,8 @@ namespace ts { * @param node The node which should not be substituted. */ function preventSubstitution(node: T): T { - if (noSubstitution === undefined) noSubstitution = createMap(); - noSubstitution.set(getNodeId(node), true); + if (noSubstitution === undefined) noSubstitution = sparseArray(); + noSubstitution[getNodeId(node)] = true; return node; } @@ -1782,7 +1781,7 @@ namespace ts { * @param node The node to test. */ function isSubstitutionPrevented(node: Node) { - return noSubstitution && node.id && noSubstitution.get(node.id); + return noSubstitution && node.id && noSubstitution[node.id]; } } } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 4b0f981f27c..ef7001f3735 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,4 +1,4 @@ -/// +/// /// /// @@ -60,7 +60,7 @@ namespace ts { * A map that keeps track of aliases created for classes with decorators to avoid issues * with the double-binding behavior of classes. */ - let classAliases: Map; + let classAliases: SparseArray; /** * Keeps track of whether we are within any containing namespaces when performing @@ -752,7 +752,7 @@ namespace ts { if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. enableSubstitutionForClassAliases(); - classAliases.set(getOriginalNodeId(node), getSynthesizedClone(temp)); + classAliases[getOriginalNodeId(node)] = getSynthesizedClone(temp); } // To preserve the behavior of the old emitter, we explicitly indent @@ -1420,7 +1420,7 @@ namespace ts { return undefined; } - const classAlias = classAliases && classAliases.get(getOriginalNodeId(node)); + const classAlias = classAliases && classAliases[getOriginalNodeId(node)]; const localName = getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); const decorate = createDecorateHelper(context, decoratorExpressions, localName); const expression = createAssignment(localName, classAlias ? createAssignment(classAlias, decorate) : decorate); @@ -3085,7 +3085,7 @@ namespace ts { if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithConstructorReference) { enableSubstitutionForClassAliases(); const classAlias = createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? node.name.text : "default"); - classAliases.set(getOriginalNodeId(node), classAlias); + classAliases[getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; } @@ -3117,7 +3117,7 @@ namespace ts { context.enableSubstitution(SyntaxKind.Identifier); // Keep track of class aliases. - classAliases = createMap(); + classAliases = sparseArray(); } } @@ -3230,7 +3230,7 @@ namespace ts { // constructor references in static property initializers. const declaration = resolver.getReferencedValueDeclaration(node); if (declaration) { - const classAlias = classAliases.get(declaration.id); + const classAlias = classAliases[declaration.id]; if (classAlias) { const clone = getSynthesizedClone(classAlias); setSourceMapRange(clone, node); diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 5de16a20fc2..ba5a0d8faea 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { @@ -67,11 +67,13 @@ namespace ts { const gutterSeparator = " "; const resetEscapeSequence = "\u001b[0m"; const ellipsis = "..."; - const categoryFormatMap = createMapFromPairs( - [DiagnosticCategory.Warning, yellowForegroundEscapeSequence], - [DiagnosticCategory.Error, redForegroundEscapeSequence], - [DiagnosticCategory.Message, blueForegroundEscapeSequence], - ); + function getCategoryFormat(category: DiagnosticCategory): string { + switch (category) { + case DiagnosticCategory.Warning: return yellowForegroundEscapeSequence; + case DiagnosticCategory.Error: return redForegroundEscapeSequence; + case DiagnosticCategory.Message: return blueForegroundEscapeSequence; + } + } function formatAndReset(text: string, formatStyle: string) { return formatStyle + text + resetEscapeSequence; @@ -139,7 +141,7 @@ namespace ts { output += `${ relativeFileName }(${ firstLine + 1 },${ firstLineChar + 1 }): `; } - const categoryColor = categoryFormatMap.get(diagnostic.category); + const categoryColor = getCategoryFormat(diagnostic.category); const category = DiagnosticCategory[diagnostic.category].toLowerCase(); output += `${ formatAndReset(category, categoryColor) } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }`; output += sys.newLine + sys.newLine; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b98a5a493ba..75ff806d605 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,4 +1,4 @@ -namespace ts { +namespace ts { /** * Type of objects whose values are all of the same type. * The `in` and `for-in` operators can *not* be safely used, @@ -8,15 +8,19 @@ namespace ts { [index: string]: T; } - /** It's allowed to get/set into a map with numbers. However, when iterating, you may get strings back due to the shim being an ordinary object (which only allows string keys). */ - export type MapKey = string | number; + /** + * Like MapLike, but keys must be numbers. + */ + export interface SparseArray { + [key: number]: T; + } /** Minimal ES6 Map interface. Does not include iterators as those are hard to shim performantly. */ export interface Map { - get(key: MapKey): T; - has(key: MapKey): boolean; - set(key: MapKey, value: T): this; - delete(key: MapKey): boolean; + get(key: string): T; + has(key: string): boolean; + set(key: string, value: T): this; + delete(key: string): boolean; clear(): void; /** `key` may *not* be a string if it was set with a number and we are not using the shim. */ forEach(action: (value: T, key: string) => void): void; @@ -2853,7 +2857,7 @@ namespace ts { // Enum types (TypeFlags.Enum) export interface EnumType extends Type { - memberTypes: Map; + memberTypes: SparseArray; } // Enum types (TypeFlags.EnumLiteral) @@ -3682,7 +3686,7 @@ namespace ts { flags?: EmitFlags; // Flags that customize emit commentRange?: TextRange; // The text range to use when emitting leading or trailing comments sourceMapRange?: TextRange; // The text range to use when emitting leading or trailing source mappings - tokenSourceMapRanges?: Map; // The text range to use when emitting source mappings for tokens + tokenSourceMapRanges?: SparseArray; // The text range to use when emitting source mappings for tokens constantValue?: number; // The constant value of an expression externalHelpersModuleName?: Identifier; // The local name for an imported helpers module helpers?: EmitHelper[]; // Emit helpers for the node diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 25973cae5cb..ead1a3b62de 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3311,12 +3311,12 @@ namespace ts { return false; } - const syntaxKindCache = createMap(); + const syntaxKindCache = sparseArray(); export function formatSyntaxKind(kind: SyntaxKind): string { const syntaxKindEnum = (ts).SyntaxKind; if (syntaxKindEnum) { - const cached = syntaxKindCache.get(kind); + const cached = syntaxKindCache[kind]; if (cached !== undefined) { return cached; } @@ -3324,7 +3324,7 @@ namespace ts { for (const name in syntaxKindEnum) { if (syntaxKindEnum[name] === kind) { const result = `${kind} (${name})`; - syntaxKindCache.set(kind, result); + syntaxKindCache[kind] = result; return result; } } diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index c9ea2af1a87..2afb1f8301e 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1,4 +1,4 @@ -/// +/// /// /// @@ -46,54 +46,56 @@ namespace ts { * supplant the existing `forEachChild` implementation if performance is not * significantly impacted. */ - const nodeEdgeTraversalMap = createMapFromPairs( - [SyntaxKind.QualifiedName, [ - { name: "left", test: isEntityName }, - { name: "right", test: isIdentifier } - ]], - [SyntaxKind.Decorator, [ - { name: "expression", test: isLeftHandSideExpression } - ]], - [SyntaxKind.TypeAssertionExpression, [ - { name: "type", test: isTypeNode }, - { name: "expression", test: isUnaryExpression } - ]], - [SyntaxKind.AsExpression, [ - { name: "expression", test: isExpression }, - { name: "type", test: isTypeNode } - ]], - [SyntaxKind.NonNullExpression, [ - { name: "expression", test: isLeftHandSideExpression } - ]], - [SyntaxKind.EnumDeclaration, [ - { name: "decorators", test: isDecorator }, - { name: "modifiers", test: isModifier }, - { name: "name", test: isIdentifier }, - { name: "members", test: isEnumMember } - ]], - [SyntaxKind.ModuleDeclaration, [ - { name: "decorators", test: isDecorator }, - { name: "modifiers", test: isModifier }, - { name: "name", test: isModuleName }, - { name: "body", test: isModuleBody } - ]], - [SyntaxKind.ModuleBlock, [ - { name: "statements", test: isStatement } - ]], - [SyntaxKind.ImportEqualsDeclaration, [ - { name: "decorators", test: isDecorator }, - { name: "modifiers", test: isModifier }, - { name: "name", test: isIdentifier }, - { name: "moduleReference", test: isModuleReference } - ]], - [SyntaxKind.ExternalModuleReference, [ - { name: "expression", test: isExpression, optional: true } - ]], - [SyntaxKind.EnumMember, [ - { name: "name", test: isPropertyName }, - { name: "initializer", test: isExpression, optional: true, parenthesize: parenthesizeExpressionForList } - ]] - ); + function getNodeEdgeTraversal(kind: SyntaxKind): NodeTraversalPath { + switch (kind) { + case SyntaxKind.QualifiedName: return [ + { name: "left", test: isEntityName }, + { name: "right", test: isIdentifier } + ]; + case SyntaxKind.Decorator: return [ + { name: "expression", test: isLeftHandSideExpression } + ]; + case SyntaxKind.TypeAssertionExpression: return [ + { name: "type", test: isTypeNode }, + { name: "expression", test: isUnaryExpression } + ]; + case SyntaxKind.AsExpression: return [ + { name: "expression", test: isExpression }, + { name: "type", test: isTypeNode } + ]; + case SyntaxKind.NonNullExpression: return [ + { name: "expression", test: isLeftHandSideExpression } + ]; + case SyntaxKind.EnumDeclaration: return [ + { name: "decorators", test: isDecorator }, + { name: "modifiers", test: isModifier }, + { name: "name", test: isIdentifier }, + { name: "members", test: isEnumMember } + ]; + case SyntaxKind.ModuleDeclaration: return [ + { name: "decorators", test: isDecorator }, + { name: "modifiers", test: isModifier }, + { name: "name", test: isModuleName }, + { name: "body", test: isModuleBody } + ]; + case SyntaxKind.ModuleBlock: return [ + { name: "statements", test: isStatement } + ]; + case SyntaxKind.ImportEqualsDeclaration: return [ + { name: "decorators", test: isDecorator }, + { name: "modifiers", test: isModifier }, + { name: "name", test: isIdentifier }, + { name: "moduleReference", test: isModuleReference } + ]; + case SyntaxKind.ExternalModuleReference: return [ + { name: "expression", test: isExpression, optional: true } + ]; + case SyntaxKind.EnumMember: return [ + { name: "name", test: isPropertyName }, + { name: "initializer", test: isExpression, optional: true, parenthesize: parenthesizeExpressionForList } + ]; + } + } function reduceNode(node: Node, f: (memo: T, node: Node) => T, initial: T) { return node ? f(initial, node) : initial; @@ -530,7 +532,7 @@ namespace ts { break; default: - const edgeTraversalPath = nodeEdgeTraversalMap.get(kind); + const edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (const edge of edgeTraversalPath) { const value = (>node)[edge.name]; @@ -1188,7 +1190,7 @@ namespace ts { default: let updated: Node & MapLike; - const edgeTraversalPath = nodeEdgeTraversalMap.get(kind); + const edgeTraversalPath = getNodeEdgeTraversal(kind); if (edgeTraversalPath) { for (const edge of edgeTraversalPath) { const value = >(>node)[edge.name]; diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index da24fe1606b..70cda27747b 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -1,4 +1,4 @@ -/// +/// const expect: typeof _chai.expect = _chai.expect; @@ -416,16 +416,16 @@ namespace ts.server { class InProcClient { private server: InProcSession; private seq = 0; - private callbacks = createMap<(resp: protocol.Response) => void>(); + private callbacks = sparseArray<(resp: protocol.Response) => void>(); private eventHandlers = createMap<(args: any) => void>(); handle(msg: protocol.Message): void { if (msg.type === "response") { const response = msg; - const handler = this.callbacks.get(response.request_seq); + const handler = this.callbacks[response.request_seq]; if (handler) { handler(response); - this.callbacks.delete(response.request_seq); + delete this.callbacks[response.request_seq]; } } else if (msg.type === "event") { @@ -460,7 +460,7 @@ namespace ts.server { command, arguments: args }); - this.callbacks.set(this.seq, callback); + this.callbacks[this.seq] = callback; } }; diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 5b4ba7d7223..ae213bd0a50 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts.projectSystem { @@ -290,30 +290,34 @@ namespace ts.projectSystem { } export class Callbacks { - private map = createMap(); + private map = sparseArray(); private nextId = 1; register(cb: (...args: any[]) => void, args: any[]) { const timeoutId = this.nextId; this.nextId++; - this.map.set(timeoutId, cb.bind(undefined, ...args)); + this.map[timeoutId] = cb.bind(undefined, ...args); return timeoutId; } unregister(id: any) { if (typeof id === "number") { - this.map.delete(id); + delete this.map[id]; } } count() { - return this.map.size; + let n = 0; + for (const _ in this.map) { + n++; + } + return n; } invoke() { - this.map.forEach(cb => { - cb(); - }); - this.map.clear(); + for (const key in this.map) { + this.map[key](); + } + this.map = sparseArray(); } } diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codefixes/codeFixProvider.ts index c6373fc1909..fe3e71f1e1c 100644 --- a/src/services/codefixes/codeFixProvider.ts +++ b/src/services/codefixes/codeFixProvider.ts @@ -16,25 +16,25 @@ namespace ts { } export namespace codefix { - const codeFixes = createMap(); + const codeFixes = sparseArray(); export function registerCodeFix(action: CodeFix) { forEach(action.errorCodes, error => { - let fixes = codeFixes.get(error); + let fixes = codeFixes[error]; if (!fixes) { fixes = []; - codeFixes.set(error, fixes); + codeFixes[error] = fixes; } fixes.push(action); }); } export function getSupportedErrorCodes() { - return keysOfMap(codeFixes); + return keysOfSparseArray(codeFixes); } export function getFixes(context: CodeFixContext): CodeAction[] { - const fixes = codeFixes.get(context.errorCode); + const fixes = codeFixes[context.errorCode]; let allActions: CodeAction[] = []; forEach(fixes, f => { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 0e7743e29fc..0df3c3134fe 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -14,16 +14,16 @@ namespace ts.codefix { } class ImportCodeActionMap { - private symbolIdToActionMap = createMap(); + private symbolIdToActionMap = sparseArray(); addAction(symbolId: number, newAction: ImportCodeAction) { if (!newAction) { return; } - const actions = this.symbolIdToActionMap.get(symbolId); + const actions = this.symbolIdToActionMap[symbolId]; if (!actions) { - this.symbolIdToActionMap.set(symbolId, [newAction]); + this.symbolIdToActionMap[symbolId] = [newAction]; return; } @@ -33,7 +33,7 @@ namespace ts.codefix { } const updatedNewImports: ImportCodeAction[] = []; - for (const existingAction of this.symbolIdToActionMap.get(symbolId)) { + for (const existingAction of this.symbolIdToActionMap[symbolId]) { if (existingAction.kind === "CodeChange") { // only import actions should compare updatedNewImports.push(existingAction); @@ -63,7 +63,7 @@ namespace ts.codefix { } // if we reach here, it means the new one is better or equal to all of the existing ones. updatedNewImports.push(newAction); - this.symbolIdToActionMap.set(symbolId, updatedNewImports); + this.symbolIdToActionMap[symbolId] = updatedNewImports; } addActions(symbolId: number, newActions: ImportCodeAction[]) { @@ -74,9 +74,9 @@ namespace ts.codefix { getAllActions() { let result: ImportCodeAction[] = []; - this.symbolIdToActionMap.forEach(actions => { - result = concatenate(result, actions); - }); + for (const key in this.symbolIdToActionMap) { + result = concatenate(result, this.symbolIdToActionMap[key]) + } return result; } @@ -125,7 +125,7 @@ namespace ts.codefix { const symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - const cachedImportDeclarations = createMap<(ImportDeclaration | ImportEqualsDeclaration)[]>(); + const cachedImportDeclarations = sparseArray<(ImportDeclaration | ImportEqualsDeclaration)[]>(); let cachedNewImportInsertPosition: number; const allPotentialModules = checker.getAmbientModules(); @@ -163,7 +163,7 @@ namespace ts.codefix { function getImportDeclarations(moduleSymbol: Symbol) { const moduleSymbolId = getUniqueSymbolId(moduleSymbol); - const cached = cachedImportDeclarations.get(moduleSymbolId); + const cached = cachedImportDeclarations[moduleSymbolId]; if (cached) { return cached; } @@ -175,7 +175,7 @@ namespace ts.codefix { existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); } } - cachedImportDeclarations.set(moduleSymbolId, existingDeclarations); + cachedImportDeclarations[moduleSymbolId] = existingDeclarations; return existingDeclarations; function getImportDeclaration(moduleSpecifier: LiteralExpression) { From 77a3dfbcfc37585da8e634e73032ee3f44fef1b3 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 27 Dec 2016 11:59:56 -0800 Subject: [PATCH 185/289] tsserver should use newline provided by the host (#13185) --- src/harness/unittests/compileOnSave.ts | 32 ++++++++++++++++++- .../unittests/tsserverProjectSystem.ts | 7 ++-- src/server/lsHost.ts | 4 +++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/harness/unittests/compileOnSave.ts b/src/harness/unittests/compileOnSave.ts index d7731a625fe..c8deb9e7554 100644 --- a/src/harness/unittests/compileOnSave.ts +++ b/src/harness/unittests/compileOnSave.ts @@ -467,6 +467,36 @@ namespace ts.projectSystem { }); describe("EmitFile test", () => { + it("should respect line endings", () => { + test("\n"); + test("\r\n"); + + function test(newLine: string) { + const lines = ["var x = 1;", "var y = 2;"]; + const path = "/a/app"; + const f = { + path: path + ".ts", + content: lines.join(newLine) + }; + const host = createServerHost([f], { newLine }); + const session = createSession(host); + session.executeCommand({ + seq: 1, + type: "request", + command: "open", + arguments: { file: f.path } + }); + session.executeCommand({ + seq: 2, + type: "request", + command: "compileOnSaveEmitFile", + arguments: { file: f.path } + }); + const emitOutput = host.readFile(path + ".js"); + assert.equal(emitOutput, f.content + newLine, "content of emit output should be identical with the input + newline"); + } + }) + it("should emit specified file", () => { const file1 = { path: "/a/b/f1.ts", @@ -480,7 +510,7 @@ namespace ts.projectSystem { path: "/a/b/tsconfig.json", content: `{}` }; - const host = createServerHost([file1, file2, configFile, libFile]); + const host = createServerHost([file1, file2, configFile, libFile], { newLine: "\r\n" }); const typingsInstaller = createTestTypingsInstaller(host); const session = new server.Session(host, nullCancellationToken, /*useSingleInferredProject*/ false, typingsInstaller, Utils.byteLength, process.hrtime, nullLogger, /*canUseEvents*/ false); diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index d379b5bbf9c..5b9f4332359 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -141,6 +141,7 @@ namespace ts.projectSystem { useCaseSensitiveFileNames?: boolean; executingFilePath?: string; currentDirectory?: string; + newLine?: string; } export function createServerHost(fileOrFolderList: FileOrFolder[], params?: TestServerHostCreationParameters): TestServerHost { @@ -151,7 +152,8 @@ namespace ts.projectSystem { params.useCaseSensitiveFileNames !== undefined ? params.useCaseSensitiveFileNames : false, params.executingFilePath || getExecutingFilePathFromLibFile(), params.currentDirectory || "/", - fileOrFolderList); + fileOrFolderList, + params.newLine); return host; } @@ -329,7 +331,6 @@ namespace ts.projectSystem { export class TestServerHost implements server.ServerHost { args: string[] = []; - newLine: "\n"; private fs: ts.FileMap; private getCanonicalFileName: (s: string) => string; @@ -342,7 +343,7 @@ namespace ts.projectSystem { private filesOrFolders: FileOrFolder[]; - constructor(public useCaseSensitiveFileNames: boolean, private executingFilePath: string, private currentDirectory: string, fileOrFolderList: FileOrFolder[]) { + constructor(public useCaseSensitiveFileNames: boolean, private executingFilePath: string, private currentDirectory: string, fileOrFolderList: FileOrFolder[], public readonly newLine = "\n") { this.getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); this.toPath = s => toPath(s, currentDirectory, this.getCanonicalFileName); diff --git a/src/server/lsHost.ts b/src/server/lsHost.ts index d73a31933f4..98b3dd9a8c0 100644 --- a/src/server/lsHost.ts +++ b/src/server/lsHost.ts @@ -135,6 +135,10 @@ namespace ts.server { } } + getNewLine() { + return this.host.newLine; + } + getProjectVersion() { return this.project.getProjectVersion(); } From 55552585d0f8b060e4794826d833229344fa0b2e Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 27 Dec 2016 12:37:42 -0800 Subject: [PATCH 186/289] Add iterators to Map interface, and shim iterators --- src/compiler/checker.ts | 2 +- src/compiler/core.ts | 175 ++++++++++----------- src/compiler/transformers/module/system.ts | 2 +- src/compiler/types.ts | 11 +- src/services/codefixes/codeFixProvider.ts | 2 +- src/services/completions.ts | 2 +- 6 files changed, 100 insertions(+), 94 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 47a7db16986..4ecfdc4d2f4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6161,7 +6161,7 @@ namespace ts { if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers const aliasSymbol = getAliasSymbolForTypeNode(node); - if (mapIsEmpty(node.symbol.members) && !aliasSymbol) { + if (node.symbol.members.size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 36847796b6e..a6766887494 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -54,40 +54,48 @@ namespace ts { return map; } - /** Methods on native maps but not on shim maps. Only used in this file. */ - interface ES6Map extends Map { - entries(): Iterator<[string, T]>; - } - - /** ES6 Iterator type. */ - interface Iterator { - next(): { value: T, done: false } | { value: never, done: true }; - } - - /** Shim maps support certain methods directly. For native maps we use a function. */ - interface ShimMap extends Map { - isEmpty(): boolean; - forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined; - some(predicate: (value: T, key: string) => boolean): boolean; - } - // The global Map object. This may not be available, so we must test for it. declare const Map: { new(): Map } | undefined; // Internet Explorer's Map doesn't support iteration, so don't use it. // tslint:disable-next-line:no-in-operator - const usingNativeMaps = typeof Map !== "undefined" && "entries" in Map.prototype; - const MapCtr = usingNativeMaps ? Map : shimMap(); + const MapCtr = typeof Map !== "undefined" && "entries" in Map.prototype ? Map : shimMap(); // Keep the class inside a function so it doesn't get compiled if it's not used. function shimMap(): { new(): Map } { - return class implements ShimMap { + + class MapIterator { + private data: MapLike; + private keys: string[]; + private index = 0; + private selector: (data: MapLike, key: string) => U; + constructor(data: MapLike, selector: (data: MapLike, key: string) => U) { + this.data = data; + this.selector = selector; + this.keys = Object.keys(data); + } + + public next(): { value: U, done: false } | { value: never, done: true } { + const index = this.index; + if (index < this.keys.length) { + this.index++; + return { value: this.selector(this.data, this.keys[index]), done: false }; + } + return { value: undefined as never, done: true } + } + } + + return class implements Map { private data = createMapLike(); + public size = 0; get(key: string): T { return this.data[key]; } set(key: string, value: T): this { + if (!this.has(key)) { + this.size++; + } this.data[key] = value; return this; } @@ -98,15 +106,29 @@ namespace ts { } delete(key: string): boolean { - const had = this.has(key); - if (had) { + if (this.has(key)) { + this.size--; delete this.data[key]; + return true; } - return had; + return false; } clear(): void { this.data = createMapLike(); + this.size = 0; + } + + keys() { + return new MapIterator(this.data, (_data, key) => key); + } + + values() { + return new MapIterator(this.data, (data, key) => data[key]); + } + + entries() { + return new MapIterator(this.data, (data, key) => [key, data[key]]); } forEach(action: (value: T, key: string) => void): void { @@ -114,36 +136,6 @@ namespace ts { action(this.data[key], key); } } - - isEmpty(): boolean { - return !this.some(() => true); - } - - get size(): number { - let size = 0; - for (const _ in this.data) { - size++; - } - return size; - } - - forEachInMap(callback: (value: T, key: string) => U | undefined): U | undefined { - for (const key in this.data) { - const result = callback(this.data[key], key); - if (result !== undefined) { - return result; - } - } - } - - some(predicate: (value: T, key: string) => boolean): boolean { - for (const key in this.data) { - if (predicate(this.data[key], key)) { - return true; - } - } - return false; - } } } @@ -877,65 +869,76 @@ namespace ts { return keys; } + function arrayFrom(iterator: Iterator): T[] { + const result: T[] = []; + for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) { + result.push(value); + } + return result; + } + /** * Array of every key in a map. * May not actually return string[] if numbers were put into the map. */ export function keysOfMap(map: Map<{}>): string[] { - const keys: string[] = []; - forEachKeyInMap(map, key => { - keys.push(key); - }); - return keys; + return arrayFrom(map.keys()); } /** Array of every value in a map. */ export function valuesOfMap(map: Map): T[] { - const values: T[] = []; - map.forEach(value => { - values.push(value); - }); - return values; + return arrayFrom(map.values()); } /** * Calls `callback` for each entry in the map, returning the first defined result. * Use `map.forEach` instead for normal iteration. */ - export const forEachInMap: (map: Map, callback: (value: T, key: string) => U | undefined) => U | undefined = usingNativeMaps - ? (map: ES6Map, callback: (value: T, key: string) => U | undefined) => { - const iterator = map.entries(); - while (true) { - const { value: pair, done } = iterator.next(); - if (done) return undefined; - const [key, value] = pair; - const result = callback(value, key); - if (result !== undefined) return result; + export function forEachInMap(map: Map, callback: (value: T, key: string) => U | undefined): U | undefined { + const iterator = map.entries(); + for (let { value: pair, done } = iterator.next(); !done; { value: pair, done } = iterator.next()) { + const [key, value] = pair; + const result = callback(value, key); + if (result !== undefined) { + return result; } } - : (map: ShimMap, callback: (value: T, key: string) => U | undefined) => map.forEachInMap(callback); + return undefined; + } /** `forEachInMap` for just keys. */ export function forEachKeyInMap(map: Map<{}>, callback: (key: string) => T | undefined): T | undefined { - return forEachInMap(map, (_, key) => callback(key)); + const iterator = map.keys(); + for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) { + const result = callback(key); + if (result !== undefined) { + return result; + } + } + return undefined; } /** Whether `predicate` is true for some entry in the map. */ - export const someInMap: (map: Map, predicate: (value: T, key: string) => boolean) => boolean = usingNativeMaps - ? (map: ES6Map, predicate: (value: T, key: string) => boolean) => { - const iterator = map.entries(); - while (true) { - const { value: pair, done } = iterator.next(); - if (done) return false; - const [key, value] = pair; - if (predicate(value, key)) return true; + export function someInMap(map: Map, predicate: (value: T, key: string) => boolean): boolean { + const iterator = map.entries(); + for (let { value: pair, done } = iterator.next(); !done; { value: pair, done } = iterator.next()) { + const [key, value] = pair; + if (predicate(value, key)) { + return true; } } - : (map: ShimMap, predicate: (value: T, key: string) => boolean) => map.some(predicate); + return false; + } /** `someInMap` for just keys. */ export function someKeyInMap(map: Map<{}>, predicate: (key: string) => boolean): boolean { - return someInMap(map, (_, key) => predicate(key)); + const iterator = map.keys(); + for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) { + if (predicate(key)) { + return true; + } + } + return false; } /** Copy entries from `source` to `target`. */ @@ -996,10 +999,6 @@ namespace ts { return result; } - export const mapIsEmpty: (map: Map<{}>) => boolean = usingNativeMaps - ? (map: ES6Map<{}>) => map.size === 0 - : (map: ShimMap<{}>) => map.isEmpty(); - export function cloneMap(map: Map) { const clone = createMap(); copyMapEntries(map, clone); diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index c20e6b5cf32..28179969ba2 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -306,7 +306,7 @@ namespace ts { // this set is used to filter names brought by star expors. // local names set should only be added if we have anything exported - if (!moduleInfo.exportedNames && mapIsEmpty(moduleInfo.exportSpecifiers)) { + if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { // no exported declarations (export var ...) or export specifiers (export {x}) // check if we have any non star export declarations. let hasExportDeclarationWithExportClause = false; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 75ff806d605..a842dbb093d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -15,16 +15,23 @@ [key: number]: T; } - /** Minimal ES6 Map interface. Does not include iterators as those are hard to shim performantly. */ + /** ES6 Map interface. */ export interface Map { get(key: string): T; has(key: string): boolean; set(key: string, value: T): this; delete(key: string): boolean; clear(): void; - /** `key` may *not* be a string if it was set with a number and we are not using the shim. */ forEach(action: (value: T, key: string) => void): void; readonly size: number; + keys(): Iterator; + values(): Iterator; + entries(): Iterator<[string, T]>; + } + + /** ES6 Iterator type. */ + export interface Iterator { + next(): { value: T, done: false } | { value: never, done: true }; } // branded string type used to store absolute, normalized and canonicalized paths diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codefixes/codeFixProvider.ts index fe3e71f1e1c..f4cb411b064 100644 --- a/src/services/codefixes/codeFixProvider.ts +++ b/src/services/codefixes/codeFixProvider.ts @@ -30,7 +30,7 @@ namespace ts { } export function getSupportedErrorCodes() { - return keysOfSparseArray(codeFixes); + return Object.keys(codeFixes); } export function getFixes(context: CodeFixContext): CodeAction[] { diff --git a/src/services/completions.ts b/src/services/completions.ts index f7efe1fec56..4715222db08 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1566,7 +1566,7 @@ namespace ts.Completions { existingImportsOrExports.set(name.text, true); } - if (mapIsEmpty(existingImportsOrExports)) { + if (existingImportsOrExports.size === 0) { return filter(exportsOfModule, e => e.name !== "default"); } From 3d7b5e6019b73e062dcd01fb6376a7087cf61a12 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 27 Dec 2016 12:46:28 -0800 Subject: [PATCH 187/289] Make `createMapLike` private and rename to `createDictionaryObject` --- src/compiler/commandLineParser.ts | 6 +++--- src/compiler/core.ts | 10 +++++----- src/harness/harnessLanguageService.ts | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index b3c538afd0a..4708b842763 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -762,7 +762,7 @@ namespace ts { } function serializeCompilerOptions(options: CompilerOptions): MapLike { - const result = createMapLike(); + const result: ts.MapLike = {}; const optionsNameMap = getOptionNameMap().optionNameMap; for (const name in options) { @@ -1302,7 +1302,7 @@ namespace ts { // /a/b/a?z - Watch /a/b directly to catch any new file matching a?z const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude"); const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - const wildcardDirectories = createMapLike(); + const wildcardDirectories: ts.MapLike = {}; if (include !== undefined) { const recursiveKeys: string[] = []; for (const file of include) { @@ -1325,7 +1325,7 @@ namespace ts { } // Remove any subpaths under an existing recursively watched directory. - for (const key in wildcardDirectories) { + for (const key in wildcardDirectories) if (hasProperty(wildcardDirectories, key)) { for (const recursiveKey of recursiveKeys) { if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { delete wildcardDirectories[key]; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a6766887494..693f6673234 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -26,8 +26,8 @@ namespace ts { // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. export const collator: { compare(a: string, b: string): number } = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; - /** Create a MapLike with good performance. Prefer this over a literal `{}`. */ - export function createMapLike(): MapLike { + /** Create a MapLike with good performance. */ + function createDictionaryObject(): MapLike { const map = Object.create(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. @@ -39,7 +39,7 @@ namespace ts { return map; } - export const sparseArray: () => SparseArray = createMapLike; + export const sparseArray: () => SparseArray = createDictionaryObject; /** Create a new map. If a template object is provided, the map will copy entries from it. */ export function createMap(template?: MapLike): Map { @@ -85,7 +85,7 @@ namespace ts { } return class implements Map { - private data = createMapLike(); + private data = createDictionaryObject(); public size = 0; get(key: string): T { @@ -115,7 +115,7 @@ namespace ts { } clear(): void { - this.data = createMapLike(); + this.data = createDictionaryObject(); this.size = 0; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2ddc38499d0..cd44fbf7a3a 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -262,7 +262,7 @@ namespace Harness.LanguageService { this.getModuleResolutionsForFile = (fileName) => { const scriptInfo = this.getScriptInfo(fileName); const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true); - const imports = ts.createMapLike(); + const imports: ts.MapLike = {}; for (const module of preprocessInfo.importedFiles) { const resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); if (resolutionInfo.resolvedModule) { @@ -275,7 +275,7 @@ namespace Harness.LanguageService { const scriptInfo = this.getScriptInfo(fileName); if (scriptInfo) { const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ false); - const resolutions = ts.createMapLike(); + const resolutions: ts.MapLike = {}; const settings = this.nativeHost.getCompilationSettings(); for (const typeReferenceDirective of preprocessInfo.typeReferenceDirectives) { const resolutionInfo = ts.resolveTypeReferenceDirective(typeReferenceDirective.fileName, fileName, settings, moduleResolutionHost); From 11dd368ec0fd98b4851b215949ab4edd4ecbe9ab Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 27 Dec 2016 15:50:14 -0800 Subject: [PATCH 188/289] do not report file lookups if containing folder is known to be missing (#13187) * added missing '.' at the end of message * do not report lookups if containing folder is known to be absent --- src/compiler/diagnosticMessages.json | 10 +- src/compiler/moduleNameResolver.ts | 86 +++++++++---- .../unittests/tsserverProjectSystem.ts | 57 ++------- .../reference/cacheResolutions.trace.json | 20 +-- .../cachedModuleResolution1.trace.json | 39 +----- .../cachedModuleResolution2.trace.json | 39 +----- .../cachedModuleResolution3.trace.json | 2 +- .../cachedModuleResolution4.trace.json | 2 +- .../cachedModuleResolution5.trace.json | 39 +----- .../cachedModuleResolution6.trace.json | 110 +++------------- .../cachedModuleResolution7.trace.json | 98 +++------------ .../cachedModuleResolution8.trace.json | 26 ++-- .../cachedModuleResolution9.trace.json | 18 +-- .../importWithTrailingSlash.trace.json | 8 +- ...portWithTrailingSlash_noResolve.trace.json | 13 +- .../reference/library-reference-11.trace.json | 7 +- .../reference/library-reference-12.trace.json | 7 +- .../reference/library-reference-4.trace.json | 22 +--- .../reference/library-reference-5.trace.json | 26 +--- ...NodeModuleJsDepthDefaultsToZero.trace.json | 8 +- .../moduleResolutionWithExtensions.trace.json | 6 +- ...tionWithExtensions_notSupported.trace.json | 20 ++- ...ionWithExtensions_notSupported2.trace.json | 9 +- ...ionWithExtensions_notSupported3.trace.json | 9 +- ...solutionWithExtensions_preferTs.trace.json | 2 +- ...lutionWithExtensions_unexpected.trace.json | 8 +- ...utionWithExtensions_unexpected2.trace.json | 8 +- ...thExtensions_withAmbientPresent.trace.json | 8 +- .../moduleResolutionWithSymlinks.trace.json | 6 +- ...onWithSymlinks_notInNodeModules.trace.json | 4 +- ...tionWithSymlinks_referenceTypes.trace.json | 6 - ...solutionWithSymlinks_withOutDir.trace.json | 6 +- ...pingBasedModuleResolution3_node.trace.json | 35 ++---- ...pingBasedModuleResolution4_node.trace.json | 35 ++---- ...gBasedModuleResolution5_classic.trace.json | 3 - ...pingBasedModuleResolution5_node.trace.json | 53 ++------ ...gBasedModuleResolution6_classic.trace.json | 3 - ...pingBasedModuleResolution6_node.trace.json | 21 +--- ...gBasedModuleResolution7_classic.trace.json | 3 - ...pingBasedModuleResolution7_node.trace.json | 70 +++-------- ...tion_withExtension_failedLookup.trace.json | 21 +--- .../typeReferenceDirectives10.trace.json | 2 +- .../typeReferenceDirectives11.trace.json | 2 +- .../typeReferenceDirectives12.trace.json | 6 +- .../typeReferenceDirectives13.trace.json | 2 +- .../typeReferenceDirectives5.trace.json | 2 +- .../typeReferenceDirectives8.trace.json | 2 +- .../typeReferenceDirectives9.trace.json | 6 +- ...mMultipleNodeModulesDirectories.trace.json | 119 ++---------------- ...romNodeModulesInParentDirectory.trace.json | 30 +---- .../reference/typingsLookup4.trace.json | 18 +-- .../reference/typingsLookupAmd.trace.json | 14 +-- 52 files changed, 286 insertions(+), 890 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 5476715468b..a049f560010 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2757,7 +2757,7 @@ "category": "Message", "code": 6094 }, - "Loading module as file / folder, candidate module location '{0}'.": { + "Loading module as file / folder, candidate module location '{0}', target file type '{1}'.": { "category": "Message", "code": 6095 }, @@ -2769,7 +2769,7 @@ "category": "Message", "code": 6097 }, - "Loading module '{0}' from 'node_modules' folder.": { + "Loading module '{0}' from 'node_modules' folder, target file type '{1}'.": { "category": "Message", "code": 6098 }, @@ -2965,10 +2965,14 @@ "category": "Message", "code": 6146 }, - "Resolution for module '{0}' was found in cache": { + "Resolution for module '{0}' was found in cache.": { "category": "Message", "code": 6147 }, + "Directory '{0}' does not exist, skipping all lookups in it.": { + "category": "Message", + "code": 6148 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index da3630765a2..e915103f3ce 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -32,7 +32,7 @@ namespace ts { * Kinds of file that we are currently looking for. * Typically there is one pass with Extensions.TypeScript, then a second pass with Extensions.JavaScript. */ - const enum Extensions { + enum Extensions { TypeScript, /** '.ts', '.tsx', or '.d.ts' */ JavaScript, /** '.js' or '.jsx' */ DtsOnly /** Only '.d.ts' */ @@ -217,9 +217,13 @@ namespace ts { return forEach(typeRoots, typeRoot => { const candidate = combinePaths(typeRoot, typeReferenceDirectiveName); const candidateDirectory = getDirectoryPath(candidate); + const directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } return resolvedTypeScriptOnly( loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, - !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + !directoryExists, moduleResolutionState)); }); } else { @@ -700,7 +704,7 @@ namespace ts { if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } const resolved = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. @@ -728,11 +732,33 @@ namespace ts { function nodeLoadModuleByRelativeName(extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { if (state.traceEnabled) { - trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - - const resolvedFromFile = !pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + const parentOfCandidate = getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + const resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + const candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } /* @internal */ @@ -791,19 +817,21 @@ namespace ts { /** Return the file if it exists. */ function tryFile(fileName: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): string | undefined { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions: Extensions, candidate: string, failedLookupLocations: Push, onlyRecordFailures: boolean, state: ModuleResolutionState): Resolved | undefined { @@ -840,7 +868,7 @@ namespace ts { } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, Diagnostics.File_0_does_not_exist, packageJsonPath); } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results @@ -872,9 +900,7 @@ namespace ts { return combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { - const nodeModulesFolder = combinePaths(directory, "node_modules"); - const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions: Extensions, moduleName: string, nodeModulesFolder: string, nodeModulesFolderExists: boolean, failedLookupLocations: Push, state: ModuleResolutionState): Resolved | undefined { const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || @@ -904,12 +930,26 @@ namespace ts { /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ function loadModuleFromNodeModulesOneLevel(extensions: Extensions, moduleName: string, directory: string, failedLookupLocations: Push, state: ModuleResolutionState, typesOnly = false): Resolved | undefined { - const packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + const nodeModulesFolder = combinePaths(directory, "node_modules"); + const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + + const packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } if (extensions !== Extensions.JavaScript) { - return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, combinePaths("@types", moduleName), directory, failedLookupLocations, state); + const nodeModulesAtTypes = combinePaths(nodeModulesFolder, "@types"); + let nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes, state.host)) { + if (state.traceEnabled) { + trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes, nodeModulesAtTypesExists, failedLookupLocations, state); } } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 5b9f4332359..9d8a1fe084d 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -2069,58 +2069,17 @@ namespace ts.projectSystem { assert.deepEqual(resolutionTrace, [ "======== Resolving module 'lib' from '/a/b/app.js'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'lib' from 'node_modules' folder.", - "File '/a/b/node_modules/lib.ts' does not exist.", - "File '/a/b/node_modules/lib.tsx' does not exist.", - "File '/a/b/node_modules/lib.d.ts' does not exist.", - "File '/a/b/node_modules/lib/package.json' does not exist.", - "File '/a/b/node_modules/lib/index.ts' does not exist.", - "File '/a/b/node_modules/lib/index.tsx' does not exist.", - "File '/a/b/node_modules/lib/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/lib.d.ts' does not exist.", - "File '/a/b/node_modules/@types/lib/package.json' does not exist.", - "File '/a/b/node_modules/@types/lib/index.d.ts' does not exist.", - "File '/a/node_modules/lib.ts' does not exist.", - "File '/a/node_modules/lib.tsx' does not exist.", - "File '/a/node_modules/lib.d.ts' does not exist.", - "File '/a/node_modules/lib/package.json' does not exist.", - "File '/a/node_modules/lib/index.ts' does not exist.", - "File '/a/node_modules/lib/index.tsx' does not exist.", - "File '/a/node_modules/lib/index.d.ts' does not exist.", - "File '/a/node_modules/@types/lib.d.ts' does not exist.", - "File '/a/node_modules/@types/lib/package.json' does not exist.", - "File '/a/node_modules/@types/lib/index.d.ts' does not exist.", - "File '/node_modules/lib.ts' does not exist.", - "File '/node_modules/lib.tsx' does not exist.", - "File '/node_modules/lib.d.ts' does not exist.", - "File '/node_modules/lib/package.json' does not exist.", - "File '/node_modules/lib/index.ts' does not exist.", - "File '/node_modules/lib/index.tsx' does not exist.", - "File '/node_modules/lib/index.d.ts' does not exist.", - "File '/node_modules/@types/lib.d.ts' does not exist.", - "File '/node_modules/@types/lib/package.json' does not exist.", - "File '/node_modules/@types/lib/index.d.ts' does not exist.", - "Loading module 'lib' from 'node_modules' folder.", - "File '/a/b/node_modules/lib.js' does not exist.", - "File '/a/b/node_modules/lib.jsx' does not exist.", - "File '/a/b/node_modules/lib/package.json' does not exist.", - "File '/a/b/node_modules/lib/index.js' does not exist.", - "File '/a/b/node_modules/lib/index.jsx' does not exist.", - "File '/a/node_modules/lib.js' does not exist.", - "File '/a/node_modules/lib.jsx' does not exist.", - "File '/a/node_modules/lib/package.json' does not exist.", - "File '/a/node_modules/lib/index.js' does not exist.", - "File '/a/node_modules/lib/index.jsx' does not exist.", - "File '/node_modules/lib.js' does not exist.", - "File '/node_modules/lib.jsx' does not exist.", - "File '/node_modules/lib/package.json' does not exist.", - "File '/node_modules/lib/index.js' does not exist.", - "File '/node_modules/lib/index.jsx' does not exist.", + "Loading module 'lib' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Loading module 'lib' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name 'lib' was not resolved. ========", `Auto discovery for typings is enabled in project '${proj.getProjectName()}'. Running extra resolution pass for module 'lib' using cache location '/a/cache'.`, "File '/a/cache/node_modules/lib.d.ts' does not exist.", - "File '/a/cache/node_modules/lib/package.json' does not exist.", - "File '/a/cache/node_modules/lib/index.d.ts' does not exist.", "File '/a/cache/node_modules/@types/lib.d.ts' does not exist.", "File '/a/cache/node_modules/@types/lib/package.json' does not exist.", "File '/a/cache/node_modules/@types/lib/index.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/cacheResolutions.trace.json b/tests/baselines/reference/cacheResolutions.trace.json index 8e7adfb9898..bf3653b489a 100644 --- a/tests/baselines/reference/cacheResolutions.trace.json +++ b/tests/baselines/reference/cacheResolutions.trace.json @@ -13,18 +13,10 @@ "File '/tslib.ts' does not exist.", "File '/tslib.tsx' does not exist.", "File '/tslib.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/tslib.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/tslib/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/tslib/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/tslib.d.ts' does not exist.", - "File '/a/b/node_modules/@types/tslib/package.json' does not exist.", - "File '/a/b/node_modules/@types/tslib/index.d.ts' does not exist.", - "File '/a/node_modules/@types/tslib.d.ts' does not exist.", - "File '/a/node_modules/@types/tslib/package.json' does not exist.", - "File '/a/node_modules/@types/tslib/index.d.ts' does not exist.", - "File '/node_modules/@types/tslib.d.ts' does not exist.", - "File '/node_modules/@types/tslib/package.json' does not exist.", - "File '/node_modules/@types/tslib/index.d.ts' does not exist.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/c/tslib.js' does not exist.", "File '/a/b/c/tslib.jsx' does not exist.", "File '/a/b/tslib.js' does not exist.", @@ -35,9 +27,9 @@ "File '/tslib.jsx' does not exist.", "======== Module name 'tslib' was not resolved. ========", "======== Resolving module 'tslib' from '/a/b/c/lib1.ts'. ========", - "Resolution for module 'tslib' was found in cache", + "Resolution for module 'tslib' was found in cache.", "======== Module name 'tslib' was not resolved. ========", "======== Resolving module 'tslib' from '/a/b/c/lib2.ts'. ========", - "Resolution for module 'tslib' was found in cache", + "Resolution for module 'tslib' was found in cache.", "======== Module name 'tslib' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution1.trace.json b/tests/baselines/reference/cachedModuleResolution1.trace.json index dbb0e6068be..ba59e8df8e8 100644 --- a/tests/baselines/reference/cachedModuleResolution1.trace.json +++ b/tests/baselines/reference/cachedModuleResolution1.trace.json @@ -1,37 +1,10 @@ [ "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo.ts' does not exist.", - "File '/a/b/c/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", @@ -39,8 +12,8 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "Resolution for module 'foo' was found in cache", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Resolution for module 'foo' was found in cache.", "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution2.trace.json b/tests/baselines/reference/cachedModuleResolution2.trace.json index 1d4b40bbc08..eb18792122a 100644 --- a/tests/baselines/reference/cachedModuleResolution2.trace.json +++ b/tests/baselines/reference/cachedModuleResolution2.trace.json @@ -1,17 +1,8 @@ [ "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/node_modules/foo.ts' does not exist.", - "File '/a/b/c/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", @@ -19,28 +10,10 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "Resolution for module 'foo' was found in cache", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Resolution for module 'foo' was found in cache.", "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution3.trace.json b/tests/baselines/reference/cachedModuleResolution3.trace.json index 2dbaea53f47..6cbab2e0796 100644 --- a/tests/baselines/reference/cachedModuleResolution3.trace.json +++ b/tests/baselines/reference/cachedModuleResolution3.trace.json @@ -16,6 +16,6 @@ "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "Resolution for module 'foo' was found in cache", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution4.trace.json b/tests/baselines/reference/cachedModuleResolution4.trace.json index 7249d948e1c..c100c0c3814 100644 --- a/tests/baselines/reference/cachedModuleResolution4.trace.json +++ b/tests/baselines/reference/cachedModuleResolution4.trace.json @@ -16,6 +16,6 @@ "File '/a/b/c/d/foo.ts' does not exist.", "File '/a/b/c/d/foo.tsx' does not exist.", "File '/a/b/c/d/foo.d.ts' does not exist.", - "Resolution for module 'foo' was found in cache", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was successfully resolved to '/a/b/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution5.trace.json b/tests/baselines/reference/cachedModuleResolution5.trace.json index d263465ff12..f489afffbe9 100644 --- a/tests/baselines/reference/cachedModuleResolution5.trace.json +++ b/tests/baselines/reference/cachedModuleResolution5.trace.json @@ -1,37 +1,10 @@ [ "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo.ts' does not exist.", - "File '/a/b/c/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/node_modules/foo.ts' does not exist.", "File '/a/b/node_modules/foo.tsx' does not exist.", "File '/a/b/node_modules/foo.d.ts' exist - use it as a name resolution result.", @@ -39,8 +12,8 @@ "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========", "======== Resolving module 'foo' from '/a/b/lib.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "Resolution for module 'foo' was found in cache", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Resolution for module 'foo' was found in cache.", "Resolving real path for '/a/b/node_modules/foo.d.ts', result '/a/b/node_modules/foo.d.ts'", "======== Module name 'foo' was successfully resolved to '/a/b/node_modules/foo.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution6.trace.json b/tests/baselines/reference/cachedModuleResolution6.trace.json index 02d52befc94..50c1c15b3e1 100644 --- a/tests/baselines/reference/cachedModuleResolution6.trace.json +++ b/tests/baselines/reference/cachedModuleResolution6.trace.json @@ -1,102 +1,24 @@ [ "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo.ts' does not exist.", - "File '/a/b/c/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/foo.ts' does not exist.", - "File '/a/b/node_modules/foo.tsx' does not exist.", - "File '/a/b/node_modules/foo.d.ts' does not exist.", - "File '/a/b/node_modules/foo/package.json' does not exist.", - "File '/a/b/node_modules/foo/index.ts' does not exist.", - "File '/a/b/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/node_modules/foo.ts' does not exist.", - "File '/a/node_modules/foo.tsx' does not exist.", - "File '/a/node_modules/foo.d.ts' does not exist.", - "File '/a/node_modules/foo/package.json' does not exist.", - "File '/a/node_modules/foo/index.ts' does not exist.", - "File '/a/node_modules/foo/index.tsx' does not exist.", - "File '/a/node_modules/foo/index.d.ts' does not exist.", - "File '/a/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/node_modules/@types/foo/package.json' does not exist.", - "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/node_modules/foo.ts' does not exist.", - "File '/node_modules/foo.tsx' does not exist.", - "File '/node_modules/foo.d.ts' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.ts' does not exist.", - "File '/node_modules/foo/index.tsx' does not exist.", - "File '/node_modules/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.js' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.jsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.js' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.jsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.js' does not exist.", - "File '/a/b/c/d/node_modules/foo.jsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.js' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.jsx' does not exist.", - "File '/a/b/c/node_modules/foo.js' does not exist.", - "File '/a/b/c/node_modules/foo.jsx' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.js' does not exist.", - "File '/a/b/c/node_modules/foo/index.jsx' does not exist.", - "File '/a/b/node_modules/foo.js' does not exist.", - "File '/a/b/node_modules/foo.jsx' does not exist.", - "File '/a/b/node_modules/foo/package.json' does not exist.", - "File '/a/b/node_modules/foo/index.js' does not exist.", - "File '/a/b/node_modules/foo/index.jsx' does not exist.", - "File '/a/node_modules/foo.js' does not exist.", - "File '/a/node_modules/foo.jsx' does not exist.", - "File '/a/node_modules/foo/package.json' does not exist.", - "File '/a/node_modules/foo/index.js' does not exist.", - "File '/a/node_modules/foo/index.jsx' does not exist.", - "File '/node_modules/foo.js' does not exist.", - "File '/node_modules/foo.jsx' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.js' does not exist.", - "File '/node_modules/foo/index.jsx' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name 'foo' was not resolved. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "Resolution for module 'foo' was found in cache", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution7.trace.json b/tests/baselines/reference/cachedModuleResolution7.trace.json index ce5bf08861d..fa1db9d115e 100644 --- a/tests/baselines/reference/cachedModuleResolution7.trace.json +++ b/tests/baselines/reference/cachedModuleResolution7.trace.json @@ -1,92 +1,22 @@ [ "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/node_modules/foo.ts' does not exist.", - "File '/a/b/c/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/foo.ts' does not exist.", - "File '/a/b/node_modules/foo.tsx' does not exist.", - "File '/a/b/node_modules/foo.d.ts' does not exist.", - "File '/a/b/node_modules/foo/package.json' does not exist.", - "File '/a/b/node_modules/foo/index.ts' does not exist.", - "File '/a/b/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/node_modules/foo.ts' does not exist.", - "File '/a/node_modules/foo.tsx' does not exist.", - "File '/a/node_modules/foo.d.ts' does not exist.", - "File '/a/node_modules/foo/package.json' does not exist.", - "File '/a/node_modules/foo/index.ts' does not exist.", - "File '/a/node_modules/foo/index.tsx' does not exist.", - "File '/a/node_modules/foo/index.d.ts' does not exist.", - "File '/a/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/node_modules/@types/foo/package.json' does not exist.", - "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/node_modules/foo.ts' does not exist.", - "File '/node_modules/foo.tsx' does not exist.", - "File '/node_modules/foo.d.ts' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.ts' does not exist.", - "File '/node_modules/foo/index.tsx' does not exist.", - "File '/node_modules/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/node_modules/foo.js' does not exist.", - "File '/a/b/c/node_modules/foo.jsx' does not exist.", - "File '/a/b/c/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/foo/index.js' does not exist.", - "File '/a/b/c/node_modules/foo/index.jsx' does not exist.", - "File '/a/b/node_modules/foo.js' does not exist.", - "File '/a/b/node_modules/foo.jsx' does not exist.", - "File '/a/b/node_modules/foo/package.json' does not exist.", - "File '/a/b/node_modules/foo/index.js' does not exist.", - "File '/a/b/node_modules/foo/index.jsx' does not exist.", - "File '/a/node_modules/foo.js' does not exist.", - "File '/a/node_modules/foo.jsx' does not exist.", - "File '/a/node_modules/foo/package.json' does not exist.", - "File '/a/node_modules/foo/index.js' does not exist.", - "File '/a/node_modules/foo/index.jsx' does not exist.", - "File '/node_modules/foo.js' does not exist.", - "File '/node_modules/foo.jsx' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.js' does not exist.", - "File '/node_modules/foo/index.jsx' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", + "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name 'foo' was not resolved. ========", "======== Resolving module 'foo' from '/a/b/c/d/e/app.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/a/b/c/d/e/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/e/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.ts' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.tsx' does not exist.", - "File '/a/b/c/d/node_modules/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "Resolution for module 'foo' was found in cache", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution8.trace.json b/tests/baselines/reference/cachedModuleResolution8.trace.json index f833f56d819..e5241278349 100644 --- a/tests/baselines/reference/cachedModuleResolution8.trace.json +++ b/tests/baselines/reference/cachedModuleResolution8.trace.json @@ -19,24 +19,12 @@ "File '/foo.ts' does not exist.", "File '/foo.tsx' does not exist.", "File '/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/e/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/d/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/node_modules/@types/foo/package.json' does not exist.", - "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Directory '/a/b/c/d/e/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/d/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/c/d/e/foo.js' does not exist.", "File '/a/b/c/d/e/foo.jsx' does not exist.", "File '/a/b/c/d/foo.js' does not exist.", @@ -52,6 +40,6 @@ "======== Module name 'foo' was not resolved. ========", "======== Resolving module 'foo' from '/a/b/c/lib.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "Resolution for module 'foo' was found in cache", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/cachedModuleResolution9.trace.json b/tests/baselines/reference/cachedModuleResolution9.trace.json index 10a79576bfc..bd148cc7ee2 100644 --- a/tests/baselines/reference/cachedModuleResolution9.trace.json +++ b/tests/baselines/reference/cachedModuleResolution9.trace.json @@ -13,18 +13,10 @@ "File '/foo.ts' does not exist.", "File '/foo.tsx' does not exist.", "File '/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/c/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/c/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/b/node_modules/@types/foo/package.json' does not exist.", - "File '/a/b/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/a/node_modules/@types/foo.d.ts' does not exist.", - "File '/a/node_modules/@types/foo/package.json' does not exist.", - "File '/a/node_modules/@types/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Directory '/a/b/c/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/a/node_modules' does not exist, skipping all lookups in it.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "File '/a/b/c/foo.js' does not exist.", "File '/a/b/c/foo.jsx' does not exist.", "File '/a/b/foo.js' does not exist.", @@ -42,6 +34,6 @@ "File '/a/b/c/d/foo.ts' does not exist.", "File '/a/b/c/d/foo.tsx' does not exist.", "File '/a/b/c/d/foo.d.ts' does not exist.", - "Resolution for module 'foo' was found in cache", + "Resolution for module 'foo' was found in cache.", "======== Module name 'foo' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/importWithTrailingSlash.trace.json b/tests/baselines/reference/importWithTrailingSlash.trace.json index 56de914f395..3efe8c1ba51 100644 --- a/tests/baselines/reference/importWithTrailingSlash.trace.json +++ b/tests/baselines/reference/importWithTrailingSlash.trace.json @@ -1,23 +1,23 @@ [ "======== Resolving module '.' from '/a/test.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location '/a'.", + "Loading module as file / folder, candidate module location '/a', target file type 'TypeScript'.", "File '/a.ts' exist - use it as a name resolution result.", "======== Module name '.' was successfully resolved to '/a.ts'. ========", "======== Resolving module './' from '/a/test.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location '/a/'.", + "Loading module as file / folder, candidate module location '/a/', target file type 'TypeScript'.", "File '/a/package.json' does not exist.", "File '/a/index.ts' exist - use it as a name resolution result.", "======== Module name './' was successfully resolved to '/a/index.ts'. ========", "======== Resolving module '..' from '/a/b/test.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location '/a'.", + "Loading module as file / folder, candidate module location '/a', target file type 'TypeScript'.", "File '/a.ts' exist - use it as a name resolution result.", "======== Module name '..' was successfully resolved to '/a.ts'. ========", "======== Resolving module '../' from '/a/b/test.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location '/a/'.", + "Loading module as file / folder, candidate module location '/a/', target file type 'TypeScript'.", "File '/a/package.json' does not exist.", "File '/a/index.ts' exist - use it as a name resolution result.", "======== Module name '../' was successfully resolved to '/a/index.ts'. ========" diff --git a/tests/baselines/reference/importWithTrailingSlash_noResolve.trace.json b/tests/baselines/reference/importWithTrailingSlash_noResolve.trace.json index 55b75c57dde..1ee467c3789 100644 --- a/tests/baselines/reference/importWithTrailingSlash_noResolve.trace.json +++ b/tests/baselines/reference/importWithTrailingSlash_noResolve.trace.json @@ -1,14 +1,9 @@ [ "======== Resolving module './foo/' from '/a.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location '/foo/'.", - "File '/foo/package.json' does not exist.", - "File '/foo/index.ts' does not exist.", - "File '/foo/index.tsx' does not exist.", - "File '/foo/index.d.ts' does not exist.", - "Loading module as file / folder, candidate module location '/foo/'.", - "File '/foo/package.json' does not exist.", - "File '/foo/index.js' does not exist.", - "File '/foo/index.jsx' does not exist.", + "Loading module as file / folder, candidate module location '/foo/', target file type 'TypeScript'.", + "Directory '/foo/' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/foo/', target file type 'JavaScript'.", + "Directory '/foo/' does not exist, skipping all lookups in it.", "======== Module name './foo/' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json index 78ac53013f7..0393f04cc80 100644 --- a/tests/baselines/reference/library-reference-11.trace.json +++ b/tests/baselines/reference/library-reference-11.trace.json @@ -2,12 +2,7 @@ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/a/b'", - "File '/a/b/node_modules/jquery.d.ts' does not exist.", - "File '/a/b/node_modules/jquery/package.json' does not exist.", - "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", - "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", - "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", "File '/a/node_modules/jquery.d.ts' does not exist.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.", diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json index 6e09c7a3f04..14e46647d6d 100644 --- a/tests/baselines/reference/library-reference-12.trace.json +++ b/tests/baselines/reference/library-reference-12.trace.json @@ -2,12 +2,7 @@ "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/a/b'", - "File '/a/b/node_modules/jquery.d.ts' does not exist.", - "File '/a/b/node_modules/jquery/package.json' does not exist.", - "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", - "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", - "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", - "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "Directory '/a/b/node_modules' does not exist, skipping all lookups in it.", "File '/a/node_modules/jquery.d.ts' does not exist.", "Found 'package.json' at '/a/node_modules/jquery/package.json'.", "'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.", diff --git a/tests/baselines/reference/library-reference-4.trace.json b/tests/baselines/reference/library-reference-4.trace.json index b47ba1065f5..b6b9e5e0af2 100644 --- a/tests/baselines/reference/library-reference-4.trace.json +++ b/tests/baselines/reference/library-reference-4.trace.json @@ -1,15 +1,8 @@ [ "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory '/src'. ========", "Resolving with primary search path '/src'", - "File '/src/foo/package.json' does not exist.", - "File '/src/foo/index.d.ts' does not exist.", "Looking up in 'node_modules' folder, initial location '/src'", - "File '/src/node_modules/foo.d.ts' does not exist.", - "File '/src/node_modules/foo/package.json' does not exist.", - "File '/src/node_modules/foo/index.d.ts' does not exist.", - "File '/src/node_modules/@types/foo.d.ts' does not exist.", - "File '/src/node_modules/@types/foo/package.json' does not exist.", - "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/foo.d.ts' does not exist.", "File '/node_modules/foo/package.json' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", @@ -17,15 +10,8 @@ "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory '/src'. ========", "Resolving with primary search path '/src'", - "File '/src/bar/package.json' does not exist.", - "File '/src/bar/index.d.ts' does not exist.", "Looking up in 'node_modules' folder, initial location '/src'", - "File '/src/node_modules/bar.d.ts' does not exist.", - "File '/src/node_modules/bar/package.json' does not exist.", - "File '/src/node_modules/bar/index.d.ts' does not exist.", - "File '/src/node_modules/@types/bar.d.ts' does not exist.", - "File '/src/node_modules/@types/bar/package.json' does not exist.", - "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/bar.d.ts' does not exist.", "File '/node_modules/bar/package.json' does not exist.", "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", @@ -33,8 +19,6 @@ "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory '/src'. ========", "Resolving with primary search path '/src'", - "File '/src/alpha/package.json' does not exist.", - "File '/src/alpha/index.d.ts' does not exist.", "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", @@ -43,8 +27,6 @@ "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory '/src'. ========", "Resolving with primary search path '/src'", - "File '/src/alpha/package.json' does not exist.", - "File '/src/alpha/index.d.ts' does not exist.", "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", diff --git a/tests/baselines/reference/library-reference-5.trace.json b/tests/baselines/reference/library-reference-5.trace.json index 8f548e04d10..818fceb42cf 100644 --- a/tests/baselines/reference/library-reference-5.trace.json +++ b/tests/baselines/reference/library-reference-5.trace.json @@ -1,15 +1,9 @@ [ "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory 'types'. ========", "Resolving with primary search path 'types'", - "File 'types/foo/package.json' does not exist.", - "File 'types/foo/index.d.ts' does not exist.", + "Directory 'types' does not exist, skipping all lookups in it.", "Looking up in 'node_modules' folder, initial location '/src'", - "File '/src/node_modules/foo.d.ts' does not exist.", - "File '/src/node_modules/foo/package.json' does not exist.", - "File '/src/node_modules/foo/index.d.ts' does not exist.", - "File '/src/node_modules/@types/foo.d.ts' does not exist.", - "File '/src/node_modules/@types/foo/package.json' does not exist.", - "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/foo.d.ts' does not exist.", "File '/node_modules/foo/package.json' does not exist.", "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", @@ -17,15 +11,9 @@ "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory 'types'. ========", "Resolving with primary search path 'types'", - "File 'types/bar/package.json' does not exist.", - "File 'types/bar/index.d.ts' does not exist.", + "Directory 'types' does not exist, skipping all lookups in it.", "Looking up in 'node_modules' folder, initial location '/src'", - "File '/src/node_modules/bar.d.ts' does not exist.", - "File '/src/node_modules/bar/package.json' does not exist.", - "File '/src/node_modules/bar/index.d.ts' does not exist.", - "File '/src/node_modules/@types/bar.d.ts' does not exist.", - "File '/src/node_modules/@types/bar/package.json' does not exist.", - "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/bar.d.ts' does not exist.", "File '/node_modules/bar/package.json' does not exist.", "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", @@ -33,8 +21,7 @@ "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory 'types'. ========", "Resolving with primary search path 'types'", - "File 'types/alpha/package.json' does not exist.", - "File 'types/alpha/index.d.ts' does not exist.", + "Directory 'types' does not exist, skipping all lookups in it.", "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", @@ -43,8 +30,7 @@ "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory 'types'. ========", "Resolving with primary search path 'types'", - "File 'types/alpha/package.json' does not exist.", - "File 'types/alpha/index.d.ts' does not exist.", + "Directory 'types' does not exist, skipping all lookups in it.", "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", diff --git a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json index f6df1476088..eeff8b42ce6 100644 --- a/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json +++ b/tests/baselines/reference/maxNodeModuleJsDepthDefaultsToZero.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'shortid' from '/index.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module 'shortid' from 'node_modules' folder.", + "Loading module 'shortid' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/shortid.ts' does not exist.", "File '/node_modules/shortid.tsx' does not exist.", "File '/node_modules/shortid.d.ts' does not exist.", @@ -9,10 +9,8 @@ "File '/node_modules/shortid/index.ts' does not exist.", "File '/node_modules/shortid/index.tsx' does not exist.", "File '/node_modules/shortid/index.d.ts' does not exist.", - "File '/node_modules/@types/shortid.d.ts' does not exist.", - "File '/node_modules/@types/shortid/package.json' does not exist.", - "File '/node_modules/@types/shortid/index.d.ts' does not exist.", - "Loading module 'shortid' from 'node_modules' folder.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Loading module 'shortid' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/shortid.js' does not exist.", "File '/node_modules/shortid.jsx' does not exist.", "File '/node_modules/shortid/package.json' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json index 6860c61bb17..50e3cccad9c 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json @@ -1,12 +1,12 @@ [ "======== Resolving module './a' from '/src/b.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/a'.", + "Loading module as file / folder, candidate module location '/src/a', target file type 'TypeScript'.", "File '/src/a.ts' exist - use it as a name resolution result.", "======== Module name './a' was successfully resolved to '/src/a.ts'. ========", "======== Resolving module './a.js' from '/src/d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/a.js'.", + "Loading module as file / folder, candidate module location '/src/a.js', target file type 'TypeScript'.", "File '/src/a.js.ts' does not exist.", "File '/src/a.js.tsx' does not exist.", "File '/src/a.js.d.ts' does not exist.", @@ -15,7 +15,7 @@ "======== Module name './a.js' was successfully resolved to '/src/a.ts'. ========", "======== Resolving module './jquery.js' from '/src/jquery_user_1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/jquery.js'.", + "Loading module as file / folder, candidate module location '/src/jquery.js', target file type 'TypeScript'.", "File '/src/jquery.js.ts' does not exist.", "File '/src/jquery.js.tsx' does not exist.", "File '/src/jquery.js.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported.trace.json index f2b0214602c..b57862c09e3 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported.trace.json @@ -1,35 +1,29 @@ [ "======== Resolving module './tsx' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/tsx'.", + "Loading module as file / folder, candidate module location '/tsx', target file type 'TypeScript'.", "File '/tsx.ts' does not exist.", "File '/tsx.tsx' exist - use it as a name resolution result.", "======== Module name './tsx' was successfully resolved to '/tsx.tsx'. ========", "======== Resolving module './jsx' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'TypeScript'.", "File '/jsx.ts' does not exist.", "File '/jsx.tsx' does not exist.", "File '/jsx.d.ts' does not exist.", - "File '/jsx/package.json' does not exist.", - "File '/jsx/index.ts' does not exist.", - "File '/jsx/index.tsx' does not exist.", - "File '/jsx/index.d.ts' does not exist.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Directory '/jsx' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'JavaScript'.", "File '/jsx.js' does not exist.", "File '/jsx.jsx' exist - use it as a name resolution result.", "======== Module name './jsx' was successfully resolved to '/jsx.jsx'. ========", "======== Resolving module './js' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/js'.", + "Loading module as file / folder, candidate module location '/js', target file type 'TypeScript'.", "File '/js.ts' does not exist.", "File '/js.tsx' does not exist.", "File '/js.d.ts' does not exist.", - "File '/js/package.json' does not exist.", - "File '/js/index.ts' does not exist.", - "File '/js/index.tsx' does not exist.", - "File '/js/index.d.ts' does not exist.", - "Loading module as file / folder, candidate module location '/js'.", + "Directory '/js' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/js', target file type 'JavaScript'.", "File '/js.js' exist - use it as a name resolution result.", "======== Module name './js' was successfully resolved to '/js.js'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported2.trace.json index 89bd061301e..7474cccdb35 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported2.trace.json @@ -1,15 +1,12 @@ [ "======== Resolving module './jsx' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'TypeScript'.", "File '/jsx.ts' does not exist.", "File '/jsx.tsx' does not exist.", "File '/jsx.d.ts' does not exist.", - "File '/jsx/package.json' does not exist.", - "File '/jsx/index.ts' does not exist.", - "File '/jsx/index.tsx' does not exist.", - "File '/jsx/index.d.ts' does not exist.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Directory '/jsx' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'JavaScript'.", "File '/jsx.js' does not exist.", "File '/jsx.jsx' exist - use it as a name resolution result.", "======== Module name './jsx' was successfully resolved to '/jsx.jsx'. ========" diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported3.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported3.trace.json index 89bd061301e..7474cccdb35 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_notSupported3.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_notSupported3.trace.json @@ -1,15 +1,12 @@ [ "======== Resolving module './jsx' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'TypeScript'.", "File '/jsx.ts' does not exist.", "File '/jsx.tsx' does not exist.", "File '/jsx.d.ts' does not exist.", - "File '/jsx/package.json' does not exist.", - "File '/jsx/index.ts' does not exist.", - "File '/jsx/index.tsx' does not exist.", - "File '/jsx/index.d.ts' does not exist.", - "Loading module as file / folder, candidate module location '/jsx'.", + "Directory '/jsx' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/jsx', target file type 'JavaScript'.", "File '/jsx.js' does not exist.", "File '/jsx.jsx' exist - use it as a name resolution result.", "======== Module name './jsx' was successfully resolved to '/jsx.jsx'. ========" diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_preferTs.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_preferTs.trace.json index f6612b84cc3..0c56366809e 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_preferTs.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_preferTs.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module './b' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/b'.", + "Loading module as file / folder, candidate module location '/b', target file type 'TypeScript'.", "File '/b.ts' does not exist.", "File '/b.tsx' does not exist.", "File '/b.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json index 84532e8db7b..e1b1673b32a 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'normalize.css' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'normalize.css' from 'node_modules' folder.", + "Loading module 'normalize.css' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/normalize.css.ts' does not exist.", "File '/node_modules/normalize.css.tsx' does not exist.", "File '/node_modules/normalize.css.d.ts' does not exist.", @@ -10,10 +10,8 @@ "File '/node_modules/normalize.css/index.ts' does not exist.", "File '/node_modules/normalize.css/index.tsx' does not exist.", "File '/node_modules/normalize.css/index.d.ts' does not exist.", - "File '/node_modules/@types/normalize.css.d.ts' does not exist.", - "File '/node_modules/@types/normalize.css/package.json' does not exist.", - "File '/node_modules/@types/normalize.css/index.d.ts' does not exist.", - "Loading module 'normalize.css' from 'node_modules' folder.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Loading module 'normalize.css' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/normalize.css.js' does not exist.", "File '/node_modules/normalize.css.jsx' does not exist.", "Found 'package.json' at '/node_modules/normalize.css/package.json'.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index 27c9d2243e5..11dd95ebe45 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'foo' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'foo' from 'node_modules' folder.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo.ts' does not exist.", "File '/node_modules/foo.tsx' does not exist.", "File '/node_modules/foo.d.ts' does not exist.", @@ -15,10 +15,8 @@ "File '/node_modules/foo/index.ts' does not exist.", "File '/node_modules/foo/index.tsx' does not exist.", "File '/node_modules/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", - "Loading module 'foo' from 'node_modules' folder.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/foo.js' does not exist.", "File '/node_modules/foo.jsx' does not exist.", "Found 'package.json' at '/node_modules/foo/package.json'.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json index 8d4217a92bd..c01ba494886 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_withAmbientPresent.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module 'js' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'js' from 'node_modules' folder.", + "Loading module 'js' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/js.ts' does not exist.", "File '/node_modules/js.tsx' does not exist.", "File '/node_modules/js.d.ts' does not exist.", @@ -9,10 +9,8 @@ "File '/node_modules/js/index.ts' does not exist.", "File '/node_modules/js/index.tsx' does not exist.", "File '/node_modules/js/index.d.ts' does not exist.", - "File '/node_modules/@types/js.d.ts' does not exist.", - "File '/node_modules/@types/js/package.json' does not exist.", - "File '/node_modules/@types/js/index.d.ts' does not exist.", - "Loading module 'js' from 'node_modules' folder.", + "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", + "Loading module 'js' from 'node_modules' folder, target file type 'JavaScript'.", "File '/node_modules/js.js' does not exist.", "File '/node_modules/js.jsx' does not exist.", "File '/node_modules/js/package.json' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json index bd23ccdb366..1b21293fc05 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module './library-a' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/library-a'.", + "Loading module as file / folder, candidate module location '/src/library-a', target file type 'TypeScript'.", "File '/src/library-a.ts' does not exist.", "File '/src/library-a.tsx' does not exist.", "File '/src/library-a.d.ts' does not exist.", @@ -10,7 +10,7 @@ "======== Module name './library-a' was successfully resolved to '/src/library-a/index.ts'. ========", "======== Resolving module './library-b' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/library-b'.", + "Loading module as file / folder, candidate module location '/src/library-b', target file type 'TypeScript'.", "File '/src/library-b.ts' does not exist.", "File '/src/library-b.tsx' does not exist.", "File '/src/library-b.d.ts' does not exist.", @@ -19,7 +19,7 @@ "======== Module name './library-b' was successfully resolved to '/src/library-b/index.ts'. ========", "======== Resolving module 'library-a' from '/src/library-b/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'library-a' from 'node_modules' folder.", + "Loading module 'library-a' from 'node_modules' folder, target file type 'TypeScript'.", "File '/src/library-b/node_modules/library-a.ts' does not exist.", "File '/src/library-b/node_modules/library-a.tsx' does not exist.", "File '/src/library-b/node_modules/library-a.d.ts' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_notInNodeModules.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks_notInNodeModules.trace.json index c2f0c04d07f..477bae0b4e2 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_notInNodeModules.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_notInNodeModules.trace.json @@ -1,12 +1,12 @@ [ "======== Resolving module './shared/abc' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/shared/abc'.", + "Loading module as file / folder, candidate module location '/src/shared/abc', target file type 'TypeScript'.", "File '/src/shared/abc.ts' exist - use it as a name resolution result.", "======== Module name './shared/abc' was successfully resolved to '/src/shared/abc.ts'. ========", "======== Resolving module './shared2/abc' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/shared2/abc'.", + "Loading module as file / folder, candidate module location '/src/shared2/abc', target file type 'TypeScript'.", "File '/src/shared2/abc.ts' exist - use it as a name resolution result.", "======== Module name './shared2/abc' was successfully resolved to '/src/shared2/abc.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json index 3e0609ee325..78d169457ee 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_referenceTypes.trace.json @@ -3,8 +3,6 @@ "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/'", "File '/node_modules/library-a.d.ts' does not exist.", - "File '/node_modules/library-a/package.json' does not exist.", - "File '/node_modules/library-a/index.d.ts' does not exist.", "File '/node_modules/@types/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-a/package.json' does not exist.", "File '/node_modules/@types/library-a/index.d.ts' exist - use it as a name resolution result.", @@ -14,8 +12,6 @@ "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/'", "File '/node_modules/library-b.d.ts' does not exist.", - "File '/node_modules/library-b/package.json' does not exist.", - "File '/node_modules/library-b/index.d.ts' does not exist.", "File '/node_modules/@types/library-b.d.ts' does not exist.", "File '/node_modules/@types/library-b/package.json' does not exist.", "File '/node_modules/@types/library-b/index.d.ts' exist - use it as a name resolution result.", @@ -25,8 +21,6 @@ "Root directory cannot be determined, skipping primary search paths.", "Looking up in 'node_modules' folder, initial location '/node_modules/@types/library-b'", "File '/node_modules/@types/library-b/node_modules/library-a.d.ts' does not exist.", - "File '/node_modules/@types/library-b/node_modules/library-a/package.json' does not exist.", - "File '/node_modules/@types/library-b/node_modules/library-a/index.d.ts' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a.d.ts' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a/package.json' does not exist.", "File '/node_modules/@types/library-b/node_modules/@types/library-a/index.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json b/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json index bd23ccdb366..1b21293fc05 100644 --- a/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSymlinks_withOutDir.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module './library-a' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/library-a'.", + "Loading module as file / folder, candidate module location '/src/library-a', target file type 'TypeScript'.", "File '/src/library-a.ts' does not exist.", "File '/src/library-a.tsx' does not exist.", "File '/src/library-a.d.ts' does not exist.", @@ -10,7 +10,7 @@ "======== Module name './library-a' was successfully resolved to '/src/library-a/index.ts'. ========", "======== Resolving module './library-b' from '/src/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/src/library-b'.", + "Loading module as file / folder, candidate module location '/src/library-b', target file type 'TypeScript'.", "File '/src/library-b.ts' does not exist.", "File '/src/library-b.tsx' does not exist.", "File '/src/library-b.d.ts' does not exist.", @@ -19,7 +19,7 @@ "======== Module name './library-b' was successfully resolved to '/src/library-b/index.ts'. ========", "======== Resolving module 'library-a' from '/src/library-b/index.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'library-a' from 'node_modules' folder.", + "Loading module 'library-a' from 'node_modules' folder, target file type 'TypeScript'.", "File '/src/library-b/node_modules/library-a.ts' does not exist.", "File '/src/library-b/node_modules/library-a.tsx' does not exist.", "File '/src/library-b/node_modules/library-a.d.ts' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json index 5c7c143f604..c61871b34c0 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json @@ -3,47 +3,26 @@ "Explicitly specified module resolution kind: 'NodeJs'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", - "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file2', target file type 'TypeScript'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file3', target file type 'TypeScript'.", "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", - "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4', target file type 'TypeScript'.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.tsx' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/root/file4/package.json' does not exist.", - "File 'c:/root/file4/index.ts' does not exist.", - "File 'c:/root/file4/index.tsx' does not exist.", - "File 'c:/root/file4/index.d.ts' does not exist.", - "Loading module 'file4' from 'node_modules' folder.", - "File 'c:/root/folder2/node_modules/file4.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4.tsx' does not exist.", - "File 'c:/root/folder2/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/file4.ts' does not exist.", - "File 'c:/root/node_modules/file4.tsx' does not exist.", - "File 'c:/root/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/file4/package.json' does not exist.", - "File 'c:/root/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "Directory 'c:/root/file4' does not exist, skipping all lookups in it.", + "Loading module 'file4' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory 'c:/root/folder2/node_modules' does not exist, skipping all lookups in it.", + "Directory 'c:/root/node_modules' does not exist, skipping all lookups in it.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", "File 'c:/node_modules/file4.d.ts' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json index 5c7c143f604..c61871b34c0 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json @@ -3,47 +3,26 @@ "Explicitly specified module resolution kind: 'NodeJs'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", - "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file2', target file type 'TypeScript'.", "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", - "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file3', target file type 'TypeScript'.", "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'file4'", "Resolving module name 'file4' relative to base url 'c:/root' - 'c:/root/file4'.", - "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4', target file type 'TypeScript'.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.tsx' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/root/file4/package.json' does not exist.", - "File 'c:/root/file4/index.ts' does not exist.", - "File 'c:/root/file4/index.tsx' does not exist.", - "File 'c:/root/file4/index.d.ts' does not exist.", - "Loading module 'file4' from 'node_modules' folder.", - "File 'c:/root/folder2/node_modules/file4.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4.tsx' does not exist.", - "File 'c:/root/folder2/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/file4.ts' does not exist.", - "File 'c:/root/node_modules/file4.tsx' does not exist.", - "File 'c:/root/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/file4/package.json' does not exist.", - "File 'c:/root/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "Directory 'c:/root/file4' does not exist, skipping all lookups in it.", + "Loading module 'file4' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory 'c:/root/folder2/node_modules' does not exist, skipping all lookups in it.", + "Directory 'c:/root/node_modules' does not exist, skipping all lookups in it.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", "File 'c:/node_modules/file4.d.ts' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json index 6c899bf028e..9108b25e88c 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json @@ -13,9 +13,6 @@ "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", "Module name 'folder3/file2', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder3/file2'.", - "File 'c:/root/folder3/file2.ts' does not exist.", - "File 'c:/root/folder3/file2.tsx' does not exist.", - "File 'c:/root/folder3/file2.d.ts' does not exist.", "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json index ebef311d2a6..d70942a4b47 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json @@ -5,7 +5,7 @@ "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", "Module name 'folder2/file1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder2/file1'.", - "Loading module as file / folder, candidate module location 'c:/root/folder2/file1'.", + "Loading module as file / folder, candidate module location 'c:/root/folder2/file1', target file type 'TypeScript'.", "File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", @@ -14,16 +14,9 @@ "'paths' option is specified, looking for a pattern to match module name 'folder3/file2'.", "Module name 'folder3/file2', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder3/file2'.", - "Loading module as file / folder, candidate module location 'c:/root/folder3/file2'.", - "File 'c:/root/folder3/file2.ts' does not exist.", - "File 'c:/root/folder3/file2.tsx' does not exist.", - "File 'c:/root/folder3/file2.d.ts' does not exist.", - "File 'c:/root/folder3/file2/package.json' does not exist.", - "File 'c:/root/folder3/file2/index.ts' does not exist.", - "File 'c:/root/folder3/file2/index.tsx' does not exist.", - "File 'c:/root/folder3/file2/index.d.ts' does not exist.", + "Loading module as file / folder, candidate module location 'c:/root/folder3/file2', target file type 'TypeScript'.", "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", - "Loading module as file / folder, candidate module location 'c:/root/generated/folder3/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/folder3/file2', target file type 'TypeScript'.", "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", @@ -32,7 +25,7 @@ "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", "Module name 'components/file3', matched pattern 'components/*'.", "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", - "Loading module as file / folder, candidate module location 'c:/root/shared/components/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/shared/components/file3', target file type 'TypeScript'.", "File 'c:/root/shared/components/file3.ts' does not exist.", "File 'c:/root/shared/components/file3.tsx' does not exist.", "File 'c:/root/shared/components/file3.d.ts' does not exist.", @@ -47,44 +40,20 @@ "'paths' option is specified, looking for a pattern to match module name 'file4'.", "Module name 'file4', matched pattern '*'.", "Trying substitution '*', candidate module location: 'file4'.", - "Loading module as file / folder, candidate module location 'c:/root/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/file4', target file type 'TypeScript'.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.tsx' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/root/file4/package.json' does not exist.", - "File 'c:/root/file4/index.ts' does not exist.", - "File 'c:/root/file4/index.tsx' does not exist.", - "File 'c:/root/file4/index.d.ts' does not exist.", + "Directory 'c:/root/file4' does not exist, skipping all lookups in it.", "Trying substitution 'generated/*', candidate module location: 'generated/file4'.", - "Loading module as file / folder, candidate module location 'c:/root/generated/file4'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/file4', target file type 'TypeScript'.", "File 'c:/root/generated/file4.ts' does not exist.", "File 'c:/root/generated/file4.tsx' does not exist.", "File 'c:/root/generated/file4.d.ts' does not exist.", - "File 'c:/root/generated/file4/package.json' does not exist.", - "File 'c:/root/generated/file4/index.ts' does not exist.", - "File 'c:/root/generated/file4/index.tsx' does not exist.", - "File 'c:/root/generated/file4/index.d.ts' does not exist.", - "Loading module 'file4' from 'node_modules' folder.", - "File 'c:/root/folder1/node_modules/file4.ts' does not exist.", - "File 'c:/root/folder1/node_modules/file4.tsx' does not exist.", - "File 'c:/root/folder1/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/folder1/node_modules/file4/package.json' does not exist.", - "File 'c:/root/folder1/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/folder1/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/folder1/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/folder1/node_modules/@types/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/file4.ts' does not exist.", - "File 'c:/root/node_modules/file4.tsx' does not exist.", - "File 'c:/root/node_modules/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/file4/package.json' does not exist.", - "File 'c:/root/node_modules/file4/index.ts' does not exist.", - "File 'c:/root/node_modules/file4/index.tsx' does not exist.", - "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", - "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "Directory 'c:/root/generated/file4' does not exist, skipping all lookups in it.", + "Loading module 'file4' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory 'c:/root/folder1/node_modules' does not exist, skipping all lookups in it.", + "Directory 'c:/root/node_modules' does not exist, skipping all lookups in it.", "File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.", "Resolving real path for 'c:/node_modules/file4.ts', result 'c:/node_modules/file4.ts'", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4.ts'. ========" diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json index d50a6c78ed7..ec865b7ac66 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json @@ -6,9 +6,6 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", - "File 'c:/root/src/project/file3.ts' does not exist.", - "File 'c:/root/src/project/file3.tsx' does not exist.", - "File 'c:/root/src/project/file3.d.ts' does not exist.", "Trying other entries in 'rootDirs'", "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json index 7c5e76a2847..d623e166ef0 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json @@ -6,17 +6,11 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file3' - 'false'.", "Longest matching prefix for 'c:/root/src/project/file3' is 'c:/root/src/'", "Loading 'project/file3' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file3'", - "Loading module as file / folder, candidate module location 'c:/root/src/project/file3'.", - "File 'c:/root/src/project/file3.ts' does not exist.", - "File 'c:/root/src/project/file3.tsx' does not exist.", - "File 'c:/root/src/project/file3.d.ts' does not exist.", - "File 'c:/root/src/project/file3/package.json' does not exist.", - "File 'c:/root/src/project/file3/index.ts' does not exist.", - "File 'c:/root/src/project/file3/index.tsx' does not exist.", - "File 'c:/root/src/project/file3/index.d.ts' does not exist.", + "Loading module as file / folder, candidate module location 'c:/root/src/project/file3', target file type 'TypeScript'.", + "Directory 'c:/root/src/project' does not exist, skipping all lookups in it.", "Trying other entries in 'rootDirs'", "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", - "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3', target file type 'TypeScript'.", "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", @@ -26,17 +20,14 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file2' - 'true'.", "Longest matching prefix for 'c:/root/generated/src/file2' is 'c:/root/generated/src/'", "Loading 'file2' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file2'", - "Loading module as file / folder, candidate module location 'c:/root/generated/src/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/file2', target file type 'TypeScript'.", "File 'c:/root/generated/src/file2.ts' does not exist.", "File 'c:/root/generated/src/file2.tsx' does not exist.", "File 'c:/root/generated/src/file2.d.ts' does not exist.", - "File 'c:/root/generated/src/file2/package.json' does not exist.", - "File 'c:/root/generated/src/file2/index.ts' does not exist.", - "File 'c:/root/generated/src/file2/index.tsx' does not exist.", - "File 'c:/root/generated/src/file2/index.d.ts' does not exist.", + "Directory 'c:/root/generated/src/file2' does not exist, skipping all lookups in it.", "Trying other entries in 'rootDirs'", "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", - "Loading module as file / folder, candidate module location 'c:/root/src/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/src/file2', target file type 'TypeScript'.", "File 'c:/root/src/file2.ts' does not exist.", "File 'c:/root/src/file2.tsx' does not exist.", "File 'c:/root/src/file2.d.ts' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json index 85373855eb5..61056ea8502 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json @@ -6,9 +6,6 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", - "File 'c:/root/src/project/file2.ts' does not exist.", - "File 'c:/root/src/project/file2.tsx' does not exist.", - "File 'c:/root/src/project/file2.d.ts' does not exist.", "Trying other entries in 'rootDirs'", "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json index 31440cca28e..4cc7dbae1c1 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json @@ -6,17 +6,11 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/src/project/file2' - 'false'.", "Longest matching prefix for 'c:/root/src/project/file2' is 'c:/root/src/'", "Loading 'project/file2' from the root dir 'c:/root/src/', candidate location 'c:/root/src/project/file2'", - "Loading module as file / folder, candidate module location 'c:/root/src/project/file2'.", - "File 'c:/root/src/project/file2.ts' does not exist.", - "File 'c:/root/src/project/file2.tsx' does not exist.", - "File 'c:/root/src/project/file2.d.ts' does not exist.", - "File 'c:/root/src/project/file2/package.json' does not exist.", - "File 'c:/root/src/project/file2/index.ts' does not exist.", - "File 'c:/root/src/project/file2/index.tsx' does not exist.", - "File 'c:/root/src/project/file2/index.d.ts' does not exist.", + "Loading module as file / folder, candidate module location 'c:/root/src/project/file2', target file type 'TypeScript'.", + "Directory 'c:/root/src/project' does not exist, skipping all lookups in it.", "Trying other entries in 'rootDirs'", "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", - "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2', target file type 'TypeScript'.", "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", @@ -25,44 +19,20 @@ "'paths' option is specified, looking for a pattern to match module name 'module3'.", "Module name 'module3', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module3'.", - "Loading module as file / folder, candidate module location 'c:/root/module3'.", + "Loading module as file / folder, candidate module location 'c:/root/module3', target file type 'TypeScript'.", "File 'c:/root/module3.ts' does not exist.", "File 'c:/root/module3.tsx' does not exist.", "File 'c:/root/module3.d.ts' does not exist.", - "File 'c:/root/module3/package.json' does not exist.", - "File 'c:/root/module3/index.ts' does not exist.", - "File 'c:/root/module3/index.tsx' does not exist.", - "File 'c:/root/module3/index.d.ts' does not exist.", + "Directory 'c:/root/module3' does not exist, skipping all lookups in it.", "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module3'.", - "Loading module as file / folder, candidate module location 'c:/shared/module3'.", + "Loading module as file / folder, candidate module location 'c:/shared/module3', target file type 'TypeScript'.", "File 'c:/shared/module3.ts' does not exist.", "File 'c:/shared/module3.tsx' does not exist.", "File 'c:/shared/module3.d.ts' does not exist.", - "File 'c:/shared/module3/package.json' does not exist.", - "File 'c:/shared/module3/index.ts' does not exist.", - "File 'c:/shared/module3/index.tsx' does not exist.", - "File 'c:/shared/module3/index.d.ts' does not exist.", - "Loading module 'module3' from 'node_modules' folder.", - "File 'c:/root/src/node_modules/module3.ts' does not exist.", - "File 'c:/root/src/node_modules/module3.tsx' does not exist.", - "File 'c:/root/src/node_modules/module3.d.ts' does not exist.", - "File 'c:/root/src/node_modules/module3/package.json' does not exist.", - "File 'c:/root/src/node_modules/module3/index.ts' does not exist.", - "File 'c:/root/src/node_modules/module3/index.tsx' does not exist.", - "File 'c:/root/src/node_modules/module3/index.d.ts' does not exist.", - "File 'c:/root/src/node_modules/@types/module3.d.ts' does not exist.", - "File 'c:/root/src/node_modules/@types/module3/package.json' does not exist.", - "File 'c:/root/src/node_modules/@types/module3/index.d.ts' does not exist.", - "File 'c:/root/node_modules/module3.ts' does not exist.", - "File 'c:/root/node_modules/module3.tsx' does not exist.", - "File 'c:/root/node_modules/module3.d.ts' does not exist.", - "File 'c:/root/node_modules/module3/package.json' does not exist.", - "File 'c:/root/node_modules/module3/index.ts' does not exist.", - "File 'c:/root/node_modules/module3/index.tsx' does not exist.", - "File 'c:/root/node_modules/module3/index.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/module3.d.ts' does not exist.", - "File 'c:/root/node_modules/@types/module3/package.json' does not exist.", - "File 'c:/root/node_modules/@types/module3/index.d.ts' does not exist.", + "Directory 'c:/shared/module3' does not exist, skipping all lookups in it.", + "Loading module 'module3' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory 'c:/root/src/node_modules' does not exist, skipping all lookups in it.", + "Directory 'c:/root/node_modules' does not exist, skipping all lookups in it.", "File 'c:/node_modules/module3.ts' does not exist.", "File 'c:/node_modules/module3.tsx' does not exist.", "File 'c:/node_modules/module3.d.ts' exist - use it as a name resolution result.", @@ -74,16 +44,13 @@ "'paths' option is specified, looking for a pattern to match module name 'module1'.", "Module name 'module1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'module1'.", - "Loading module as file / folder, candidate module location 'c:/root/module1'.", + "Loading module as file / folder, candidate module location 'c:/root/module1', target file type 'TypeScript'.", "File 'c:/root/module1.ts' does not exist.", "File 'c:/root/module1.tsx' does not exist.", "File 'c:/root/module1.d.ts' does not exist.", - "File 'c:/root/module1/package.json' does not exist.", - "File 'c:/root/module1/index.ts' does not exist.", - "File 'c:/root/module1/index.tsx' does not exist.", - "File 'c:/root/module1/index.d.ts' does not exist.", + "Directory 'c:/root/module1' does not exist, skipping all lookups in it.", "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module1'.", - "Loading module as file / folder, candidate module location 'c:/shared/module1'.", + "Loading module as file / folder, candidate module location 'c:/shared/module1', target file type 'TypeScript'.", "File 'c:/shared/module1.ts' does not exist.", "File 'c:/shared/module1.tsx' does not exist.", "File 'c:/shared/module1.d.ts' does not exist.", @@ -98,7 +65,7 @@ "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", "Module name 'templates/module2', matched pattern 'templates/*'.", "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", - "Loading module as file / folder, candidate module location 'c:/root/generated/src/templates/module2'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/templates/module2', target file type 'TypeScript'.", "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.", "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", @@ -108,17 +75,14 @@ "Checking if 'c:/root/generated/src/' is the longest matching prefix for 'c:/root/generated/src/file3' - 'true'.", "Longest matching prefix for 'c:/root/generated/src/file3' is 'c:/root/generated/src/'", "Loading 'file3' from the root dir 'c:/root/generated/src/', candidate location 'c:/root/generated/src/file3'", - "Loading module as file / folder, candidate module location 'c:/root/generated/src/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/generated/src/file3', target file type 'TypeScript'.", "File 'c:/root/generated/src/file3.ts' does not exist.", "File 'c:/root/generated/src/file3.tsx' does not exist.", "File 'c:/root/generated/src/file3.d.ts' does not exist.", - "File 'c:/root/generated/src/file3/package.json' does not exist.", - "File 'c:/root/generated/src/file3/index.ts' does not exist.", - "File 'c:/root/generated/src/file3/index.tsx' does not exist.", - "File 'c:/root/generated/src/file3/index.d.ts' does not exist.", + "Directory 'c:/root/generated/src/file3' does not exist, skipping all lookups in it.", "Trying other entries in 'rootDirs'", "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", - "Loading module as file / folder, candidate module location 'c:/root/src/file3'.", + "Loading module as file / folder, candidate module location 'c:/root/src/file3', target file type 'TypeScript'.", "File 'c:/root/src/file3.ts' does not exist.", "File 'c:/root/src/file3.tsx' does not exist.", "File 'c:/root/src/file3.d.ts' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json index face88d225e..197b7f5c249 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_failedLookup.trace.json @@ -6,27 +6,14 @@ "Module name 'foo', matched pattern 'foo'.", "Trying substitution 'foo/foo.ts', candidate module location: 'foo/foo.ts'.", "File '/foo/foo.ts' does not exist.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/node_modules/foo.ts' does not exist.", - "File '/node_modules/foo.tsx' does not exist.", - "File '/node_modules/foo.d.ts' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.ts' does not exist.", - "File '/node_modules/foo/index.tsx' does not exist.", - "File '/node_modules/foo/index.d.ts' does not exist.", - "File '/node_modules/@types/foo.d.ts' does not exist.", - "File '/node_modules/@types/foo/package.json' does not exist.", - "File '/node_modules/@types/foo/index.d.ts' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo'", "'paths' option is specified, looking for a pattern to match module name 'foo'.", "Module name 'foo', matched pattern 'foo'.", "Trying substitution 'foo/foo.ts', candidate module location: 'foo/foo.ts'.", "File '/foo/foo.ts' does not exist.", - "Loading module 'foo' from 'node_modules' folder.", - "File '/node_modules/foo.js' does not exist.", - "File '/node_modules/foo.jsx' does not exist.", - "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/index.js' does not exist.", - "File '/node_modules/foo/index.jsx' does not exist.", + "Loading module 'foo' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/node_modules' does not exist, skipping all lookups in it.", "======== Module name 'foo' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives10.trace.json b/tests/baselines/reference/typeReferenceDirectives10.trace.json index 5bd31419793..910ec0cafa6 100644 --- a/tests/baselines/reference/typeReferenceDirectives10.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives10.trace.json @@ -7,7 +7,7 @@ "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/ref'.", + "Loading module as file / folder, candidate module location '/ref', target file type 'TypeScript'.", "File '/ref.ts' does not exist.", "File '/ref.tsx' does not exist.", "File '/ref.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/typeReferenceDirectives11.trace.json b/tests/baselines/reference/typeReferenceDirectives11.trace.json index a6ab6bc8d68..ae6786cba55 100644 --- a/tests/baselines/reference/typeReferenceDirectives11.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives11.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module './mod1' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/mod1'.", + "Loading module as file / folder, candidate module location '/mod1', target file type 'TypeScript'.", "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", diff --git a/tests/baselines/reference/typeReferenceDirectives12.trace.json b/tests/baselines/reference/typeReferenceDirectives12.trace.json index 5f87ab7ea39..96c6aee65ec 100644 --- a/tests/baselines/reference/typeReferenceDirectives12.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives12.trace.json @@ -1,12 +1,12 @@ [ "======== Resolving module './main' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/main'.", + "Loading module as file / folder, candidate module location '/main', target file type 'TypeScript'.", "File '/main.ts' exist - use it as a name resolution result.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving module './mod1' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/mod1'.", + "Loading module as file / folder, candidate module location '/mod1', target file type 'TypeScript'.", "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========", @@ -16,7 +16,7 @@ "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", - "Resolution for module './main' was found in cache", + "Resolution for module './main' was found in cache.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", "Resolving with primary search path '/types'", diff --git a/tests/baselines/reference/typeReferenceDirectives13.trace.json b/tests/baselines/reference/typeReferenceDirectives13.trace.json index 5bd31419793..910ec0cafa6 100644 --- a/tests/baselines/reference/typeReferenceDirectives13.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives13.trace.json @@ -7,7 +7,7 @@ "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/ref'.", + "Loading module as file / folder, candidate module location '/ref', target file type 'TypeScript'.", "File '/ref.ts' does not exist.", "File '/ref.tsx' does not exist.", "File '/ref.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/typeReferenceDirectives5.trace.json b/tests/baselines/reference/typeReferenceDirectives5.trace.json index 5bd31419793..910ec0cafa6 100644 --- a/tests/baselines/reference/typeReferenceDirectives5.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives5.trace.json @@ -7,7 +7,7 @@ "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './ref' from '/app.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/ref'.", + "Loading module as file / folder, candidate module location '/ref', target file type 'TypeScript'.", "File '/ref.ts' does not exist.", "File '/ref.tsx' does not exist.", "File '/ref.d.ts' exist - use it as a name resolution result.", diff --git a/tests/baselines/reference/typeReferenceDirectives8.trace.json b/tests/baselines/reference/typeReferenceDirectives8.trace.json index a6ab6bc8d68..ae6786cba55 100644 --- a/tests/baselines/reference/typeReferenceDirectives8.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives8.trace.json @@ -1,7 +1,7 @@ [ "======== Resolving module './mod1' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/mod1'.", + "Loading module as file / folder, candidate module location '/mod1', target file type 'TypeScript'.", "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", diff --git a/tests/baselines/reference/typeReferenceDirectives9.trace.json b/tests/baselines/reference/typeReferenceDirectives9.trace.json index 5f87ab7ea39..96c6aee65ec 100644 --- a/tests/baselines/reference/typeReferenceDirectives9.trace.json +++ b/tests/baselines/reference/typeReferenceDirectives9.trace.json @@ -1,12 +1,12 @@ [ "======== Resolving module './main' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/main'.", + "Loading module as file / folder, candidate module location '/main', target file type 'TypeScript'.", "File '/main.ts' exist - use it as a name resolution result.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving module './mod1' from '/mod2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module as file / folder, candidate module location '/mod1'.", + "Loading module as file / folder, candidate module location '/mod1', target file type 'TypeScript'.", "File '/mod1.ts' exist - use it as a name resolution result.", "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========", @@ -16,7 +16,7 @@ "Resolving real path for '/types/lib/index.d.ts', result '/types/lib/index.d.ts'", "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", "======== Resolving module './main' from '/mod1.ts'. ========", - "Resolution for module './main' was found in cache", + "Resolution for module './main' was found in cache.", "======== Module name './main' was successfully resolved to '/main.ts'. ========", "======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========", "Resolving with primary search path '/types'", diff --git a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json index b38bb7c0acd..8074424995e 100644 --- a/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json +++ b/tests/baselines/reference/typeRootsFromMultipleNodeModulesDirectories.trace.json @@ -1,153 +1,60 @@ [ "======== Resolving module 'xyz' from '/foo/bar/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'xyz' from 'node_modules' folder.", - "File '/foo/bar/node_modules/xyz.ts' does not exist.", - "File '/foo/bar/node_modules/xyz.tsx' does not exist.", - "File '/foo/bar/node_modules/xyz.d.ts' does not exist.", - "File '/foo/bar/node_modules/xyz/package.json' does not exist.", - "File '/foo/bar/node_modules/xyz/index.ts' does not exist.", - "File '/foo/bar/node_modules/xyz/index.tsx' does not exist.", - "File '/foo/bar/node_modules/xyz/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/xyz.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/xyz/index.d.ts' does not exist.", + "Loading module 'xyz' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/xyz.ts' does not exist.", "File '/foo/node_modules/xyz.tsx' does not exist.", "File '/foo/node_modules/xyz.d.ts' does not exist.", - "File '/foo/node_modules/xyz/package.json' does not exist.", - "File '/foo/node_modules/xyz/index.ts' does not exist.", - "File '/foo/node_modules/xyz/index.tsx' does not exist.", - "File '/foo/node_modules/xyz/index.d.ts' does not exist.", "File '/foo/node_modules/@types/xyz.d.ts' does not exist.", - "File '/foo/node_modules/@types/xyz/package.json' does not exist.", - "File '/foo/node_modules/@types/xyz/index.d.ts' does not exist.", "File '/node_modules/xyz.ts' does not exist.", "File '/node_modules/xyz.tsx' does not exist.", "File '/node_modules/xyz.d.ts' does not exist.", - "File '/node_modules/xyz/package.json' does not exist.", - "File '/node_modules/xyz/index.ts' does not exist.", - "File '/node_modules/xyz/index.tsx' does not exist.", - "File '/node_modules/xyz/index.d.ts' does not exist.", "File '/node_modules/@types/xyz.d.ts' does not exist.", - "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.d.ts' does not exist.", - "Loading module 'xyz' from 'node_modules' folder.", - "File '/foo/bar/node_modules/xyz.js' does not exist.", - "File '/foo/bar/node_modules/xyz.jsx' does not exist.", - "File '/foo/bar/node_modules/xyz/package.json' does not exist.", - "File '/foo/bar/node_modules/xyz/index.js' does not exist.", - "File '/foo/bar/node_modules/xyz/index.jsx' does not exist.", + "Loading module 'xyz' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/xyz.js' does not exist.", "File '/foo/node_modules/xyz.jsx' does not exist.", - "File '/foo/node_modules/xyz/package.json' does not exist.", - "File '/foo/node_modules/xyz/index.js' does not exist.", - "File '/foo/node_modules/xyz/index.jsx' does not exist.", "File '/node_modules/xyz.js' does not exist.", "File '/node_modules/xyz.jsx' does not exist.", - "File '/node_modules/xyz/package.json' does not exist.", - "File '/node_modules/xyz/index.js' does not exist.", - "File '/node_modules/xyz/index.jsx' does not exist.", "======== Module name 'xyz' was not resolved. ========", "======== Resolving module 'pdq' from '/foo/bar/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'pdq' from 'node_modules' folder.", - "File '/foo/bar/node_modules/pdq.ts' does not exist.", - "File '/foo/bar/node_modules/pdq.tsx' does not exist.", - "File '/foo/bar/node_modules/pdq.d.ts' does not exist.", - "File '/foo/bar/node_modules/pdq/package.json' does not exist.", - "File '/foo/bar/node_modules/pdq/index.ts' does not exist.", - "File '/foo/bar/node_modules/pdq/index.tsx' does not exist.", - "File '/foo/bar/node_modules/pdq/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/pdq.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/pdq/index.d.ts' does not exist.", + "Loading module 'pdq' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/pdq.ts' does not exist.", "File '/foo/node_modules/pdq.tsx' does not exist.", "File '/foo/node_modules/pdq.d.ts' does not exist.", - "File '/foo/node_modules/pdq/package.json' does not exist.", - "File '/foo/node_modules/pdq/index.ts' does not exist.", - "File '/foo/node_modules/pdq/index.tsx' does not exist.", - "File '/foo/node_modules/pdq/index.d.ts' does not exist.", "File '/foo/node_modules/@types/pdq.d.ts' does not exist.", - "File '/foo/node_modules/@types/pdq/package.json' does not exist.", - "File '/foo/node_modules/@types/pdq/index.d.ts' does not exist.", "File '/node_modules/pdq.ts' does not exist.", "File '/node_modules/pdq.tsx' does not exist.", "File '/node_modules/pdq.d.ts' does not exist.", - "File '/node_modules/pdq/package.json' does not exist.", - "File '/node_modules/pdq/index.ts' does not exist.", - "File '/node_modules/pdq/index.tsx' does not exist.", - "File '/node_modules/pdq/index.d.ts' does not exist.", "File '/node_modules/@types/pdq.d.ts' does not exist.", - "File '/node_modules/@types/pdq/package.json' does not exist.", - "File '/node_modules/@types/pdq/index.d.ts' does not exist.", - "Loading module 'pdq' from 'node_modules' folder.", - "File '/foo/bar/node_modules/pdq.js' does not exist.", - "File '/foo/bar/node_modules/pdq.jsx' does not exist.", - "File '/foo/bar/node_modules/pdq/package.json' does not exist.", - "File '/foo/bar/node_modules/pdq/index.js' does not exist.", - "File '/foo/bar/node_modules/pdq/index.jsx' does not exist.", + "Loading module 'pdq' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/pdq.js' does not exist.", "File '/foo/node_modules/pdq.jsx' does not exist.", - "File '/foo/node_modules/pdq/package.json' does not exist.", - "File '/foo/node_modules/pdq/index.js' does not exist.", - "File '/foo/node_modules/pdq/index.jsx' does not exist.", "File '/node_modules/pdq.js' does not exist.", "File '/node_modules/pdq.jsx' does not exist.", - "File '/node_modules/pdq/package.json' does not exist.", - "File '/node_modules/pdq/index.js' does not exist.", - "File '/node_modules/pdq/index.jsx' does not exist.", "======== Module name 'pdq' was not resolved. ========", "======== Resolving module 'abc' from '/foo/bar/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'abc' from 'node_modules' folder.", - "File '/foo/bar/node_modules/abc.ts' does not exist.", - "File '/foo/bar/node_modules/abc.tsx' does not exist.", - "File '/foo/bar/node_modules/abc.d.ts' does not exist.", - "File '/foo/bar/node_modules/abc/package.json' does not exist.", - "File '/foo/bar/node_modules/abc/index.ts' does not exist.", - "File '/foo/bar/node_modules/abc/index.tsx' does not exist.", - "File '/foo/bar/node_modules/abc/index.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/abc.d.ts' does not exist.", - "File '/foo/bar/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/bar/node_modules/@types/abc/index.d.ts' does not exist.", + "Loading module 'abc' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/abc.ts' does not exist.", "File '/foo/node_modules/abc.tsx' does not exist.", "File '/foo/node_modules/abc.d.ts' does not exist.", - "File '/foo/node_modules/abc/package.json' does not exist.", - "File '/foo/node_modules/abc/index.ts' does not exist.", - "File '/foo/node_modules/abc/index.tsx' does not exist.", - "File '/foo/node_modules/abc/index.d.ts' does not exist.", "File '/foo/node_modules/@types/abc.d.ts' does not exist.", - "File '/foo/node_modules/@types/abc/package.json' does not exist.", - "File '/foo/node_modules/@types/abc/index.d.ts' does not exist.", "File '/node_modules/abc.ts' does not exist.", "File '/node_modules/abc.tsx' does not exist.", "File '/node_modules/abc.d.ts' does not exist.", - "File '/node_modules/abc/package.json' does not exist.", - "File '/node_modules/abc/index.ts' does not exist.", - "File '/node_modules/abc/index.tsx' does not exist.", - "File '/node_modules/abc/index.d.ts' does not exist.", "File '/node_modules/@types/abc.d.ts' does not exist.", - "File '/node_modules/@types/abc/package.json' does not exist.", - "File '/node_modules/@types/abc/index.d.ts' does not exist.", - "Loading module 'abc' from 'node_modules' folder.", - "File '/foo/bar/node_modules/abc.js' does not exist.", - "File '/foo/bar/node_modules/abc.jsx' does not exist.", - "File '/foo/bar/node_modules/abc/package.json' does not exist.", - "File '/foo/bar/node_modules/abc/index.js' does not exist.", - "File '/foo/bar/node_modules/abc/index.jsx' does not exist.", + "Loading module 'abc' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/foo/bar/node_modules' does not exist, skipping all lookups in it.", "File '/foo/node_modules/abc.js' does not exist.", "File '/foo/node_modules/abc.jsx' does not exist.", - "File '/foo/node_modules/abc/package.json' does not exist.", - "File '/foo/node_modules/abc/index.js' does not exist.", - "File '/foo/node_modules/abc/index.jsx' does not exist.", "File '/node_modules/abc.js' does not exist.", "File '/node_modules/abc.jsx' does not exist.", - "File '/node_modules/abc/package.json' does not exist.", - "File '/node_modules/abc/index.js' does not exist.", - "File '/node_modules/abc/index.jsx' does not exist.", "======== Module name 'abc' was not resolved. ========", "======== Resolving type reference directive 'grumpy', containing file '/foo/bar/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", @@ -163,8 +70,6 @@ "======== Type reference directive 'sneezy' was successfully resolved to '/foo/node_modules/@types/sneezy/index.d.ts', primary: true. ========", "======== Resolving type reference directive 'dopey', containing file '/foo/bar/__inferred type names__.ts', root directory '/foo/node_modules/@types,/node_modules/@types'. ========", "Resolving with primary search path '/foo/node_modules/@types, /node_modules/@types'", - "File '/foo/node_modules/@types/dopey/package.json' does not exist.", - "File '/foo/node_modules/@types/dopey/index.d.ts' does not exist.", "File '/node_modules/@types/dopey/package.json' does not exist.", "File '/node_modules/@types/dopey/index.d.ts' exist - use it as a name resolution result.", "Resolving real path for '/node_modules/@types/dopey/index.d.ts', result '/node_modules/@types/dopey/index.d.ts'", diff --git a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json index 6c2090e2b45..dc21070f1ae 100644 --- a/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json +++ b/tests/baselines/reference/typeRootsFromNodeModulesInParentDirectory.trace.json @@ -1,38 +1,16 @@ [ "======== Resolving module 'xyz' from '/src/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'xyz' from 'node_modules' folder.", - "File '/src/node_modules/xyz.ts' does not exist.", - "File '/src/node_modules/xyz.tsx' does not exist.", - "File '/src/node_modules/xyz.d.ts' does not exist.", - "File '/src/node_modules/xyz/package.json' does not exist.", - "File '/src/node_modules/xyz/index.ts' does not exist.", - "File '/src/node_modules/xyz/index.tsx' does not exist.", - "File '/src/node_modules/xyz/index.d.ts' does not exist.", - "File '/src/node_modules/@types/xyz.d.ts' does not exist.", - "File '/src/node_modules/@types/xyz/package.json' does not exist.", - "File '/src/node_modules/@types/xyz/index.d.ts' does not exist.", + "Loading module 'xyz' from 'node_modules' folder, target file type 'TypeScript'.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/xyz.ts' does not exist.", "File '/node_modules/xyz.tsx' does not exist.", "File '/node_modules/xyz.d.ts' does not exist.", - "File '/node_modules/xyz/package.json' does not exist.", - "File '/node_modules/xyz/index.ts' does not exist.", - "File '/node_modules/xyz/index.tsx' does not exist.", - "File '/node_modules/xyz/index.d.ts' does not exist.", "File '/node_modules/@types/xyz.d.ts' does not exist.", - "File '/node_modules/@types/xyz/package.json' does not exist.", - "File '/node_modules/@types/xyz/index.d.ts' does not exist.", - "Loading module 'xyz' from 'node_modules' folder.", - "File '/src/node_modules/xyz.js' does not exist.", - "File '/src/node_modules/xyz.jsx' does not exist.", - "File '/src/node_modules/xyz/package.json' does not exist.", - "File '/src/node_modules/xyz/index.js' does not exist.", - "File '/src/node_modules/xyz/index.jsx' does not exist.", + "Loading module 'xyz' from 'node_modules' folder, target file type 'JavaScript'.", + "Directory '/src/node_modules' does not exist, skipping all lookups in it.", "File '/node_modules/xyz.js' does not exist.", "File '/node_modules/xyz.jsx' does not exist.", - "File '/node_modules/xyz/package.json' does not exist.", - "File '/node_modules/xyz/index.js' does not exist.", - "File '/node_modules/xyz/index.jsx' does not exist.", "======== Module name 'xyz' was not resolved. ========", "======== Resolving type reference directive 'foo', containing file '/src/__inferred type names__.ts', root directory '/node_modules/@types'. ========", "Resolving with primary search path '/node_modules/@types'", diff --git a/tests/baselines/reference/typingsLookup4.trace.json b/tests/baselines/reference/typingsLookup4.trace.json index 2b7de6a4286..451d68edf28 100644 --- a/tests/baselines/reference/typingsLookup4.trace.json +++ b/tests/baselines/reference/typingsLookup4.trace.json @@ -1,14 +1,10 @@ [ "======== Resolving module 'jquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'jquery' from 'node_modules' folder.", + "Loading module 'jquery' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/jquery.ts' does not exist.", "File '/node_modules/jquery.tsx' does not exist.", "File '/node_modules/jquery.d.ts' does not exist.", - "File '/node_modules/jquery/package.json' does not exist.", - "File '/node_modules/jquery/index.ts' does not exist.", - "File '/node_modules/jquery/index.tsx' does not exist.", - "File '/node_modules/jquery/index.d.ts' does not exist.", "File '/node_modules/@types/jquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/jquery/package.json'.", "'package.json' has 'typings' field 'jquery.d.ts' that references '/node_modules/@types/jquery/jquery.d.ts'.", @@ -17,14 +13,10 @@ "======== Module name 'jquery' was successfully resolved to '/node_modules/@types/jquery/jquery.d.ts'. ========", "======== Resolving module 'kquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'kquery' from 'node_modules' folder.", + "Loading module 'kquery' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/kquery.ts' does not exist.", "File '/node_modules/kquery.tsx' does not exist.", "File '/node_modules/kquery.d.ts' does not exist.", - "File '/node_modules/kquery/package.json' does not exist.", - "File '/node_modules/kquery/index.ts' does not exist.", - "File '/node_modules/kquery/index.tsx' does not exist.", - "File '/node_modules/kquery/index.d.ts' does not exist.", "File '/node_modules/@types/kquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/kquery/package.json'.", "'package.json' has 'typings' field 'kquery' that references '/node_modules/@types/kquery/kquery'.", @@ -36,14 +28,10 @@ "======== Module name 'kquery' was successfully resolved to '/node_modules/@types/kquery/kquery.d.ts'. ========", "======== Resolving module 'lquery' from '/a.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", - "Loading module 'lquery' from 'node_modules' folder.", + "Loading module 'lquery' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/lquery.ts' does not exist.", "File '/node_modules/lquery.tsx' does not exist.", "File '/node_modules/lquery.d.ts' does not exist.", - "File '/node_modules/lquery/package.json' does not exist.", - "File '/node_modules/lquery/index.ts' does not exist.", - "File '/node_modules/lquery/index.tsx' does not exist.", - "File '/node_modules/lquery/index.d.ts' does not exist.", "File '/node_modules/@types/lquery.d.ts' does not exist.", "Found 'package.json' at '/node_modules/@types/lquery/package.json'.", "'package.json' has 'typings' field 'lquery' that references '/node_modules/@types/lquery/lquery'.", diff --git a/tests/baselines/reference/typingsLookupAmd.trace.json b/tests/baselines/reference/typingsLookupAmd.trace.json index 6ad05d9cbf9..49abda2815d 100644 --- a/tests/baselines/reference/typingsLookupAmd.trace.json +++ b/tests/baselines/reference/typingsLookupAmd.trace.json @@ -10,9 +10,7 @@ "File '/b.ts' does not exist.", "File '/b.tsx' does not exist.", "File '/b.d.ts' does not exist.", - "File '/x/y/node_modules/@types/b.d.ts' does not exist.", - "File '/x/y/node_modules/@types/b/package.json' does not exist.", - "File '/x/y/node_modules/@types/b/index.d.ts' does not exist.", + "Directory '/x/y/node_modules' does not exist, skipping all lookups in it.", "File '/x/node_modules/@types/b.d.ts' does not exist.", "File '/x/node_modules/@types/b/package.json' does not exist.", "File '/x/node_modules/@types/b/index.d.ts' exist - use it as a name resolution result.", @@ -34,15 +32,9 @@ "File '/a.ts' does not exist.", "File '/a.tsx' does not exist.", "File '/a.d.ts' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a.d.ts' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/b/node_modules/@types/a/index.d.ts' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a.d.ts' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/node_modules/@types/a/index.d.ts' does not exist.", + "Directory '/x/node_modules/@types/b/node_modules' does not exist, skipping all lookups in it.", + "Directory '/x/node_modules/@types/node_modules' does not exist, skipping all lookups in it.", "File '/x/node_modules/@types/a.d.ts' does not exist.", - "File '/x/node_modules/@types/a/package.json' does not exist.", - "File '/x/node_modules/@types/a/index.d.ts' does not exist.", "File '/node_modules/@types/a.d.ts' does not exist.", "File '/node_modules/@types/a/package.json' does not exist.", "File '/node_modules/@types/a/index.d.ts' exist - use it as a name resolution result.", From 3b114f4a1ec1b166000d365aed34b14e530268e1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 27 Dec 2016 15:26:49 -0800 Subject: [PATCH 189/289] Fix UMD header to work with r.js --- src/compiler/emitter.ts | 2 - src/compiler/factory.ts | 13 -- src/compiler/transformers/module/module.ts | 165 ++++++++++++++---- src/compiler/types.ts | 11 -- src/compiler/utilities.ts | 15 +- .../reference/anonymousDefaultExportsUmd.js | 26 +-- .../decoratedDefaultExportsGetExportedUmd.js | 26 +-- .../defaultExportInAwaitExpression01.js | 26 +-- .../reference/defaultExportsGetExportedUmd.js | 26 +-- .../destructuringInVariableDeclarations5.js | 13 +- .../destructuringInVariableDeclarations6.js | 13 +- tests/baselines/reference/es5-umd2.js | 13 +- tests/baselines/reference/es5-umd3.js | 13 +- tests/baselines/reference/es5-umd4.js | 13 +- tests/baselines/reference/es6-umd2.js | 13 +- tests/baselines/reference/exportEqualsUmd.js | 13 +- .../exportNonInitializedVariablesUMD.js | 13 +- .../reference/isolatedModulesPlainFile-UMD.js | 13 +- .../baselines/reference/modulePrologueUmd.js | 13 +- .../reference/noImplicitUseStrict_umd.js | 13 +- .../transpile/Rename dependencies - UMD.js | 13 +- .../reference/umdDependencyComment2.js | 13 +- .../reference/umdDependencyCommentName1.js | 13 +- .../reference/umdDependencyCommentName2.js | 13 +- 24 files changed, 298 insertions(+), 207 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0a03ec6863f..b5217638bfb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -670,8 +670,6 @@ namespace ts { // Transformation nodes case SyntaxKind.PartiallyEmittedExpression: return emitPartiallyEmittedExpression(node); - case SyntaxKind.RawExpression: - return writeLines((node).text); } } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 9e2bbc12394..ac1f52a991f 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1530,19 +1530,6 @@ namespace ts { return node; } - /** - * Creates a node that emits a string of raw text in an expression position. Raw text is never - * transformed, should be ES3 compliant, and should have the same precedence as - * PrimaryExpression. - * - * @param text The raw text of the node. - */ - export function createRawExpression(text: string) { - const node = createNode(SyntaxKind.RawExpression); - node.text = text; - return node; - } - // Compound nodes export function createComma(left: Expression, right: Expression) { diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index c900b7d20e1..170af0778ca 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -102,28 +102,7 @@ namespace ts { function transformAMDModule(node: SourceFile) { const define = createIdentifier("define"); const moduleName = tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true); - } - /** - * Transforms a SourceFile into a UMD module. - * - * @param node The SourceFile node. - */ - function transformUMDModule(node: SourceFile) { - const define = createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); - } - - /** - * Transforms a SourceFile into an AMD or UMD module. - * - * @param node The SourceFile node. - * @param define The expression used to define the module. - * @param moduleName An expression for the module name, if available. - * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies. - */ - function transformAsynchronousModule(node: SourceFile, define: Expression, moduleName: Expression, includeNonAmdDependencies: boolean) { // An AMD define function has the following shape: // // define(id?, dependencies?, factory); @@ -145,7 +124,7 @@ namespace ts { // // we need to add modules without alias names to the end of the dependencies list - const { aliasedModuleNames, unaliasedModuleNames, importAliasNames } = collectAsynchronousDependencies(node, includeNonAmdDependencies); + const { aliasedModuleNames, unaliasedModuleNames, importAliasNames } = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true); // Create an updated SourceFile: // @@ -194,6 +173,137 @@ namespace ts { ); } + /** + * Transforms a SourceFile into a UMD module. + * + * @param node The SourceFile node. + */ + function transformUMDModule(node: SourceFile) { + const { aliasedModuleNames, unaliasedModuleNames, importAliasNames } = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false); + const umdHeader = createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + [createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, + createBlock( + [ + createIf( + createLogicalAnd( + createTypeCheck(createIdentifier("module"), "object"), + createTypeCheck(createPropertyAccess(createIdentifier("module"), "exports"), "object") + ), + createBlock([ + createVariableStatement( + /*modifiers*/ undefined, + [ + createVariableDeclaration( + "v", + /*type*/ undefined, + createCall( + createIdentifier("factory"), + /*typeArguments*/ undefined, + [ + createIdentifier("require"), + createIdentifier("exports") + ] + ) + ) + ] + ), + setEmitFlags( + createIf( + createStrictInequality( + createIdentifier("v"), + createIdentifier("undefined") + ), + createStatement( + createAssignment( + createPropertyAccess(createIdentifier("module"), "exports"), + createIdentifier("v") + ) + ) + ), + EmitFlags.SingleLine + ) + ]), + createIf( + createLogicalAnd( + createTypeCheck(createIdentifier("define"), "function"), + createPropertyAccess(createIdentifier("define"), "amd") + ), + createBlock([ + createStatement( + createCall( + createIdentifier("define"), + /*typeArguments*/ undefined, + [ + createArrayLiteral([ + createLiteral("require"), + createLiteral("exports"), + ...aliasedModuleNames, + ...unaliasedModuleNames + ]), + createIdentifier("factory") + ] + ) + ) + ]) + ) + ) + ], + /*location*/ undefined, + /*multiLine*/ true + ) + ); + + // Create an updated SourceFile: + // + // (function (factory) { + // if (typeof module === "object" && typeof module.exports === "object") { + // var v = factory(require, exports); + // if (v !== undefined) module.exports = v; + // } + // else if (typeof define === 'function' && define.amd) { + // define(["require", "exports"], factory); + // } + // })(function ...) + + return updateSourceFileNode( + node, + createNodeArray( + [ + createStatement( + createCall( + umdHeader, + /*typeArguments*/ undefined, + [ + // Add the module body function argument: + // + // function (require, exports) ... + createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + [ + createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports"), + ...importAliasNames + ], + /*type*/ undefined, + transformAsynchronousModuleBody(node) + ) + ] + ) + ) + ], + /*location*/ node.statements + ) + ); + } + /** * Collect the additional asynchronous dependencies for the module. * @@ -1333,15 +1443,4 @@ namespace ts { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; }` }; - - // emit output for the UMD helper function. - const umdHelper = ` - (function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; - } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); - } - })`; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index f9b416fc4de..1b00d3760b8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -370,7 +370,6 @@ namespace ts { PartiallyEmittedExpression, MergeDeclarationMarker, EndOfDeclarationMarker, - RawExpression, // Enum value count Count, @@ -1521,16 +1520,6 @@ namespace ts { kind: SyntaxKind.EndOfDeclarationMarker; } - /** - * Emits a string of raw text in an expression position. Raw text is never transformed, should - * be ES3 compliant, and should have the same precedence as PrimaryExpression. - */ - /* @internal */ - export interface RawExpression extends PrimaryExpression { - kind: SyntaxKind.RawExpression; - text: string; - } - /** * Marks the beginning of a merged transformed declaration. */ diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ebd7832f8d6..c0c3e48b716 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2141,7 +2141,6 @@ namespace ts { case SyntaxKind.TemplateExpression: case SyntaxKind.ParenthesizedExpression: case SyntaxKind.OmittedExpression: - case SyntaxKind.RawExpression: return 19; case SyntaxKind.TaggedTemplateExpression: @@ -2365,13 +2364,11 @@ namespace ts { * Note that this doesn't actually wrap the input in double quotes. */ export function escapeString(s: string): string { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; + return s.replace(escapedCharsRegExp, getReplacement); + } - return s; - - function getReplacement(c: string) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + function getReplacement(c: string) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); } export function isIntrinsicJsxName(name: string) { @@ -3888,8 +3885,7 @@ namespace ts { || kind === SyntaxKind.ThisKeyword || kind === SyntaxKind.TrueKeyword || kind === SyntaxKind.SuperKeyword - || kind === SyntaxKind.NonNullExpression - || kind === SyntaxKind.RawExpression; + || kind === SyntaxKind.NonNullExpression; } export function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression { @@ -3919,7 +3915,6 @@ namespace ts { || kind === SyntaxKind.SpreadElement || kind === SyntaxKind.AsExpression || kind === SyntaxKind.OmittedExpression - || kind === SyntaxKind.RawExpression || isUnaryExpressionKind(kind); } diff --git a/tests/baselines/reference/anonymousDefaultExportsUmd.js b/tests/baselines/reference/anonymousDefaultExportsUmd.js index 97910161999..85ed1d30444 100644 --- a/tests/baselines/reference/anonymousDefaultExportsUmd.js +++ b/tests/baselines/reference/anonymousDefaultExportsUmd.js @@ -7,14 +7,15 @@ export default class {} export default function() {} //// [a.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; class default_1 { } @@ -22,14 +23,15 @@ export default function() {} exports.default = default_1; }); //// [b.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; function default_1() { } Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js index c32e18ec008..47f9a524432 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.js @@ -20,14 +20,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var decorator; let Foo = class Foo { @@ -45,14 +46,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var decorator; let default_1 = class { diff --git a/tests/baselines/reference/defaultExportInAwaitExpression01.js b/tests/baselines/reference/defaultExportInAwaitExpression01.js index 9a122ae99c5..66d100ad07d 100644 --- a/tests/baselines/reference/defaultExportInAwaitExpression01.js +++ b/tests/baselines/reference/defaultExportInAwaitExpression01.js @@ -13,14 +13,15 @@ import x from './a'; //// [a.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; const x = new Promise((resolve, reject) => { resolve({}); }); Object.defineProperty(exports, "__esModule", { value: true }); @@ -35,14 +36,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "./a"], factory); } -})(["require", "exports", "./a"], function (require, exports) { +})(function (require, exports) { "use strict"; const a_1 = require("./a"); (function () { diff --git a/tests/baselines/reference/defaultExportsGetExportedUmd.js b/tests/baselines/reference/defaultExportsGetExportedUmd.js index 79d88222806..71aa347ce32 100644 --- a/tests/baselines/reference/defaultExportsGetExportedUmd.js +++ b/tests/baselines/reference/defaultExportsGetExportedUmd.js @@ -8,14 +8,15 @@ export default function foo() {} //// [a.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; class Foo { } @@ -23,14 +24,15 @@ export default function foo() {} exports.default = Foo; }); //// [b.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; function foo() { } Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/destructuringInVariableDeclarations5.js b/tests/baselines/reference/destructuringInVariableDeclarations5.js index 48053fdbc4f..94530d8d258 100644 --- a/tests/baselines/reference/destructuringInVariableDeclarations5.js +++ b/tests/baselines/reference/destructuringInVariableDeclarations5.js @@ -6,14 +6,15 @@ export let { toString } = 1; //// [destructuringInVariableDeclarations5.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; exports.toString = (1).toString; { diff --git a/tests/baselines/reference/destructuringInVariableDeclarations6.js b/tests/baselines/reference/destructuringInVariableDeclarations6.js index 479d4ee34af..c16a0a7d0a2 100644 --- a/tests/baselines/reference/destructuringInVariableDeclarations6.js +++ b/tests/baselines/reference/destructuringInVariableDeclarations6.js @@ -7,14 +7,15 @@ export {}; //// [destructuringInVariableDeclarations6.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; let { toString } = 1; { diff --git a/tests/baselines/reference/es5-umd2.js b/tests/baselines/reference/es5-umd2.js index 592c5d63ffe..76333572abe 100644 --- a/tests/baselines/reference/es5-umd2.js +++ b/tests/baselines/reference/es5-umd2.js @@ -15,14 +15,15 @@ export class A //// [es5-umd2.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var A = (function () { function A() { diff --git a/tests/baselines/reference/es5-umd3.js b/tests/baselines/reference/es5-umd3.js index 7ac960d1d39..0689ef19da3 100644 --- a/tests/baselines/reference/es5-umd3.js +++ b/tests/baselines/reference/es5-umd3.js @@ -15,14 +15,15 @@ export default class A //// [es5-umd3.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var A = (function () { function A() { diff --git a/tests/baselines/reference/es5-umd4.js b/tests/baselines/reference/es5-umd4.js index b4034058dcd..ea3cba50ac0 100644 --- a/tests/baselines/reference/es5-umd4.js +++ b/tests/baselines/reference/es5-umd4.js @@ -17,14 +17,15 @@ export = A; //// [es5-umd4.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var A = (function () { function A() { diff --git a/tests/baselines/reference/es6-umd2.js b/tests/baselines/reference/es6-umd2.js index ed5ce4aacb8..dc094122d9d 100644 --- a/tests/baselines/reference/es6-umd2.js +++ b/tests/baselines/reference/es6-umd2.js @@ -14,14 +14,15 @@ export class A } //// [es6-umd2.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; class A { constructor() { diff --git a/tests/baselines/reference/exportEqualsUmd.js b/tests/baselines/reference/exportEqualsUmd.js index 500c8795dc7..2201f2b8407 100644 --- a/tests/baselines/reference/exportEqualsUmd.js +++ b/tests/baselines/reference/exportEqualsUmd.js @@ -2,14 +2,15 @@ export = { ["hi"]: "there" }; //// [exportEqualsUmd.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var _a; return _a = {}, _a["hi"] = "there", _a; diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.js b/tests/baselines/reference/exportNonInitializedVariablesUMD.js index 5cbf6d381b0..796818c650c 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesUMD.js +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.js @@ -35,14 +35,15 @@ export let h1: D = new D; //// [exportNonInitializedVariablesUMD.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var ; let; diff --git a/tests/baselines/reference/isolatedModulesPlainFile-UMD.js b/tests/baselines/reference/isolatedModulesPlainFile-UMD.js index ecc8ade69b7..ece949b9100 100644 --- a/tests/baselines/reference/isolatedModulesPlainFile-UMD.js +++ b/tests/baselines/reference/isolatedModulesPlainFile-UMD.js @@ -5,14 +5,15 @@ run(1); //// [isolatedModulesPlainFile-UMD.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; run(1); }); diff --git a/tests/baselines/reference/modulePrologueUmd.js b/tests/baselines/reference/modulePrologueUmd.js index fb366945d66..18edf1ef4af 100644 --- a/tests/baselines/reference/modulePrologueUmd.js +++ b/tests/baselines/reference/modulePrologueUmd.js @@ -4,14 +4,15 @@ export class Foo {} //// [modulePrologueUmd.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { "use strict"; var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/noImplicitUseStrict_umd.js b/tests/baselines/reference/noImplicitUseStrict_umd.js index 566c3bbe0b6..eafb8246bf7 100644 --- a/tests/baselines/reference/noImplicitUseStrict_umd.js +++ b/tests/baselines/reference/noImplicitUseStrict_umd.js @@ -3,13 +3,14 @@ export var x = 0; //// [noImplicitUseStrict_umd.js] -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports"], factory); } -})(["require", "exports"], function (require, exports) { +})(function (require, exports) { exports.x = 0; }); diff --git a/tests/baselines/reference/transpile/Rename dependencies - UMD.js b/tests/baselines/reference/transpile/Rename dependencies - UMD.js index 88bdc515936..c2b337076ba 100644 --- a/tests/baselines/reference/transpile/Rename dependencies - UMD.js +++ b/tests/baselines/reference/transpile/Rename dependencies - UMD.js @@ -1,11 +1,12 @@ -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "SomeOtherName"], factory); } -})(["require", "exports", "SomeOtherName"], function (require, exports) { +})(function (require, exports) { "use strict"; var SomeName_1 = require("SomeOtherName"); use(SomeName_1.foo); diff --git a/tests/baselines/reference/umdDependencyComment2.js b/tests/baselines/reference/umdDependencyComment2.js index 68cffd22023..4e784d87fa3 100644 --- a/tests/baselines/reference/umdDependencyComment2.js +++ b/tests/baselines/reference/umdDependencyComment2.js @@ -7,14 +7,15 @@ m1.f(); //// [umdDependencyComment2.js] /// -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "bar", "m2"], factory); } -})(["require", "exports", "bar", "m2"], function (require, exports) { +})(function (require, exports) { "use strict"; var m1 = require("m2"); m1.f(); diff --git a/tests/baselines/reference/umdDependencyCommentName1.js b/tests/baselines/reference/umdDependencyCommentName1.js index ac2fcc99981..45cae25192a 100644 --- a/tests/baselines/reference/umdDependencyCommentName1.js +++ b/tests/baselines/reference/umdDependencyCommentName1.js @@ -7,14 +7,15 @@ m1.f(); //// [umdDependencyCommentName1.js] /// -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "bar", "m2"], factory); } -})(["require", "exports", "bar", "m2"], function (require, exports, b) { +})(function (require, exports, b) { "use strict"; var m1 = require("m2"); m1.f(); diff --git a/tests/baselines/reference/umdDependencyCommentName2.js b/tests/baselines/reference/umdDependencyCommentName2.js index 06bd2c8a90c..e85d5b99b14 100644 --- a/tests/baselines/reference/umdDependencyCommentName2.js +++ b/tests/baselines/reference/umdDependencyCommentName2.js @@ -11,14 +11,15 @@ m1.f(); /// /// /// -(function (dependencies, factory) { - if (typeof module === 'object' && typeof module.exports === 'object') { - var v = factory(require, exports); if (v !== undefined) module.exports = v; +(function (factory) { + if (typeof module === "object" && typeof module.exports === "object") { + var v = factory(require, exports); + if (v !== undefined) module.exports = v; } - else if (typeof define === 'function' && define.amd) { - define(dependencies, factory); + else if (typeof define === "function" && define.amd) { + define(["require", "exports", "bar", "goo", "foo", "m2"], factory); } -})(["require", "exports", "bar", "goo", "foo", "m2"], function (require, exports, b, c) { +})(function (require, exports, b, c) { "use strict"; var m1 = require("m2"); m1.f(); From 5928f60d62062a6625e45be25e9127ecd14f2316 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 27 Dec 2016 16:45:26 -0800 Subject: [PATCH 190/289] Do not report helper module errors in ambient contexts for Rest helper --- src/compiler/checker.ts | 4 +- .../importHelpersInAmbientContext.js | 59 ++++++++ .../importHelpersInAmbientContext.symbols | 131 ++++++++++++++++++ .../importHelpersInAmbientContext.types | 131 ++++++++++++++++++ .../compiler/importHelpersInAmbientContext.ts | 55 ++++++++ 5 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/importHelpersInAmbientContext.js create mode 100644 tests/baselines/reference/importHelpersInAmbientContext.symbols create mode 100644 tests/baselines/reference/importHelpersInAmbientContext.types create mode 100644 tests/cases/compiler/importHelpersInAmbientContext.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 62f7aacdcd0..139f3f052cb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,4 +1,4 @@ -/// +/// /// /* @internal */ @@ -17244,7 +17244,7 @@ namespace ts { } if (node.kind === SyntaxKind.BindingElement) { - if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext) { + if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext && !isInAmbientContext(node)) { checkExternalEmitHelpers(node, ExternalEmitHelpers.Rest); } // check computed properties inside property names of binding elements diff --git a/tests/baselines/reference/importHelpersInAmbientContext.js b/tests/baselines/reference/importHelpersInAmbientContext.js new file mode 100644 index 00000000000..b9db8c4751f --- /dev/null +++ b/tests/baselines/reference/importHelpersInAmbientContext.js @@ -0,0 +1,59 @@ +//// [tests/cases/compiler/importHelpersInAmbientContext.ts] //// + +//// [a.d.ts] + +export { }; + +// Extends +declare class C { } +declare class D extends C { } + +// Destructuring +interface I { + ({descendants, read}?: { + descendants?: boolean; + read?: any; + }): any; +} + + +// Object Rest +interface Foo { + a: number; b: string; +} +export var { a, ...x } : Foo; + +//// [b.ts] +export {}; +declare namespace N { + // Extends + class C { } + class D extends C { } + + // Destructuring + interface I { + ({descendants, read}?: { + descendants?: boolean; + read?: any; + }): any; + } + + + // Object Rest + interface Foo { + a: number; b: string; + } + export var { a, ...x } : Foo; +} + +//// [tslib.d.ts] +export declare function __extends(d: Function, b: Function): void; +export declare function __assign(t: any, ...sources: any[]): any; +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +export declare function __param(paramIndex: number, decorator: Function): Function; +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; + + +//// [b.js] +"use strict"; diff --git a/tests/baselines/reference/importHelpersInAmbientContext.symbols b/tests/baselines/reference/importHelpersInAmbientContext.symbols new file mode 100644 index 00000000000..7da1ea95042 --- /dev/null +++ b/tests/baselines/reference/importHelpersInAmbientContext.symbols @@ -0,0 +1,131 @@ +=== tests/cases/compiler/a.d.ts === + +export { }; + +// Extends +declare class C { } +>C : Symbol(C, Decl(a.d.ts, 1, 11)) + +declare class D extends C { } +>D : Symbol(D, Decl(a.d.ts, 4, 19)) +>C : Symbol(C, Decl(a.d.ts, 1, 11)) + +// Destructuring +interface I { +>I : Symbol(I, Decl(a.d.ts, 5, 29)) + + ({descendants, read}?: { +>descendants : Symbol(descendants, Decl(a.d.ts, 9, 6)) +>read : Symbol(read, Decl(a.d.ts, 9, 18)) + + descendants?: boolean; +>descendants : Symbol(descendants, Decl(a.d.ts, 9, 28)) + + read?: any; +>read : Symbol(read, Decl(a.d.ts, 10, 30)) + + }): any; +} + + +// Object Rest +interface Foo { +>Foo : Symbol(Foo, Decl(a.d.ts, 13, 1)) + + a: number; b: string; +>a : Symbol(Foo.a, Decl(a.d.ts, 17, 15)) +>b : Symbol(Foo.b, Decl(a.d.ts, 18, 14)) +} +export var { a, ...x } : Foo; +>a : Symbol(a, Decl(a.d.ts, 20, 12)) +>x : Symbol(x, Decl(a.d.ts, 20, 15)) +>Foo : Symbol(Foo, Decl(a.d.ts, 13, 1)) + +=== tests/cases/compiler/b.ts === +export {}; +declare namespace N { +>N : Symbol(N, Decl(b.ts, 0, 10)) + + // Extends + class C { } +>C : Symbol(C, Decl(b.ts, 1, 21)) + + class D extends C { } +>D : Symbol(D, Decl(b.ts, 3, 12)) +>C : Symbol(C, Decl(b.ts, 1, 21)) + + // Destructuring + interface I { +>I : Symbol(I, Decl(b.ts, 4, 22)) + + ({descendants, read}?: { +>descendants : Symbol(descendants, Decl(b.ts, 8, 4)) +>read : Symbol(read, Decl(b.ts, 8, 16)) + + descendants?: boolean; +>descendants : Symbol(descendants, Decl(b.ts, 8, 26)) + + read?: any; +>read : Symbol(read, Decl(b.ts, 9, 25)) + + }): any; + } + + + // Object Rest + interface Foo { +>Foo : Symbol(Foo, Decl(b.ts, 12, 2)) + + a: number; b: string; +>a : Symbol(Foo.a, Decl(b.ts, 16, 16)) +>b : Symbol(Foo.b, Decl(b.ts, 17, 12)) + } + export var { a, ...x } : Foo; +>a : Symbol(a, Decl(b.ts, 19, 13)) +>x : Symbol(x, Decl(b.ts, 19, 16)) +>Foo : Symbol(Foo, Decl(b.ts, 12, 2)) +} + +=== tests/cases/compiler/tslib.d.ts === +export declare function __extends(d: Function, b: Function): void; +>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --)) +>d : Symbol(d, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>b : Symbol(b, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +export declare function __assign(t: any, ...sources: any[]): any; +>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --)) +>t : Symbol(t, Decl(tslib.d.ts, --, --)) +>sources : Symbol(sources, Decl(tslib.d.ts, --, --)) + +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --)) +>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>target : Symbol(target, Decl(tslib.d.ts, --, --)) +>key : Symbol(key, Decl(tslib.d.ts, --, --)) +>desc : Symbol(desc, Decl(tslib.d.ts, --, --)) + +export declare function __param(paramIndex: number, decorator: Function): Function; +>__param : Symbol(__param, Decl(tslib.d.ts, --, --)) +>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --)) +>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --)) +>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --)) +>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --)) +>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --)) +>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --)) +>P : Symbol(P, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>generator : Symbol(generator, Decl(tslib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) + diff --git a/tests/baselines/reference/importHelpersInAmbientContext.types b/tests/baselines/reference/importHelpersInAmbientContext.types new file mode 100644 index 00000000000..5f3102b68f5 --- /dev/null +++ b/tests/baselines/reference/importHelpersInAmbientContext.types @@ -0,0 +1,131 @@ +=== tests/cases/compiler/a.d.ts === + +export { }; + +// Extends +declare class C { } +>C : C + +declare class D extends C { } +>D : D +>C : C + +// Destructuring +interface I { +>I : I + + ({descendants, read}?: { +>descendants : boolean +>read : any + + descendants?: boolean; +>descendants : boolean + + read?: any; +>read : any + + }): any; +} + + +// Object Rest +interface Foo { +>Foo : Foo + + a: number; b: string; +>a : number +>b : string +} +export var { a, ...x } : Foo; +>a : number +>x : { b: string; } +>Foo : Foo + +=== tests/cases/compiler/b.ts === +export {}; +declare namespace N { +>N : typeof N + + // Extends + class C { } +>C : C + + class D extends C { } +>D : D +>C : C + + // Destructuring + interface I { +>I : I + + ({descendants, read}?: { +>descendants : boolean +>read : any + + descendants?: boolean; +>descendants : boolean + + read?: any; +>read : any + + }): any; + } + + + // Object Rest + interface Foo { +>Foo : Foo + + a: number; b: string; +>a : number +>b : string + } + export var { a, ...x } : Foo; +>a : number +>x : { b: string; } +>Foo : Foo +} + +=== tests/cases/compiler/tslib.d.ts === +export declare function __extends(d: Function, b: Function): void; +>__extends : (d: Function, b: Function) => void +>d : Function +>Function : Function +>b : Function +>Function : Function + +export declare function __assign(t: any, ...sources: any[]): any; +>__assign : (t: any, ...sources: any[]) => any +>t : any +>sources : any[] + +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any +>decorators : Function[] +>Function : Function +>target : any +>key : string | symbol +>desc : any + +export declare function __param(paramIndex: number, decorator: Function): Function; +>__param : (paramIndex: number, decorator: Function) => Function +>paramIndex : number +>decorator : Function +>Function : Function +>Function : Function + +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +>__metadata : (metadataKey: any, metadataValue: any) => Function +>metadataKey : any +>metadataValue : any +>Function : Function + +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; +>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any +>thisArg : any +>_arguments : any +>P : Function +>Function : Function +>generator : Function +>Function : Function + diff --git a/tests/cases/compiler/importHelpersInAmbientContext.ts b/tests/cases/compiler/importHelpersInAmbientContext.ts new file mode 100644 index 00000000000..8bfa5b25404 --- /dev/null +++ b/tests/cases/compiler/importHelpersInAmbientContext.ts @@ -0,0 +1,55 @@ +// @importHelpers: true +// @target: es5 + +// @filename: a.d.ts +export { }; + +// Extends +declare class C { } +declare class D extends C { } + +// Destructuring +interface I { + ({descendants, read}?: { + descendants?: boolean; + read?: any; + }): any; +} + + +// Object Rest +interface Foo { + a: number; b: string; +} +export var { a, ...x } : Foo; + +// @filename: b.ts +export {}; +declare namespace N { + // Extends + class C { } + class D extends C { } + + // Destructuring + interface I { + ({descendants, read}?: { + descendants?: boolean; + read?: any; + }): any; + } + + + // Object Rest + interface Foo { + a: number; b: string; + } + export var { a, ...x } : Foo; +} + +// @filename: tslib.d.ts +export declare function __extends(d: Function, b: Function): void; +export declare function __assign(t: any, ...sources: any[]): any; +export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; +export declare function __param(paramIndex: number, decorator: Function): Function; +export declare function __metadata(metadataKey: any, metadataValue: any): Function; +export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; From d7b61b2da50482380fdca71a3073898ff48bd0e5 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 27 Dec 2016 17:58:42 -0800 Subject: [PATCH 191/289] Aggregate flags for ExpressionWithTypeArguments --- src/compiler/visitor.ts | 2 +- .../baselines/reference/jsxInExtendsClause.js | 35 ++++++++++++++ .../reference/jsxInExtendsClause.symbols | 42 +++++++++++++++++ .../reference/jsxInExtendsClause.types | 46 +++++++++++++++++++ tests/cases/compiler/jsxInExtendsClause.tsx | 12 +++++ 5 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/jsxInExtendsClause.js create mode 100644 tests/baselines/reference/jsxInExtendsClause.symbols create mode 100644 tests/baselines/reference/jsxInExtendsClause.types create mode 100644 tests/cases/compiler/jsxInExtendsClause.tsx diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 43e01ca56bb..5fc80bb014d 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1328,7 +1328,7 @@ namespace ts { function aggregateTransformFlagsForSubtree(node: Node): TransformFlags { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (hasModifier(node, ModifierFlags.Ambient) || isTypeNode(node)) { + if (hasModifier(node, ModifierFlags.Ambient) || (isTypeNode(node) && node.kind !== SyntaxKind.ExpressionWithTypeArguments)) { return TransformFlags.None; } diff --git a/tests/baselines/reference/jsxInExtendsClause.js b/tests/baselines/reference/jsxInExtendsClause.js new file mode 100644 index 00000000000..8204067cb04 --- /dev/null +++ b/tests/baselines/reference/jsxInExtendsClause.js @@ -0,0 +1,35 @@ +//// [jsxInExtendsClause.tsx] +// https://github.com/Microsoft/TypeScript/issues/13157 +declare namespace React { + interface ComponentClass

{ new (): Component; } + class Component {} +} +declare function createComponentClass

(factory: () => React.ComponentClass

): React.ComponentClass

; +class Foo extends createComponentClass(() => class extends React.Component<{}, {}> { + render() { + return Hello, world!; + } +}) {} + +//// [jsxInExtendsClause.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Foo = (function (_super) { + __extends(Foo, _super); + function Foo() { + return _super.apply(this, arguments) || this; + } + return Foo; +}(createComponentClass(function () { return (function (_super) { + __extends(class_1, _super); + function class_1() { + return _super.apply(this, arguments) || this; + } + class_1.prototype.render = function () { + return React.createElement("span", null, "Hello, world!"); + }; + return class_1; +}(React.Component)); }))); diff --git a/tests/baselines/reference/jsxInExtendsClause.symbols b/tests/baselines/reference/jsxInExtendsClause.symbols new file mode 100644 index 00000000000..b7f3635bfd9 --- /dev/null +++ b/tests/baselines/reference/jsxInExtendsClause.symbols @@ -0,0 +1,42 @@ +=== tests/cases/compiler/jsxInExtendsClause.tsx === +// https://github.com/Microsoft/TypeScript/issues/13157 +declare namespace React { +>React : Symbol(React, Decl(jsxInExtendsClause.tsx, 0, 0)) + + interface ComponentClass

{ new (): Component; } +>ComponentClass : Symbol(ComponentClass, Decl(jsxInExtendsClause.tsx, 1, 25)) +>P : Symbol(P, Decl(jsxInExtendsClause.tsx, 2, 27)) +>Component : Symbol(Component, Decl(jsxInExtendsClause.tsx, 2, 59)) +>P : Symbol(P, Decl(jsxInExtendsClause.tsx, 2, 27)) + + class Component {} +>Component : Symbol(Component, Decl(jsxInExtendsClause.tsx, 2, 59)) +>A : Symbol(A, Decl(jsxInExtendsClause.tsx, 3, 18)) +>B : Symbol(B, Decl(jsxInExtendsClause.tsx, 3, 20)) +} +declare function createComponentClass

(factory: () => React.ComponentClass

): React.ComponentClass

; +>createComponentClass : Symbol(createComponentClass, Decl(jsxInExtendsClause.tsx, 4, 1)) +>P : Symbol(P, Decl(jsxInExtendsClause.tsx, 5, 38)) +>factory : Symbol(factory, Decl(jsxInExtendsClause.tsx, 5, 41)) +>React : Symbol(React, Decl(jsxInExtendsClause.tsx, 0, 0)) +>ComponentClass : Symbol(React.ComponentClass, Decl(jsxInExtendsClause.tsx, 1, 25)) +>P : Symbol(P, Decl(jsxInExtendsClause.tsx, 5, 38)) +>React : Symbol(React, Decl(jsxInExtendsClause.tsx, 0, 0)) +>ComponentClass : Symbol(React.ComponentClass, Decl(jsxInExtendsClause.tsx, 1, 25)) +>P : Symbol(P, Decl(jsxInExtendsClause.tsx, 5, 38)) + +class Foo extends createComponentClass(() => class extends React.Component<{}, {}> { +>Foo : Symbol(Foo, Decl(jsxInExtendsClause.tsx, 5, 106)) +>createComponentClass : Symbol(createComponentClass, Decl(jsxInExtendsClause.tsx, 4, 1)) +>React.Component : Symbol(React.Component, Decl(jsxInExtendsClause.tsx, 2, 59)) +>React : Symbol(React, Decl(jsxInExtendsClause.tsx, 0, 0)) +>Component : Symbol(React.Component, Decl(jsxInExtendsClause.tsx, 2, 59)) + + render() { +>render : Symbol((Anonymous class).render, Decl(jsxInExtendsClause.tsx, 6, 84)) + + return Hello, world!; +>span : Symbol(unknown) +>span : Symbol(unknown) + } +}) {} diff --git a/tests/baselines/reference/jsxInExtendsClause.types b/tests/baselines/reference/jsxInExtendsClause.types new file mode 100644 index 00000000000..5363c16a944 --- /dev/null +++ b/tests/baselines/reference/jsxInExtendsClause.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/jsxInExtendsClause.tsx === +// https://github.com/Microsoft/TypeScript/issues/13157 +declare namespace React { +>React : typeof React + + interface ComponentClass

{ new (): Component; } +>ComponentClass : ComponentClass

+>P : P +>Component : Component +>P : P + + class Component {} +>Component : Component +>A : A +>B : B +} +declare function createComponentClass

(factory: () => React.ComponentClass

): React.ComponentClass

; +>createComponentClass :

(factory: () => React.ComponentClass

) => React.ComponentClass

+>P : P +>factory : () => React.ComponentClass

+>React : any +>ComponentClass : React.ComponentClass

+>P : P +>React : any +>ComponentClass : React.ComponentClass

+>P : P + +class Foo extends createComponentClass(() => class extends React.Component<{}, {}> { +>Foo : Foo +>createComponentClass(() => class extends React.Component<{}, {}> { render() { return Hello, world!; }}) : React.Component<{}, {}> +>createComponentClass :

(factory: () => React.ComponentClass

) => React.ComponentClass

+>() => class extends React.Component<{}, {}> { render() { return Hello, world!; }} : () => typeof (Anonymous class) +>class extends React.Component<{}, {}> { render() { return Hello, world!; }} : typeof (Anonymous class) +>React.Component : React.Component<{}, {}> +>React : typeof React +>Component : typeof React.Component + + render() { +>render : () => any + + return Hello, world!; +>Hello, world! : any +>span : any +>span : any + } +}) {} diff --git a/tests/cases/compiler/jsxInExtendsClause.tsx b/tests/cases/compiler/jsxInExtendsClause.tsx new file mode 100644 index 00000000000..6482a5964e1 --- /dev/null +++ b/tests/cases/compiler/jsxInExtendsClause.tsx @@ -0,0 +1,12 @@ +// @jsx: react +// https://github.com/Microsoft/TypeScript/issues/13157 +declare namespace React { + interface ComponentClass

{ new (): Component; } + class Component {} +} +declare function createComponentClass

(factory: () => React.ComponentClass

): React.ComponentClass

; +class Foo extends createComponentClass(() => class extends React.Component<{}, {}> { + render() { + return Hello, world!; + } +}) {} \ No newline at end of file From 498568b16f5b8eef0f70a96d4816d98001f68ed9 Mon Sep 17 00:00:00 2001 From: Slawomir Sadziak Date: Wed, 28 Dec 2016 05:18:53 +0100 Subject: [PATCH 192/289] #13063 Fix strictNullChecks breaking typeof * Allow typeof to use not-auto variable in strictNullChecks mode --- src/compiler/checker.ts | 2 +- tests/baselines/reference/typeofStrictNull.js | 8 ++++++++ tests/baselines/reference/typeofStrictNull.symbols | 9 +++++++++ tests/baselines/reference/typeofStrictNull.types | 9 +++++++++ tests/cases/compiler/typeofStrictNull.ts | 4 ++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/typeofStrictNull.js create mode 100644 tests/baselines/reference/typeofStrictNull.symbols create mode 100644 tests/baselines/reference/typeofStrictNull.types create mode 100644 tests/cases/compiler/typeofStrictNull.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 139f3f052cb..c08a44b347e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10372,7 +10372,7 @@ namespace ts { // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). const assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || isInTypeQuery(node) || (type.flags & TypeFlags.Any) !== 0) || isInAmbientContext(declaration); const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph diff --git a/tests/baselines/reference/typeofStrictNull.js b/tests/baselines/reference/typeofStrictNull.js new file mode 100644 index 00000000000..520a72b9f0f --- /dev/null +++ b/tests/baselines/reference/typeofStrictNull.js @@ -0,0 +1,8 @@ +//// [typeofStrictNull.ts] + +let a: number; +let b: typeof a; + +//// [typeofStrictNull.js] +var a; +var b; diff --git a/tests/baselines/reference/typeofStrictNull.symbols b/tests/baselines/reference/typeofStrictNull.symbols new file mode 100644 index 00000000000..7b2dfb41797 --- /dev/null +++ b/tests/baselines/reference/typeofStrictNull.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/typeofStrictNull.ts === + +let a: number; +>a : Symbol(a, Decl(typeofStrictNull.ts, 1, 3)) + +let b: typeof a; +>b : Symbol(b, Decl(typeofStrictNull.ts, 2, 3)) +>a : Symbol(a, Decl(typeofStrictNull.ts, 1, 3)) + diff --git a/tests/baselines/reference/typeofStrictNull.types b/tests/baselines/reference/typeofStrictNull.types new file mode 100644 index 00000000000..59344727987 --- /dev/null +++ b/tests/baselines/reference/typeofStrictNull.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/typeofStrictNull.ts === + +let a: number; +>a : number + +let b: typeof a; +>b : number +>a : number + diff --git a/tests/cases/compiler/typeofStrictNull.ts b/tests/cases/compiler/typeofStrictNull.ts new file mode 100644 index 00000000000..ede2b857305 --- /dev/null +++ b/tests/cases/compiler/typeofStrictNull.ts @@ -0,0 +1,4 @@ +// @strictNullChecks: true + +let a: number; +let b: typeof a; \ No newline at end of file From a8a1a826b3924c9d62841d01cd16c5b206abe3ee Mon Sep 17 00:00:00 2001 From: zhengbli Date: Wed, 28 Dec 2016 08:15:21 -0800 Subject: [PATCH 193/289] set the option when creating inferred projects --- src/server/editorServices.ts | 6 ++++++ src/server/project.ts | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 00df53e1e35..23b172d1cfe 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1079,6 +1079,12 @@ namespace ts.server { project, fileName => this.onConfigFileAddedForInferredProject(fileName)); + if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { + const options = project.getCompilerOptions(); + options.maxNodeModuleJsDepth = 2; + project.setCompilerOptions(options); + } + project.updateGraph(); if (!useExistingProject) { diff --git a/src/server/project.ts b/src/server/project.ts index 2172b037d89..6085ee05159 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -169,13 +169,6 @@ namespace ts.server { this.compilerOptions.allowNonTsExtensions = true; } - if (this.projectKind === ProjectKind.Inferred) { - // Add default compiler options for inferred projects here - if (this.compilerOptions.maxNodeModuleJsDepth === undefined) { - this.compilerOptions.maxNodeModuleJsDepth = 2; - } - } - this.setInternalCompilerOptionsForEmittingJsFiles(); this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken); From f510897dbd5d1f8d0024c1b14243270dfe7006a3 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 28 Dec 2016 08:58:31 -0800 Subject: [PATCH 194/289] Remove "sparseArray" constructor function and just use array literals --- src/compiler/checker.ts | 2 +- src/compiler/core.ts | 2 -- src/compiler/factory.ts | 2 +- src/compiler/moduleNameResolver.ts | 6 +++--- src/compiler/transformers/generators.ts | 2 +- src/compiler/transformers/module/module.ts | 6 +++--- src/compiler/transformers/module/system.ts | 10 +++++----- src/compiler/transformers/ts.ts | 2 +- src/compiler/utilities.ts | 4 ++-- src/harness/unittests/session.ts | 2 +- src/harness/unittests/tsserverProjectSystem.ts | 4 ++-- src/services/codefixes/codeFixProvider.ts | 2 +- src/services/codefixes/importFixes.ts | 4 ++-- 13 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 165e4c3cca7..3ed4c383ef2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4084,7 +4084,7 @@ namespace ts { enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { const memberTypeList: Type[] = []; - const memberTypes = sparseArray(); + const memberTypes: SparseArray = []; for (const declaration of enumType.symbol.declarations) { if (declaration.kind === SyntaxKind.EnumDeclaration) { computeEnumMemberValues(declaration); diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a7864a0646f..e9dbdb8786a 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -39,8 +39,6 @@ namespace ts { return map; } - export const sparseArray: () => SparseArray = createDictionaryObject; - /** Create a new map. If a template object is provided, the map will copy entries from it. */ export function createMap(template?: MapLike): Map { const map: Map = new MapCtr(); diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 661a0346f26..38e28fc2de0 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -3299,7 +3299,7 @@ namespace ts { export function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo { const externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[] = []; const exportSpecifiers = createMap(); - const exportedBindings = sparseArray(); + const exportedBindings: SparseArray = []; const uniqueExports = createMap(); let exportedNames: Identifier[]; let hasExportDefault = false; diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index a8b634c0234..1efe9078f5a 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -388,7 +388,7 @@ namespace ts { } } } - + function getCommonPrefix(directory: Path, resolution: string) { if (resolution === undefined) { return undefined; @@ -418,7 +418,7 @@ namespace ts { trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } const containingDirectory = getDirectoryPath(containingFile); - let perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + const perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); let result = perFolderCache && perFolderCache.get(moduleName); if (result) { @@ -991,7 +991,7 @@ namespace ts { * - { value: } - found - stop searching */ type SearchResult = { value: T | undefined } | undefined; - + /** * Wraps value to SearchResult. * @returns undefined if value is undefined or { value } otherwise diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 7cf7602efa0..8c9da9c4847 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -2096,7 +2096,7 @@ namespace ts { if (!renamedCatchVariables) { renamedCatchVariables = createMap(); - renamedCatchVariableDeclarations = sparseArray(); + renamedCatchVariableDeclarations = []; context.enableSubstitution(SyntaxKind.Identifier); } diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index e5e27c8360d..192f1f81a8f 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -39,8 +39,8 @@ namespace ts { context.enableSubstitution(SyntaxKind.ShorthandPropertyAssignment); // Substitutes shorthand property assignments for imported/exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap = sparseArray(); // The ExternalModuleInfo for each file. - const deferredExports = sparseArray(); // Exports to defer until an EndOfDeclarationMarker is found. + const moduleInfoMap: SparseArray = []; // The ExternalModuleInfo for each file. + const deferredExports: SparseArray = []; // Exports to defer until an EndOfDeclarationMarker is found. let currentSourceFile: SourceFile; // The current file. let currentModuleInfo: ExternalModuleInfo; // The ExternalModuleInfo for the current file. @@ -1105,7 +1105,7 @@ namespace ts { if (node.kind === SyntaxKind.SourceFile) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[getOriginalNodeId(currentSourceFile)]; - noSubstitution = sparseArray(); + noSubstitution = []; previousOnEmitNode(emitContext, node, emitCallback); diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 5f23ccd0669..d332f3376b1 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -28,10 +28,10 @@ namespace ts { context.enableSubstitution(SyntaxKind.PostfixUnaryExpression); // Substitutes updates to exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap = sparseArray(); // The ExternalModuleInfo for each file. - const deferredExports = sparseArray(); // Exports to defer until an EndOfDeclarationMarker is found. - const exportFunctionsMap = sparseArray(); // The export function associated with a source file. - const noSubstitutionMap = sparseArray>(); // Set of nodes for which substitution rules should be ignored for each file. + const moduleInfoMap: SparseArray = []; // The ExternalModuleInfo for each file. + const deferredExports: SparseArray = []; // Exports to defer until an EndOfDeclarationMarker is found. + const exportFunctionsMap: SparseArray = []; // The export function associated with a source file. + const noSubstitutionMap: SparseArray> = []; // Set of nodes for which substitution rules should be ignored for each file. let currentSourceFile: SourceFile; // The current file. let moduleInfo: ExternalModuleInfo; // ExternalModuleInfo for the current file. @@ -1771,7 +1771,7 @@ namespace ts { * @param node The node which should not be substituted. */ function preventSubstitution(node: T): T { - if (noSubstitution === undefined) noSubstitution = sparseArray(); + if (noSubstitution === undefined) noSubstitution = []; noSubstitution[getNodeId(node)] = true; return node; } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 0947c894db8..96b00434660 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -3125,7 +3125,7 @@ namespace ts { context.enableSubstitution(SyntaxKind.Identifier); // Keep track of class aliases. - classAliases = sparseArray(); + classAliases = []; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7fdda448ae8..44bb05dd4a8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /* @internal */ namespace ts { @@ -3365,7 +3365,7 @@ namespace ts { return false; } - const syntaxKindCache = sparseArray(); + const syntaxKindCache: SparseArray = []; export function formatSyntaxKind(kind: SyntaxKind): string { const syntaxKindEnum = (ts).SyntaxKind; diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index 70cda27747b..82f6ede865f 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -416,7 +416,7 @@ namespace ts.server { class InProcClient { private server: InProcSession; private seq = 0; - private callbacks = sparseArray<(resp: protocol.Response) => void>(); + private callbacks: SparseArray<(resp: protocol.Response) => void> = []; private eventHandlers = createMap<(args: any) => void>(); handle(msg: protocol.Message): void { diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 98a34d2a3bb..4ae2dc7a389 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -292,7 +292,7 @@ namespace ts.projectSystem { } export class Callbacks { - private map = sparseArray(); + private map: SparseArray = []; private nextId = 1; register(cb: (...args: any[]) => void, args: any[]) { @@ -319,7 +319,7 @@ namespace ts.projectSystem { for (const key in this.map) { this.map[key](); } - this.map = sparseArray(); + this.map = []; } } diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codefixes/codeFixProvider.ts index f4cb411b064..e1e3ef18865 100644 --- a/src/services/codefixes/codeFixProvider.ts +++ b/src/services/codefixes/codeFixProvider.ts @@ -16,7 +16,7 @@ namespace ts { } export namespace codefix { - const codeFixes = sparseArray(); + const codeFixes: SparseArray = []; export function registerCodeFix(action: CodeFix) { forEach(action.errorCodes, error => { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 0df3c3134fe..81b299bf708 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -14,7 +14,7 @@ namespace ts.codefix { } class ImportCodeActionMap { - private symbolIdToActionMap = sparseArray(); + private symbolIdToActionMap: SparseArray = []; addAction(symbolId: number, newAction: ImportCodeAction) { if (!newAction) { @@ -125,7 +125,7 @@ namespace ts.codefix { const symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - const cachedImportDeclarations = sparseArray<(ImportDeclaration | ImportEqualsDeclaration)[]>(); + const cachedImportDeclarations: SparseArray<(ImportDeclaration | ImportEqualsDeclaration)[]> = []; let cachedNewImportInsertPosition: number; const allPotentialModules = checker.getAmbientModules(); From 39c19a74eae41dc83f44885bfa740d50e7b17c81 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 28 Dec 2016 09:05:52 -0800 Subject: [PATCH 195/289] Inline `keysOfMap` and `valuesOfMap`. --- src/compiler/commandLineParser.ts | 8 ++++---- src/compiler/core.ts | 18 +++--------------- src/compiler/tsc.ts | 2 +- src/harness/unittests/tsserverProjectSystem.ts | 2 +- src/server/project.ts | 6 +++--- src/services/documentRegistry.ts | 4 ++-- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a32a5137bad..7bf50f675aa 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -543,7 +543,7 @@ namespace ts { /* @internal */ export function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic { - const namesOfType = keysOfMap(opt.type).map(key => `'${key}'`).join(", "); + const namesOfType = arrayFrom(opt.type.keys()).map(key => `'${key}'`).join(", "); return createCompilerDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, namesOfType); } @@ -1255,8 +1255,8 @@ namespace ts { } } - const literalFiles = valuesOfMap(literalFileMap); - const wildcardFiles = valuesOfMap(wildcardFileMap); + const literalFiles = arrayFrom(literalFileMap.values()); + const wildcardFiles = arrayFrom(wildcardFileMap.values()); wildcardFiles.sort(host.useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); return { fileNames: literalFiles.concat(wildcardFiles), diff --git a/src/compiler/core.ts b/src/compiler/core.ts index e9dbdb8786a..9f8f1ba3f55 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -156,7 +156,7 @@ namespace ts { } function getKeys() { - return keysOfMap(files) as Path[]; + return arrayFrom(files.keys()) as Path[]; } // path should already be well-formed so it does not need to be normalized @@ -867,7 +867,8 @@ namespace ts { return keys; } - function arrayFrom(iterator: Iterator): T[] { + /** Shims `Array.from`. */ + export function arrayFrom(iterator: Iterator): T[] { const result: T[] = []; for (let { value, done } = iterator.next(); !done; { value, done } = iterator.next()) { result.push(value); @@ -875,19 +876,6 @@ namespace ts { return result; } - /** - * Array of every key in a map. - * May not actually return string[] if numbers were put into the map. - */ - export function keysOfMap(map: Map<{}>): string[] { - return arrayFrom(map.keys()); - } - - /** Array of every value in a map. */ - export function valuesOfMap(map: Map): T[] { - return arrayFrom(map.values()); - } - /** * Calls `callback` for each entry in the map, returning the first defined result. * Use `map.forEach` instead for normal iteration. diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index ba5a0d8faea..a0e7d5ba323 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -680,7 +680,7 @@ namespace ts { description = getDiagnosticText(option.description); const element = (option).element; const typeMap = >element.type; - optionsDescriptionMap.set(description, keysOfMap(typeMap).map(key => `'${key}'`)); + optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`)); } else { description = getDiagnosticText(option.description); diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 4ae2dc7a389..caa51cd5566 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -246,7 +246,7 @@ namespace ts.projectSystem { export function checkMapKeys(caption: string, map: Map, expectedKeys: string[]) { assert.equal(map.size, expectedKeys.length, `${caption}: incorrect size of map`); for (const name of expectedKeys) { - assert.isTrue(map.has(name), `${caption} is expected to contain ${name}, actual keys: ${keysOfMap(map)}`); + assert.isTrue(map.has(name), `${caption} is expected to contain ${name}, actual keys: ${arrayFrom(map.keys())}`); } } diff --git a/src/server/project.ts b/src/server/project.ts index 505eb2f63fb..054b484392e 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// @@ -617,7 +617,7 @@ namespace ts.server { const added: string[] = []; const removed: string[] = []; - const updated: string[] = keysOfMap(updatedFileNames); + const updated: string[] = arrayFrom(updatedFileNames.keys()); forEachKeyInMap(currentFiles, id => { if (!lastReportedFileNames.has(id)) { @@ -691,7 +691,7 @@ namespace ts.server { }) } - const allFileNames = keysOfMap(referencedFiles) as Path[]; + const allFileNames = arrayFrom(referencedFiles.keys()) as Path[]; return filter(allFileNames, file => this.projectService.host.fileExists(file)); } diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 4291abf6c1f..80b0133ccfe 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,4 +1,4 @@ -namespace ts { +namespace ts { /** * The document registry represents a store of SourceFile objects that can be shared between * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) @@ -121,7 +121,7 @@ namespace ts { } function reportStats() { - const bucketInfoArray = keysOfMap(buckets).filter(name => name && name.charAt(0) === "_").map(name => { + const bucketInfoArray = arrayFrom(buckets.keys()).filter(name => name && name.charAt(0) === "_").map(name => { const entries = buckets.get(name); const sourceFiles: { name: string; refCount: number; references: string[]; }[] = []; entries.forEachValue((key, entry) => { From 932eaa3f90c7418c6e4ce09cdab7ca30309e19ca Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 28 Dec 2016 09:16:38 -0800 Subject: [PATCH 196/289] Rename and consolidate map iteration helpers --- src/compiler/checker.ts | 10 ++--- src/compiler/commandLineParser.ts | 2 +- src/compiler/core.ts | 37 ++++--------------- src/compiler/declarationEmitter.ts | 2 +- src/compiler/program.ts | 2 +- .../unittests/cachingInServerLSHost.ts | 4 +- .../unittests/reuseProgramStructure.ts | 6 +-- src/server/editorServices.ts | 2 +- src/server/project.ts | 4 +- src/services/completions.ts | 4 +- src/services/findAllReferences.ts | 4 +- src/services/navigateTo.ts | 4 +- src/services/transpile.ts | 6 +-- 13 files changed, 32 insertions(+), 55 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3ed4c383ef2..b8e51c7f390 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1815,7 +1815,7 @@ namespace ts { } // Check if symbol is any of the alias - return forEachInMap(symbols, symbolFromSymbolTable => { + return forEachEntry(symbols, symbolFromSymbolTable => { if (symbolFromSymbolTable.flags & SymbolFlags.Alias && symbolFromSymbolTable.name !== "export=" && !getDeclarationOfKind(symbolFromSymbolTable, SyntaxKind.ExportSpecifier)) { @@ -7758,7 +7758,7 @@ namespace ts { const maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up const destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1]; - copyMapEntries(maybeCache, destinationCache); + copyEntries(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it @@ -18001,7 +18001,7 @@ namespace ts { else { const blockLocals = catchClause.block.locals; if (blockLocals) { - forEachKeyInMap(catchClause.locals, caughtName => { + forEachKey(catchClause.locals, caughtName => { const blockLocal = blockLocals.get(caughtName); if (blockLocal && (blockLocal.flags & SymbolFlags.BlockScopedVariable) !== 0) { grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); @@ -19187,7 +19187,7 @@ namespace ts { } function hasExportedMembers(moduleSymbol: Symbol) { - return someInMap(moduleSymbol.exports, (_, id) => id !== "export="); + return forEachEntry(moduleSymbol.exports, (_, id) => id !== "export="); } function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) { @@ -20097,7 +20097,7 @@ namespace ts { // otherwise - check if at least one export is value symbolLinks.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & SymbolFlags.Value) - : someInMap(getExportsOfModule(moduleSymbol), isValue); + : forEachEntry(getExportsOfModule(moduleSymbol), isValue); } return symbolLinks.exportsSomeValue; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 7bf50f675aa..3f89d3e3f9d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -753,7 +753,7 @@ namespace ts { function getNameOfCompilerOptionValue(value: CompilerOptionsValue, customTypeMap: Map): string | undefined { // There is a typeMap associated with this command-line option so use it to map value back to its name - return forEachInMap(customTypeMap, (mapValue, key) => { + return forEachEntry(customTypeMap, (mapValue, key) => { if (mapValue === value) { return key; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 9f8f1ba3f55..effe24a253e 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -877,15 +877,15 @@ namespace ts { } /** - * Calls `callback` for each entry in the map, returning the first defined result. + * Calls `callback` for each entry in the map, returning the first truthy result. * Use `map.forEach` instead for normal iteration. */ - export function forEachInMap(map: Map, callback: (value: T, key: string) => U | undefined): U | undefined { + export function forEachEntry(map: Map, callback: (value: T, key: string) => U | undefined): U | undefined { const iterator = map.entries(); for (let { value: pair, done } = iterator.next(); !done; { value: pair, done } = iterator.next()) { const [key, value] = pair; const result = callback(value, key); - if (result !== undefined) { + if (result) { return result; } } @@ -893,42 +893,19 @@ namespace ts { } /** `forEachInMap` for just keys. */ - export function forEachKeyInMap(map: Map<{}>, callback: (key: string) => T | undefined): T | undefined { + export function forEachKey(map: Map<{}>, callback: (key: string) => T | undefined): T | undefined { const iterator = map.keys(); for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) { const result = callback(key); - if (result !== undefined) { + if (result) { return result; } } return undefined; } - /** Whether `predicate` is true for some entry in the map. */ - export function someInMap(map: Map, predicate: (value: T, key: string) => boolean): boolean { - const iterator = map.entries(); - for (let { value: pair, done } = iterator.next(); !done; { value: pair, done } = iterator.next()) { - const [key, value] = pair; - if (predicate(value, key)) { - return true; - } - } - return false; - } - - /** `someInMap` for just keys. */ - export function someKeyInMap(map: Map<{}>, predicate: (key: string) => boolean): boolean { - const iterator = map.keys(); - for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) { - if (predicate(key)) { - return true; - } - } - return false; - } - /** Copy entries from `source` to `target`. */ - export function copyMapEntries(source: Map, target: Map): void { + export function copyEntries(source: Map, target: Map): void { source.forEach((value, key) => { target.set(key, value); }); @@ -987,7 +964,7 @@ namespace ts { export function cloneMap(map: Map) { const clone = createMap(); - copyMapEntries(map, clone); + copyEntries(map, clone); return clone; } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index e010519d641..a006ab4fced 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -156,7 +156,7 @@ namespace ts { }); if (usedTypeDirectiveReferences) { - forEachKeyInMap(usedTypeDirectiveReferences, directive => { + forEachKey(usedTypeDirectiveReferences, directive => { referencesOutput += `/// ${newLine}`; }); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b6138e92a7b..324a21f229e 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -464,7 +464,7 @@ namespace ts { classifiableNames = createMap(); for (const sourceFile of files) { - copyMapEntries(sourceFile.classifiableNames, classifiableNames); + copyEntries(sourceFile.classifiableNames, classifiableNames); } } diff --git a/src/harness/unittests/cachingInServerLSHost.ts b/src/harness/unittests/cachingInServerLSHost.ts index b6a90f53259..8389186c486 100644 --- a/src/harness/unittests/cachingInServerLSHost.ts +++ b/src/harness/unittests/cachingInServerLSHost.ts @@ -1,4 +1,4 @@ -/// +/// namespace ts { interface File { @@ -8,7 +8,7 @@ namespace ts { function createDefaultServerHost(fileMap: Map): server.ServerHost { const existingDirectories = createMap(); - forEachKeyInMap(fileMap, name => { + forEachKey(fileMap, name => { let dir = getDirectoryPath(name); let previous: string; do { diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index eb4395154e4..8a89b8d27c6 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { @@ -197,13 +197,13 @@ namespace ts { function mapsAreEqual(left: Map, right: Map, valuesAreEqual?: (left: T, right: T) => boolean): boolean { if (left === right) return true; if (!left || !right) return false; - const someInLeftHasNoMatch = someInMap(left, (leftValue, leftKey) => { + const someInLeftHasNoMatch = forEachEntry(left, (leftValue, leftKey) => { if (!right.has(leftKey)) return true; const rightValue = right.get(leftKey); return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue); }); if (someInLeftHasNoMatch) return false; - const someInRightHasNoMatch = someKeyInMap(right, rightKey => !left.has(rightKey)); + const someInRightHasNoMatch = forEachKey(right, rightKey => !left.has(rightKey)); return !someInRightHasNoMatch; } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 239cd385f57..8865d821d29 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1373,7 +1373,7 @@ namespace ts.server { } // close projects that were missing in the input list - forEachKeyInMap(projectsToClose, externalProjectName => { + forEachKey(projectsToClose, externalProjectName => { this.closeExternalProject(externalProjectName, /*suppressRefresh*/ true) }); diff --git a/src/server/project.ts b/src/server/project.ts index 054b484392e..94a08a485f9 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -619,12 +619,12 @@ namespace ts.server { const removed: string[] = []; const updated: string[] = arrayFrom(updatedFileNames.keys()); - forEachKeyInMap(currentFiles, id => { + forEachKey(currentFiles, id => { if (!lastReportedFileNames.has(id)) { added.push(id); } }); - forEachKeyInMap(lastReportedFileNames, id => { + forEachKey(lastReportedFileNames, id => { if (!currentFiles.has(id)) { removed.push(id); } diff --git a/src/services/completions.ts b/src/services/completions.ts index 4715222db08..04e3952b88b 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,4 +1,4 @@ -/// +/// /* @internal */ namespace ts.Completions { @@ -378,7 +378,7 @@ namespace ts.Completions { } } - forEachKeyInMap(foundFiles, foundFile => { + forEachKey(foundFiles, foundFile => { result.push(createCompletionEntryForModule(foundFile, ScriptElementKind.scriptElement, span)); }); } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 9e53537b69b..a7bf76e0656 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,4 +1,4 @@ -/* @internal */ +/* @internal */ namespace ts.FindAllReferences { export function findReferencedSymbols(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], sourceFile: SourceFile, position: number, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[] { const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); @@ -508,7 +508,7 @@ namespace ts.FindAllReferences { result.push(ctrKeyword); } - forEachInMap(classSymbol.exports, member => { + classSymbol.exports.forEach(member => { const decl = member.valueDeclaration; if (decl && decl.kind === SyntaxKind.MethodDeclaration) { const body = (decl).body; diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 40f22941268..aa72da1ba5c 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,4 +1,4 @@ -/* @internal */ +/* @internal */ namespace ts.NavigateTo { type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration }; @@ -14,7 +14,7 @@ namespace ts.NavigateTo { continue; } - forEachInMap(sourceFile.getNamedDeclarations(), (declarations, name) => { + forEachEntry(sourceFile.getNamedDeclarations(), (declarations, name) => { if (declarations) { // 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. diff --git a/src/services/transpile.ts b/src/services/transpile.ts index d989a528497..b72399384b7 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -1,4 +1,4 @@ -namespace ts { +namespace ts { export interface TranspileOptions { compilerOptions?: CompilerOptions; fileName?: string; @@ -126,7 +126,7 @@ namespace ts { function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions { // Lazily create this value to fix module loading errors. commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || filter(optionDeclarations, o => - typeof o.type === "object" && !forEachInMap(o.type, v => typeof v !== "number")); + typeof o.type === "object" && !forEachEntry(o.type, v => typeof v !== "number")); options = clone(options); @@ -142,7 +142,7 @@ namespace ts { options[opt.name] = parseCustomTypeOption(opt, value, diagnostics); } else { - if (!someInMap(opt.type, v => v === value)) { + if (!forEachEntry(opt.type, v => v === value)) { // Supplied value isn't a valid enum value. diagnostics.push(createCompilerDiagnosticForInvalidCustomType(opt)); } From 145f0b2f18b2cc4ad69ed577920a541faf1ad123 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 28 Dec 2016 09:33:43 -0800 Subject: [PATCH 197/289] Add `createMultiMap` to replace `multiMapAdd` and `multiMapRemove` --- src/compiler/core.ts | 52 +++++++++---------- src/compiler/factory.ts | 16 +++++- src/compiler/sys.ts | 8 +-- src/harness/fourslash.ts | 4 +- .../unittests/tsserverProjectSystem.ts | 12 ++--- src/services/services.ts | 4 +- 6 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index effe24a253e..3669ece5104 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -989,43 +989,43 @@ namespace ts { return result; } - /** - * Adds the value to an array of values associated with the key, and returns the array. - * Creates the array if it does not already exist. - */ - export function multiMapAdd(map: Map, key: string, value: V): V[] { - let values = map.get(key); + export interface MultiMap extends Map { + /** + * Adds the value to an array of values associated with the key, and returns the array. + * Creates the array if it does not already exist. + */ + add(key: string, value: T): T[]; + /** + * Removes a value from an array of values associated with the key. + * Does not preserve the order of those values. + * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. + */ + remove(key: string, value: T): void; + } + + export function createMultiMap(): MultiMap { + const map = createMap() as MultiMap; + map.add = multiMapAdd; + map.remove = multiMapRemove; + return map; + } + function multiMapAdd(this: MultiMap, key: string, value: T) { + let values = this.get(key); if (values) { values.push(value); } else { - map.set(key, values = [value]); + this.set(key, values = [value]); } return values; - } - export function multiMapSparseArrayAdd(map: SparseArray, key: number, value: V): V[] { - let values = map[key]; - if (values) { - values.push(value); - } - else { - map[key] = values = [value]; - } - return values; } - - /** - * Removes a value from an array of values associated with the key. - * Does not preserve the order of those values. - * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. - */ - export function multiMapRemove(map: Map, key: string, value: V): void { - const values = map.get(key); + function multiMapRemove(this: MultiMap, key: string, value: T) { + const values = this.get(key); if (values) { unorderedRemoveItem(values, value); if (!values.length) { - map.delete(key); + this.delete(key); } } } diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 38e28fc2de0..06108f2d0b2 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -3298,7 +3298,7 @@ namespace ts { export function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo { const externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[] = []; - const exportSpecifiers = createMap(); + const exportSpecifiers = createMultiMap(); const exportedBindings: SparseArray = []; const uniqueExports = createMap(); let exportedNames: Identifier[]; @@ -3352,7 +3352,7 @@ namespace ts { for (const specifier of (node).exportClause.elements) { if (!uniqueExports.get(specifier.name.text)) { const name = specifier.propertyName || specifier.name; - multiMapAdd(exportSpecifiers, name.text, specifier); + exportSpecifiers.add(name.text, specifier); const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); @@ -3446,4 +3446,16 @@ namespace ts { } return exportedNames; } + + /** Use a sparse array as a multi-map. */ + function multiMapSparseArrayAdd(map: SparseArray, key: number, value: V): V[] { + let values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index b10d746e435..3c28efd0de8 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,4 +1,4 @@ -/// +/// namespace ts { export type FileWatcherCallback = (fileName: string, removed?: boolean) => void; @@ -243,7 +243,7 @@ namespace ts { function createWatchedFileSet() { const dirWatchers = createMap(); // One file can have multiple watchers - const fileWatcherCallbacks = createMap(); + const fileWatcherCallbacks = createMultiMap(); return { addFile, removeFile }; function reduceDirWatcherRefCountForFile(fileName: string) { @@ -275,7 +275,7 @@ namespace ts { } function addFileWatcherCallback(filePath: string, callback: FileWatcherCallback): void { - multiMapAdd(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.add(filePath, callback); } function addFile(fileName: string, callback: FileWatcherCallback): WatchedFile { @@ -291,7 +291,7 @@ namespace ts { } function removeFileWatcherCallback(filePath: string, callback: FileWatcherCallback) { - multiMapRemove(fileWatcherCallbacks, filePath, callback); + fileWatcherCallbacks.remove(filePath, callback); } function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: string) { diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 04fd55b110e..8b127afa081 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1760,10 +1760,10 @@ namespace FourSlash { } public rangesByText(): ts.Map { - const result = ts.createMap(); + const result = ts.createMultiMap(); for (const range of this.getRanges()) { const text = this.rangeText(range); - ts.multiMapAdd(result, text, range); + result.add(text, range); } return result; } diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index caa51cd5566..c8729d49497 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -334,8 +334,8 @@ namespace ts.projectSystem { private timeoutCallbacks = new Callbacks(); private immediateCallbacks = new Callbacks(); - readonly watchedDirectories = createMap<{ cb: DirectoryWatcherCallback, recursive: boolean }[]>(); - readonly watchedFiles = createMap(); + readonly watchedDirectories = createMultiMap<{ cb: DirectoryWatcherCallback, recursive: boolean }>(); + readonly watchedFiles = createMultiMap(); private filesOrFolders: FileOrFolder[]; @@ -421,11 +421,11 @@ namespace ts.projectSystem { watchDirectory(directoryName: string, callback: DirectoryWatcherCallback, recursive: boolean): DirectoryWatcher { const path = this.toPath(directoryName); const cbWithRecursive = { cb: callback, recursive }; - multiMapAdd(this.watchedDirectories, path, cbWithRecursive); + this.watchedDirectories.add(path, cbWithRecursive); return { referenceCount: 0, directoryName, - close: () => multiMapRemove(this.watchedDirectories, path, cbWithRecursive) + close: () => this.watchedDirectories.remove(path, cbWithRecursive) }; } @@ -455,8 +455,8 @@ namespace ts.projectSystem { watchFile(fileName: string, callback: FileWatcherCallback) { const path = this.toPath(fileName); - multiMapAdd(this.watchedFiles, path, callback); - return { close: () => multiMapRemove(this.watchedFiles, path, callback) }; + this.watchedFiles.add(path, callback); + return { close: () => this.watchedFiles.remove(path, callback) }; } // TOOD: record and invoke callbacks to simulate timer events diff --git a/src/services/services.ts b/src/services/services.ts index 7cd2dce196d..86fbf22b71a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -518,7 +518,7 @@ namespace ts { } private computeNamedDeclarations(): Map { - const result = createMap(); + const result = createMultiMap(); forEachChild(this, visit); @@ -527,7 +527,7 @@ namespace ts { function addDeclaration(declaration: Declaration) { const name = getDeclarationName(declaration); if (name) { - multiMapAdd(result, name, declaration); + result.add(name, declaration); } } From 2e6f369e8fa15ad75668467d1dbcb2b411d7f75d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 28 Dec 2016 09:39:58 -0800 Subject: [PATCH 198/289] Replace SparseArray with T[] --- src/compiler/checker.ts | 2 +- src/compiler/factory.ts | 8 ++++---- src/compiler/transformers/generators.ts | 2 +- src/compiler/transformers/module/module.ts | 6 +++--- src/compiler/transformers/module/system.ts | 10 +++++----- src/compiler/transformers/ts.ts | 2 +- src/compiler/types.ts | 11 ++--------- src/compiler/utilities.ts | 2 +- src/harness/unittests/session.ts | 2 +- src/harness/unittests/tsserverProjectSystem.ts | 2 +- src/services/codefixes/codeFixProvider.ts | 2 +- src/services/codefixes/importFixes.ts | 4 ++-- 12 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fcc44ba087f..48a0876d881 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4084,7 +4084,7 @@ namespace ts { enumType.symbol = symbol; if (enumHasLiteralMembers(symbol)) { const memberTypeList: Type[] = []; - const memberTypes: SparseArray = []; + const memberTypes: EnumLiteralType[] = []; for (const declaration of enumType.symbol.declarations) { if (declaration.kind === SyntaxKind.EnumDeclaration) { computeEnumMemberValues(declaration); diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index a326c0c0475..f63094ae16d 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -2646,7 +2646,7 @@ namespace ts { return destEmitNode; } - function mergeTokenSourceMapRanges(sourceRanges: SparseArray, destRanges: SparseArray) { + function mergeTokenSourceMapRanges(sourceRanges: TextRange[], destRanges: TextRange[]) { if (!destRanges) destRanges = []; for (const key in sourceRanges) { destRanges[key] = sourceRanges[key]; @@ -3277,7 +3277,7 @@ namespace ts { externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; // imports of other external modules externalHelpersImportDeclaration: ImportDeclaration | undefined; // import of external helpers exportSpecifiers: Map; // export specifiers by name - exportedBindings: SparseArray; // exported names of local declarations + exportedBindings: Identifier[][]; // exported names of local declarations exportedNames: Identifier[]; // all exported names local to module exportEquals: ExportAssignment | undefined; // an export= declaration if one was present hasExportStarsToExportValues: boolean; // whether this module contains export* @@ -3286,7 +3286,7 @@ namespace ts { export function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo { const externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[] = []; const exportSpecifiers = createMultiMap(); - const exportedBindings: SparseArray = []; + const exportedBindings: Identifier[][] = []; const uniqueExports = createMap(); let exportedNames: Identifier[]; let hasExportDefault = false; @@ -3435,7 +3435,7 @@ namespace ts { } /** Use a sparse array as a multi-map. */ - function multiMapSparseArrayAdd(map: SparseArray, key: number, value: V): V[] { + function multiMapSparseArrayAdd(map: V[][], key: number, value: V): V[] { let values = map[key]; if (values) { values.push(value); diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 8c9da9c4847..7dcfe76a427 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -243,7 +243,7 @@ namespace ts { let currentSourceFile: SourceFile; let renamedCatchVariables: Map; - let renamedCatchVariableDeclarations: SparseArray; + let renamedCatchVariableDeclarations: Identifier[]; let inGeneratorFunctionBody: boolean; let inStatementContainingYield: boolean; diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index b42f4bf4bee..0adea4fd540 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -39,12 +39,12 @@ namespace ts { context.enableSubstitution(SyntaxKind.ShorthandPropertyAssignment); // Substitutes shorthand property assignments for imported/exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap: SparseArray = []; // The ExternalModuleInfo for each file. - const deferredExports: SparseArray = []; // Exports to defer until an EndOfDeclarationMarker is found. + const moduleInfoMap: ExternalModuleInfo[] = []; // The ExternalModuleInfo for each file. + const deferredExports: Statement[][] = []; // Exports to defer until an EndOfDeclarationMarker is found. let currentSourceFile: SourceFile; // The current file. let currentModuleInfo: ExternalModuleInfo; // The ExternalModuleInfo for the current file. - let noSubstitution: SparseArray; // Set of nodes for which substitution rules should be ignored. + let noSubstitution: boolean[]; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index d332f3376b1..3f1488b649d 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -28,10 +28,10 @@ namespace ts { context.enableSubstitution(SyntaxKind.PostfixUnaryExpression); // Substitutes updates to exported symbols. context.enableEmitNotification(SyntaxKind.SourceFile); // Restore state when substituting nodes in a file. - const moduleInfoMap: SparseArray = []; // The ExternalModuleInfo for each file. - const deferredExports: SparseArray = []; // Exports to defer until an EndOfDeclarationMarker is found. - const exportFunctionsMap: SparseArray = []; // The export function associated with a source file. - const noSubstitutionMap: SparseArray> = []; // Set of nodes for which substitution rules should be ignored for each file. + const moduleInfoMap: ExternalModuleInfo[] = []; // The ExternalModuleInfo for each file. + const deferredExports: Statement[][] = []; // Exports to defer until an EndOfDeclarationMarker is found. + const exportFunctionsMap: Identifier[] = []; // The export function associated with a source file. + const noSubstitutionMap: boolean[][] = []; // Set of nodes for which substitution rules should be ignored for each file. let currentSourceFile: SourceFile; // The current file. let moduleInfo: ExternalModuleInfo; // ExternalModuleInfo for the current file. @@ -39,7 +39,7 @@ namespace ts { let contextObject: Identifier; // The context object for the current file. let hoistedStatements: Statement[]; let enclosingBlockScopedContainer: Node; - let noSubstitution: SparseArray; // Set of nodes for which substitution rules should be ignored. + let noSubstitution: boolean[]; // Set of nodes for which substitution rules should be ignored. return transformSourceFile; diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 96b00434660..e2b8b8fe2ec 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -60,7 +60,7 @@ namespace ts { * A map that keeps track of aliases created for classes with decorators to avoid issues * with the double-binding behavior of classes. */ - let classAliases: SparseArray; + let classAliases: Identifier[]; /** * Keeps track of whether we are within any containing namespaces when performing diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d734998cd7f..2489434c82d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -8,13 +8,6 @@ [index: string]: T; } - /** - * Like MapLike, but keys must be numbers. - */ - export interface SparseArray { - [key: number]: T; - } - /** ES6 Map interface. */ export interface Map { get(key: string): T; @@ -2854,7 +2847,7 @@ // Enum types (TypeFlags.Enum) export interface EnumType extends Type { - memberTypes: SparseArray; + memberTypes: EnumLiteralType[]; } // Enum types (TypeFlags.EnumLiteral) @@ -3684,7 +3677,7 @@ flags?: EmitFlags; // Flags that customize emit commentRange?: TextRange; // The text range to use when emitting leading or trailing comments sourceMapRange?: TextRange; // The text range to use when emitting leading or trailing source mappings - tokenSourceMapRanges?: SparseArray; // The text range to use when emitting source mappings for tokens + tokenSourceMapRanges?: TextRange[]; // The text range to use when emitting source mappings for tokens constantValue?: number; // The constant value of an expression externalHelpersModuleName?: Identifier; // The local name for an imported helpers module helpers?: EmitHelper[]; // Emit helpers for the node diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5e15d97752b..f74c450d61a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3362,7 +3362,7 @@ namespace ts { return false; } - const syntaxKindCache: SparseArray = []; + const syntaxKindCache: string[] = []; export function formatSyntaxKind(kind: SyntaxKind): string { const syntaxKindEnum = (ts).SyntaxKind; diff --git a/src/harness/unittests/session.ts b/src/harness/unittests/session.ts index 82f6ede865f..15c43d9e76b 100644 --- a/src/harness/unittests/session.ts +++ b/src/harness/unittests/session.ts @@ -416,7 +416,7 @@ namespace ts.server { class InProcClient { private server: InProcSession; private seq = 0; - private callbacks: SparseArray<(resp: protocol.Response) => void> = []; + private callbacks: Array<(resp: protocol.Response) => void> = []; private eventHandlers = createMap<(args: any) => void>(); handle(msg: protocol.Message): void { diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index 4d4873465b5..b2e2eca2951 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -292,7 +292,7 @@ namespace ts.projectSystem { } export class Callbacks { - private map: SparseArray = []; + private map: TimeOutCallback[] = []; private nextId = 1; register(cb: (...args: any[]) => void, args: any[]) { diff --git a/src/services/codefixes/codeFixProvider.ts b/src/services/codefixes/codeFixProvider.ts index e1e3ef18865..10d0b8eef34 100644 --- a/src/services/codefixes/codeFixProvider.ts +++ b/src/services/codefixes/codeFixProvider.ts @@ -16,7 +16,7 @@ namespace ts { } export namespace codefix { - const codeFixes: SparseArray = []; + const codeFixes: CodeFix[][] = []; export function registerCodeFix(action: CodeFix) { forEach(action.errorCodes, error => { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 81b299bf708..8cd0a9664a0 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -14,7 +14,7 @@ namespace ts.codefix { } class ImportCodeActionMap { - private symbolIdToActionMap: SparseArray = []; + private symbolIdToActionMap: ImportCodeAction[][] = []; addAction(symbolId: number, newAction: ImportCodeAction) { if (!newAction) { @@ -125,7 +125,7 @@ namespace ts.codefix { const symbolIdActionMap = new ImportCodeActionMap(); // this is a module id -> module import declaration map - const cachedImportDeclarations: SparseArray<(ImportDeclaration | ImportEqualsDeclaration)[]> = []; + const cachedImportDeclarations: (ImportDeclaration | ImportEqualsDeclaration)[][] = []; let cachedNewImportInsertPosition: number; const allPotentialModules = checker.getAmbientModules(); From 5317f13c165e84881f25a8a44b282bf103914e42 Mon Sep 17 00:00:00 2001 From: Slawomir Sadziak Date: Wed, 28 Dec 2016 20:22:24 +0100 Subject: [PATCH 199/289] #13063 Optimization Add isInTypeQuery as the last OR --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c08a44b347e..a944918f9a3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10372,7 +10372,7 @@ namespace ts { // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). const assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || isInTypeQuery(node) || (type.flags & TypeFlags.Any) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node)) || isInAmbientContext(declaration); const flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph From bf5faa04a636dc9633c90a9ee4dadb1a85a78fc8 Mon Sep 17 00:00:00 2001 From: zhengbli Date: Wed, 28 Dec 2016 14:46:58 -0800 Subject: [PATCH 200/289] Use inherited setCompilerOptions for inferred project --- .../unittests/tsserverProjectSystem.ts | 8 ++++--- src/server/editorServices.ts | 10 ++++---- src/server/project.ts | 23 ++++++++++++++++--- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index e1ac647c2ac..dbf9bf670e6 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -3068,9 +3068,11 @@ namespace ts.projectSystem { projectService.openClientFile(file1.path); const project = projectService.inferredProjects[0]; - const sourceFile = project.getSourceFile(file1.path); - assert.isTrue("test" in sourceFile.resolvedModules); - assert.equal((sourceFile.resolvedModules["test"]).resolvedFileName, moduleFile.path); + const sourceFileForFile1 = project.getSourceFile(file1.path); + const sourceFileForModuleFile = project.getSourceFile(moduleFile.path); + + assert.isNotNull(sourceFileForFile1); + assert.isNotNull(sourceFileForModuleFile); }); }); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 23b172d1cfe..eba0dbb119c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1072,6 +1072,10 @@ namespace ts.server { ? this.inferredProjects[0] : new InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); + if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { + project.isJsInferredProject = true; + } + project.addRoot(root); this.directoryWatchers.startWatchingContainingDirectoriesForFile( @@ -1079,12 +1083,6 @@ namespace ts.server { project, fileName => this.onConfigFileAddedForInferredProject(fileName)); - if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { - const options = project.getCompilerOptions(); - options.maxNodeModuleJsDepth = 2; - project.setCompilerOptions(options); - } - project.updateGraph(); if (!useExistingProject) { diff --git a/src/server/project.ts b/src/server/project.ts index 6085ee05159..ca3950a48a8 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -566,9 +566,6 @@ namespace ts.server { setCompilerOptions(compilerOptions: CompilerOptions) { if (compilerOptions) { - if (this.projectKind === ProjectKind.Inferred) { - compilerOptions.allowJs = true; - } compilerOptions.allowNonTsExtensions = true; if (changesAffectModuleResolution(this.compilerOptions, compilerOptions)) { // reset cached unresolved imports if changes in compiler options affected module resolution @@ -715,6 +712,26 @@ namespace ts.server { } })(); + private _isJsInferredProject = false; + set isJsInferredProject(newValue: boolean) { + if (newValue && !this._isJsInferredProject) { + this.setCompilerOptions(this.getCompilerOptions()); + } + this._isJsInferredProject = newValue; + } + + setCompilerOptions(newOptions: CompilerOptions) { + if (!newOptions) { + return; + } + + if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { + newOptions.maxNodeModuleJsDepth = 2; + } + newOptions.allowJs = true; + super.setCompilerOptions(newOptions); + } + // Used to keep track of what directories are watched for this project directoriesWatchedForTsconfig: string[] = []; From 69e0677ea1630daec111b5129aae609809d511e9 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Wed, 28 Dec 2016 15:04:15 -0800 Subject: [PATCH 201/289] Support quick fixes for UMD global (#12545) * Support quick fixes for UMD global * refactor --- src/services/codefixes/importFixes.ts | 22 +++++++++++++------ .../fourslash/importNameCodeFixUMDGlobal0.ts | 16 ++++++++++++++ .../fourslash/importNameCodeFixUMDGlobal1.ts | 19 ++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 tests/cases/fourslash/importNameCodeFixUMDGlobal0.ts create mode 100644 tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index bda310f2d33..3dc33e39897 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -112,7 +112,10 @@ namespace ts.codefix { } registerCodeFix({ - errorCodes: [Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + Diagnostics.Cannot_find_name_0.code, + Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: (context: CodeFixContext) => { const sourceFile = context.sourceFile; const checker = context.program.getTypeChecker(); @@ -127,6 +130,12 @@ namespace ts.codefix { const cachedImportDeclarations = createMap<(ImportDeclaration | ImportEqualsDeclaration)[]>(); let cachedNewImportInsertPosition: number; + const currentTokenMeaning = getMeaningFromLocation(token); + if (context.errorCode === Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + const symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, /*isDefault*/ false, /*isNamespaceImport*/ true); + } + const allPotentialModules = checker.getAmbientModules(); for (const otherSourceFile of allSourceFiles) { if (otherSourceFile !== sourceFile && isExternalOrCommonJsModule(otherSourceFile)) { @@ -134,7 +143,6 @@ namespace ts.codefix { } } - const currentTokenMeaning = getMeaningFromLocation(token); for (const moduleSymbol of allPotentialModules) { context.cancellationToken.throwIfCancellationRequested(); @@ -203,7 +211,7 @@ namespace ts.codefix { return declarations ? some(symbol.declarations, decl => !!(getMeaningFromDeclaration(decl) & meaning)) : false; } - function getCodeActionForImport(moduleSymbol: Symbol, isDefault?: boolean): ImportCodeAction[] { + function getCodeActionForImport(moduleSymbol: Symbol, isDefault?: boolean, isNamespaceImport?: boolean): ImportCodeAction[] { const existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { // With an existing import statement, there are more than one actions the user can do. @@ -213,8 +221,6 @@ namespace ts.codefix { return [getCodeActionForNewImport()]; } - - function getCodeActionsForExistingImport(declarations: (ImportDeclaration | ImportEqualsDeclaration)[]): ImportCodeAction[] { const actions: ImportCodeAction[] = []; @@ -262,7 +268,7 @@ namespace ts.codefix { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { /** * If the existing import declaration already has a named import list, just @@ -386,7 +392,9 @@ namespace ts.codefix { const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); const importStatementText = isDefault ? `import ${name} from "${moduleSpecifierWithoutQuotes}"` - : `import { ${name} } from "${moduleSpecifierWithoutQuotes}"`; + : isNamespaceImport + ? `import * as ${name} from "${moduleSpecifierWithoutQuotes}"` + : `import { ${name} } from "${moduleSpecifierWithoutQuotes}"`; // if this file doesn't have any import statements, insert an import statement and then insert a new line // between the only import statement and user code. Otherwise just insert the statement because chances diff --git a/tests/cases/fourslash/importNameCodeFixUMDGlobal0.ts b/tests/cases/fourslash/importNameCodeFixUMDGlobal0.ts new file mode 100644 index 00000000000..3c780dc0af6 --- /dev/null +++ b/tests/cases/fourslash/importNameCodeFixUMDGlobal0.ts @@ -0,0 +1,16 @@ +/// + +// @Filename: a/f1.ts +//// [|export function test() { }; +//// bar1/*0*/.bar;|] + +// @Filename: a/foo.d.ts +//// export declare function bar(): number; +//// export as namespace bar1; + +verify.importFixAtPosition([ +`import * as bar1 from "./foo"; + +export function test() { }; +bar1.bar;` +]); \ No newline at end of file diff --git a/tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts b/tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts new file mode 100644 index 00000000000..96671ad6f91 --- /dev/null +++ b/tests/cases/fourslash/importNameCodeFixUMDGlobal1.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: a/f1.ts +//// [|import { bar } from "./foo"; +//// +//// export function test() { }; +//// bar1/*0*/.bar();|] + +// @Filename: a/foo.d.ts +//// export declare function bar(): number; +//// export as namespace bar1; + +verify.importFixAtPosition([ +`import { bar } from "./foo"; +import * as bar1 from "./foo"; + +export function test() { }; +bar1.bar();` +]); \ No newline at end of file From 09fc3b3a181e6babb9ad4dee2fd5166385793839 Mon Sep 17 00:00:00 2001 From: zhengbli Date: Thu, 29 Dec 2016 10:26:34 -0800 Subject: [PATCH 202/289] address cr feedback --- src/harness/unittests/tsserverProjectSystem.ts | 13 ++++++++----- src/server/editorServices.ts | 2 +- src/server/project.ts | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index dbf9bf670e6..a766a9c4230 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -3067,12 +3067,15 @@ namespace ts.projectSystem { const projectService = createProjectService(host); projectService.openClientFile(file1.path); - const project = projectService.inferredProjects[0]; - const sourceFileForFile1 = project.getSourceFile(file1.path); - const sourceFileForModuleFile = project.getSourceFile(moduleFile.path); + let project = projectService.inferredProjects[0]; + let options = project.getCompilerOptions(); + assert.isTrue(options.maxNodeModuleJsDepth === 2); - assert.isNotNull(sourceFileForFile1); - assert.isNotNull(sourceFileForModuleFile); + // Assert the option sticks + projectService.setCompilerOptionsForInferredProjects({ target: ScriptTarget.ES2016 }); + project = projectService.inferredProjects[0]; + options = project.getCompilerOptions(); + assert.isTrue(options.maxNodeModuleJsDepth === 2); }); }); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index eba0dbb119c..2b87fdf1cc7 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1073,7 +1073,7 @@ namespace ts.server { : new InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { - project.isJsInferredProject = true; + project.setAsJsInferredProject(); } project.addRoot(root); diff --git a/src/server/project.ts b/src/server/project.ts index ca3950a48a8..5178820b3c4 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -713,14 +713,14 @@ namespace ts.server { })(); private _isJsInferredProject = false; - set isJsInferredProject(newValue: boolean) { - if (newValue && !this._isJsInferredProject) { - this.setCompilerOptions(this.getCompilerOptions()); - } - this._isJsInferredProject = newValue; + + setAsJsInferredProject() { + this._isJsInferredProject = true; + this.setCompilerOptions(); } - setCompilerOptions(newOptions: CompilerOptions) { + setCompilerOptions(newOptions?: CompilerOptions) { + newOptions = newOptions ? newOptions : this.getCompilerOptions(); if (!newOptions) { return; } From 8ac22ecbb04df7fc6bccec93a10fa38a4eea94da Mon Sep 17 00:00:00 2001 From: zhengbli Date: Thu, 29 Dec 2016 17:00:04 -0800 Subject: [PATCH 203/289] Change the design to track addRoot and removeRoot --- .../unittests/tsserverProjectSystem.ts | 31 ++++++++++++- src/server/editorServices.ts | 4 -- src/server/project.ts | 44 ++++++++++++++----- src/server/scriptInfo.ts | 4 ++ 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index a766a9c4230..1844b0743ca 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -1620,7 +1620,7 @@ namespace ts.projectSystem { const configureHostRequest = makeSessionRequest(CommandNames.Configure, { extraFileExtensions }); session.executeCommand(configureHostRequest).response; - // HTML file still not included in the project as it is closed + // HTML file still not included in the project as it is closed checkNumberOfProjects(projectService, { configuredProjects: 1 }); checkProjectActualFiles(projectService.configuredProjects[0], [file1.path]); @@ -3053,7 +3053,7 @@ namespace ts.projectSystem { }); describe("maxNodeModuleJsDepth for inferred projects", () => { - it("should be set by default", () => { + it("should be set to 2 if the project has js root files", () => { const file1: FileOrFolder = { path: "/a/b/file1.js", content: `var t = require("test"); t.` @@ -3077,6 +3077,33 @@ namespace ts.projectSystem { options = project.getCompilerOptions(); assert.isTrue(options.maxNodeModuleJsDepth === 2); }); + + it("should return to normal state when all js root files are removed from project", () => { + const file1 = { + path: "/a/file1.ts", + content: "let x =1;" + }; + const file2 = { + path: "/a/file2.js", + content: "let x =1;" + }; + + const host = createServerHost([file1, file2, libFile]); + const projectService = createProjectService(host, { useSingleInferredProject: true }); + + projectService.openClientFile(file1.path); + checkNumberOfInferredProjects(projectService, 1); + let project = projectService.inferredProjects[0]; + assert.isUndefined(project.getCompilerOptions().maxNodeModuleJsDepth); + + projectService.openClientFile(file2.path); + project = projectService.inferredProjects[0]; + assert.isTrue(project.getCompilerOptions().maxNodeModuleJsDepth === 2); + + projectService.closeClientFile(file2.path); + project = projectService.inferredProjects[0]; + assert.isUndefined(project.getCompilerOptions().maxNodeModuleJsDepth); + }); }); } \ No newline at end of file diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 2b87fdf1cc7..00df53e1e35 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1072,10 +1072,6 @@ namespace ts.server { ? this.inferredProjects[0] : new InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); - if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) { - project.setAsJsInferredProject(); - } - project.addRoot(root); this.directoryWatchers.startWatchingContainingDirectoriesForFile( diff --git a/src/server/project.ts b/src/server/project.ts index 5178820b3c4..89312610a54 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -395,7 +395,9 @@ namespace ts.server { } removeFile(info: ScriptInfo, detachFromProject = true) { - this.removeRootFileIfNecessary(info); + if (this.isRoot(info)) { + this.removeRoot(info); + } this.lsHost.notifyFileRemoved(info); this.cachedUnresolvedImportsPerFile.remove(info.path); @@ -693,11 +695,9 @@ namespace ts.server { } // remove a root file from project - private removeRootFileIfNecessary(info: ScriptInfo): void { - if (this.isRoot(info)) { - remove(this.rootFiles, info); - this.rootFilesMap.remove(info.path); - } + protected removeRoot(info: ScriptInfo): void { + remove(this.rootFiles, info); + this.rootFilesMap.remove(info.path); } } @@ -714,13 +714,16 @@ namespace ts.server { private _isJsInferredProject = false; - setAsJsInferredProject() { - this._isJsInferredProject = true; - this.setCompilerOptions(); + toggleJsInferredProject(isJsInferredProject: boolean) { + if (isJsInferredProject !== this._isJsInferredProject) { + this._isJsInferredProject = isJsInferredProject; + this.setCompilerOptions(); + } } - setCompilerOptions(newOptions?: CompilerOptions) { - newOptions = newOptions ? newOptions : this.getCompilerOptions(); + setCompilerOptions(options?: CompilerOptions) { + // Avoid manipulating the given options directly + const newOptions = options ? clone(options) : this.getCompilerOptions(); if (!newOptions) { return; } @@ -728,6 +731,9 @@ namespace ts.server { if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") { newOptions.maxNodeModuleJsDepth = 2; } + else if (!this._isJsInferredProject) { + newOptions.maxNodeModuleJsDepth = undefined; + } newOptions.allowJs = true; super.setCompilerOptions(newOptions); } @@ -746,6 +752,22 @@ namespace ts.server { /*compileOnSaveEnabled*/ false); } + addRoot(info: ScriptInfo) { + if (!this._isJsInferredProject && info.isJavaScript()) { + this.toggleJsInferredProject(/*isJsInferredProject*/ true); + } + super.addRoot(info); + } + + removeRoot(info: ScriptInfo) { + if (this._isJsInferredProject && info.isJavaScript()) { + if (filter(this.getRootScriptInfos(), info => info.isJavaScript()).length === 0) { + this.toggleJsInferredProject(/*isJsInferredProject*/ false); + } + } + super.removeRoot(info); + } + getProjectRootPath() { // Single inferred project does not have a project root. if (this.projectService.useSingleInferredProject) { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 0acd45d0287..a93600de1a8 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -355,5 +355,9 @@ namespace ts.server { positionToLineOffset(position: number): ILineInfo { return this.textStorage.positionToLineOffset(position); } + + public isJavaScript() { + return this.scriptKind === ScriptKind.JS || this.scriptKind === ScriptKind.JSX; + } } } \ No newline at end of file From d22f4fb513cab8acc9c340d358f1112f098e6b8a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 30 Dec 2016 12:14:31 -0500 Subject: [PATCH 204/289] Added a test. --- .../narrowingGenericTypeFromInstanceof01.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts diff --git a/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts new file mode 100644 index 00000000000..0209d7d3ccf --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts @@ -0,0 +1,27 @@ +class A { + constructor(private a: string) { } +} + +class B { +} + +function acceptA(a: A) { } +function acceptB(b: B) { } + +function test(x: A | B) { + if (x instanceof B) { + acceptA(x); + } + + if (x instanceof A) { + acceptA(x); + } + + if (x instanceof B) { + acceptB(x); + } + + if (x instanceof B) { + acceptB(x); + } +} \ No newline at end of file From 228f42356662ccc196ab8f3b3096cb6831de77ab Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 30 Dec 2016 12:18:40 -0500 Subject: [PATCH 205/289] Accepted baselines. --- .../narrowingGenericTypeFromInstanceof01.js | 57 +++++++++++++ ...rrowingGenericTypeFromInstanceof01.symbols | 73 +++++++++++++++++ ...narrowingGenericTypeFromInstanceof01.types | 81 +++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 tests/baselines/reference/narrowingGenericTypeFromInstanceof01.js create mode 100644 tests/baselines/reference/narrowingGenericTypeFromInstanceof01.symbols create mode 100644 tests/baselines/reference/narrowingGenericTypeFromInstanceof01.types diff --git a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.js b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.js new file mode 100644 index 00000000000..96fa20359ca --- /dev/null +++ b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.js @@ -0,0 +1,57 @@ +//// [narrowingGenericTypeFromInstanceof01.ts] +class A { + constructor(private a: string) { } +} + +class B { +} + +function acceptA(a: A) { } +function acceptB(b: B) { } + +function test(x: A | B) { + if (x instanceof B) { + acceptA(x); + } + + if (x instanceof A) { + acceptA(x); + } + + if (x instanceof B) { + acceptB(x); + } + + if (x instanceof B) { + acceptB(x); + } +} + +//// [narrowingGenericTypeFromInstanceof01.js] +var A = (function () { + function A(a) { + this.a = a; + } + return A; +}()); +var B = (function () { + function B() { + } + return B; +}()); +function acceptA(a) { } +function acceptB(b) { } +function test(x) { + if (x instanceof B) { + acceptA(x); + } + if (x instanceof A) { + acceptA(x); + } + if (x instanceof B) { + acceptB(x); + } + if (x instanceof B) { + acceptB(x); + } +} diff --git a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.symbols b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.symbols new file mode 100644 index 00000000000..2130d68cb24 --- /dev/null +++ b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.symbols @@ -0,0 +1,73 @@ +=== tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts === +class A { +>A : Symbol(A, Decl(narrowingGenericTypeFromInstanceof01.ts, 0, 0)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 0, 8)) + + constructor(private a: string) { } +>a : Symbol(A.a, Decl(narrowingGenericTypeFromInstanceof01.ts, 1, 16)) +} + +class B { +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 4, 8)) +} + +function acceptA(a: A) { } +>acceptA : Symbol(acceptA, Decl(narrowingGenericTypeFromInstanceof01.ts, 5, 1)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 17)) +>a : Symbol(a, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 20)) +>A : Symbol(A, Decl(narrowingGenericTypeFromInstanceof01.ts, 0, 0)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 17)) + +function acceptB(b: B) { } +>acceptB : Symbol(acceptB, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 32)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 8, 17)) +>b : Symbol(b, Decl(narrowingGenericTypeFromInstanceof01.ts, 8, 20)) +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 8, 17)) + +function test(x: A | B) { +>test : Symbol(test, Decl(narrowingGenericTypeFromInstanceof01.ts, 8, 32)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 14)) +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) +>A : Symbol(A, Decl(narrowingGenericTypeFromInstanceof01.ts, 0, 0)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 14)) +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) +>T : Symbol(T, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 14)) + + if (x instanceof B) { +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) + + acceptA(x); +>acceptA : Symbol(acceptA, Decl(narrowingGenericTypeFromInstanceof01.ts, 5, 1)) +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) + } + + if (x instanceof A) { +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) +>A : Symbol(A, Decl(narrowingGenericTypeFromInstanceof01.ts, 0, 0)) + + acceptA(x); +>acceptA : Symbol(acceptA, Decl(narrowingGenericTypeFromInstanceof01.ts, 5, 1)) +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) + } + + if (x instanceof B) { +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) + + acceptB(x); +>acceptB : Symbol(acceptB, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 32)) +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) + } + + if (x instanceof B) { +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) +>B : Symbol(B, Decl(narrowingGenericTypeFromInstanceof01.ts, 2, 1)) + + acceptB(x); +>acceptB : Symbol(acceptB, Decl(narrowingGenericTypeFromInstanceof01.ts, 7, 32)) +>x : Symbol(x, Decl(narrowingGenericTypeFromInstanceof01.ts, 10, 17)) + } +} diff --git a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.types b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.types new file mode 100644 index 00000000000..a5b7c637c6c --- /dev/null +++ b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.types @@ -0,0 +1,81 @@ +=== tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts === +class A { +>A : A +>T : T + + constructor(private a: string) { } +>a : string +} + +class B { +>B : B +>T : T +} + +function acceptA(a: A) { } +>acceptA : (a: A) => void +>T : T +>a : A +>A : A +>T : T + +function acceptB(b: B) { } +>acceptB : (b: B) => void +>T : T +>b : B +>B : B +>T : T + +function test(x: A | B) { +>test : (x: A | B) => void +>T : T +>x : A | B +>A : A +>T : T +>B : B +>T : T + + if (x instanceof B) { +>x instanceof B : boolean +>x : A | B +>B : typeof B + + acceptA(x); +>acceptA(x) : void +>acceptA : (a: A) => void +>x : A + } + + if (x instanceof A) { +>x instanceof A : boolean +>x : A | B +>A : typeof A + + acceptA(x); +>acceptA(x) : void +>acceptA : (a: A) => void +>x : A + } + + if (x instanceof B) { +>x instanceof B : boolean +>x : A | B +>B : typeof B + + acceptB(x); +>acceptB(x) : void +>acceptB : (b: B) => void +>x : A + } + + if (x instanceof B) { +>x instanceof B : boolean +>x : A | B +>B : typeof B + + acceptB(x); +>acceptB(x) : void +>acceptB : (b: B) => void +>x : A + } +} From 32308044d4bd89f750da42cbd1baa955c37c4511 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 30 Dec 2016 12:29:22 -0500 Subject: [PATCH 206/289] Check if the target types are equal instead of the types themselves. --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 22dec25324d..7b34433ab62 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6894,7 +6894,7 @@ namespace ts { // subtype of T but not structurally identical to T. This specifically means that two distinct but // structurally identical types (such as two classes) are not considered instances of each other. function isTypeInstanceOf(source: Type, target: Type): boolean { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } /** From e535c0c29b675f749091a05926cdff5a7ecb75f9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 30 Dec 2016 12:29:59 -0500 Subject: [PATCH 207/289] Accepted baselines. --- ...wingGenericTypeFromInstanceof01.errors.txt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt diff --git a/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt new file mode 100644 index 00000000000..c686cd7a7cf --- /dev/null +++ b/tests/baselines/reference/narrowingGenericTypeFromInstanceof01.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts(13,17): error TS2345: Argument of type 'A | B' is not assignable to parameter of type 'A'. + Type 'B' is not assignable to type 'A'. + Property 'a' is missing in type 'B'. + + +==== tests/cases/conformance/types/typeRelationships/instanceOf/narrowingGenericTypeFromInstanceof01.ts (1 errors) ==== + class A { + constructor(private a: string) { } + } + + class B { + } + + function acceptA(a: A) { } + function acceptB(b: B) { } + + function test(x: A | B) { + if (x instanceof B) { + acceptA(x); + ~ +!!! error TS2345: Argument of type 'A | B' is not assignable to parameter of type 'A'. +!!! error TS2345: Type 'B' is not assignable to type 'A'. +!!! error TS2345: Property 'a' is missing in type 'B'. + } + + if (x instanceof A) { + acceptA(x); + } + + if (x instanceof B) { + acceptB(x); + } + + if (x instanceof B) { + acceptB(x); + } + } \ No newline at end of file From 60476ceffefba81a4fec6cfc400edd8a14f4d4f4 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 30 Dec 2016 13:49:50 -0800 Subject: [PATCH 208/289] Fix test failure resulting from bad merge --- tests/cases/fourslash/completionForStringLiteral5.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/fourslash/completionForStringLiteral5.ts b/tests/cases/fourslash/completionForStringLiteral5.ts index 3752734d913..a850ee3aafc 100644 --- a/tests/cases/fourslash/completionForStringLiteral5.ts +++ b/tests/cases/fourslash/completionForStringLiteral5.ts @@ -11,5 +11,5 @@ goTo.marker('1'); verify.completionListContains("foo"); verify.completionListContains("bar"); -verify.memberListCount(2); +verify.completionListCount(2); From a437c0a6893cb1625123c1b482ba934391af2a80 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 30 Dec 2016 18:27:38 -0800 Subject: [PATCH 209/289] Fix homomorphic type check in instantiateMappedType --- src/compiler/checker.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 22dec25324d..38feb249b76 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6628,17 +6628,19 @@ namespace ts { const constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & TypeFlags.Index) { const typeVariable = (constraintType).type; - const mappedTypeVariable = instantiateType(typeVariable, mapper); - if (typeVariable !== mappedTypeVariable) { - return mapType(mappedTypeVariable, t => { - if (isMappableType(t)) { - const replacementMapper = createUnaryTypeMapper(typeVariable, t); - const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable.flags & TypeFlags.TypeParameter) { + const mappedTypeVariable = instantiateType(typeVariable, mapper); + if (typeVariable !== mappedTypeVariable) { + return mapType(mappedTypeVariable, t => { + if (isMappableType(t)) { + const replacementMapper = createUnaryTypeMapper(typeVariable, t); + const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); From bb37a61f61884fb7f2283af45e5fb78e02ee611e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 30 Dec 2016 18:48:16 -0800 Subject: [PATCH 210/289] Add regression test --- .../cases/conformance/types/mapped/mappedTypes4.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/cases/conformance/types/mapped/mappedTypes4.ts b/tests/cases/conformance/types/mapped/mappedTypes4.ts index 74b3e395f32..4def192d602 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes4.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes4.ts @@ -59,4 +59,15 @@ type DeepReadonlyFoo = { }; var x1: DeepReadonly; -var x1: DeepReadonlyFoo; \ No newline at end of file +var x1: DeepReadonlyFoo; + +// Repro from #13232 + +type Z = { a: number }; +type Clone = { + [P in keyof (T & {})]: T[P]; +}; +type M = Clone; // M should be { a: number } + +var z1: Z; +var z1: Clone; From c0bf7de08283e496b07f6e4173d20e4e54df158d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 30 Dec 2016 18:48:23 -0800 Subject: [PATCH 211/289] Accept new baselines --- tests/baselines/reference/mappedTypes4.js | 25 ++++++++++++++- .../baselines/reference/mappedTypes4.symbols | 31 +++++++++++++++++++ tests/baselines/reference/mappedTypes4.types | 31 +++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/mappedTypes4.js b/tests/baselines/reference/mappedTypes4.js index bb003b1a1ec..963538d2269 100644 --- a/tests/baselines/reference/mappedTypes4.js +++ b/tests/baselines/reference/mappedTypes4.js @@ -58,7 +58,19 @@ type DeepReadonlyFoo = { }; var x1: DeepReadonly; -var x1: DeepReadonlyFoo; +var x1: DeepReadonlyFoo; + +// Repro from #13232 + +type Z = { a: number }; +type Clone = { + [P in keyof (T & {})]: T[P]; +}; +type M = Clone; // M should be { a: number } + +var z1: Z; +var z1: Clone; + //// [mappedTypes4.js] function boxify(obj) { @@ -76,6 +88,8 @@ function f1(x) { } var x1; var x1; +var z1; +var z1; //// [mappedTypes4.d.ts] @@ -127,3 +141,12 @@ declare type DeepReadonlyFoo = { }; declare var x1: DeepReadonly; declare var x1: DeepReadonlyFoo; +declare type Z = { + a: number; +}; +declare type Clone = { + [P in keyof (T & {})]: T[P]; +}; +declare type M = Clone; +declare var z1: Z; +declare var z1: Clone; diff --git a/tests/baselines/reference/mappedTypes4.symbols b/tests/baselines/reference/mappedTypes4.symbols index b57adfe9954..ed108b47d78 100644 --- a/tests/baselines/reference/mappedTypes4.symbols +++ b/tests/baselines/reference/mappedTypes4.symbols @@ -196,3 +196,34 @@ var x1: DeepReadonlyFoo; >x1 : Symbol(x1, Decl(mappedTypes4.ts, 58, 3), Decl(mappedTypes4.ts, 59, 3)) >DeepReadonlyFoo : Symbol(DeepReadonlyFoo, Decl(mappedTypes4.ts, 50, 2)) +// Repro from #13232 + +type Z = { a: number }; +>Z : Symbol(Z, Decl(mappedTypes4.ts, 59, 24)) +>a : Symbol(a, Decl(mappedTypes4.ts, 63, 10)) + +type Clone = { +>Clone : Symbol(Clone, Decl(mappedTypes4.ts, 63, 23)) +>T : Symbol(T, Decl(mappedTypes4.ts, 64, 11)) + + [P in keyof (T & {})]: T[P]; +>P : Symbol(P, Decl(mappedTypes4.ts, 65, 3)) +>T : Symbol(T, Decl(mappedTypes4.ts, 64, 11)) +>T : Symbol(T, Decl(mappedTypes4.ts, 64, 11)) +>P : Symbol(P, Decl(mappedTypes4.ts, 65, 3)) + +}; +type M = Clone; // M should be { a: number } +>M : Symbol(M, Decl(mappedTypes4.ts, 66, 2)) +>Clone : Symbol(Clone, Decl(mappedTypes4.ts, 63, 23)) +>Z : Symbol(Z, Decl(mappedTypes4.ts, 59, 24)) + +var z1: Z; +>z1 : Symbol(z1, Decl(mappedTypes4.ts, 69, 3), Decl(mappedTypes4.ts, 70, 3)) +>Z : Symbol(Z, Decl(mappedTypes4.ts, 59, 24)) + +var z1: Clone; +>z1 : Symbol(z1, Decl(mappedTypes4.ts, 69, 3), Decl(mappedTypes4.ts, 70, 3)) +>Clone : Symbol(Clone, Decl(mappedTypes4.ts, 63, 23)) +>Z : Symbol(Z, Decl(mappedTypes4.ts, 59, 24)) + diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types index cc492d82120..a2fec06ccec 100644 --- a/tests/baselines/reference/mappedTypes4.types +++ b/tests/baselines/reference/mappedTypes4.types @@ -211,3 +211,34 @@ var x1: DeepReadonlyFoo; >x1 : DeepReadonly >DeepReadonlyFoo : DeepReadonlyFoo +// Repro from #13232 + +type Z = { a: number }; +>Z : Z +>a : number + +type Clone = { +>Clone : Clone +>T : T + + [P in keyof (T & {})]: T[P]; +>P : P +>T : T +>T : T +>P : P + +}; +type M = Clone; // M should be { a: number } +>M : Clone +>Clone : Clone +>Z : Z + +var z1: Z; +>z1 : Z +>Z : Z + +var z1: Clone; +>z1 : Z +>Clone : Clone +>Z : Z + From a89bb82929afb3a58998c07ed7311225999575d8 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sat, 31 Dec 2016 22:26:39 +0900 Subject: [PATCH 212/289] address feedback --- src/compiler/transformers/es2015.ts | 4 ++-- ...sClassHeritageListMemberTypeAnnotations.js | 4 ++-- ...accessibleTypeInTypeParameterConstraint.js | 4 ++-- .../reference/abstractClassInLocalScope.js | 4 ++-- .../abstractClassInLocalScopeIsAbstract.js | 4 ++-- tests/baselines/reference/abstractProperty.js | 4 ++-- .../reference/abstractPropertyNegative.js | 4 ++-- .../accessOverriddenBaseClassMember1.js | 4 ++-- .../accessors_spec_section-4.5_inference.js | 4 ++-- .../reference/aliasUsageInAccessorsOfClass.js | 4 ++-- .../baselines/reference/aliasUsageInArray.js | 4 ++-- .../aliasUsageInFunctionExpression.js | 4 ++-- .../reference/aliasUsageInGenericFunction.js | 4 ++-- .../reference/aliasUsageInIndexerOfClass.js | 4 ++-- .../reference/aliasUsageInObjectLiteral.js | 4 ++-- .../reference/aliasUsageInOrExpression.js | 4 ++-- ...aliasUsageInTypeArgumentOfExtendsClause.js | 8 +++---- .../reference/aliasUsageInVarAssignment.js | 4 ++-- .../reference/ambiguousOverloadResolution.js | 4 ++-- .../reference/apparentTypeSubtyping.js | 4 ++-- .../reference/apparentTypeSupertype.js | 4 ++-- .../reference/arrayAssignmentTest1.js | 4 ++-- .../reference/arrayAssignmentTest2.js | 4 ++-- .../reference/arrayBestCommonTypes.js | 4 ++-- .../reference/arrayLiteralTypeInference.js | 4 ++-- tests/baselines/reference/arrayLiterals.js | 4 ++-- .../arrayLiteralsWithRecursiveGenerics.js | 4 ++-- ...rayOfSubtypeIsAssignableToReadonlyArray.js | 4 ++-- .../reference/arrowFunctionContexts.js | 4 ++-- .../assignmentCompatWithCallSignatures3.js | 4 ++-- .../assignmentCompatWithCallSignatures4.js | 4 ++-- .../assignmentCompatWithCallSignatures5.js | 4 ++-- .../assignmentCompatWithCallSignatures6.js | 4 ++-- ...ssignmentCompatWithConstructSignatures3.js | 4 ++-- ...ssignmentCompatWithConstructSignatures4.js | 4 ++-- ...ssignmentCompatWithConstructSignatures5.js | 4 ++-- ...ssignmentCompatWithConstructSignatures6.js | 4 ++-- .../assignmentCompatWithNumericIndexer.js | 4 ++-- .../assignmentCompatWithNumericIndexer3.js | 4 ++-- .../assignmentCompatWithObjectMembers4.js | 4 ++-- ...nmentCompatWithObjectMembersOptionality.js | 4 ++-- ...mentCompatWithObjectMembersOptionality2.js | 4 ++-- .../assignmentCompatWithStringIndexer.js | 4 ++-- .../reference/assignmentLHSIsValue.js | 4 ++-- .../reference/asyncImportedPromise_es5.js | 4 ++-- tests/baselines/reference/autolift4.js | 4 ++-- tests/baselines/reference/baseCheck.js | 4 ++-- .../reference/baseIndexSignatureResolution.js | 4 ++-- .../reference/baseTypeOrderChecking.js | 4 ++-- .../baseTypeWrappingInstantiationChain.js | 4 ++-- tests/baselines/reference/bases.js | 4 ++-- .../bestCommonTypeOfConditionalExpressions.js | 4 ++-- ...bestCommonTypeOfConditionalExpressions2.js | 4 ++-- .../reference/bestCommonTypeOfTuple2.js | 4 ++-- ...allSignatureAssignabilityInInheritance2.js | 4 ++-- ...allSignatureAssignabilityInInheritance3.js | 4 ++-- ...allSignatureAssignabilityInInheritance4.js | 4 ++-- ...allSignatureAssignabilityInInheritance5.js | 4 ++-- ...allSignatureAssignabilityInInheritance6.js | 4 ++-- tests/baselines/reference/callWithSpread.js | 4 ++-- .../reference/captureThisInSuperCall.js | 4 ++-- tests/baselines/reference/castingTuple.js | 4 ++-- .../baselines/reference/chainedAssignment3.js | 4 ++-- ...arameterConstrainedToOtherTypeParameter.js | 4 ++-- .../reference/checkForObjectTooStrict.js | 4 ++-- .../checkSuperCallBeforeThisAccessing1.js | 4 ++-- .../checkSuperCallBeforeThisAccessing2.js | 4 ++-- .../checkSuperCallBeforeThisAccessing3.js | 4 ++-- .../checkSuperCallBeforeThisAccessing4.js | 4 ++-- .../checkSuperCallBeforeThisAccessing5.js | 4 ++-- .../checkSuperCallBeforeThisAccessing6.js | 4 ++-- .../checkSuperCallBeforeThisAccessing7.js | 4 ++-- .../checkSuperCallBeforeThisAccessing8.js | 4 ++-- .../reference/circularImportAlias.js | 4 ++-- .../circularTypeofWithFunctionModule.js | 4 ++-- .../classAbstractConstructorAssignability.js | 4 ++-- .../reference/classAbstractCrashedOnce.js | 4 ++-- .../reference/classAbstractExtends.js | 4 ++-- .../reference/classAbstractFactoryFunction.js | 4 ++-- .../reference/classAbstractGeneric.js | 4 ++-- .../reference/classAbstractInAModule.js | 4 ++-- .../reference/classAbstractInheritance.js | 4 ++-- .../reference/classAbstractInstantiations1.js | 4 ++-- .../reference/classAbstractInstantiations2.js | 4 ++-- .../classAbstractOverrideWithAbstract.js | 4 ++-- .../reference/classAbstractSuperCalls.js | 4 ++-- .../classAbstractUsingAbstractMethod1.js | 4 ++-- .../classAbstractUsingAbstractMethods2.js | 4 ++-- .../classConstructorAccessibility2.js | 4 ++-- .../classConstructorAccessibility4.js | 4 ++-- .../classConstructorAccessibility5.js | 4 ++-- ...classConstructorParametersAccessibility.js | 4 ++-- ...lassConstructorParametersAccessibility2.js | 4 ++-- ...lassConstructorParametersAccessibility3.js | 4 ++-- ...clarationMergedInModuleWithContinuation.js | 4 ++-- .../classDeclaredBeforeClassFactory.js | 4 ++-- .../classDoesNotDependOnBaseTypes.js | 4 ++-- tests/baselines/reference/classExpression2.js | 4 ++-- tests/baselines/reference/classExpression3.js | 4 ++-- .../classExpressionExtendingAbstractClass.js | 4 ++-- .../reference/classExtendingBuiltinType.js | 4 ++-- .../reference/classExtendingClass.js | 4 ++-- .../reference/classExtendingClassLikeType.js | 4 ++-- .../reference/classExtendingNonConstructor.js | 4 ++-- .../baselines/reference/classExtendingNull.js | 4 ++-- .../reference/classExtendingPrimitive.js | 4 ++-- .../reference/classExtendingPrimitive2.js | 4 ++-- .../reference/classExtendingQualifiedName.js | 4 ++-- .../reference/classExtendingQualifiedName2.js | 4 ++-- .../reference/classExtendsAcrossFiles.js | 8 +++---- ...sMergedWithModuleNotReferingConstructor.js | 4 ++-- ...tendsClauseClassNotReferringConstructor.js | 4 ++-- .../reference/classExtendsEveryObjectType.js | 4 ++-- .../reference/classExtendsEveryObjectType2.js | 4 ++-- .../reference/classExtendsInterface.js | 4 ++-- .../classExtendsInterfaceInExpression.js | 4 ++-- .../classExtendsInterfaceInModule.js | 4 ++-- .../baselines/reference/classExtendsItself.js | 4 ++-- .../reference/classExtendsItselfIndirectly.js | 4 ++-- .../classExtendsItselfIndirectly2.js | 4 ++-- .../classExtendsItselfIndirectly3.js | 24 +++++++++---------- .../classExtendsMultipleBaseClasses.js | 4 ++-- tests/baselines/reference/classExtendsNull.js | 4 ++-- ...classExtendsShadowedConstructorFunction.js | 4 ++-- .../classExtendsValidConstructorFunction.js | 4 ++-- .../classHeritageWithTrailingSeparator.js | 4 ++-- .../reference/classImplementsClass2.js | 4 ++-- .../reference/classImplementsClass3.js | 4 ++-- .../reference/classImplementsClass4.js | 4 ++-- .../reference/classImplementsClass5.js | 4 ++-- .../reference/classImplementsClass6.js | 4 ++-- tests/baselines/reference/classIndexer3.js | 4 ++-- tests/baselines/reference/classInheritence.js | 4 ++-- .../reference/classIsSubtypeOfBaseType.js | 4 ++-- tests/baselines/reference/classOrder2.js | 4 ++-- tests/baselines/reference/classOrderBug.js | 4 ++-- .../reference/classSideInheritance1.js | 4 ++-- .../reference/classSideInheritance2.js | 4 ++-- .../reference/classSideInheritance3.js | 4 ++-- tests/baselines/reference/classUpdateTests.js | 4 ++-- .../classWithBaseClassButNoConstructor.js | 4 ++-- .../reference/classWithConstructors.js | 4 ++-- .../reference/classWithProtectedProperty.js | 4 ++-- .../reference/classWithStaticMembers.js | 4 ++-- tests/baselines/reference/classdecl.js | 4 ++-- .../reference/clodulesDerivedClasses.js | 4 ++-- ...llisionSuperAndLocalFunctionInAccessors.js | 4 ++-- ...isionSuperAndLocalFunctionInConstructor.js | 4 ++-- .../collisionSuperAndLocalFunctionInMethod.js | 4 ++-- ...ollisionSuperAndLocalFunctionInProperty.js | 4 ++-- .../collisionSuperAndLocalVarInAccessors.js | 4 ++-- .../collisionSuperAndLocalVarInConstructor.js | 4 ++-- .../collisionSuperAndLocalVarInMethod.js | 4 ++-- .../collisionSuperAndLocalVarInProperty.js | 4 ++-- .../collisionSuperAndNameResolution.js | 4 ++-- .../reference/collisionSuperAndParameter.js | 4 ++-- .../reference/collisionSuperAndParameter1.js | 4 ++-- ...perAndPropertyNameAsConstuctorParameter.js | 4 ++-- ...xpressionAndLocalVarWithSuperExperssion.js | 4 ++-- .../reference/commentsInheritance.js | 4 ++-- .../comparisonOperatorWithIdenticalObjects.js | 4 ++-- ...ithNoRelationshipObjectsOnCallSignature.js | 4 ++-- ...lationshipObjectsOnConstructorSignature.js | 4 ++-- ...thNoRelationshipObjectsOnIndexSignature.js | 4 ++-- ...nshipObjectsOnInstantiatedCallSignature.js | 4 ++-- ...jectsOnInstantiatedConstructorSignature.js | 4 ++-- ...peratorWithSubtypeObjectOnCallSignature.js | 4 ++-- ...WithSubtypeObjectOnConstructorSignature.js | 4 ++-- ...eratorWithSubtypeObjectOnIndexSignature.js | 4 ++-- ...ubtypeObjectOnInstantiatedCallSignature.js | 4 ++-- ...bjectOnInstantiatedConstructorSignature.js | 4 ++-- ...isonOperatorWithSubtypeObjectOnProperty.js | 4 ++-- .../reference/complexClassRelationships.js | 4 ++-- ...catedGenericRecursiveBaseClassReference.js | 4 ++-- .../reference/compoundAssignmentLHSIsValue.js | 4 ++-- ...poundExponentiationAssignmentLHSIsValue.js | 4 ++-- .../reference/computedPropertyNames24_ES5.js | 4 ++-- .../reference/computedPropertyNames25_ES5.js | 4 ++-- .../reference/computedPropertyNames26_ES5.js | 4 ++-- .../reference/computedPropertyNames27_ES5.js | 4 ++-- .../reference/computedPropertyNames28_ES5.js | 4 ++-- .../reference/computedPropertyNames30_ES5.js | 4 ++-- .../reference/computedPropertyNames31_ES5.js | 4 ++-- .../reference/computedPropertyNames43_ES5.js | 4 ++-- .../reference/computedPropertyNames44_ES5.js | 4 ++-- .../reference/computedPropertyNames45_ES5.js | 4 ++-- .../conditionalOperatorWithIdenticalBCT.js | 4 ++-- .../conditionalOperatorWithoutIdenticalBCT.js | 4 ++-- .../reference/constantOverloadFunction.js | 4 ++-- .../constantOverloadFunctionNoSubtypeError.js | 4 ++-- ...nstraintCheckInGenericBaseTypeReference.js | 4 ++-- ...uctSignatureAssignabilityInInheritance2.js | 4 ++-- ...uctSignatureAssignabilityInInheritance3.js | 4 ++-- ...uctSignatureAssignabilityInInheritance4.js | 4 ++-- ...uctSignatureAssignabilityInInheritance5.js | 4 ++-- ...uctSignatureAssignabilityInInheritance6.js | 4 ++-- tests/baselines/reference/constructorArgs.js | 4 ++-- ...uctorFunctionTypeIsAssignableToBaseType.js | 4 ++-- ...ctorFunctionTypeIsAssignableToBaseType2.js | 4 ++-- .../constructorHasPrototypeProperty.js | 4 ++-- .../reference/constructorOverloads2.js | 4 ++-- .../reference/constructorOverloads3.js | 4 ++-- .../reference/constructorWithCapturedSuper.js | 4 ++-- ...constructorWithIncompleteTypeAnnotation.js | 4 ++-- .../contextualTypingArrayOfLambdas.js | 4 ++-- ...contextualTypingOfConditionalExpression.js | 4 ++-- ...ontextualTypingOfConditionalExpression2.js | 4 ++-- ...urcePropertyIsRelatableToTargetProperty.js | 4 ++-- .../reference/declFileClassExtendsNull.js | 4 ++-- .../declFileForFunctionTypeAsTypeParameter.js | 4 ++-- ...ileGenericClassWithGenericExtendedClass.js | 4 ++-- .../reference/declFileGenericType.js | 4 ++-- .../reference/declFileGenericType2.js | 4 ++-- ...lictingWithClassReferredByExtendsClause.js | 4 ++-- ...dsClauseThatHasItsContainerNameConflict.js | 4 ++-- .../declarationEmitExpressionInExtends.js | 4 ++-- .../declarationEmitExpressionInExtends2.js | 4 ++-- .../declarationEmitExpressionInExtends3.js | 4 ++-- .../declarationEmitExpressionInExtends4.js | 4 ++-- .../declarationEmitNameConflicts3.js | 4 ++-- .../declarationEmitProtectedMembers.js | 4 ++-- .../declarationEmitThisPredicates01.js | 4 ++-- ...tionEmitThisPredicatesWithPrivateName01.js | 4 ++-- .../reference/declareDottedExtend.js | 4 ++-- .../reference/decoratorOnClassConstructor2.js | 4 ++-- .../reference/decoratorOnClassConstructor3.js | 4 ++-- .../reference/decoratorOnClassMethod12.js | 4 ++-- ...edClassConstructorWithExplicitReturns01.js | 4 ++-- ...tructorWithExplicitReturns01.sourcemap.txt | 4 ++-- ...derivedClassConstructorWithoutSuperCall.js | 4 ++-- ...ClassFunctionOverridesBaseClassAccessor.js | 4 ++-- .../derivedClassIncludesInheritedMembers.js | 4 ++-- ...idesIndexersWithAssignmentCompatibility.js | 4 ++-- .../derivedClassOverridesPrivateFunction1.js | 4 ++-- .../derivedClassOverridesPrivates.js | 4 ++-- .../derivedClassOverridesProtectedMembers.js | 4 ++-- .../derivedClassOverridesProtectedMembers2.js | 4 ++-- .../derivedClassOverridesProtectedMembers3.js | 4 ++-- .../derivedClassOverridesProtectedMembers4.js | 4 ++-- .../derivedClassOverridesPublicMembers.js | 4 ++-- .../derivedClassOverridesWithoutSubtype.js | 4 ++-- .../derivedClassParameterProperties.js | 4 ++-- ...dClassSuperCallsInNonConstructorMembers.js | 4 ++-- .../derivedClassSuperCallsWithThisArg.js | 4 ++-- .../reference/derivedClassTransitivity.js | 4 ++-- .../reference/derivedClassTransitivity2.js | 4 ++-- .../reference/derivedClassTransitivity3.js | 4 ++-- .../reference/derivedClassTransitivity4.js | 4 ++-- .../reference/derivedClassWithAny.js | 4 ++-- ...ivateInstanceShadowingProtectedInstance.js | 4 ++-- ...hPrivateInstanceShadowingPublicInstance.js | 4 ++-- ...thPrivateStaticShadowingProtectedStatic.js | 4 ++-- ...sWithPrivateStaticShadowingPublicStatic.js | 4 ++-- .../derivedClassWithoutExplicitConstructor.js | 4 ++-- ...derivedClassWithoutExplicitConstructor2.js | 4 ++-- ...derivedClassWithoutExplicitConstructor3.js | 4 ++-- tests/baselines/reference/derivedClasses.js | 4 ++-- .../reference/derivedGenericClassWithAny.js | 4 ++-- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 4 ++-- .../derivedTypeDoesNotRequireExtendsClause.js | 4 ++-- .../destructuringParameterDeclaration5.js | 4 ++-- ...BeforeEmitParameterPropertyDeclaration1.js | 4 ++-- ...SuperCallBeforeEmitPropertyDeclaration1.js | 4 ++-- ...arationAndParameterPropertyDeclaration1.js | 4 ++-- .../reference/emitThisInSuperMethodCall.js | 4 ++-- tests/baselines/reference/emptyModuleName.js | 4 ++-- ...rorForwardReferenceForwadingConstructor.js | 4 ++-- tests/baselines/reference/errorSuperCalls.js | 4 ++-- .../reference/errorSuperPropertyAccess.js | 4 ++-- .../reference/errorsInGenericTypeReference.js | 4 ++-- .../reference/es6ClassSuperCodegenBug.js | 4 ++-- tests/baselines/reference/es6ClassTest.js | 4 ++-- tests/baselines/reference/es6ClassTest2.js | 4 ++-- tests/baselines/reference/es6ClassTest7.js | 4 ++-- .../exportAssignmentOfGenericType1.js | 4 ++-- .../exportDeclarationInInternalModule.js | 4 ++-- tests/baselines/reference/extBaseClass1.js | 4 ++-- tests/baselines/reference/extBaseClass2.js | 4 ++-- .../extendAndImplementTheSameBaseType.js | 4 ++-- .../extendAndImplementTheSameBaseType2.js | 4 ++-- .../extendBaseClassBeforeItsDeclared.js | 4 ++-- .../extendClassExpressionFromModule.js | 4 ++-- .../extendConstructSignatureInInterface.js | 4 ++-- .../reference/extendNonClassSymbol1.js | 4 ++-- .../reference/extendNonClassSymbol2.js | 4 ++-- .../extendPrivateConstructorClass.js | 4 ++-- ...xtendingClassFromAliasAndUsageInIndexer.js | 8 +++---- .../reference/extendsClauseAlreadySeen.js | 4 ++-- .../reference/extendsClauseAlreadySeen2.js | 4 ++-- tests/baselines/reference/fluentClasses.js | 4 ++-- tests/baselines/reference/for-inStatements.js | 4 ++-- .../reference/for-inStatementsInvalid.js | 4 ++-- .../forStatementsMultipleInvalidDecl.js | 4 ++-- .../reference/functionImplementationErrors.js | 4 ++-- .../reference/functionImplementations.js | 4 ++-- .../reference/functionSubtypingOfVarArgs.js | 4 ++-- .../reference/functionSubtypingOfVarArgs2.js | 4 ++-- .../reference/generatedContextualTyping.js | 4 ++-- .../genericBaseClassLiteralProperty.js | 4 ++-- .../genericBaseClassLiteralProperty2.js | 4 ++-- ...allWithConstraintsTypeArgumentInference.js | 4 ++-- .../genericCallWithObjectTypeArgs2.js | 4 ++-- ...icCallWithObjectTypeArgsAndConstraints2.js | 4 ++-- ...icCallWithObjectTypeArgsAndConstraints3.js | 4 ++-- .../genericCallbacksAndClassHierarchy.js | 4 ++-- .../genericClassExpressionInFunction.js | 4 ++-- ...sInheritsConstructorFromNonGenericClass.js | 4 ++-- ...cClassPropertyInheritanceSpecialization.js | 4 ++-- .../reference/genericClassStaticMethod.js | 4 ++-- tests/baselines/reference/genericClasses3.js | 4 ++-- ...genericConstraintOnExtendedBuiltinTypes.js | 4 ++-- ...enericConstraintOnExtendedBuiltinTypes2.js | 4 ++-- .../genericDerivedTypeWithSpecializedBase.js | 4 ++-- .../genericDerivedTypeWithSpecializedBase2.js | 4 ++-- .../genericInheritedDefaultConstructors.js | 4 ++-- .../reference/genericPrototypeProperty2.js | 4 ++-- .../reference/genericPrototypeProperty3.js | 4 ++-- ...ericRecursiveImplicitConstructorErrors2.js | 4 ++-- ...ericRecursiveImplicitConstructorErrors3.js | 4 ++-- .../reference/genericTypeAssertions2.js | 4 ++-- .../reference/genericTypeAssertions4.js | 4 ++-- .../reference/genericTypeAssertions6.js | 4 ++-- .../reference/genericTypeConstraints.js | 4 ++-- ...genericTypeReferenceWithoutTypeArgument.js | 4 ++-- ...enericTypeReferenceWithoutTypeArgument2.js | 4 ++-- .../genericWithIndexerOfTypeParameterType2.js | 4 ++-- .../reference/heterogeneousArrayLiterals.js | 4 ++-- .../reference/ifDoWhileStatements.js | 4 ++-- .../illegalSuperCallsInConstructor.js | 4 ++-- .../implementClausePrecedingExtends.js | 4 ++-- ...gAnInterfaceExtendingClassWithPrivates2.js | 4 ++-- ...AnInterfaceExtendingClassWithProtecteds.js | 4 ++-- .../baselines/reference/importAsBaseClass.js | 4 ++-- tests/baselines/reference/importHelpers.js | 4 ++-- .../reference/importHelpersNoHelpers.js | 4 ++-- .../reference/importHelpersNoModule.js | 4 ++-- .../reference/importShadowsGlobalName.js | 4 ++-- .../reference/importUsedInExtendsList1.js | 4 ++-- .../reference/indexerConstraints2.js | 4 ++-- .../reference/indirectSelfReference.js | 4 ++-- .../reference/indirectSelfReferenceGeneric.js | 4 ++-- .../infinitelyExpandingTypesNonGenericBase.js | 4 ++-- .../inheritFromGenericTypeParameter.js | 4 ++-- ...SameNamePrivatePropertiesFromSameOrigin.js | 4 ++-- tests/baselines/reference/inheritance.js | 4 ++-- tests/baselines/reference/inheritance1.js | 4 ++-- ...itanceGrandParentPrivateMemberCollision.js | 4 ++-- ...tPrivateMemberCollisionWithPublicMember.js | 4 ++-- ...tPublicMemberCollisionWithPrivateMember.js | 4 ++-- ...ritanceMemberAccessorOverridingAccessor.js | 4 ++-- ...heritanceMemberAccessorOverridingMethod.js | 4 ++-- ...ritanceMemberAccessorOverridingProperty.js | 4 ++-- ...inheritanceMemberFuncOverridingAccessor.js | 4 ++-- .../inheritanceMemberFuncOverridingMethod.js | 4 ++-- ...inheritanceMemberFuncOverridingProperty.js | 4 ++-- ...ritanceMemberPropertyOverridingAccessor.js | 4 ++-- ...heritanceMemberPropertyOverridingMethod.js | 4 ++-- ...ritanceMemberPropertyOverridingProperty.js | 4 ++-- .../inheritanceOfGenericConstructorMethod1.js | 4 ++-- .../inheritanceOfGenericConstructorMethod2.js | 4 ++-- ...ritanceStaticAccessorOverridingAccessor.js | 4 ++-- ...heritanceStaticAccessorOverridingMethod.js | 4 ++-- ...ritanceStaticAccessorOverridingProperty.js | 4 ++-- ...inheritanceStaticFuncOverridingAccessor.js | 4 ++-- ...eStaticFuncOverridingAccessorOfFuncType.js | 4 ++-- .../inheritanceStaticFuncOverridingMethod.js | 4 ++-- ...inheritanceStaticFuncOverridingProperty.js | 4 ++-- ...eStaticFuncOverridingPropertyOfFuncType.js | 4 ++-- ...taticFunctionOverridingInstanceProperty.js | 4 ++-- .../inheritanceStaticMembersCompatible.js | 4 ++-- .../inheritanceStaticMembersIncompatible.js | 4 ++-- ...ritanceStaticPropertyOverridingAccessor.js | 4 ++-- ...heritanceStaticPropertyOverridingMethod.js | 4 ++-- ...ritanceStaticPropertyOverridingProperty.js | 4 ++-- .../inheritedConstructorWithRestParams.js | 4 ++-- .../inheritedConstructorWithRestParams2.js | 4 ++-- .../inheritedModuleMembersForClodule.js | 4 ++-- .../reference/instanceOfAssignability.js | 4 ++-- ...nstancePropertiesInheritedIntoClassType.js | 4 ++-- .../reference/instanceSubtypeCheck2.js | 4 ++-- ...nstanceofWithStructurallyIdenticalTypes.js | 4 ++-- .../instantiatedReturnTypeContravariance.js | 4 ++-- .../reference/interfaceClassMerging.js | 4 ++-- .../reference/interfaceClassMerging2.js | 4 ++-- .../reference/interfaceExtendsClass1.js | 4 ++-- .../interfaceExtendsClassWithPrivate1.js | 4 ++-- .../interfaceExtendsClassWithPrivate2.js | 4 ++-- .../reference/interfaceImplementation8.js | 4 ++-- .../invalidModuleWithStatementsOfEveryKind.js | 4 ++-- .../invalidMultipleVariableDeclarations.js | 4 ++-- .../reference/invalidReturnStatements.js | 4 ++-- .../isolatedModulesImportExportElision.js | 4 ++-- tests/baselines/reference/jsxViaImport.js | 4 ++-- .../reference/keyofAndIndexedAccess.js | 4 ++-- tests/baselines/reference/lambdaArgCrash.js | 4 ++-- tests/baselines/reference/lift.js | 4 ++-- tests/baselines/reference/localTypes1.js | 4 ++-- tests/baselines/reference/m7Bugs.js | 4 ++-- .../reference/mergedDeclarations5.js | 4 ++-- .../reference/mergedDeclarations6.js | 4 ++-- .../mergedInheritedClassInterface.js | 4 ++-- .../mergedInterfacesWithInheritedPrivates2.js | 4 ++-- .../mergedInterfacesWithInheritedPrivates3.js | 4 ++-- .../missingPropertiesOfClassExpression.js | 4 ++-- tests/baselines/reference/moduleAsBaseType.js | 4 ++-- .../moduleImportedForTypeArgumentPosition.js | 4 ++-- .../moduleWithStatementsOfEveryKind.js | 4 ++-- .../reference/multipleInheritance.js | 4 ++-- .../mutuallyRecursiveGenericBaseTypes2.js | 4 ++-- .../noImplicitAnyMissingGetAccessor.js | 4 ++-- .../noImplicitAnyMissingSetAccessor.js | 4 ++-- ...enericClassExtendingGenericClassWithAny.js | 4 ++-- ...cIndexerConstrainsPropertyDeclarations2.js | 4 ++-- .../reference/numericIndexerConstraint3.js | 4 ++-- .../reference/numericIndexerConstraint4.js | 4 ++-- .../reference/numericIndexerTyping2.js | 4 ++-- ...objectCreationOfElementAccessExpression.js | 4 ++-- ...objectTypeHidingMembersOfExtendedObject.js | 4 ++-- ...objectTypesIdentityWithNumericIndexers1.js | 4 ++-- ...objectTypesIdentityWithNumericIndexers2.js | 4 ++-- ...objectTypesIdentityWithNumericIndexers3.js | 4 ++-- .../objectTypesIdentityWithPrivates.js | 4 ++-- .../objectTypesIdentityWithPrivates2.js | 4 ++-- .../objectTypesIdentityWithPrivates3.js | 4 ++-- .../objectTypesIdentityWithStringIndexers.js | 4 ++-- .../objectTypesIdentityWithStringIndexers2.js | 4 ++-- .../optionalConstructorArgInSuper.js | 4 ++-- tests/baselines/reference/optionalMethods.js | 4 ++-- .../reference/optionalParamArgsTest.js | 4 ++-- .../reference/optionalParamInOverride.js | 4 ++-- .../reference/optionalParameterProperty.js | 4 ++-- .../baselines/reference/outModuleConcatAmd.js | 4 ++-- .../outModuleConcatAmd.sourcemap.txt | 4 ++-- .../reference/outModuleConcatSystem.js | 4 ++-- .../outModuleConcatSystem.sourcemap.txt | 4 ++-- .../reference/outModuleTripleSlashRefs.js | 4 ++-- .../outModuleTripleSlashRefs.sourcemap.txt | 4 ++-- tests/baselines/reference/overload1.js | 4 ++-- .../overloadOnConstConstraintChecks1.js | 4 ++-- .../overloadOnConstConstraintChecks2.js | 4 ++-- .../overloadOnConstConstraintChecks3.js | 4 ++-- .../overloadOnConstConstraintChecks4.js | 4 ++-- .../overloadOnConstantsInvalidOverload1.js | 4 ++-- .../baselines/reference/overloadResolution.js | 4 ++-- .../overloadResolutionClassConstructors.js | 4 ++-- .../overloadResolutionConstructors.js | 4 ++-- .../reference/overloadingOnConstants1.js | 4 ++-- .../reference/overloadingOnConstants2.js | 4 ++-- .../overridingPrivateStaticMembers.js | 4 ++-- .../reference/parseErrorInHeritageClause1.js | 4 ++-- tests/baselines/reference/parser509630.js | 4 ++-- tests/baselines/reference/parserAstSpans1.js | 4 ++-- .../reference/parserClassDeclaration1.js | 4 ++-- .../reference/parserClassDeclaration3.js | 4 ++-- .../reference/parserClassDeclaration4.js | 4 ++-- .../reference/parserClassDeclaration5.js | 4 ++-- .../reference/parserClassDeclaration6.js | 4 ++-- ...rrorRecovery_ExtendsOrImplementsClause2.js | 4 ++-- ...rrorRecovery_ExtendsOrImplementsClause4.js | 4 ++-- ...rrorRecovery_ExtendsOrImplementsClause5.js | 4 ++-- .../parserGenericsInTypeContexts1.js | 4 ++-- .../parserGenericsInTypeContexts2.js | 4 ++-- .../baselines/reference/parserRealSource10.js | 4 ++-- .../baselines/reference/parserRealSource11.js | 4 ++-- tests/baselines/reference/parserharness.js | 4 ++-- ...artiallyAnnotatedFunctionInferenceError.js | 4 ++-- ...tatedFunctionInferenceWithTypeParameter.js | 4 ++-- tests/baselines/reference/primitiveMembers.js | 4 ++-- tests/baselines/reference/privacyClass.js | 4 ++-- .../privacyClassExtendsClauseDeclFile.js | 8 +++---- tests/baselines/reference/privacyGloClass.js | 4 ++-- .../reference/privateAccessInSubclass1.js | 4 ++-- .../privateInstanceMemberAccessibility.js | 4 ++-- ...tedMembersAreNotAccessibleDestructuring.js | 4 ++-- .../privateStaticMemberAccessibility.js | 4 ++-- .../privateStaticNotAccessibleInClodule2.js | 4 ++-- .../amd/testGlo.js | 4 ++-- .../node/testGlo.js | 4 ++-- .../reference/project/prologueEmit/amd/out.js | 4 ++-- .../project/prologueEmit/node/out.js | 4 ++-- .../amd/m'ain.js | 4 ++-- .../node/m'ain.js | 4 ++-- .../reference/propertiesAndIndexers.js | 4 ++-- tests/baselines/reference/propertyAccess.js | 4 ++-- ...tyAccessOnTypeParameterWithConstraints2.js | 4 ++-- ...tyAccessOnTypeParameterWithConstraints3.js | 4 ++-- ...tyAccessOnTypeParameterWithConstraints5.js | 4 ++-- ...sPropertyAccessibleWithinNestedSubclass.js | 4 ++-- ...PropertyAccessibleWithinNestedSubclass1.js | 4 ++-- ...edClassPropertyAccessibleWithinSubclass.js | 4 ++-- ...dClassPropertyAccessibleWithinSubclass2.js | 4 ++-- ...dClassPropertyAccessibleWithinSubclass3.js | 4 ++-- .../protectedInstanceMemberAccessibility.js | 4 ++-- tests/baselines/reference/protectedMembers.js | 4 ++-- ...icClassPropertyAccessibleWithinSubclass.js | 4 ++-- ...cClassPropertyAccessibleWithinSubclass2.js | 4 ++-- ...solution-does-not-affect-class-heritage.js | 4 ++-- .../readonlyConstructorAssignment.js | 4 ++-- .../reference/recursiveBaseCheck3.js | 4 ++-- .../reference/recursiveBaseCheck4.js | 4 ++-- .../reference/recursiveBaseCheck6.js | 4 ++-- .../recursiveBaseConstructorCreation1.js | 4 ++-- ...ssInstantiationsWithDefaultConstructors.js | 4 ++-- .../reference/recursiveClassReferenceTest.js | 4 ++-- .../recursiveClassReferenceTest.sourcemap.txt | 4 ++-- .../reference/recursiveComplicatedClasses.js | 4 ++-- ...sivelySpecializedConstructorDeclaration.js | 4 ++-- .../reference/reexportClassDefinition.js | 4 ++-- ...lassDeclarationWhenInBaseTypeResolution.js | 4 ++-- .../reference/returnInConstructor1.js | 4 ++-- tests/baselines/reference/returnStatements.js | 4 ++-- ...peCheckExtendedClassInsidePublicMethod2.js | 4 ++-- ...peCheckExtendedClassInsideStaticMethod1.js | 4 ++-- tests/baselines/reference/scopeTests.js | 4 ++-- .../reference/shadowPrivateMembers.js | 4 ++-- ...sWithDefaultConstructorAndExtendsClause.js | 4 ++-- ...tConstructorAndExtendsClause.sourcemap.txt | 4 ++-- .../specializedInheritedConstructors1.js | 4 ++-- .../specializedOverloadWithRestParameters.js | 4 ++-- tests/baselines/reference/staticFactory1.js | 4 ++-- .../baselines/reference/staticInheritance.js | 4 ++-- .../staticMemberAccessOffDerivedType1.js | 4 ++-- tests/baselines/reference/staticPropSuper.js | 4 ++-- .../reference/strictModeInConstructor.js | 4 ++-- .../reference/strictModeReservedWord.js | 4 ++-- ...trictModeReservedWordInClassDeclaration.js | 4 ++-- ...gIndexerConstrainsPropertyDeclarations2.js | 4 ++-- .../reference/subtypesOfTypeParameter.js | 4 ++-- .../subtypesOfTypeParameterWithConstraints.js | 4 ++-- ...subtypesOfTypeParameterWithConstraints4.js | 4 ++-- ...OfTypeParameterWithRecursiveConstraints.js | 4 ++-- .../reference/subtypingTransitivity.js | 4 ++-- .../reference/subtypingWithCallSignatures2.js | 4 ++-- .../reference/subtypingWithCallSignatures3.js | 4 ++-- .../reference/subtypingWithCallSignatures4.js | 4 ++-- .../subtypingWithConstructSignatures2.js | 4 ++-- .../subtypingWithConstructSignatures3.js | 4 ++-- .../subtypingWithConstructSignatures4.js | 4 ++-- .../subtypingWithConstructSignatures5.js | 4 ++-- .../subtypingWithConstructSignatures6.js | 4 ++-- .../reference/subtypingWithNumericIndexer.js | 4 ++-- .../reference/subtypingWithNumericIndexer3.js | 4 ++-- .../reference/subtypingWithNumericIndexer4.js | 4 ++-- .../reference/subtypingWithObjectMembers.js | 4 ++-- .../reference/subtypingWithObjectMembers4.js | 4 ++-- ...subtypingWithObjectMembersAccessibility.js | 4 ++-- ...ubtypingWithObjectMembersAccessibility2.js | 4 ++-- .../reference/subtypingWithStringIndexer.js | 4 ++-- .../reference/subtypingWithStringIndexer3.js | 4 ++-- .../reference/subtypingWithStringIndexer4.js | 4 ++-- tests/baselines/reference/super.js | 4 ++-- tests/baselines/reference/super1.js | 4 ++-- tests/baselines/reference/super2.js | 4 ++-- tests/baselines/reference/superAccess.js | 4 ++-- tests/baselines/reference/superAccess2.js | 4 ++-- .../reference/superAccessInFatArrow1.js | 4 ++-- .../reference/superCallArgsMustMatch.js | 4 ++-- .../reference/superCallAssignResult.js | 4 ++-- .../superCallBeforeThisAccessing1.js | 4 ++-- .../superCallBeforeThisAccessing2.js | 4 ++-- .../superCallBeforeThisAccessing3.js | 4 ++-- .../superCallBeforeThisAccessing4.js | 4 ++-- .../superCallBeforeThisAccessing5.js | 4 ++-- .../superCallBeforeThisAccessing6.js | 4 ++-- .../superCallBeforeThisAccessing7.js | 4 ++-- .../superCallBeforeThisAccessing8.js | 4 ++-- ...allFromClassThatDerivesFromGenericType1.js | 4 ++-- ...allFromClassThatDerivesFromGenericType2.js | 4 ++-- ...eButWithIncorrectNumberOfTypeArguments1.js | 4 ++-- ...sFromGenericTypeButWithNoTypeArguments1.js | 4 ++-- ...ivesNonGenericTypeButWithTypeArguments1.js | 4 ++-- .../reference/superCallInNonStaticMethod.js | 4 ++-- .../reference/superCallInStaticMethod.js | 4 ++-- .../superCallInsideClassDeclaration.js | 4 ++-- .../superCallInsideClassExpression.js | 4 ++-- .../superCallInsideObjectLiteralExpression.js | 4 ++-- .../reference/superCallOutsideConstructor.js | 4 ++-- .../superCallParameterContextualTyping1.js | 4 ++-- .../superCallParameterContextualTyping2.js | 4 ++-- .../superCallParameterContextualTyping3.js | 4 ++-- .../reference/superCallWithCommentEmit01.js | 4 ++-- .../superCallWithMissingBaseClass.js | 4 ++-- tests/baselines/reference/superCalls.js | 4 ++-- .../reference/superCallsInConstructor.js | 4 ++-- tests/baselines/reference/superErrors.js | 4 ++-- .../baselines/reference/superInCatchBlock1.js | 4 ++-- .../reference/superInConstructorParam1.js | 4 ++-- tests/baselines/reference/superInLambdas.js | 4 ++-- .../reference/superInObjectLiterals_ES5.js | 4 ++-- tests/baselines/reference/superNewCall1.js | 4 ++-- .../reference/superPropertyAccess.js | 4 ++-- .../reference/superPropertyAccess1.js | 4 ++-- .../reference/superPropertyAccess2.js | 4 ++-- ...essInComputedPropertiesOfNestedType_ES5.js | 4 ++-- .../reference/superPropertyAccessNoError.js | 4 ++-- .../reference/superPropertyAccess_ES5.js | 4 ++-- ...perPropertyInConstructorBeforeSuperCall.js | 4 ++-- .../reference/superSymbolIndexedAccess5.js | 4 ++-- .../reference/superSymbolIndexedAccess6.js | 4 ++-- .../superWithGenericSpecialization.js | 4 ++-- .../baselines/reference/superWithGenerics.js | 4 ++-- .../reference/superWithTypeArgument.js | 4 ++-- .../reference/superWithTypeArgument2.js | 4 ++-- .../reference/superWithTypeArgument3.js | 4 ++-- ...side-object-literal-getters-and-setters.js | 4 ++-- tests/baselines/reference/switchStatements.js | 4 ++-- .../reference/systemModuleWithSuperClass.js | 4 ++-- .../reference/targetTypeBaseCalls.js | 4 ++-- .../reference/thisInInvalidContexts.js | 4 ++-- .../thisInInvalidContextsExternalModule.js | 4 ++-- tests/baselines/reference/thisInSuperCall.js | 4 ++-- tests/baselines/reference/thisInSuperCall1.js | 4 ++-- tests/baselines/reference/thisInSuperCall2.js | 4 ++-- tests/baselines/reference/thisInSuperCall3.js | 4 ++-- .../reference/thisTypeInFunctions.js | 4 ++-- .../reference/thisTypeInFunctionsNegative.js | 4 ++-- .../tsxCorrectlyParseLessThanComparison1.js | 4 ++-- .../baselines/reference/tsxDynamicTagName5.js | 4 ++-- .../baselines/reference/tsxDynamicTagName7.js | 4 ++-- .../baselines/reference/tsxDynamicTagName8.js | 4 ++-- .../baselines/reference/tsxDynamicTagName9.js | 4 ++-- .../reference/tsxExternalModuleEmit1.js | 8 +++---- .../tsxStatelessFunctionComponents2.js | 4 ++-- .../reference/tsxUnionTypeComponent1.js | 4 ++-- tests/baselines/reference/typeAssertions.js | 4 ++-- .../baselines/reference/typeGuardFunction.js | 4 ++-- .../reference/typeGuardFunctionErrors.js | 4 ++-- .../reference/typeGuardFunctionGenerics.js | 4 ++-- .../reference/typeGuardFunctionOfFormThis.js | 4 ++-- .../typeGuardFunctionOfFormThisErrors.js | 4 ++-- .../reference/typeGuardOfFormInstanceOf.js | 4 ++-- .../reference/typeGuardOfFormIsType.js | 4 ++-- .../reference/typeGuardOfFormThisMember.js | 4 ++-- .../typeGuardOfFormThisMemberErrors.js | 4 ++-- tests/baselines/reference/typeMatch2.js | 4 ++-- tests/baselines/reference/typeOfSuperCall.js | 4 ++-- .../reference/typeParameterAsBaseClass.js | 4 ++-- .../reference/typeParameterAsBaseType.js | 4 ++-- .../reference/typeParameterExtendingUnion1.js | 4 ++-- .../reference/typeParameterExtendingUnion2.js | 4 ++-- .../baselines/reference/typeRelationships.js | 4 ++-- .../baselines/reference/typeValueConflict1.js | 4 ++-- .../baselines/reference/typeValueConflict2.js | 4 ++-- tests/baselines/reference/typeofClass2.js | 4 ++-- .../typesWithSpecializedCallSignatures.js | 4 ++-- ...typesWithSpecializedConstructSignatures.js | 4 ++-- tests/baselines/reference/undeclaredBase.js | 4 ++-- .../undefinedIsSubtypeOfEverything.js | 4 ++-- .../baselines/reference/underscoreMapFirst.js | 4 ++-- .../underscoreThisInDerivedClass01.js | 4 ++-- .../underscoreThisInDerivedClass02.js | 4 ++-- .../reference/unionTypeEquivalence.js | 4 ++-- .../reference/unionTypeFromArrayLiteral.js | 4 ++-- .../reference/unionTypesAssignability.js | 4 ++-- tests/baselines/reference/unknownSymbols1.js | 4 ++-- .../reference/unspecializedConstraints.js | 4 ++-- ...untypedFunctionCallsWithTypeParameters1.js | 4 ++-- .../reference/unusedClassesinNamespace4.js | 4 ++-- .../unusedIdentifiersConsolidated1.js | 4 ++-- .../reference/validUseOfThisInSuper.js | 4 ++-- .../reference/varArgsOnConstructorTypes.js | 4 ++-- 661 files changed, 1342 insertions(+), 1342 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 1fb777e11f3..d97cbeb09d8 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -3337,11 +3337,11 @@ namespace ts { priority: 0, text: ` var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index 13af9d45322..abdbe37f2e6 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -22,11 +22,11 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index b3ff0c58e11..c674c23ab84 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -26,11 +26,11 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index 501743c1ad7..111714fcc13 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -9,11 +9,11 @@ //// [abstractClassInLocalScope.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index c63088fcbbe..16e3e7c497d 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -9,11 +9,11 @@ //// [abstractClassInLocalScopeIsAbstract.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index 87c67d18205..0cb89665b94 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -23,11 +23,11 @@ class C extends B { //// [abstractProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index 9728e047bf1..1b0898de8e3 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -45,11 +45,11 @@ abstract class AbstractAccessorMismatch { //// [abstractPropertyNegative.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index 9afff0a8ff9..1fdf137a7e7 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -17,11 +17,11 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index eec92837d95..50a498e278c 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -26,11 +26,11 @@ class LanguageSpec_section_4_5_inference { //// [accessors_spec_section-4.5_inference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 9ccd5c16666..87ce93aa104 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -38,11 +38,11 @@ exports.Model = Model; //// [aliasUsage1_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index f08236bbf41..fa93daad9bc 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -32,11 +32,11 @@ exports.Model = Model; //// [aliasUsageInArray_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index c0f537ac0dd..908480fb5b2 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -31,11 +31,11 @@ exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 222c8a78643..f0625fde40a 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -35,11 +35,11 @@ exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index c2ed9f345a0..11a9a969a49 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -37,11 +37,11 @@ exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index d5ad53a981c..e82b58bab8f 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -32,11 +32,11 @@ exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 2864b71595f..4dc10ee726b 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -35,11 +35,11 @@ exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 8fc0815fcff..e7c42281f4f 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -35,11 +35,11 @@ exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -56,11 +56,11 @@ exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 0b42447701b..1d1b1c51f2c 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -31,11 +31,11 @@ exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 7adda16b65f..1f24276e2fb 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -10,11 +10,11 @@ var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 2c4b343c813..7bbd61d6689 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -25,11 +25,11 @@ class Derived2 extends Base2 { // error because of the prototy // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index 028935c28c1..2b835917fb4 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -15,11 +15,11 @@ class Derived extends Base { // error // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index ad1c748be75..c080b83957b 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -87,11 +87,11 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 34c5c921bd3..5e2911b13fb 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -61,11 +61,11 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index f232b44ce28..bc78f629bcb 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -109,11 +109,11 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 95e4d98574d..fc62da7d3a2 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -53,11 +53,11 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 001e0ff525f..8d69ab90dcf 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -39,11 +39,11 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index b092fe4da32..bd1d38de4cb 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -27,11 +27,11 @@ var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index fcc3ab99d3c..3e4e6d6a148 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -21,11 +21,11 @@ rrb = cra; // error: 'A' is not assignable to 'B' //// [arrayOfSubtypeIsAssignableToReadonlyArray.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index 5b1daa5b594..8f3364bd6d5 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -98,11 +98,11 @@ var asserted2: any; //// [arrowFunctionContexts.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index a748ec873ae..f0c8557659b 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -102,11 +102,11 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 409a7f5ceae..40c98239cbc 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -101,11 +101,11 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 00acd326ba8..2ac6493af4d 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -68,11 +68,11 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index f8fbe3b0b84..1281cfc0f5d 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -45,11 +45,11 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index fb991a85f05..888a4939854 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -102,11 +102,11 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index eb406898854..32081f035e6 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -101,11 +101,11 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index d246aec2509..7c4e7ca53f3 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -68,11 +68,11 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index f3149664bc6..5ac28d58024 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -45,11 +45,11 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 127f21bbfd7..59d173ebd71 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -46,11 +46,11 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 704cf67ec83..afac7265036 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -43,11 +43,11 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 88c77f2fb35..9204c87a172 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -94,11 +94,11 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 328b5192d96..1e539a9713b 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -91,11 +91,11 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 730fd15be7a..3387a818b6f 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -93,11 +93,11 @@ module SourceHasOptional { // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index 7b871a20b3a..d296c256d17 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -56,11 +56,11 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 1cf7c2ac317..34e0df7cacd 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -72,11 +72,11 @@ foo() = value; //// [assignmentLHSIsValue.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 9a6ef70582a..0185fcaf4e2 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -12,11 +12,11 @@ class Test { //// [task.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index aff1ce9986f..6d91c61d59d 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -25,11 +25,11 @@ class Point3D extends Point { //// [autolift4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index c8145c170b6..2b4f90d27b1 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -31,11 +31,11 @@ function f() { //// [baseCheck.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 7389e2afe8b..82818ecafbe 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -26,11 +26,11 @@ var z: Derived = b.foo(); //// [baseIndexSignatureResolution.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index c2eb77a3b9e..57ee369a03c 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -38,11 +38,11 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index 308637b576c..d2087b3100a 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -29,11 +29,11 @@ class C extends CBase { //// [baseTypeWrappingInstantiationChain.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 201d0e7ac27..a1499143fd4 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -22,11 +22,11 @@ new C().y; //// [bases.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index af0c24ca5d5..b31e773ff24 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -30,11 +30,11 @@ function foo5(t: T, u: U): Object { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index bf3c8b830aa..31d0c03a5dc 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -28,11 +28,11 @@ function foo3(t: T, u: U) { // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 3bac937c8ae..9b0c2be7b76 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -24,11 +24,11 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 662bfa931fb..74b5bafad38 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -72,11 +72,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index e27e4729cd4..84b7e2d0a52 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -117,11 +117,11 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 687cc9aa0e1..04e8e2d6a2a 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -52,11 +52,11 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 16e50218cd9..9fabe405db0 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -52,11 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 717fe64da4e..52e08ae4401 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -55,11 +55,11 @@ interface I9 extends A { // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 06ca3e91d02..23c1fff2d09 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -60,11 +60,11 @@ class D extends C { //// [callWithSpread.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index c218c8b1687..4682a50a2e6 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -10,11 +10,11 @@ class B extends A { //// [captureThisInSuperCall.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 04965748c0d..4cff94b3b90 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -34,11 +34,11 @@ t4[2] = 10; //// [castingTuple.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 2ddd0f7577e..116fcd0f83d 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -24,11 +24,11 @@ a = b = new A(); //// [chainedAssignment3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index f820e6c39a3..fc23b30e197 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -21,11 +21,11 @@ class C extends B { //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index dbf1a34b465..6d330285f6e 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -33,11 +33,11 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js index 8322bb81783..40717cb4759 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing1.js @@ -12,11 +12,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 6d787a70b8c..8c59c4d6682 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -12,11 +12,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 41092fcd984..1699b3a0f35 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -17,11 +17,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 9bc5cc6f82b..49dfb6e4a22 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -21,11 +21,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js index c178a78e84e..49f1e81d1a1 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing5.js @@ -9,11 +9,11 @@ class Derived extends Based { //// [checkSuperCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 14cbda775d5..8931b0090cf 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -12,11 +12,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js index ad85fa1736c..38a37e03cf3 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing7.js @@ -11,11 +11,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index 3f824a00c96..77e4a4096d0 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -12,11 +12,11 @@ class Super extends Base { //// [checkSuperCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 2ca47382b32..27be18c2a28 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -22,11 +22,11 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index e1e3c1efe58..38bced08608 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -15,11 +15,11 @@ namespace maker { //// [circularTypeofWithFunctionModule.js] // Repro from #6072 var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index e9beaced63d..52335c203b2 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -16,11 +16,11 @@ new CC; //// [classAbstractConstructorAssignability.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index 319c6c237dc..dbad78fbd00 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -12,11 +12,11 @@ var x = new bar(); //// [classAbstractCrashedOnce.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index 9b4faff67c3..e0fb7ad8189 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -18,11 +18,11 @@ class E extends B { //// [classAbstractExtends.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index e7ddb867d28..89b77b62a9a 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -19,11 +19,11 @@ NewB(B); //// [classAbstractFactoryFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index 5063d7fcdd6..df6222f6495 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -27,11 +27,11 @@ class G extends A { //// [classAbstractGeneric.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 73ff32d3d5e..86e6b8e3153 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -9,11 +9,11 @@ new M.B; //// [classAbstractInAModule.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index 8a173bb1bf4..a26a8170f53 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -23,11 +23,11 @@ abstract class GG extends CC {} //// [classAbstractInheritance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 094bc755559..101dca316df 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -29,11 +29,11 @@ c = new B; // Calling new with (non)abstract classes. // var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 01277eb034a..8449689f84a 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -53,11 +53,11 @@ class H { // error -- not declared abstract //// [classAbstractInstantiations2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index 8f304c709cf..345ce20ca1f 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -25,11 +25,11 @@ class DD extends BB { //// [classAbstractOverrideWithAbstract.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index ba9ed10795b..e569f90528e 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -29,11 +29,11 @@ abstract class BB extends AA { //// [classAbstractSuperCalls.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 8e23906e149..61b5fd6fd13 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -19,11 +19,11 @@ a.foo(); //// [classAbstractUsingAbstractMethod1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index 3d09949c0ae..bd17fa96091 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -29,11 +29,11 @@ class DD extends AA { //// [classAbstractUsingAbstractMethods2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility2.js b/tests/baselines/reference/classConstructorAccessibility2.js index e16a623ef43..7c77d13dffb 100644 --- a/tests/baselines/reference/classConstructorAccessibility2.js +++ b/tests/baselines/reference/classConstructorAccessibility2.js @@ -48,11 +48,11 @@ var dc = new DerivedC(1); //// [classConstructorAccessibility2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 0680f590ef4..73451f5fab4 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -32,11 +32,11 @@ class D { //// [classConstructorAccessibility4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index 671530694e7..a6738e229e0 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -13,11 +13,11 @@ class Unrelated { //// [classConstructorAccessibility5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index 4c3d3747157..497f662a8b0 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -28,11 +28,11 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 14f7a33a6b3..7a885bbd8d6 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -28,11 +28,11 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index 1f02b7a75b5..f96f0171046 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -15,11 +15,11 @@ d.p; // public, OK //// [classConstructorParametersAccessibility3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index bf15fcf8fad..a7fa44091c8 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -13,11 +13,11 @@ module M { //// [classDeclarationMergedInModuleWithContinuation.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index 8a49c6ca138..f6cc69037c4 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -9,11 +9,11 @@ function makeBaseClass() { //// [classDeclaredBeforeClassFactory.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index 17dc3850214..9fc1aecd9b2 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -14,11 +14,11 @@ class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 01685865265..6973fbec816 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -4,11 +4,11 @@ var v = class C extends D {}; //// [classExpression2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 3acbcef1ab8..858238d24ee 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -8,11 +8,11 @@ c.c; //// [classExpression3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index 1d661cafb65..1ce5078ed63 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -10,11 +10,11 @@ var C = class extends A { // no error reported! //// [classExpressionExtendingAbstractClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index 902b3327754..2ddf4c8961d 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -13,11 +13,11 @@ class C10 extends Array { } //// [classExtendingBuiltinType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index f9085262904..22bb12d95ec 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -33,11 +33,11 @@ var r8 = D2.other(1); //// [classExtendingClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index d793534bd18..564fd14da51 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -60,11 +60,11 @@ class D5 extends getBadBase() { //// [classExtendingClassLikeType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index 43112c4076b..2a2e0b5eebc 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -16,11 +16,11 @@ class C7 extends foo { } //// [classExtendingNonConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 44fd8a51a86..4d9eaba615e 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -5,11 +5,11 @@ class C2 extends (null) { } //// [classExtendingNull.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 15f225a6dbe..ade53d91a74 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -17,11 +17,11 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 49fbce51aa2..4e2c314b2dd 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -7,11 +7,11 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index 02346427ed3..59a84ba3e0a 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -9,11 +9,11 @@ module M { //// [classExtendingQualifiedName.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index 8add3046013..b2b91a9aedb 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -9,11 +9,11 @@ module M { //// [classExtendingQualifiedName2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index 0f0fb5ba2d9..e8d4c530da1 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -22,11 +22,11 @@ export const b = { //// [b.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -52,11 +52,11 @@ exports.b = { //// [a.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 9bca40631f9..fb44ad9469a 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -15,11 +15,11 @@ module Foo { //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 3d02e381da9..d70305fe5ba 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -8,11 +8,11 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 91ccc496fcb..ef16075c727 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -18,11 +18,11 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index a30b3d8c8d8..507a9bbfcf9 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -5,11 +5,11 @@ class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index e5710190673..f291aedb4ec 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -10,11 +10,11 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index e017ebb8e06..b37daba7f7a 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -10,11 +10,11 @@ class C extends factory(A) {} //// [classExtendsInterfaceInExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 3d100bcfb67..2299df89ab7 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -17,11 +17,11 @@ class D extends Mod.Nested.I {} //// [classExtendsInterfaceInModule.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index 2f32d827dcb..8f6aecec843 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -7,11 +7,11 @@ class E extends E { } // error //// [classExtendsItself.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index d6ca939a910..4ca9186f89c 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -13,11 +13,11 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 6587c65a5fa..86d2cd60887 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -24,11 +24,11 @@ module O { //// [classExtendsItselfIndirectly2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index d36545bafd3..1c42dc28634 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -20,11 +20,11 @@ class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -38,11 +38,11 @@ var C = (function (_super) { }(E)); // error //// [classExtendsItselfIndirectly_file2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -56,11 +56,11 @@ var D = (function (_super) { }(C)); //// [classExtendsItselfIndirectly_file3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -74,11 +74,11 @@ var E = (function (_super) { }(D)); //// [classExtendsItselfIndirectly_file4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -92,11 +92,11 @@ var C2 = (function (_super) { }(E2)); // error //// [classExtendsItselfIndirectly_file5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -110,11 +110,11 @@ var D2 = (function (_super) { }(C2)); //// [classExtendsItselfIndirectly_file6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 3b1fd2de5cf..a36ab4355ad 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -5,11 +5,11 @@ class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index d8cadbbe32b..07618bead38 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -14,11 +14,11 @@ class D extends null { //// [classExtendsNull.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index 79ae0cf243f..908c91850e8 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -10,11 +10,11 @@ module M { //// [classExtendsShadowedConstructorFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index b2a38318bab..fbbb91d29ea 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -7,11 +7,11 @@ class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index bd9f925b7d6..72779e9eb97 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -5,11 +5,11 @@ class D extends C, { //// [classHeritageWithTrailingSeparator.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index e564beda164..80acbd8d204 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -15,11 +15,11 @@ c2 = c; //// [classImplementsClass2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 707a9dbe6b9..4c2d096f465 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -16,11 +16,11 @@ c2 = c; //// [classImplementsClass3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 5748fbb30f5..49c43b8ef3a 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -18,11 +18,11 @@ c2 = c; //// [classImplementsClass4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 12388b65a17..a10b08fad2d 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -19,11 +19,11 @@ c2 = c; //// [classImplementsClass5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 52959ed351a..ec814464801 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -23,11 +23,11 @@ c2.bar(); // should error //// [classImplementsClass6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index 29dd552da9c..f50c50e4c90 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -12,11 +12,11 @@ class D123 extends C123 { //// [classIndexer3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index d53bdbd8214..61a2ce9f262 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -4,11 +4,11 @@ class A extends A { } //// [classInheritence.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index f8a691ead9a..ec7a1f1babf 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -17,11 +17,11 @@ class Derived2 extends Base<{ bar: string; }> { //// [classIsSubtypeOfBaseType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index c9859337efe..e7dd6959731 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -21,11 +21,11 @@ a.foo(); //// [classOrder2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index 14ab934d77c..5631152514f 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -17,11 +17,11 @@ class foo extends baz {} //// [classOrderBug.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index da6e44e42fe..cb958b2e12e 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -17,11 +17,11 @@ C2.bar(); // valid //// [classSideInheritance1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index a75bef9fbaf..9887472615f 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -22,11 +22,11 @@ class TextBase implements IText { //// [classSideInheritance2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index 1538ed6e07e..9ce60d012f4 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -20,11 +20,11 @@ var r3: typeof A = C; // ok //// [classSideInheritance3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 5e11c448307..eb9541ab737 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -115,11 +115,11 @@ class R { //// [classUpdateTests.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index d6638d88cec..249fa099007 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -42,11 +42,11 @@ var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index fde7ad2da32..07b592bf730 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -51,11 +51,11 @@ module Generics { //// [classWithConstructors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 0188835fdac..0a2bb39b449 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -30,11 +30,11 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 1ed38d2fee8..0e08046f8c2 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -21,11 +21,11 @@ var r3 = r.foo; //// [classWithStaticMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index ef7490f572d..97ccd8e1410 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -95,11 +95,11 @@ class e { //// [classdecl.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index 3fd40d61762..a622261b685 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -24,11 +24,11 @@ module Path.Utils { //// [clodulesDerivedClasses.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index 77025b6aa0c..5f7fc0cccdf 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -41,11 +41,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInAccessors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index 02e88a60761..d516c06ad18 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -26,11 +26,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 91f9f5617df..1401411ad8e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -30,11 +30,11 @@ class c extends Foo { //// [collisionSuperAndLocalFunctionInMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 520367125fe..99fe7e8dcef 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -20,11 +20,11 @@ class b extends Foo { //// [collisionSuperAndLocalFunctionInProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index e77c21c058e..3278f9bd3a8 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -34,11 +34,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInAccessors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index 1a2f6b35800..dcbf08024a9 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -22,11 +22,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 028ce3ae4a9..541035dd43b 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -20,11 +20,11 @@ class c extends Foo { //// [collisionSuperAndLocalVarInMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index c8ed5fc9d8f..8371687ff34 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -19,11 +19,11 @@ class b extends Foo { //// [collisionSuperAndLocalVarInProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index 2c0316dc66b..165943ec132 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -13,11 +13,11 @@ class Foo extends base { //// [collisionSuperAndNameResolution.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index ef86232c1f1..e2771fadf1f 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -64,11 +64,11 @@ class Foo4 extends Foo { //// [collisionSuperAndParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index d70f7da34e8..818f15b3f15 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -11,11 +11,11 @@ class Foo2 extends Foo { //// [collisionSuperAndParameter1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index 919265f587e..f905e520866 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -32,11 +32,11 @@ class b4 extends a { //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index f380d8dc4ba..a5e68e4eaab 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -20,11 +20,11 @@ class b2 extends a { //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index e7feed00b6a..26150c60d12 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -153,11 +153,11 @@ i2_i = i3_i; //// [commentsInheritance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 15b82315972..39a53a241c9 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -196,11 +196,11 @@ var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 7b541b2c304..63bd4442479 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -170,11 +170,11 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 9cf6be1f116..05657e3ec5e 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -170,11 +170,11 @@ var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index f0fe513de27..685fb769e99 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -113,11 +113,11 @@ var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 4b31f7403e1..48d598efe26 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -151,11 +151,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index 06472bc1527..c5e512a735b 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -151,11 +151,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index 91fa37507bf..e93fc8c7b50 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -261,11 +261,11 @@ var r8b11 = b11 !== a11; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index 2eb5c7de9e8..a0e7b1a424e 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -223,11 +223,11 @@ var r8b9 = b9 !== a9; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index a5287dcb0af..e8d706eb290 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -109,11 +109,11 @@ var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index c34ed06252f..51e077113dd 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -166,11 +166,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index 0056917d60d..86c6fb86be2 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -166,11 +166,11 @@ var r8b6 = b6 !== a6; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 73c2b62cd3a..2cd9fc1bb29 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -80,11 +80,11 @@ var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index bfbbbab2bc5..8a865e2d024 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -49,11 +49,11 @@ class FooBase { //// [complexClassRelationships.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 187a4389261..5af6a97f781 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -7,11 +7,11 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index ec8610a1164..064f2157c1e 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -125,11 +125,11 @@ foo() += value; //// [compoundAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index c7060a5120d..bd152ea11ad 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -87,11 +87,11 @@ foo() **= value; //// [compoundExponentiationAssignmentLHSIsValue.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 75c032d7f91..ab1d81e8fb0 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -10,11 +10,11 @@ class C extends Base { //// [computedPropertyNames24_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index a300b687f53..6443c3cedb2 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -15,11 +15,11 @@ class C extends Base { //// [computedPropertyNames25_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 16566ec14e7..a34bcef3b3d 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -12,11 +12,11 @@ class C extends Base { //// [computedPropertyNames26_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index a7d16a4d18e..00d9c9f0f43 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -7,11 +7,11 @@ class C extends Base { //// [computedPropertyNames27_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 5eb7b307b62..c6e2c5d7732 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -12,11 +12,11 @@ class C extends Base { //// [computedPropertyNames28_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 44b748a0af2..f029b9b8651 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -17,11 +17,11 @@ class C extends Base { //// [computedPropertyNames30_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 97f03e71923..fd0db774e71 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -17,11 +17,11 @@ class C extends Base { //// [computedPropertyNames31_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index 100258284ba..e49d4426cf7 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -14,11 +14,11 @@ class D extends C { //// [computedPropertyNames43_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index 6064411248d..46029ee5475 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -13,11 +13,11 @@ class D extends C { //// [computedPropertyNames44_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index d3b6ccc7552..7108935ab9e 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -14,11 +14,11 @@ class D extends C { //// [computedPropertyNames45_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 609c81f173d..5c948261bb2 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -49,11 +49,11 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index df5c7aac44f..01b0fe327fa 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -25,11 +25,11 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 70effecc498..e204db38c28 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -15,11 +15,11 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 74e70d97bd9..22ca8603ffb 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -16,11 +16,11 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index 49f93e2497e..074cfa49b47 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -21,11 +21,11 @@ class Container { //// [constraintCheckInGenericBaseTypeReference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index e2a884c4589..53ba73b8ba9 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -72,11 +72,11 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index 87392413b1b..f6629487ff5 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -115,11 +115,11 @@ module Errors { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index fb09253688d..3c20e2f96b5 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -62,11 +62,11 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 6ad855c7d32..1d8efafc234 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -52,11 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index 5e768b4a41b..f6436b7d3e2 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -55,11 +55,11 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index 47c508cab06..877cef3dd0a 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -17,11 +17,11 @@ class Sub extends Super { //// [constructorArgs.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 633a7a155c5..27ed085a009 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -21,11 +21,11 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index 07e11b5c681..56891defbe0 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -35,11 +35,11 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index f2b90a57161..dae4e0bab23 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -33,11 +33,11 @@ module Generic { //// [constructorHasPrototypeProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index 67df7fb4e22..291ea545733 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -27,11 +27,11 @@ f1.bar1(); //// [constructorOverloads2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index 79b648e0cbb..8ba67658a08 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -24,11 +24,11 @@ f1.bar1(); //// [constructorOverloads3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithCapturedSuper.js b/tests/baselines/reference/constructorWithCapturedSuper.js index 2034ea11c4f..503742de9fe 100644 --- a/tests/baselines/reference/constructorWithCapturedSuper.js +++ b/tests/baselines/reference/constructorWithCapturedSuper.js @@ -54,11 +54,11 @@ class D extends A { //// [constructorWithCapturedSuper.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index dbeed3de1fd..3193d69ed3c 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -282,11 +282,11 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 60cc6d99771..4fda0eca214 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -16,11 +16,11 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index 063ae781b6f..6e6ea60691c 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -16,11 +16,11 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index c2bf66b2973..0678ff5bf74 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -14,11 +14,11 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 8c6de85ca93..b71997f21fe 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -12,11 +12,11 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index b5d473c86ce..d46ff63f62a 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -5,11 +5,11 @@ class ExtendsNull extends null { //// [declFileClassExtendsNull.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index 3262454f72d..3d90e148d42 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -11,11 +11,11 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index 0333bf19d21..c2d7a1faf33 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -14,11 +14,11 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 6946e840dbe..8d7f16745c0 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -42,11 +42,11 @@ export var j = C.F6; //// [declFileGenericType.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index 1b9a79e95cb..1c6f2002da2 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -44,11 +44,11 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 5edd9c8c19d..da5177c89df 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -22,11 +22,11 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index 07809bc8dec..a396c81c27f 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -20,11 +20,11 @@ module A.B.C { //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index e3ebe2d0a42..7a0fe6ed603 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -16,11 +16,11 @@ q.s; //// [declarationEmitExpressionInExtends.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 284b0ca83ce..1df6168f09b 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -14,11 +14,11 @@ class MyClass extends getClass(2) { //// [declarationEmitExpressionInExtends2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index 41383d43d9e..2a291f273dc 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -46,11 +46,11 @@ export class MyClass4 extends getExportedClass(undefined)>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 9c295b584ad..51cca070d1f 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -35,11 +35,11 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index bb9fcbc1952..35dd1e197e2 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -16,11 +16,11 @@ class Derived extends Base { //// [derivedClassFunctionOverridesBaseClassAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 10cad78a322..03310fcfc4c 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -42,11 +42,11 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index 875270b57f3..36ad6580c18 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -19,11 +19,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index cd04b7ede37..a7c35a96ac3 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -17,11 +17,11 @@ new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index 9dc81e9b5ad..c14783c8337 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -17,11 +17,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesPrivates.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index 2ae532f0c84..9230a295f5b 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -38,11 +38,11 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 0f321c18241..dc9059f956e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -65,11 +65,11 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index 014cea9753e..615bdcddcf0 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -73,11 +73,11 @@ class Derived10 extends Base { //// [derivedClassOverridesProtectedMembers3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index 5e4804b5bac..8e90218b063 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -16,11 +16,11 @@ class Derived2 extends Derived1 { //// [derivedClassOverridesProtectedMembers4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 73d620ce2f5..3bbd661c704 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -64,11 +64,11 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index 81fda59ae78..b53c736b857 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -25,11 +25,11 @@ class Derived2 extends Base2 { //// [derivedClassOverridesWithoutSubtype.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index 26bf27bd023..c127b1993ef 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -97,11 +97,11 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 5c29ea9ed89..92ef489cd4c 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -34,11 +34,11 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index bce8697a7e8..787bdefc79c 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -30,11 +30,11 @@ class Derived4 extends Base { //// [derivedClassSuperCallsWithThisArg.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index 997d25693a6..2809d899351 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -23,11 +23,11 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index c1304ad5242..8b69ea00102 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -23,11 +23,11 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index 264616cea7f..98e4bdd4b43 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -23,11 +23,11 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 63a78e3d3b6..315d0322ed2 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -23,11 +23,11 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 01d7c130f94..dd89a166cc1 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -61,11 +61,11 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 1b8cca7a0a8..c38b9b3bd00 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -24,11 +24,11 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index e2ecad8be4b..a50008d4142 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -34,11 +34,11 @@ Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 26095ed6628..1680b9178ff 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -23,11 +23,11 @@ class Derived extends Base { //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index f01edcc8a3a..2b65181cea9 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -35,11 +35,11 @@ Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index d3ce1f3cdbf..ca746223e1b 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -27,11 +27,11 @@ var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index c15ac71c573..492682b67bc 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -35,11 +35,11 @@ var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index fe02d135c24..cf4d5cadecc 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -49,11 +49,11 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index f310c0e5fd2..3bb1f7793ef 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -32,11 +32,11 @@ b.hue(); //// [derivedClasses.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index abd8954fe22..bab2879b229 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -44,11 +44,11 @@ var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index b32d0a79d6b..9d076ad63a7 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -19,11 +19,11 @@ class Derived extends Base { //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index b5ef2f81099..faa148c65a5 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -22,11 +22,11 @@ var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/destructuringParameterDeclaration5.js b/tests/baselines/reference/destructuringParameterDeclaration5.js index a00fc248939..d2499528735 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration5.js +++ b/tests/baselines/reference/destructuringParameterDeclaration5.js @@ -53,11 +53,11 @@ d3({ y: "world" }); //// [destructuringParameterDeclaration5.js] // Parameter Declaration with generic var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js index 325a15007c8..3a8bbdb0c73 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitParameterPropertyDeclaration1.js @@ -15,11 +15,11 @@ class B extends A { //// [emitSuperCallBeforeEmitParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js index 2d97d0a9865..d8145f6dc27 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclaration1.js @@ -17,11 +17,11 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclaration1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js index 63de121ed4d..75c618d84db 100644 --- a/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js +++ b/tests/baselines/reference/emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js @@ -15,11 +15,11 @@ class B extends A { //// [emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 5488e3aa005..16712fb82cf 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -29,11 +29,11 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index 16493baae98..7a22f87cfb4 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -6,11 +6,11 @@ class B extends A { //// [emptyModuleName.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 98eb91ce417..c5403b4d685 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -13,11 +13,11 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 6c7a1441b05..17a96d335f3 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -76,11 +76,11 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 70d777644c6..04ce626be32 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -130,11 +130,11 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index d7797d7e350..49ddbe58dac 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -74,11 +74,11 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index c958470d077..c909a68ccf7 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -16,11 +16,11 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 6834e6139aa..9d66d2d8dc8 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -86,11 +86,11 @@ declare module AmbientMod { //// [es6ClassTest.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index c456f270d6e..5133757348b 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -160,11 +160,11 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 899ac4100eb..48937285684 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -10,11 +10,11 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 4be64d67745..f9ffa44e82c 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -25,11 +25,11 @@ define(["require", "exports"], function (require, exports) { }); //// [exportAssignmentOfGenericType1_1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index c9c59360621..c1827d0df9e 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -20,11 +20,11 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index c05c43c1d27..3424f39bd16 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -21,11 +21,11 @@ module N { //// [extBaseClass1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index d55b201a728..ffc3249d7bf 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -12,11 +12,11 @@ module M { //// [extBaseClass2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index 1a690094925..ed5232d88c9 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -15,11 +15,11 @@ d.foo; //// [extendAndImplementTheSameBaseType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index d262bcae95f..e9f37d718ff 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -18,11 +18,11 @@ var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 25be2160ecb..3a755b0e6f6 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -5,11 +5,11 @@ class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 746379cc73c..6e6943d5766 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -22,11 +22,11 @@ module.exports = x; //// [foo2.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index d8562243c66..30c1151c332 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -12,11 +12,11 @@ var e: E = new E(1); //// [extendConstructSignatureInInterface.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index ac2f6c7ff93..066d19560b6 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -5,11 +5,11 @@ class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 5b8800a553d..b82c3e2233b 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -7,11 +7,11 @@ class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 96b1bf98538..21968a3c47b 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -11,11 +11,11 @@ class C extends abc.XYZ { //// [extendPrivateConstructorClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index 5e5f09622ee..b689e9b2640 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -43,11 +43,11 @@ exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -64,11 +64,11 @@ exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index cf06895cb86..ec727e6b757 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -8,11 +8,11 @@ class D extends C extends C { //// [extendsClauseAlreadySeen.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 3dd977b657a..7b960bb97eb 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -8,11 +8,11 @@ class D extends C extends C { //// [extendsClauseAlreadySeen2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index 34e8b10d70c..ae117674a81 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -20,11 +20,11 @@ var z = c.foo().bar().baz(); // Fluent pattern //// [fluentClasses.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index b57d6383d96..44e7cf24bf4 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -82,11 +82,11 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 4670bf17807..437e3fb9aef 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -65,11 +65,11 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5f400591741..ea3bee7b12b 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -56,11 +56,11 @@ for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 67f13db465e..4a641451815 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -76,11 +76,11 @@ var f13 = () => { //// [functionImplementationErrors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 9fd603f16d3..26468d8af80 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -159,11 +159,11 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC //// [functionImplementations.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index f7365781a2c..83b889fa22b 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -16,11 +16,11 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index 6f534e64e88..bc49c602acb 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -16,11 +16,11 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 43aa5dd6e9a..782f3e985a1 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -357,11 +357,11 @@ var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } //// [generatedContextualTyping.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index 73f5cb87bed..35c31bb6677 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -14,11 +14,11 @@ class SubClass extends BaseClass { //// [genericBaseClassLiteralProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index fb4f51749cd..8e91f9e228d 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -17,11 +17,11 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index d625797ea53..d7564d3e052 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -110,11 +110,11 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index ae844d043e6..28c0fbcec7e 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -34,11 +34,11 @@ var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index e3d80ebd572..32e7bc1e74c 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -42,11 +42,11 @@ var r7 = f3(null, x => x); // any // Generic call with constraints infering type parameter from object member properties // No errors expected var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index 387c4526764..f54727317e5 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -40,11 +40,11 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index d4d86fe5793..cba1152fb02 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -25,11 +25,11 @@ module M { //// [genericCallbacksAndClassHierarchy.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index 152237d458d..41252322414 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -33,11 +33,11 @@ s.genericVar = 12; //// [genericClassExpressionInFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index aa3e06cf57e..d91a43805e3 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -7,11 +7,11 @@ class C { //// [genericClassInheritsConstructorFromNonGenericClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 4efb95cdeba..b5c8f47bfd4 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -77,11 +77,11 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 32b29319c12..ea236e40203 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -12,11 +12,11 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index a8a3db2f3a0..94c22c1241f 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -19,11 +19,11 @@ var z = v2.b; //// [genericClasses3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index 97bc5d27ee0..c66279ec873 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -28,11 +28,11 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index 66df4074441..af5f46c3c57 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -27,11 +27,11 @@ module EndGate.Tweening { //// [genericConstraintOnExtendedBuiltinTypes2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index edd74ea92e4..1e231a172c3 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -14,11 +14,11 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 9fb286b1c40..2438206cbf2 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -14,11 +14,11 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index 7ed0c8179dd..6d4112fb666 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -12,11 +12,11 @@ var c:Constructor> = B; // shouldn't error here //// [genericInheritedDefaultConstructors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index 73a64a65763..dd494b1bdcd 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -17,11 +17,11 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index 48e8b367486..45e39d173a1 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -16,11 +16,11 @@ class MyEventWrapper extends BaseEventWrapper { //// [genericPrototypeProperty3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index a9ea14337f4..558f6034b16 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -28,11 +28,11 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index 60d214a1914..bea6d81dbaa 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -32,11 +32,11 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index 416317ea9f6..bcdaaa3958b 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -15,11 +15,11 @@ var r5: A = >[]; // error //// [genericTypeAssertions2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index a857ae3ef8d..a2a7548bb63 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -27,11 +27,11 @@ function foo2(x: T) { //// [genericTypeAssertions4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index 8e69ccdbbc3..cdeb709fdfb 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -26,11 +26,11 @@ var c: A = >b; //// [genericTypeAssertions6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeConstraints.js b/tests/baselines/reference/genericTypeConstraints.js index 48baec0e6f6..cbb03b683a8 100644 --- a/tests/baselines/reference/genericTypeConstraints.js +++ b/tests/baselines/reference/genericTypeConstraints.js @@ -15,11 +15,11 @@ class BarExtended extends Bar { //// [genericTypeConstraints.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index d123ce1bd2e..8704103d530 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -41,11 +41,11 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index e03295d5086..75317fe0c81 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -41,11 +41,11 @@ var k = null; // it is an error to use a generic type without type arguments // all of these are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index 25f443c9bf4..f91d9b5d6cf 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -16,11 +16,11 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index 828a2894ed0..e15125ed70e 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -134,11 +134,11 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 527e241c35c..83e40177434 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -165,11 +165,11 @@ do { }while(fn) //// [ifDoWhileStatements.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 37fa76388f0..7e138dbf4a1 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -22,11 +22,11 @@ class Derived extends Base { //// [illegalSuperCallsInConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index 916bbaebf7a..20a95fbcdc8 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -4,11 +4,11 @@ class D implements C extends C { } //// [implementClausePrecedingExtends.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index e6831db5f9c..07819ad752c 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -87,11 +87,11 @@ module M2 { //// [implementingAnInterfaceExtendingClassWithPrivates2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 4e2dc2514d2..d79ae31ac25 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -43,11 +43,11 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 9f2461ebd42..290e331b3f1 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -22,11 +22,11 @@ exports.Greeter = Greeter; //// [importAsBaseClass_1.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index 7a28d808710..f5214bcceb8 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -69,11 +69,11 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index 7fc3f22e1e2..0e87f20cb79 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -71,11 +71,11 @@ var y = tslib_1.__assign({}, o); var x = tslib_1.__rest(y, []); //// [script.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index 820913a0f94..b7944b45867 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -61,11 +61,11 @@ C = tslib_1.__decorate([ ], C); //// [script.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 0c6a299ee5a..cb3f0378328 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -22,11 +22,11 @@ define(["require", "exports"], function (require, exports) { }); //// [Bar.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index 25c82b8cb7b..c19e5be7e13 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -22,11 +22,11 @@ exports.Super = Super; //// [importUsedInExtendsList1_1.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index 8a9b10c34c7..2dfc6d69e06 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -30,11 +30,11 @@ class K extends J { //// [indexerConstraints2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index dbf484907e7..d912f07c145 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -4,11 +4,11 @@ class b extends a{ } //// [indirectSelfReference.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index 6c73f2fa095..7c362a384aa 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -4,11 +4,11 @@ class b extends a { } //// [indirectSelfReferenceGeneric.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index 7fb9d286791..4589d2d9671 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -26,11 +26,11 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index aadf2edb314..4e58f0b490d 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -4,11 +4,11 @@ interface I extends T { } //// [inheritFromGenericTypeParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index 81717bfec05..15cdaba7d01 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -12,11 +12,11 @@ interface A extends C, C2 { // ok //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index b6195423128..72fa6c80a81 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -36,11 +36,11 @@ class Baad extends Good { //// [inheritance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index 6f1e76e8925..b3d87d0452f 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -63,11 +63,11 @@ l1 = c; //// [inheritance1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 3a79d28b51e..5c1568663dc 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -12,11 +12,11 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index 6b49c0fb9b5..f35305b2bcc 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -12,11 +12,11 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index f801c6cdd0d..8a6de50ee60 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -12,11 +12,11 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index b85a1f7d99e..be1cecd939d 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -19,11 +19,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index ac0b0376749..76829925c62 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -16,11 +16,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index eaae0a3c126..fff0dd7b832 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -14,11 +14,11 @@ class b extends a { //// [inheritanceMemberAccessorOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 8ed9f07dbb6..085b3966541 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -16,11 +16,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index a05acd4752f..fc405638f0f 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -13,11 +13,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 1b27447d3dc..94ea69a7fba 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceMemberFuncOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index c18e12d38cb..866323cd204 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -15,11 +15,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index e9b333ddee1..fe8c0457240 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 0ccfa544a7c..e431d295d01 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -9,11 +9,11 @@ class b extends a { //// [inheritanceMemberPropertyOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index c150ef6434d..1e1a7c69a08 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -9,11 +9,11 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 8753fbe9b46..01370a3183c 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -16,11 +16,11 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index 3abc4b6d453..bff113f80e3 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -19,11 +19,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index 8215f4fdf0e..773f97c2bc9 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -16,11 +16,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index 3375597f114..73eb1021d62 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -14,11 +14,11 @@ class b extends a { //// [inheritanceStaticAccessorOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index 7f27718a1fb..8d2aab0bbd1 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -16,11 +16,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index 03de6f62af4..c41281eecc4 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -13,11 +13,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index a1380343bee..cdbc3913a22 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -13,11 +13,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index e28d0a026dd..77a8e21dc74 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index d8155525444..0f0eb43fdd6 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index 9b696526a44..fd92a887219 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceStaticFunctionOverridingInstanceProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 59dc7e5fff1..7a74aea52d6 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -9,11 +9,11 @@ class b extends a { //// [inheritanceStaticMembersCompatible.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index e6e2edf0d5b..f1805811345 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -9,11 +9,11 @@ class b extends a { //// [inheritanceStaticMembersIncompatible.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index 7872f35ae90..435bf6d0a8d 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -14,11 +14,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index 24a6135b30c..ee69b89dd4c 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -11,11 +11,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index 182fb27a970..7fd7cca98c4 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -9,11 +9,11 @@ class b extends a { //// [inheritanceStaticPropertyOverridingProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index a2538cf999d..a11136ba6b7 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -16,11 +16,11 @@ new Derived(3); //// [inheritedConstructorWithRestParams.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 17cca41912d..7d06886f562 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -36,11 +36,11 @@ new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 5e7f49be559..3a20f4313b6 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -23,11 +23,11 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index c85caf07e53..a0b15b0e287 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -91,11 +91,11 @@ function fn8(x: Alpha|Beta|Gamma) { //// [instanceOfAssignability.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 8eb7e3321f9..b80c8f0ff13 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -44,11 +44,11 @@ module Generic { //// [instancePropertiesInheritedIntoClassType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index 58192144612..c42f071ddb9 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -9,11 +9,11 @@ class C2 extends C1 { //// [instanceSubtypeCheck2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 8eefac93223..32c15674984 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -73,11 +73,11 @@ function goo(x: A) { //// [instanceofWithStructurallyIdenticalTypes.js] // Repro from #7271 var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 01b8da419c4..7eed6d7f5fc 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -32,11 +32,11 @@ return null; //// [instantiatedReturnTypeContravariance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 9b75b9e4d10..4cca8c1c8b9 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -42,11 +42,11 @@ obj = bar; //// [interfaceClassMerging.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index 93c05759367..8d860ae95e7 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -38,11 +38,11 @@ foo = bar; //// [interfaceClassMerging2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index 5e8d36136a8..fc5afcdddac 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -20,11 +20,11 @@ class Location { //// [interfaceExtendsClass1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index d567d5661d9..334ac5cd292 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -29,11 +29,11 @@ d = c; // error //// [interfaceExtendsClassWithPrivate1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index b7e2fe715cb..cc3e8163d18 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -25,11 +25,11 @@ class D2 extends C implements I { // error //// [interfaceExtendsClassWithPrivate2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index f90d58edd4f..aa9bf7b4cf8 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -42,11 +42,11 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 4b88d58fd18..897fa17c4e5 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -81,11 +81,11 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 4e473a95bf5..466d7eb9049 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -55,11 +55,11 @@ var m = M.A; //// [invalidMultipleVariableDeclarations.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 7dc01b18b5b..a61d036d9ed 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -22,11 +22,11 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index e430e1eda1b..7c295a315f9 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -16,11 +16,11 @@ export var z = x; //// [file1.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 7955a6e65b9..92d8b063a44 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -26,11 +26,11 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index e9d76ee4d7f..173b5a47347 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -368,11 +368,11 @@ function f(p: K) { //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index cdc03b555ef..f138aa162bd 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -36,11 +36,11 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index d2f2ed8dc0d..80eebe9cb00 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -19,11 +19,11 @@ class C extends B { //// [lift.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index 27045613c81..b0aaed7906a 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -143,11 +143,11 @@ function f6() { //// [localTypes1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index 86504bdf8f9..be611c2e5cd 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -28,11 +28,11 @@ var y3: C1 = {}; //// [m7Bugs.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index 886afebe358..d393ec00e2c 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -20,11 +20,11 @@ var A = (function () { }()); //// [b.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index 445fbac34b7..2b1f468c873 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -38,11 +38,11 @@ define(["require", "exports"], function (require, exports) { }); //// [b.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 1772d6139d8..29d140f3f68 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -48,11 +48,11 @@ grandchild.method2(); //// [mergedInheritedClassInterface.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index 65477941c0a..b705d58e1eb 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -33,11 +33,11 @@ var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index c3d2cc0ea57..c002a30a828 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -40,11 +40,11 @@ module M { //// [mergedInterfacesWithInheritedPrivates3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/missingPropertiesOfClassExpression.js b/tests/baselines/reference/missingPropertiesOfClassExpression.js index a2d38f47c62..7f468d14def 100644 --- a/tests/baselines/reference/missingPropertiesOfClassExpression.js +++ b/tests/baselines/reference/missingPropertiesOfClassExpression.js @@ -8,11 +8,11 @@ class George extends class { reset() { return this.y; } } { //// [missingPropertiesOfClassExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 99553e04108..24a04eff872 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -6,11 +6,11 @@ class C2 implements M { } //// [moduleAsBaseType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index 6471abaf13d..57087e49aa1 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -17,11 +17,11 @@ define(["require", "exports"], function (require, exports) { }); //// [moduleImportedForTypeArgumentPosition_1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index f7532442020..cedfcd8b86c 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -60,11 +60,11 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index f0074664ad1..536f694ba17 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -40,11 +40,11 @@ class Baad extends Good { //// [multipleInheritance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 90ffbf5148f..0e846877cb8 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -12,11 +12,11 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index 25815641e95..12859100009 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -14,11 +14,11 @@ class Child extends Parent { //// [noImplicitAnyMissingGetAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index cb37fafd9f9..bb6e1e53f0f 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -13,11 +13,11 @@ class Child extends Parent { //// [noImplicitAnyMissingSetAccessor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 49a3a7e05eb..132145dbf3f 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -7,11 +7,11 @@ class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 9c44df83757..046414eba34 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -48,11 +48,11 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 4a8c3caf12b..ebe02d70f7d 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -14,11 +14,11 @@ class C { //// [numericIndexerConstraint3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 4fe10b54ee4..fda23bce27c 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -14,11 +14,11 @@ var x: { //// [numericIndexerConstraint4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index e6fce38d818..f87198f32a7 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -14,11 +14,11 @@ var r2: string = i2[1]; // error: numeric indexer returns the type of the string //// [numericIndexerTyping2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index 7d192f7ee9a..72645662e01 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -57,11 +57,11 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 84caecad63a..ffe2ca6ab7e 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -56,11 +56,11 @@ var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index a00f33b2a97..550ef48125d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -125,11 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index fa176f483d7..249c39be6d3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -128,11 +128,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index a09e844b6c4..7f16c30799f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -125,11 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index a187c353056..b1902922277 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -123,11 +123,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 5d130734c7b..8de254e15c1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -41,11 +41,11 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index f28147ba50d..6970f06854b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -27,11 +27,11 @@ var c3: C3; //// [objectTypesIdentityWithPrivates3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index a561df31753..3c45a453d88 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -125,11 +125,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index 282ec34ea5f..e9dce1d5366 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -128,11 +128,11 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index 5033f9d1581..c18a38ec343 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -12,11 +12,11 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index 3af46d7e41a..e79c6f85fd3 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -59,11 +59,11 @@ class Derived extends Base { //// [optionalMethods.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 2bcfbd44da5..5c8503a9bef 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -126,11 +126,11 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index 52fa0a38517..03db09eac1a 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -9,11 +9,11 @@ class Y extends Z { //// [optionalParamInOverride.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/optionalParameterProperty.js b/tests/baselines/reference/optionalParameterProperty.js index ed1b910241d..fc288d09767 100644 --- a/tests/baselines/reference/optionalParameterProperty.js +++ b/tests/baselines/reference/optionalParameterProperty.js @@ -13,11 +13,11 @@ class D extends C { //// [optionalParameterProperty.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 398978793c1..810cd73b502 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -10,11 +10,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index f220eb3e0ed..6e905832277 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -9,11 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index e5a1bd65cad..ff8f1f6fd0a 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -10,11 +10,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 72b6bf09dd1..1a25b6358fa 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -9,11 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/a.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index 8308f58cc99..b144c6e74c8 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -32,11 +32,11 @@ export class B extends A { } //// [all.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 102664ea71a..0f20e86cd00 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -9,11 +9,11 @@ emittedFile:all.js sourceFile:tests/cases/compiler/ref/b.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index e73c84abb14..eddb4181ad6 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -41,11 +41,11 @@ var v=x.g; //// [overload1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index 18d16ef9913..058a294833c 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -24,11 +24,11 @@ class D implements MyDoc { //// [overloadOnConstConstraintChecks1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index f78ed9a7d50..9cbbedfabb3 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -13,11 +13,11 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index b26d1067f55..5f710f17837 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -14,11 +14,11 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index db2d6e9adba..afa8d83cb13 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -15,11 +15,11 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index 438c41fa8bd..534a4f9dde8 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -13,11 +13,11 @@ foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 24de1599796..b154ceff837 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -96,11 +96,11 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 5f81c47c9ff..45d07483f4f 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -103,11 +103,11 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 02cc668c64d..4a64e8be917 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -104,11 +104,11 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index 606d4aa674c..774436ba5ee 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -27,11 +27,11 @@ var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 7beb3662ff1..6cc20caa80e 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -29,11 +29,11 @@ var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index b5bfa6ac627..f7fb709cda2 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -9,11 +9,11 @@ class Derived2 extends Base2 { //// [overridingPrivateStaticMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index 293309025fe..647ddb733a7 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -4,11 +4,11 @@ class C extends A # { //// [parseErrorInHeritageClause1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index 482a078f3d1..6676b2499dd 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -8,11 +8,11 @@ class Any extends Type { //// [parser509630.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index fd9c5822dd8..ae274f3dcbb 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -221,11 +221,11 @@ class c6 extends c5 { //// [parserAstSpans1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 5b8ea6c183a..11c087cf568 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -4,11 +4,11 @@ class C extends A extends B { //// [parserClassDeclaration1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index a419598461f..886fce51892 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -4,11 +4,11 @@ class C implements A extends B { //// [parserClassDeclaration3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index 6ed902beed0..d9f1f1acbed 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -4,11 +4,11 @@ class C extends A implements B extends C { //// [parserClassDeclaration4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index a8e54191fee..38fa87e2ce1 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -4,11 +4,11 @@ class C extends A implements B implements C { //// [parserClassDeclaration5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 648213d1516..a4720967984 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -4,11 +4,11 @@ class C extends A, B { //// [parserClassDeclaration6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index 5cd993caf70..231b4fb3d06 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -4,11 +4,11 @@ class C extends A, { //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 9d5b0393218..584088cd511 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -4,11 +4,11 @@ class C extends A implements { //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 010eace1920..97dd2af2925 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -4,11 +4,11 @@ class C extends A, implements B, { //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index f85f5b6fd1a..a072e9c3565 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -19,11 +19,11 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index 1491fd37b5f..7e8694e9416 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -19,11 +19,11 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index d2e8c5ff1f7..0d42dc5f47b 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -459,11 +459,11 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0e39573238c..0d942cb1c68 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2368,11 +2368,11 @@ module TypeScript { // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index f173052a112..5090c33bdc8 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2097,11 +2097,11 @@ module Harness { // limitations under the License. // var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index 0d1097b4773..e09713cfdfa 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -17,11 +17,11 @@ testError((t1, t2, t3: D) => {}) //// [partiallyAnnotatedFunctionInferenceError.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index c55721cb647..2647bd4d8ee 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -36,11 +36,11 @@ testRest((t2, ...t3: D[]) => {}) //// [partiallyAnnotatedFunctionInferenceWithTypeParameter.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 6ef048203ae..d378e5abee0 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -33,11 +33,11 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index 07ea7691ac2..154e4ad453d 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -130,11 +130,11 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo //// [privacyClass.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index c1b219a3eaf..04f18d61340 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -100,11 +100,11 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -291,11 +291,11 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index 9698b1a0977..017bd375b54 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -62,11 +62,11 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 0f02de4ad4d..cf1a6cb1d44 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -11,11 +11,11 @@ class D extends Base { //// [privateAccessInSubclass1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 5f9a857269e..72f1ea01f0d 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -15,11 +15,11 @@ class Derived extends Base { //// [privateInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index f9d4fe56c39..96808c3daeb 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -23,11 +23,11 @@ let { priv: a, prot: b, privateMethod: f } = k; // error //// [privateProtectedMembersAreNotAccessibleDestructuring.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 548b08b9b92..19da5064fbb 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -10,11 +10,11 @@ class Derived extends Base { //// [privateStaticMemberAccessibility.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index a4171441430..eceda383092 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -17,11 +17,11 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 26700d01d59..bf8401f6b4d 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,9 +1,9 @@ var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 26700d01d59..bf8401f6b4d 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,9 +1,9 @@ var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 5d13ff191f0..5fdfd475186 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,9 +1,9 @@ var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 5d13ff191f0..5fdfd475186 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,9 +1,9 @@ var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index 859117be880..2fe4870822f 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,10 +1,10 @@ /// var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index 859117be880..2fe4870822f 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,10 +1,10 @@ /// var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 9ea39c60dfb..899390cc913 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -53,11 +53,11 @@ var c: { //// [propertiesAndIndexers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 4a3910e8594..f9b92420a70 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -152,11 +152,11 @@ var x3: A; //// [propertyAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 665550081b3..b3464d30f9c 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -84,11 +84,11 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index a79ba9ed75c..a43b44c4b2b 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -59,11 +59,11 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 41de2d8c0e0..604131ef7b7 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -46,11 +46,11 @@ var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't //// [propertyAccessOnTypeParameterWithConstraints5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index a94af12901d..0756ef8ca9b 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -40,11 +40,11 @@ class E extends C { //// [protectedClassPropertyAccessibleWithinNestedSubclass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index d26f70b75bd..6d0c068039f 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -116,11 +116,11 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinNestedSubclass1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 330f73bca19..c2f072b213b 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -22,11 +22,11 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index cbde651add9..b7421c6161c 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -96,11 +96,11 @@ d4.x; // Error, neither within their declaring class nor class //// [protectedClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index a2cb66b2997..72cf5039e6c 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -15,11 +15,11 @@ class Derived extends Base { //// [protectedClassPropertyAccessibleWithinSubclass3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index abe608b1ed4..dc74f3ed190 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -46,11 +46,11 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index 689d11be3c3..fddbdf80bcc 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -117,11 +117,11 @@ class B3 extends A3 { //// [protectedMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index f681073d629..9564b6e35b9 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -45,11 +45,11 @@ Derived3.x; // Error, neither within their declaring class nor classes deriv //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index 3096ea6aa3c..ca6af2bc4ed 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -23,11 +23,11 @@ class Derived2 extends Derived1 { //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index 96df9d1d85b..ff51753f683 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -8,11 +8,11 @@ class Beta extends Alpha.x { //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/readonlyConstructorAssignment.js b/tests/baselines/reference/readonlyConstructorAssignment.js index 42f88abcf54..bb4ddec93a8 100644 --- a/tests/baselines/reference/readonlyConstructorAssignment.js +++ b/tests/baselines/reference/readonlyConstructorAssignment.js @@ -42,11 +42,11 @@ class E extends D { //// [readonlyConstructorAssignment.js] // Tests that readonly parameter properties behave like regular readonly properties var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index 3e2cbcee520..84b40e2f035 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -6,11 +6,11 @@ class C extends A { } //// [recursiveBaseCheck3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index 5bcf5bb63a7..5db14dcf42d 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -4,11 +4,11 @@ class M extends M { } //// [recursiveBaseCheck4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index 7c5134c397c..e1ac79b3a63 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -4,11 +4,11 @@ class S18 extends S18<{ S19: A; }>{ } //// [recursiveBaseCheck6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index 0caeb0b3b67..32a6a6c4de1 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -8,11 +8,11 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 2b0c30072dc..1c33cf9f2c7 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -11,11 +11,11 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 8469935d13b..bb711d95ce7 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -106,11 +106,11 @@ module Sample.Thing.Languages.PlainText { // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index c1c48650241..10d04ca9719 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -27,11 +27,11 @@ sourceFile:recursiveClassReferenceTest.ts 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- >>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index f1f34e272f1..c81d10ed99b 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -26,11 +26,11 @@ class TypeSymbol extends InferenceSymbol { //// [recursiveComplicatedClasses.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index e2a2e8dccff..e75661c2ea9 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -31,11 +31,11 @@ declare module MsPortal.Controls.Base.ItemList { //// [recursivelySpecializedConstructorDeclaration.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index bbaf78a0283..5566d296883 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -34,11 +34,11 @@ module.exports = { //// [foo3.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index cf9592ab4b2..6145c8927e0 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1021,11 +1021,11 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index 0a71ab129a8..6bdcc0cb6a2 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -68,11 +68,11 @@ class I extends G { //// [returnInConstructor1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 999d12f15f8..d3ebb904355 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -26,11 +26,11 @@ function fn13(): C { return null; } //// [returnStatements.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 33723f36d6a..81f97455a1f 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -10,11 +10,11 @@ class D extends C { //// [scopeCheckExtendedClassInsidePublicMethod2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index bac44a57ac0..5532c363050 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -10,11 +10,11 @@ class D extends C { //// [scopeCheckExtendedClassInsideStaticMethod1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index 0086a0b08ce..b60242c0714 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -13,11 +13,11 @@ class D extends C { //// [scopeTests.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 2c56c8ddada..20be8a60287 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -5,11 +5,11 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index b07cc2e8d8e..177c96a551a 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -9,11 +9,11 @@ class Greeter extends AbstractGreeter { //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 00e15a91e19..94fa02e8e6b 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -9,11 +9,11 @@ emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorA sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- >>>var __extends = (this && this.__extends) || (function () { ->>> var __extendStatics = Object.setPrototypeOf || +>>> var extendStatics = Object.setPrototypeOf || >>> ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || >>> function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; >>> return function (d, b) { ->>> __extendStatics(d, b); +>>> extendStatics(d, b); >>> function __() { this.constructor = d; } >>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); >>> }; diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 3904422842f..1a9b07b4ca1 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -19,11 +19,11 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index a40be7711c1..245fe1d40a9 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -14,11 +14,11 @@ function g(tagName: any): Base { //// [specializedOverloadWithRestParameters.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index 77ce4a3d8bc..9e0d218ca50 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -15,11 +15,11 @@ d.foo(); //// [staticFactory1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index a603fc607b9..6e76a0b3155 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -13,11 +13,11 @@ doThing(B); //OK //// [staticInheritance.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index f07c4e9ae0f..ae6e906c635 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -11,11 +11,11 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index dd36b0928f0..ba54ed851c1 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -37,11 +37,11 @@ class E extends A { //// [staticPropSuper.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 9c289a209b5..83ddc4bcf4e 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -62,11 +62,11 @@ class Ds extends A { //// [strictModeInConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index 614f20eafd6..ed33097cb83 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -29,11 +29,11 @@ function foo() { //// [strictModeReservedWord.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index 344f4edb83d..d40175b6d77 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -30,11 +30,11 @@ class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index 5fdc2444791..376574cc3dd 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -42,11 +42,11 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index d5d790c4d4f..469288cc968 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -108,11 +108,11 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 20685aaf52c..90f362d9bc6 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -170,11 +170,11 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index dbcdd47ba6d..3239afebe41 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -81,11 +81,11 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 7b1a7738d99..d55bffe2c80 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -160,11 +160,11 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 82a814c9c41..9292d1fb878 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -21,11 +21,11 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index 9e080909067..aa919f2e737 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -175,11 +175,11 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index 64b182872f6..c597a841828 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -122,11 +122,11 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index e5770b58dfc..9b6939167ef 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -114,11 +114,11 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 5961a930dca..e2653d77593 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -175,11 +175,11 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index 62c46d8add9..820d2221638 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -124,11 +124,11 @@ module WithGenericSignaturesInBaseType { // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 93415f6d2e6..604604a59cf 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -114,11 +114,11 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 64e9965cb85..6473bbeafd8 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -52,11 +52,11 @@ interface I extends B { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 247fcbbd1bc..dba21a9a3e2 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -55,11 +55,11 @@ interface I9 extends A { // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index 835f82c72b9..ceae3b0f84e 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -42,11 +42,11 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 761739f547f..6f77e8a5d13 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -46,11 +46,11 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 3d8bac24a79..c25e7abb329 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -30,11 +30,11 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 7526548f24e..c7a2c5a938e 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -69,11 +69,11 @@ module TwoLevels { //// [subtypingWithObjectMembers.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index ae620141587..4952a1e25ff 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -36,11 +36,11 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 54995020573..3b7b643b35e 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -36,11 +36,11 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index a2aca0d13bd..40910f393f7 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -64,11 +64,11 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index 7418e3dcb40..bfdb583ac8d 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -43,11 +43,11 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 081219774e5..3385ea5a792 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -46,11 +46,11 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index b0c55cf6398..04075c906f4 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -30,11 +30,11 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 8984c5860ea..98c38569c37 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -39,11 +39,11 @@ s.foo() + ss.foo(); //// [super.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index 49a057a7f49..7d695c2aeca 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -68,11 +68,11 @@ module Base4 { //// [super1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index 451c569c907..80bfbe0d8be 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -52,11 +52,11 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index a218ba0968a..a1303185739 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -15,11 +15,11 @@ class MyDerived extends MyBase { //// [superAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index d678ff22480..b4766c67bdd 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -26,11 +26,11 @@ class Q extends P { //// [superAccess2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index a58b119c67f..b4e81c65da5 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -17,11 +17,11 @@ module test { //// [superAccessInFatArrow1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index d488506e019..113fbd69625 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -27,11 +27,11 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index 50e1c20b6bc..ef0493d3b2b 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -12,11 +12,11 @@ class H extends E { //// [superCallAssignResult.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing1.js b/tests/baselines/reference/superCallBeforeThisAccessing1.js index 71c9e05e7cb..3045968da16 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing1.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing1.js @@ -18,11 +18,11 @@ class D extends Base { //// [superCallBeforeThisAccessing1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing2.js b/tests/baselines/reference/superCallBeforeThisAccessing2.js index a18505f8203..da634558f12 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing2.js @@ -12,11 +12,11 @@ class D extends Base { //// [superCallBeforeThisAccessing2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 61ed4fe5c4c..99feb79042c 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -15,11 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index cf5e9e89eba..0ee568c527e 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -17,11 +17,11 @@ class E extends null { //// [superCallBeforeThisAccessing4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 31087b70094..8cd5cda0520 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -9,11 +9,11 @@ class D extends null { //// [superCallBeforeThisAccessing5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing6.js b/tests/baselines/reference/superCallBeforeThisAccessing6.js index 0c3d20c102f..d5c6fd9c684 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing6.js @@ -12,11 +12,11 @@ class D extends Base { //// [superCallBeforeThisAccessing6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index ba79e0b65ae..af649aa4c30 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -15,11 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing7.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index 4f6a383aadf..ae115d0ffbd 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -15,11 +15,11 @@ class D extends Base { //// [superCallBeforeThisAccessing8.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index e24d0b53c1f..4ee302020ef 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -13,11 +13,11 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 3413bc18467..3d9c8ff717e 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -12,11 +12,11 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index f31fd399b36..18038207125 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -12,11 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index 4c99415f643..77b0f4af212 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -12,11 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index bbea46b2783..861bd9b470c 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -12,11 +12,11 @@ class B extends A { //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index 54c77157590..056dda2bf33 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -52,11 +52,11 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index 15d46bc1577..4e2610414b7 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -48,11 +48,11 @@ class Other extends Doing { //// [superCallInStaticMethod.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 7f5913549cc..1533df5f305 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -18,11 +18,11 @@ class B extends A { //// [superCallInsideClassDeclaration.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index 0f1fa8dc549..1f3242c8b1e 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -18,11 +18,11 @@ class B extends A { //// [superCallInsideClassExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index 0130a6c2b48..eb7df511e05 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -14,11 +14,11 @@ class B extends A { //// [superCallInsideObjectLiteralExpression.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index 0251b19231e..60e9411d414 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -24,11 +24,11 @@ var d = new D(); //// [superCallOutsideConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index a3d5303efaa..cfb0efa9d3d 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -14,11 +14,11 @@ class B extends A { //// [superCallParameterContextualTyping1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index e90755ffee8..f1180347142 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -13,11 +13,11 @@ class C extends A { //// [superCallParameterContextualTyping2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index fe68db83a04..c955f210779 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -33,11 +33,11 @@ class C extends CBase { //// [superCallParameterContextualTyping3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithCommentEmit01.js b/tests/baselines/reference/superCallWithCommentEmit01.js index 3a2981b8466..993776f0057 100644 --- a/tests/baselines/reference/superCallWithCommentEmit01.js +++ b/tests/baselines/reference/superCallWithCommentEmit01.js @@ -12,11 +12,11 @@ class B extends A { //// [superCallWithCommentEmit01.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index 7ae8d5b3099..a10281c4d3c 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -11,11 +11,11 @@ class Foo extends Bar { //// [superCallWithMissingBaseClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index ac9b0878083..e5c014a4e16 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -32,11 +32,11 @@ class OtherDerived extends OtherBase { //// [superCalls.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index d44ae6c11ec..2290ff746cd 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -22,11 +22,11 @@ class Derived extends Base { //// [superCallsInConstructor.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index d7078f39c16..cf7edc83a63 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -53,11 +53,11 @@ class RegisteredUser extends User { //// [superErrors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index b9d7c910977..31015ee9cfc 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -15,11 +15,11 @@ class B extends A { //// [superInCatchBlock1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index 0f6ec4e386f..940559c6828 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -12,11 +12,11 @@ class C extends B { //// [superInConstructorParam1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 9eeeaa0723c..83dad0b3251 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -69,11 +69,11 @@ class RegisteredUser4 extends User { //// [superInLambdas.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index cfcd7a4de2a..f86052cb923 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -61,11 +61,11 @@ class B extends A { //// [superInObjectLiterals_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index 5a5a91cd8f7..311f3bb6acc 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -14,11 +14,11 @@ class B extends A { //// [superNewCall1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index f6c09ab9092..0c01882e6ad 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -38,11 +38,11 @@ class MyDerived extends MyBase { //// [superPropertyAccess.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index 3eef279e454..8779dd7069b 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -29,11 +29,11 @@ class D extends C { //// [superPropertyAccess1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index 767b08dc2b9..a6fb7c95b0c 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -29,11 +29,11 @@ class D extends C { //// [superPropertyAccess2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index 014110485e6..1b906baa3bb 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -16,11 +16,11 @@ class B extends A { //// [superPropertyAccessInComputedPropertiesOfNestedType_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index 10e64d97a92..d2e3d7aad41 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -78,11 +78,11 @@ instance.returnThis().fn(); //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 2a48bfbdba7..6d10e60f1c0 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -31,11 +31,11 @@ class B extends A { //// [superPropertyAccess_ES5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 3188e79bd7e..6e87bfc97c5 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -17,11 +17,11 @@ class C2 extends B { //// [superPropertyInConstructorBeforeSuperCall.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index ec26d7dd67f..715c6568a2f 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -15,11 +15,11 @@ class Bar extends Foo { //// [superSymbolIndexedAccess5.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index 09bef412516..c92ecda44c1 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -15,11 +15,11 @@ class Bar extends Foo { //// [superSymbolIndexedAccess6.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index afd049ed8a2..6f3cee935ef 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -16,11 +16,11 @@ var r2: number = d.y; //// [superWithGenericSpecialization.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index 148fac45a70..a66656832f4 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -13,11 +13,11 @@ class D extends B { //// [superWithGenerics.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 22b802ec2df..158799cc93d 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -11,11 +11,11 @@ class D extends C { //// [superWithTypeArgument.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index ace1355c374..349589625fb 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -11,11 +11,11 @@ class D extends C { //// [superWithTypeArgument2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index 318b45a9981..a8325a5a594 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -15,11 +15,11 @@ class D extends C { //// [superWithTypeArgument3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 2fca7ec7fe4..0547650c7d8 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -29,11 +29,11 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 5af42176dfc..7d8c2477b68 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -57,11 +57,11 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index c9adf13f48c..76c4648daa1 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -33,11 +33,11 @@ System.register([], function (exports_1, context_1) { System.register(["./foo"], function (exports_1, context_1) { "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index 92ad5afba94..70e14fd521f 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -20,11 +20,11 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index a2237177f84..59530b8903e 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -50,11 +50,11 @@ enum SomeEnum { //// [thisInInvalidContexts.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index ccb2a71080f..37a1fb596d4 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -51,11 +51,11 @@ export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index b537231f74b..58eadaf874f 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -24,11 +24,11 @@ class Foo3 extends Base { //// [thisInSuperCall.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index 9f40814cc5f..c975c10927e 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -12,11 +12,11 @@ class Foo extends Base { //// [thisInSuperCall1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index ebbb974f23f..be9b2bbb9f3 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -21,11 +21,11 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index 5c9405534f4..2e07d294843 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -14,11 +14,11 @@ class Foo extends Base { //// [thisInSuperCall3.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index 21714308cb1..8a09f18b3f1 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -196,11 +196,11 @@ function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } //// [thisTypeInFunctions.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index 27bc47b84d2..c68aa2ee0a0 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -178,11 +178,11 @@ c.explicitProperty = (this, m) => m + this.n; //// [thisTypeInFunctionsNegative.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index 55d3ba54221..b092b4c96d5 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -22,11 +22,11 @@ export class ShortDetails extends React.Component<{ id: number }, {}> { //// [tsxCorrectlyParseLessThanComparison1.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index 2b055cd5a5a..d40e84c9078 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -22,11 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index 3108566db85..8e051ec9012 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -22,11 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index 8859061b463..6f247113055 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -22,11 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index 818e384fdf6..652d6334216 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -22,11 +22,11 @@ export class Text extends React.Component<{}, {}> { //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index 559306b800b..b030df4f253 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -34,11 +34,11 @@ export class Button extends React.Component { //// [button.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; @@ -58,11 +58,11 @@ exports.Button = Button; //// [app.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index 12c2f1f9ab3..e0165faa36a 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -41,11 +41,11 @@ let i =

x.propertyNotOnHtmlDivElement} />; //// [file.jsx] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 2b1634555ef..601be253e50 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -27,11 +27,11 @@ class MyButtonComponent extends React.Component<{},{}> { //// [file.js] "use strict"; var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index 3107a196f2a..84101c7db2d 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -53,11 +53,11 @@ if((numOrStr === undefined) as numOrStr is string) { // Error //// [typeAssertions.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index 0eb332af60e..8ce969eaa80 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -85,11 +85,11 @@ let union3: boolean | B = isA(union2) || union2; //// [typeGuardFunction.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 21d9dfeebf1..1471a235b89 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -147,11 +147,11 @@ if (hasMissingParameter()) { //// [typeGuardFunctionErrors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index 0344e168c53..9fec88b1959 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -35,11 +35,11 @@ let test3: B = funE(isB, 1); //// [typeGuardFunctionGenerics.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index 54110ba24d8..58b9c9027fa 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -143,11 +143,11 @@ interface MimicGuardInterface { //// [typeGuardFunctionOfFormThis.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index a79efd94c8f..b53f3ca511a 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -61,11 +61,11 @@ else { //// [typeGuardFunctionOfFormThisErrors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index fa99dbd87cf..23a1770d564 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -74,11 +74,11 @@ else { // it is a subtype of the type of x, or // - when false, has no effect on the type of x. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index f1a94c5167a..3ea3839651e 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -39,11 +39,11 @@ var r2: C2 | D1 = isC1(c2Ord1) && c2Ord1; // C2 | D1 //// [typeGuardOfFormIsType.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index b7d442711d7..6540c298766 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -84,11 +84,11 @@ namespace Test { //// [typeGuardOfFormThisMember.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index e2b8b8ec168..9e4fd71e1ec 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -34,11 +34,11 @@ namespace Test { //// [typeGuardOfFormThisMemberErrors.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 84ff8f72c5c..b051cdf506f 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -46,11 +46,11 @@ function f4() { //// [typeMatch2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index eca6ad1bc0a..48f57c4c9f7 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -10,11 +10,11 @@ class D extends C { //// [typeOfSuperCall.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index dc579b7b62f..444e44c3687 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -4,11 +4,11 @@ class C2 implements T {} //// [typeParameterAsBaseClass.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 80317823731..00d8781efca 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -14,11 +14,11 @@ interface I2 extends U { } // type parameters cannot be used as base types // these are all errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 80fd91c64b8..7b456983f2e 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -14,11 +14,11 @@ function f(a: T) { //// [typeParameterExtendingUnion1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index 8dc8db48ed8..508eb8e0616 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -14,11 +14,11 @@ function f(a: T) { //// [typeParameterExtendingUnion2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 42ff32f9ab1..93d920a6c8c 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -42,11 +42,11 @@ class D extends C { //// [typeRelationships.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index a84939d2e10..065c2968a12 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -13,11 +13,11 @@ module M2 { //// [typeValueConflict1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 40bdb364218..6cbcc708a0d 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -20,11 +20,11 @@ module M3 { //// [typeValueConflict2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index d7e92bd6a8f..e829411ed32 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -23,11 +23,11 @@ var r2: typeof d; //// [typeofClass2.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index 24ea5d0ed64..282a3f72f15 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -44,11 +44,11 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index 396f24805eb..b27eaf2725c 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -42,11 +42,11 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index a280e90e75c..ed2f2d66d93 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -5,11 +5,11 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index 56ae1ae2447..c00281f2b8c 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -124,11 +124,11 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index dea8545ce6f..c0b6cf1b6da 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -50,11 +50,11 @@ class MyView extends View { //// [underscoreMapFirst.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index 0528b292208..410503dc6fc 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -26,11 +26,11 @@ class D extends C { //// [underscoreThisInDerivedClass01.js] // @target es5 var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index 5901d6e2a7c..365ba64a2c6 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -20,11 +20,11 @@ class D extends C { //// [underscoreThisInDerivedClass02.js] // @target es5 var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index 28401c6db6b..a11476152f9 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -21,11 +21,11 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index bf882f163eb..9b42b1b7532 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -29,11 +29,11 @@ var arr9 = [e, f]; // (E|F)[] // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index 837116d719d..87be4dbb4fd 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -75,11 +75,11 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index 540d8058331..7ec636f672a 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -34,11 +34,11 @@ class C5 { //// [unknownSymbols1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index 2094404dd0a..53b4fcf2f22 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -155,11 +155,11 @@ module ts { //// [unspecializedConstraints.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 12dd53ebea9..2adb8dae89f 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -45,11 +45,11 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index 7b97612fa61..85c5cc6aae7 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -16,11 +16,11 @@ namespace Validation { //// [unusedClassesinNamespace4.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 2d89558f83d..6615c45cf29 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -104,11 +104,11 @@ namespace Greeter { //// [unusedIdentifiersConsolidated1.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index ad56ae8cdd3..869e848ad62 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -11,11 +11,11 @@ class Super extends Base { //// [validUseOfThisInSuper.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index 0577bdb645a..c859b4f8260 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -26,11 +26,11 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] var __extends = (this && this.__extends) || (function () { - var __extendStatics = Object.setPrototypeOf || + var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { - __extendStatics(d, b); + extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; From 4affef2f2abecda2d65bda02cdf2bedbb1204661 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sat, 31 Dec 2016 22:31:48 +0900 Subject: [PATCH 213/289] update baselines --- .../captureSuperPropertyAccessInSuperCall01.js | 15 ++++++++++----- .../reference/decoratorOnClassConstructor4.js | 15 ++++++++++----- tests/baselines/reference/jsxInExtendsClause.js | 15 ++++++++++----- tests/baselines/reference/jsxViaImport.2.js | 15 ++++++++++----- tests/baselines/reference/newTarget.es5.js | 15 ++++++++++----- .../subSubClassCanAccessProtectedConstructor.js | 15 ++++++++++----- .../reference/superPropertyAccessInSuperCall01.js | 15 ++++++++++----- 7 files changed, 70 insertions(+), 35 deletions(-) diff --git a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js index 4f350c1a3a3..98ca7cb47d7 100644 --- a/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js +++ b/tests/baselines/reference/captureSuperPropertyAccessInSuperCall01.js @@ -12,11 +12,16 @@ class B extends A { } //// [captureSuperPropertyAccessInSuperCall01.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(f) { } diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js index 22414e89e43..a9b30440f6b 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor4.js +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -15,11 +15,16 @@ class C extends A { } //// [decoratorOnClassConstructor4.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); diff --git a/tests/baselines/reference/jsxInExtendsClause.js b/tests/baselines/reference/jsxInExtendsClause.js index 8204067cb04..aa1c611783a 100644 --- a/tests/baselines/reference/jsxInExtendsClause.js +++ b/tests/baselines/reference/jsxInExtendsClause.js @@ -12,11 +12,16 @@ class Foo extends createComponentClass(() => class extends React.Component<{}, { }) {} //// [jsxInExtendsClause.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Foo = (function (_super) { __extends(Foo, _super); function Foo() { diff --git a/tests/baselines/reference/jsxViaImport.2.js b/tests/baselines/reference/jsxViaImport.2.js index 19432238e0b..635754599b1 100644 --- a/tests/baselines/reference/jsxViaImport.2.js +++ b/tests/baselines/reference/jsxViaImport.2.js @@ -25,11 +25,16 @@ class TestComponent extends React.Component { //// [consumer.jsx] "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); /// var BaseComponent_1 = require("BaseComponent"); var TestComponent = (function (_super) { diff --git a/tests/baselines/reference/newTarget.es5.js b/tests/baselines/reference/newTarget.es5.js index 0de967d5477..2ebe4bfcadc 100644 --- a/tests/baselines/reference/newTarget.es5.js +++ b/tests/baselines/reference/newTarget.es5.js @@ -33,11 +33,16 @@ const O = { //// [newTarget.es5.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A() { var _newTarget = this.constructor; diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js index 15d6fc70da5..f3e5175c4a3 100644 --- a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js @@ -17,11 +17,16 @@ class SubclassOfSubclass extends Subclass { //// [subSubClassCanAccessProtectedConstructor.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var Base = (function () { function Base() { this.instance1 = new Base(); // allowed diff --git a/tests/baselines/reference/superPropertyAccessInSuperCall01.js b/tests/baselines/reference/superPropertyAccessInSuperCall01.js index de96b2bbc5e..d5800323de2 100644 --- a/tests/baselines/reference/superPropertyAccessInSuperCall01.js +++ b/tests/baselines/reference/superPropertyAccessInSuperCall01.js @@ -12,11 +12,16 @@ class B extends A { } //// [superPropertyAccessInSuperCall01.js] -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var A = (function () { function A(f) { } From 8b44ce2fd7bc70a89721db3dd5db3b1ec0e6ea0d Mon Sep 17 00:00:00 2001 From: Joel Day Date: Sat, 31 Dec 2016 17:37:51 -0800 Subject: [PATCH 214/289] Emitting tsserverlibrary as an external module. --- Gulpfile.ts | 3 ++ Jakefile.js | 38 +++++++++---------- src/server/shared.ts | 2 +- src/server/tsconfig.library.json | 14 ++++--- src/server/{types.d.ts => types.ts} | 0 src/server/typingsInstaller/tsconfig.json | 2 +- .../typingsInstaller/typingsInstaller.ts | 2 +- src/server/utilities.ts | 2 +- 8 files changed, 35 insertions(+), 28 deletions(-) rename src/server/{types.d.ts => types.ts} (100%) diff --git a/Gulpfile.ts b/Gulpfile.ts index 054e99c8003..2eec5c22045 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -472,6 +472,9 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => { .pipe(sourcemaps.write(".")) .pipe(gulp.dest(".")), dts.pipe(prependCopyright()) + .pipe(insert.transform((content) => { + return content + "\r\nexport = ts;"; + })) .pipe(gulp.dest(".")) ]); }); diff --git a/Jakefile.js b/Jakefile.js index 3c26003fdf0..801ac924027 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -183,8 +183,8 @@ var servicesSources = [ return path.join(servicesDirectory, f); })); -var serverCoreSources = [ - "types.d.ts", +var baseServerCoreSources = [ + "types.ts", "shared.ts", "utilities.ts", "scriptVersionCache.ts", @@ -195,11 +195,16 @@ var serverCoreSources = [ "editorServices.ts", "protocol.ts", "session.ts", - "server.ts" ].map(function (f) { return path.join(serverDirectory, f); }); +var serverCoreSources = [ + "server.ts" +].map(function (f) { + return path.join(serverDirectory, f); +}).concat(baseServerCoreSources); + var cancellationTokenSources = [ "cancellationToken.ts" ].map(function (f) { @@ -207,7 +212,7 @@ var cancellationTokenSources = [ }); var typingsInstallerSources = [ - "../types.d.ts", + "../types.ts", "../shared.ts", "typingsInstaller.ts", "nodeTypingsInstaller.ts" @@ -216,20 +221,7 @@ var typingsInstallerSources = [ }); var serverSources = serverCoreSources.concat(servicesSources); - -var languageServiceLibrarySources = [ - "protocol.ts", - "utilities.ts", - "scriptVersionCache.ts", - "scriptInfo.ts", - "lsHost.ts", - "project.ts", - "editorServices.ts", - "session.ts", - -].map(function (f) { - return path.join(serverDirectory, f); -}).concat(servicesSources); +var languageServiceLibrarySources = baseServerCoreSources.concat(servicesSources); var harnessCoreSources = [ "harness.ts", @@ -727,7 +719,15 @@ compileFile( [builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets), /*prefixes*/[copyright], /*useBuiltCompiler*/ true, - { noOutFile: false, generateDeclarations: true }); + { noOutFile: false, generateDeclarations: true }, + /*callback*/ function () { + + prependFile(copyright, tsserverLibraryDefinitionFile); + + // Appending 'export = ts;' at the end of the server library file to turn it into an external module + var tsserverLibraryDefinitionFileContents = fs.readFileSync(tsserverLibraryDefinitionFile).toString() + "\r\nexport = ts;"; + fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents); + }); // Local target to build the language service server library desc("Builds language service server library"); diff --git a/src/server/shared.ts b/src/server/shared.ts index c56d4098e75..77f66fc5a2d 100644 --- a/src/server/shared.ts +++ b/src/server/shared.ts @@ -1,4 +1,4 @@ -/// +/// namespace ts.server { export const ActionSet: ActionSet = "action::set"; diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index 5483cc8ec28..c589d875c3a 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -1,16 +1,20 @@ { "compilerOptions": { "noImplicitAny": true, + "noImplicitThis": true, "removeComments": true, "preserveConstEnums": true, + "pretty": true, "outFile": "../../built/local/tsserverlibrary.js", "sourceMap": true, "stripInternal": true, - "declaration": true, - "types": [], + "types": [ + "node" + ], "target": "es5", "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "declaration": true }, "files": [ "../services/shims.ts", @@ -19,11 +23,11 @@ "utilities.ts", "scriptVersionCache.ts", "scriptInfo.ts", - "lshost.ts", + "lsHost.ts", "typingsCache.ts", "project.ts", "editorServices.ts", - "protocol.d.ts", + "protocol.ts", "session.ts" ] } diff --git a/src/server/types.d.ts b/src/server/types.ts similarity index 100% rename from src/server/types.d.ts rename to src/server/types.ts diff --git a/src/server/typingsInstaller/tsconfig.json b/src/server/typingsInstaller/tsconfig.json index c6031b19aae..27f5cedc9d1 100644 --- a/src/server/typingsInstaller/tsconfig.json +++ b/src/server/typingsInstaller/tsconfig.json @@ -16,7 +16,7 @@ "noUnusedParameters": true }, "files": [ - "../types.d.ts", + "../types.ts", "../shared.ts", "typingsInstaller.ts", "nodeTypingsInstaller.ts" diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts index 7a09c1f6c21..f706943a0f5 100644 --- a/src/server/typingsInstaller/typingsInstaller.ts +++ b/src/server/typingsInstaller/typingsInstaller.ts @@ -1,7 +1,7 @@ /// /// /// -/// +/// /// namespace ts.server.typingsInstaller { diff --git a/src/server/utilities.ts b/src/server/utilities.ts index d0790b93dba..1889b055d29 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts.server { From d5d9b1bb5e4b6c4ef94dcaa01924657c01c6f2a3 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Sun, 1 Jan 2017 22:59:14 +0100 Subject: [PATCH 215/289] Add DefaultClause to BlockLike union --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6eebb0b99d7..008cbe3dfb4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1550,7 +1550,7 @@ namespace ts { name?: Identifier; } - export type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + export type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; export interface Block extends Statement { kind: SyntaxKind.Block; From cf5508732a520cd8ef26a071c9aab51e58a49087 Mon Sep 17 00:00:00 2001 From: Joel Day Date: Sun, 1 Jan 2017 17:58:33 -0800 Subject: [PATCH 216/289] Fix Gulp build of tsserverlibrary to match Jake. --- Gulpfile.ts | 2 +- Jakefile.js | 14 +++++++------- src/server/tsconfig.library.json | 26 +++++++++++++------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index 2eec5c22045..22bf020a435 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -471,7 +471,7 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => { js.pipe(prependCopyright()) .pipe(sourcemaps.write(".")) .pipe(gulp.dest(".")), - dts.pipe(prependCopyright()) + dts.pipe(prependCopyright(/*outputCopyright*/true)) .pipe(insert.transform((content) => { return content + "\r\nexport = ts;"; })) diff --git a/Jakefile.js b/Jakefile.js index 801ac924027..b810477d861 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -184,17 +184,17 @@ var servicesSources = [ })); var baseServerCoreSources = [ - "types.ts", - "shared.ts", - "utilities.ts", - "scriptVersionCache.ts", - "typingsCache.ts", - "scriptInfo.ts", + "editorServices.ts", "lsHost.ts", "project.ts", - "editorServices.ts", "protocol.ts", + "scriptInfo.ts", + "scriptVersionCache.ts", "session.ts", + "shared.ts", + "types.ts", + "typingsCache.ts", + "utilities.ts", ].map(function (f) { return path.join(serverDirectory, f); }); diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index c589d875c3a..397211e6ff4 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -2,12 +2,11 @@ "compilerOptions": { "noImplicitAny": true, "noImplicitThis": true, - "removeComments": true, + "removeComments": false, "preserveConstEnums": true, "pretty": true, "outFile": "../../built/local/tsserverlibrary.js", "sourceMap": true, - "stripInternal": true, "types": [ "node" ], @@ -17,17 +16,18 @@ "declaration": true }, "files": [ - "../services/shims.ts", - "../services/utilities.ts", - "shared.ts", - "utilities.ts", - "scriptVersionCache.ts", - "scriptInfo.ts", - "lsHost.ts", - "typingsCache.ts", - "project.ts", "editorServices.ts", - "protocol.ts", - "session.ts" + "lsHost.ts", + "project.ts", + "protocol.d.ts", + "scriptInfo.ts", + "scriptVersionCache.ts", + "session.ts", + "shared.ts", + "types.ts", + "typingsCache.ts", + "utilities.ts", + "../services/shims.ts", + "../services/utilities.ts" ] } From 54ceb51d85712a38cb86d37d3d10189532f13f41 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 3 Jan 2017 10:59:31 -0800 Subject: [PATCH 217/289] Fix the emit when jsx attribute expression is empty Fixes #12994 --- src/compiler/transformers/jsx.ts | 3 ++ ...AttributeWithoutExpressionReact.errors.txt | 33 +++++++++++++++++++ .../jsxAttributeWithoutExpressionReact.js | 14 ++++++++ .../jsxAttributeWithoutExpressionReact.tsx | 9 +++++ 4 files changed, 59 insertions(+) create mode 100644 tests/baselines/reference/jsxAttributeWithoutExpressionReact.errors.txt create mode 100644 tests/baselines/reference/jsxAttributeWithoutExpressionReact.js create mode 100644 tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index ecb5dd053e0..c0179a10e88 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -150,6 +150,9 @@ namespace ts { return decoded ? createLiteral(decoded, /*location*/ node) : node; } else if (node.kind === SyntaxKind.JsxExpression) { + if (node.expression === undefined) { + return createLiteral(true); + } return visitJsxExpression(node); } else { diff --git a/tests/baselines/reference/jsxAttributeWithoutExpressionReact.errors.txt b/tests/baselines/reference/jsxAttributeWithoutExpressionReact.errors.txt new file mode 100644 index 00000000000..3801562709a --- /dev/null +++ b/tests/baselines/reference/jsxAttributeWithoutExpressionReact.errors.txt @@ -0,0 +1,33 @@ +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(3,2): error TS2304: Cannot find name 'View'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(4,6): error TS2304: Cannot find name 'ListView'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(5,10): error TS2304: Cannot find name 'RefreshControl'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(5,35): error TS17000: JSX attributes must only be assigned a non-empty 'expression'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(6,44): error TS17000: JSX attributes must only be assigned a non-empty 'expression'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(7,7): error TS2304: Cannot find name 'ListView'. +tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx(8,3): error TS2304: Cannot find name 'View'. + + +==== tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx (7 errors) ==== + + declare var React: any; + + ~~~~ +!!! error TS2304: Cannot find name 'View'. + + ~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RefreshControl'. + ~~ +!!! error TS17000: JSX attributes must only be assigned a non-empty 'expression'. + } dataSource={this.state.ds} renderRow={}> + ~~ +!!! error TS17000: JSX attributes must only be assigned a non-empty 'expression'. + + ~~~~~~~~ +!!! error TS2304: Cannot find name 'ListView'. + + ~~~~ +!!! error TS2304: Cannot find name 'View'. + \ No newline at end of file diff --git a/tests/baselines/reference/jsxAttributeWithoutExpressionReact.js b/tests/baselines/reference/jsxAttributeWithoutExpressionReact.js new file mode 100644 index 00000000000..f07cbabd7f8 --- /dev/null +++ b/tests/baselines/reference/jsxAttributeWithoutExpressionReact.js @@ -0,0 +1,14 @@ +//// [jsxAttributeWithoutExpressionReact.tsx] + +declare var React: any; + + + } dataSource={this.state.ds} renderRow={}> + + + + +//// [jsxAttributeWithoutExpressionReact.js] +React.createElement(View, null, + React.createElement(ListView, { refreshControl: React.createElement(RefreshControl, { onRefresh: true, refreshing: true }), dataSource: this.state.ds, renderRow: true })); diff --git a/tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx b/tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx new file mode 100644 index 00000000000..a108a405f97 --- /dev/null +++ b/tests/cases/compiler/jsxAttributeWithoutExpressionReact.tsx @@ -0,0 +1,9 @@ +//@jsx: react + +declare var React: any; + + + } dataSource={this.state.ds} renderRow={}> + + From 6c29e580624c3f31fdcd8480d1ad65c6a62e3dd5 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 3 Jan 2017 13:42:12 -0800 Subject: [PATCH 218/289] Fix super/this capture for extends null --- src/compiler/transformers/es2015.ts | 26 +++-- ...sClassHeritageListMemberTypeAnnotations.js | 2 +- ...accessibleTypeInTypeParameterConstraint.js | 2 +- .../reference/abstractClassInLocalScope.js | 2 +- .../abstractClassInLocalScopeIsAbstract.js | 2 +- tests/baselines/reference/abstractProperty.js | 2 +- .../reference/abstractPropertyNegative.js | 8 +- .../accessors_spec_section-4.5_inference.js | 2 +- .../reference/aliasUsageInAccessorsOfClass.js | 2 +- .../baselines/reference/aliasUsageInArray.js | 2 +- .../aliasUsageInFunctionExpression.js | 2 +- .../reference/aliasUsageInGenericFunction.js | 2 +- .../reference/aliasUsageInIndexerOfClass.js | 2 +- .../reference/aliasUsageInObjectLiteral.js | 2 +- .../reference/aliasUsageInOrExpression.js | 2 +- ...aliasUsageInTypeArgumentOfExtendsClause.js | 4 +- .../reference/aliasUsageInVarAssignment.js | 2 +- .../reference/ambiguousOverloadResolution.js | 2 +- .../reference/apparentTypeSubtyping.js | 4 +- .../reference/apparentTypeSupertype.js | 2 +- .../reference/arrayAssignmentTest1.js | 2 +- .../reference/arrayAssignmentTest2.js | 2 +- .../reference/arrayBestCommonTypes.js | 4 +- .../reference/arrayLiteralTypeInference.js | 4 +- tests/baselines/reference/arrayLiterals.js | 4 +- .../arrayLiteralsWithRecursiveGenerics.js | 2 +- ...rayOfSubtypeIsAssignableToReadonlyArray.js | 4 +- .../assignmentCompatWithCallSignatures3.js | 6 +- .../assignmentCompatWithCallSignatures4.js | 6 +- .../assignmentCompatWithCallSignatures5.js | 6 +- .../assignmentCompatWithCallSignatures6.js | 6 +- ...ssignmentCompatWithConstructSignatures3.js | 6 +- ...ssignmentCompatWithConstructSignatures4.js | 6 +- ...ssignmentCompatWithConstructSignatures5.js | 6 +- ...ssignmentCompatWithConstructSignatures6.js | 6 +- .../assignmentCompatWithNumericIndexer.js | 2 +- .../assignmentCompatWithNumericIndexer3.js | 2 +- .../assignmentCompatWithObjectMembers4.js | 8 +- ...nmentCompatWithObjectMembersOptionality.js | 4 +- ...mentCompatWithObjectMembersOptionality2.js | 4 +- .../assignmentCompatWithStringIndexer.js | 4 +- .../reference/asyncImportedPromise_es5.js | 2 +- .../reference/asyncMethodWithSuper_es5.js | 2 +- .../reference/asyncQualifiedReturnType_es5.js | 2 +- .../reference/awaitClassExpression_es5.js | 2 +- .../reference/baseIndexSignatureResolution.js | 2 +- .../reference/baseTypeOrderChecking.js | 4 +- .../baseTypeWrappingInstantiationChain.js | 4 +- tests/baselines/reference/bases.js | 2 +- .../bestCommonTypeOfConditionalExpressions.js | 4 +- ...bestCommonTypeOfConditionalExpressions2.js | 4 +- .../reference/bestCommonTypeOfTuple2.js | 4 +- ...allSignatureAssignabilityInInheritance2.js | 6 +- ...allSignatureAssignabilityInInheritance3.js | 6 +- ...allSignatureAssignabilityInInheritance4.js | 6 +- ...allSignatureAssignabilityInInheritance5.js | 6 +- ...allSignatureAssignabilityInInheritance6.js | 6 +- tests/baselines/reference/castingTuple.js | 4 +- .../baselines/reference/chainedAssignment3.js | 2 +- ...arameterConstrainedToOtherTypeParameter.js | 4 +- .../checkSuperCallBeforeThisAccessing2.js | 2 +- .../checkSuperCallBeforeThisAccessing3.js | 2 +- .../checkSuperCallBeforeThisAccessing4.js | 2 +- .../checkSuperCallBeforeThisAccessing6.js | 2 +- .../checkSuperCallBeforeThisAccessing8.js | 2 +- .../reference/circularImportAlias.js | 2 +- .../circularTypeofWithFunctionModule.js | 2 +- .../classAbstractConstructorAssignability.js | 4 +- .../reference/classAbstractCrashedOnce.js | 2 +- .../reference/classAbstractExtends.js | 8 +- .../reference/classAbstractFactoryFunction.js | 2 +- .../reference/classAbstractGeneric.js | 12 +-- .../reference/classAbstractInAModule.js | 2 +- .../reference/classAbstractInheritance.js | 16 ++-- .../reference/classAbstractInstantiations1.js | 4 +- .../reference/classAbstractInstantiations2.js | 8 +- .../classAbstractOverrideWithAbstract.js | 8 +- .../reference/classAbstractSuperCalls.js | 6 +- .../classAbstractUsingAbstractMethod1.js | 4 +- .../classAbstractUsingAbstractMethods2.js | 14 +-- .../classConstructorAccessibility4.js | 4 +- .../classConstructorAccessibility5.js | 2 +- ...clarationMergedInModuleWithContinuation.js | 2 +- .../classDeclaredBeforeClassFactory.js | 2 +- .../classDoesNotDependOnBaseTypes.js | 2 +- tests/baselines/reference/classExpression2.js | 2 +- tests/baselines/reference/classExpression3.js | 4 +- .../classExpressionExtendingAbstractClass.js | 2 +- .../reference/classExtendingBuiltinType.js | 20 ++-- .../reference/classExtendingClass.js | 4 +- .../reference/classExtendingClassLikeType.js | 6 +- .../reference/classExtendingNonConstructor.js | 14 +-- .../baselines/reference/classExtendingNull.js | 4 +- .../reference/classExtendingPrimitive.js | 18 ++-- .../reference/classExtendingPrimitive2.js | 2 +- .../reference/classExtendingQualifiedName.js | 2 +- .../reference/classExtendingQualifiedName2.js | 2 +- .../reference/classExtendsAcrossFiles.js | 4 +- ...sMergedWithModuleNotReferingConstructor.js | 2 +- ...tendsClauseClassNotReferringConstructor.js | 2 +- .../reference/classExtendsEveryObjectType.js | 12 +-- .../reference/classExtendsEveryObjectType2.js | 4 +- .../reference/classExtendsInterface.js | 4 +- .../classExtendsInterfaceInExpression.js | 2 +- .../classExtendsInterfaceInModule.js | 6 +- .../baselines/reference/classExtendsItself.js | 6 +- .../reference/classExtendsItselfIndirectly.js | 12 +-- .../classExtendsItselfIndirectly2.js | 12 +-- .../classExtendsItselfIndirectly3.js | 12 +-- .../classExtendsMultipleBaseClasses.js | 2 +- tests/baselines/reference/classExtendsNull.js | 2 +- ...classExtendsShadowedConstructorFunction.js | 2 +- .../classExtendsValidConstructorFunction.js | 2 +- .../classHeritageWithTrailingSeparator.js | 2 +- .../reference/classImplementsClass2.js | 2 +- .../reference/classImplementsClass3.js | 2 +- .../reference/classImplementsClass4.js | 2 +- .../reference/classImplementsClass5.js | 2 +- .../reference/classImplementsClass6.js | 2 +- tests/baselines/reference/classIndexer3.js | 2 +- tests/baselines/reference/classInheritence.js | 4 +- .../reference/classIsSubtypeOfBaseType.js | 4 +- tests/baselines/reference/classOrder2.js | 2 +- tests/baselines/reference/classOrderBug.js | 2 +- .../reference/classSideInheritance1.js | 2 +- tests/baselines/reference/classUpdateTests.js | 8 +- .../classWithBaseClassButNoConstructor.js | 8 +- .../reference/classWithConstructors.js | 4 +- .../reference/classWithProtectedProperty.js | 2 +- .../reference/classWithStaticMembers.js | 2 +- tests/baselines/reference/classdecl.js | 6 +- .../reference/clodulesDerivedClasses.js | 2 +- ...llisionSuperAndLocalFunctionInAccessors.js | 4 +- .../collisionSuperAndLocalFunctionInMethod.js | 4 +- ...ollisionSuperAndLocalFunctionInProperty.js | 2 +- .../collisionSuperAndLocalVarInAccessors.js | 4 +- .../collisionSuperAndLocalVarInMethod.js | 4 +- .../collisionSuperAndLocalVarInProperty.js | 2 +- .../collisionSuperAndNameResolution.js | 2 +- .../reference/collisionSuperAndParameter1.js | 2 +- ...xpressionAndLocalVarWithSuperExperssion.js | 4 +- .../reference/commentsInheritance.js | 2 +- .../comparisonOperatorWithIdenticalObjects.js | 4 +- ...ithNoRelationshipObjectsOnCallSignature.js | 2 +- ...lationshipObjectsOnConstructorSignature.js | 2 +- ...thNoRelationshipObjectsOnIndexSignature.js | 2 +- ...nshipObjectsOnInstantiatedCallSignature.js | 2 +- ...jectsOnInstantiatedConstructorSignature.js | 2 +- ...peratorWithSubtypeObjectOnCallSignature.js | 2 +- ...WithSubtypeObjectOnConstructorSignature.js | 2 +- ...eratorWithSubtypeObjectOnIndexSignature.js | 2 +- ...ubtypeObjectOnInstantiatedCallSignature.js | 2 +- ...bjectOnInstantiatedConstructorSignature.js | 2 +- ...isonOperatorWithSubtypeObjectOnProperty.js | 4 +- .../reference/complexClassRelationships.js | 2 +- ...catedGenericRecursiveBaseClassReference.js | 2 +- .../reference/computedPropertyNames24_ES5.js | 2 +- .../reference/computedPropertyNames25_ES5.js | 2 +- .../reference/computedPropertyNames26_ES5.js | 2 +- .../reference/computedPropertyNames27_ES5.js | 2 +- .../reference/computedPropertyNames31_ES5.js | 2 +- .../reference/computedPropertyNames43_ES5.js | 2 +- .../reference/computedPropertyNames44_ES5.js | 2 +- .../reference/computedPropertyNames45_ES5.js | 2 +- .../conditionalOperatorWithIdenticalBCT.js | 4 +- .../conditionalOperatorWithoutIdenticalBCT.js | 4 +- .../reference/constantOverloadFunction.js | 6 +- .../constantOverloadFunctionNoSubtypeError.js | 6 +- ...nstraintCheckInGenericBaseTypeReference.js | 2 +- ...uctSignatureAssignabilityInInheritance2.js | 6 +- ...uctSignatureAssignabilityInInheritance3.js | 6 +- ...uctSignatureAssignabilityInInheritance4.js | 6 +- ...uctSignatureAssignabilityInInheritance5.js | 6 +- ...uctSignatureAssignabilityInInheritance6.js | 6 +- ...uctorFunctionTypeIsAssignableToBaseType.js | 4 +- .../constructorHasPrototypeProperty.js | 4 +- .../reference/constructorOverloads3.js | 2 +- ...constructorWithIncompleteTypeAnnotation.js | 2 +- .../contextualTypingArrayOfLambdas.js | 4 +- ...contextualTypingOfConditionalExpression.js | 4 +- ...ontextualTypingOfConditionalExpression2.js | 4 +- ...urcePropertyIsRelatableToTargetProperty.js | 2 +- .../reference/declFileClassExtendsNull.js | 2 +- .../declFileForFunctionTypeAsTypeParameter.js | 2 +- ...ileGenericClassWithGenericExtendedClass.js | 2 +- .../reference/declFileGenericType.js | 2 +- ...lictingWithClassReferredByExtendsClause.js | 4 +- ...dsClauseThatHasItsContainerNameConflict.js | 2 +- .../declarationEmitExpressionInExtends.js | 2 +- .../declarationEmitExpressionInExtends2.js | 2 +- .../declarationEmitExpressionInExtends3.js | 8 +- .../declarationEmitExpressionInExtends4.js | 6 +- .../declarationEmitNameConflicts3.js | 2 +- .../declarationEmitProtectedMembers.js | 4 +- .../declarationEmitThisPredicates01.js | 2 +- ...tionEmitThisPredicatesWithPrivateName01.js | 2 +- .../reference/declareDottedExtend.js | 4 +- .../reference/decoratorOnClassConstructor4.js | 2 +- .../reference/decoratorOnClassMethod12.js | 2 +- ...derivedClassConstructorWithoutSuperCall.js | 8 +- ...ClassFunctionOverridesBaseClassAccessor.js | 2 +- .../derivedClassIncludesInheritedMembers.js | 4 +- ...idesIndexersWithAssignmentCompatibility.js | 4 +- .../derivedClassOverridesPrivates.js | 4 +- .../derivedClassOverridesProtectedMembers2.js | 2 +- .../derivedClassOverridesProtectedMembers4.js | 4 +- .../derivedClassOverridesPublicMembers.js | 2 +- .../derivedClassOverridesWithoutSubtype.js | 4 +- .../derivedClassParameterProperties.js | 12 +-- ...dClassSuperCallsInNonConstructorMembers.js | 2 +- .../reference/derivedClassTransitivity.js | 4 +- .../reference/derivedClassTransitivity2.js | 4 +- .../reference/derivedClassTransitivity3.js | 4 +- .../reference/derivedClassTransitivity4.js | 4 +- .../reference/derivedClassWithAny.js | 4 +- ...ivateInstanceShadowingProtectedInstance.js | 2 +- ...hPrivateInstanceShadowingPublicInstance.js | 2 +- ...thPrivateStaticShadowingProtectedStatic.js | 2 +- ...sWithPrivateStaticShadowingPublicStatic.js | 2 +- .../derivedClassWithoutExplicitConstructor.js | 4 +- ...derivedClassWithoutExplicitConstructor2.js | 4 +- ...derivedClassWithoutExplicitConstructor3.js | 4 +- tests/baselines/reference/derivedClasses.js | 4 +- .../reference/derivedGenericClassWithAny.js | 4 +- ...sesHiddenBaseCallViaSuperPropertyAccess.js | 2 +- .../derivedTypeDoesNotRequireExtendsClause.js | 2 +- .../reference/emitThisInSuperMethodCall.js | 2 +- tests/baselines/reference/emptyModuleName.js | 2 +- ...rorForwardReferenceForwadingConstructor.js | 2 +- tests/baselines/reference/errorSuperCalls.js | 4 +- .../reference/errorSuperPropertyAccess.js | 2 +- .../reference/errorsInGenericTypeReference.js | 2 +- .../reference/es6ClassSuperCodegenBug.js | 2 +- tests/baselines/reference/es6ClassTest2.js | 2 +- tests/baselines/reference/es6ClassTest7.js | 2 +- .../exportAssignmentOfGenericType1.js | 2 +- .../exportDeclarationInInternalModule.js | 2 +- tests/baselines/reference/extBaseClass1.js | 6 +- tests/baselines/reference/extBaseClass2.js | 4 +- .../extendAndImplementTheSameBaseType.js | 2 +- .../extendAndImplementTheSameBaseType2.js | 2 +- .../extendBaseClassBeforeItsDeclared.js | 2 +- .../extendClassExpressionFromModule.js | 2 +- .../extendConstructSignatureInInterface.js | 2 +- .../reference/extendNonClassSymbol1.js | 2 +- .../reference/extendNonClassSymbol2.js | 2 +- .../extendPrivateConstructorClass.js | 2 +- ...xtendingClassFromAliasAndUsageInIndexer.js | 4 +- .../reference/extendsClauseAlreadySeen.js | 2 +- .../reference/extendsClauseAlreadySeen2.js | 2 +- tests/baselines/reference/fluentClasses.js | 4 +- tests/baselines/reference/for-inStatements.js | 2 +- .../reference/for-inStatementsInvalid.js | 2 +- .../forStatementsMultipleInvalidDecl.js | 2 +- .../reference/functionImplementationErrors.js | 4 +- .../reference/functionImplementations.js | 4 +- .../reference/functionSubtypingOfVarArgs.js | 2 +- .../reference/functionSubtypingOfVarArgs2.js | 2 +- .../reference/generatedContextualTyping.js | 4 +- .../genericBaseClassLiteralProperty.js | 2 +- .../genericBaseClassLiteralProperty2.js | 2 +- ...allWithConstraintsTypeArgumentInference.js | 4 +- .../genericCallWithObjectTypeArgs2.js | 4 +- ...icCallWithObjectTypeArgsAndConstraints2.js | 2 +- ...icCallWithObjectTypeArgsAndConstraints3.js | 4 +- .../genericCallbacksAndClassHierarchy.js | 2 +- .../genericClassExpressionInFunction.js | 12 +-- ...sInheritsConstructorFromNonGenericClass.js | 4 +- .../reference/genericClassStaticMethod.js | 2 +- tests/baselines/reference/genericClasses3.js | 2 +- .../genericDerivedTypeWithSpecializedBase.js | 2 +- .../genericDerivedTypeWithSpecializedBase2.js | 2 +- .../genericInheritedDefaultConstructors.js | 2 +- .../reference/genericPrototypeProperty2.js | 4 +- .../reference/genericPrototypeProperty3.js | 4 +- ...ericRecursiveImplicitConstructorErrors2.js | 2 +- ...ericRecursiveImplicitConstructorErrors3.js | 2 +- .../reference/genericTypeAssertions2.js | 2 +- .../reference/genericTypeAssertions4.js | 4 +- .../reference/genericTypeAssertions6.js | 2 +- ...genericTypeReferenceWithoutTypeArgument.js | 4 +- ...enericTypeReferenceWithoutTypeArgument2.js | 4 +- .../genericWithIndexerOfTypeParameterType2.js | 4 +- .../reference/heterogeneousArrayLiterals.js | 4 +- .../reference/ifDoWhileStatements.js | 2 +- .../illegalSuperCallsInConstructor.js | 2 +- .../implementClausePrecedingExtends.js | 2 +- ...gAnInterfaceExtendingClassWithPrivates2.js | 22 ++--- ...AnInterfaceExtendingClassWithProtecteds.js | 8 +- .../baselines/reference/importAsBaseClass.js | 2 +- tests/baselines/reference/importHelpers.js | 4 +- tests/baselines/reference/importHelpersAmd.js | 2 +- .../importHelpersInIsolatedModules.js | 4 +- .../reference/importHelpersNoHelpers.js | 4 +- .../reference/importHelpersNoModule.js | 4 +- .../reference/importHelpersOutFile.js | 4 +- .../reference/importHelpersSystem.js | 2 +- .../reference/importShadowsGlobalName.js | 2 +- .../reference/importUsedInExtendsList1.js | 2 +- .../reference/indexerConstraints2.js | 8 +- .../reference/indirectSelfReference.js | 4 +- .../reference/indirectSelfReferenceGeneric.js | 4 +- .../infinitelyExpandingTypesNonGenericBase.js | 2 +- .../inheritFromGenericTypeParameter.js | 2 +- ...SameNamePrivatePropertiesFromSameOrigin.js | 4 +- tests/baselines/reference/inheritance.js | 8 +- tests/baselines/reference/inheritance1.js | 8 +- ...itanceGrandParentPrivateMemberCollision.js | 4 +- ...tPrivateMemberCollisionWithPublicMember.js | 4 +- ...tPublicMemberCollisionWithPrivateMember.js | 4 +- ...ritanceMemberAccessorOverridingAccessor.js | 2 +- ...heritanceMemberAccessorOverridingMethod.js | 2 +- ...ritanceMemberAccessorOverridingProperty.js | 2 +- ...inheritanceMemberFuncOverridingAccessor.js | 2 +- .../inheritanceMemberFuncOverridingMethod.js | 2 +- ...inheritanceMemberFuncOverridingProperty.js | 2 +- ...ritanceMemberPropertyOverridingAccessor.js | 2 +- ...heritanceMemberPropertyOverridingMethod.js | 2 +- ...ritanceMemberPropertyOverridingProperty.js | 2 +- .../inheritanceOfGenericConstructorMethod1.js | 2 +- .../inheritanceOfGenericConstructorMethod2.js | 4 +- ...ritanceStaticAccessorOverridingAccessor.js | 2 +- ...heritanceStaticAccessorOverridingMethod.js | 2 +- ...ritanceStaticAccessorOverridingProperty.js | 2 +- ...inheritanceStaticFuncOverridingAccessor.js | 2 +- ...eStaticFuncOverridingAccessorOfFuncType.js | 2 +- .../inheritanceStaticFuncOverridingMethod.js | 2 +- ...inheritanceStaticFuncOverridingProperty.js | 2 +- ...eStaticFuncOverridingPropertyOfFuncType.js | 2 +- ...taticFunctionOverridingInstanceProperty.js | 2 +- .../inheritanceStaticMembersCompatible.js | 2 +- .../inheritanceStaticMembersIncompatible.js | 2 +- ...ritanceStaticPropertyOverridingAccessor.js | 2 +- ...heritanceStaticPropertyOverridingMethod.js | 2 +- ...ritanceStaticPropertyOverridingProperty.js | 2 +- .../inheritedConstructorWithRestParams.js | 2 +- .../inheritedConstructorWithRestParams2.js | 4 +- .../inheritedModuleMembersForClodule.js | 4 +- .../reference/instanceOfAssignability.js | 4 +- ...nstancePropertiesInheritedIntoClassType.js | 4 +- .../reference/instanceSubtypeCheck2.js | 2 +- ...nstanceofWithStructurallyIdenticalTypes.js | 4 +- .../instantiatedReturnTypeContravariance.js | 2 +- .../reference/interfaceClassMerging.js | 2 +- .../reference/interfaceClassMerging2.js | 2 +- .../reference/interfaceExtendsClass1.js | 6 +- .../interfaceExtendsClassWithPrivate1.js | 2 +- .../interfaceExtendsClassWithPrivate2.js | 4 +- .../reference/interfaceImplementation8.js | 8 +- .../invalidModuleWithStatementsOfEveryKind.js | 12 +-- .../invalidMultipleVariableDeclarations.js | 2 +- .../reference/invalidReturnStatements.js | 2 +- .../isolatedModulesImportExportElision.js | 2 +- .../baselines/reference/jsxInExtendsClause.js | 4 +- tests/baselines/reference/jsxViaImport.2.js | 2 +- tests/baselines/reference/jsxViaImport.js | 2 +- .../reference/keyofAndIndexedAccess.js | 2 +- tests/baselines/reference/lambdaArgCrash.js | 2 +- tests/baselines/reference/localTypes1.js | 4 +- tests/baselines/reference/m7Bugs.js | 2 +- .../reference/mergedDeclarations5.js | 2 +- .../reference/mergedDeclarations6.js | 2 +- .../mergedInheritedClassInterface.js | 4 +- .../mergedInterfacesWithInheritedPrivates2.js | 4 +- .../mergedInterfacesWithInheritedPrivates3.js | 2 +- tests/baselines/reference/moduleAsBaseType.js | 2 +- .../moduleImportedForTypeArgumentPosition.js | 2 +- .../moduleWithStatementsOfEveryKind.js | 8 +- .../reference/multipleInheritance.js | 12 +-- .../mutuallyRecursiveGenericBaseTypes2.js | 2 +- tests/baselines/reference/noEmitHelpers.js | 2 +- .../noImplicitAnyMissingGetAccessor.js | 2 +- .../noImplicitAnyMissingSetAccessor.js | 2 +- ...enericClassExtendingGenericClassWithAny.js | 2 +- ...cIndexerConstrainsPropertyDeclarations2.js | 2 +- .../reference/numericIndexerConstraint3.js | 2 +- .../reference/numericIndexerConstraint4.js | 2 +- .../reference/numericIndexerTyping2.js | 2 +- ...objectTypeHidingMembersOfExtendedObject.js | 2 +- ...objectTypesIdentityWithNumericIndexers1.js | 4 +- ...objectTypesIdentityWithNumericIndexers2.js | 6 +- ...objectTypesIdentityWithNumericIndexers3.js | 4 +- .../objectTypesIdentityWithPrivates.js | 4 +- .../objectTypesIdentityWithPrivates2.js | 2 +- .../objectTypesIdentityWithPrivates3.js | 4 +- .../objectTypesIdentityWithStringIndexers.js | 4 +- .../objectTypesIdentityWithStringIndexers2.js | 6 +- .../optionalConstructorArgInSuper.js | 2 +- tests/baselines/reference/optionalMethods.js | 2 +- .../reference/optionalParamInOverride.js | 2 +- .../baselines/reference/outModuleConcatAmd.js | 2 +- .../outModuleConcatAmd.sourcemap.txt | 4 +- .../reference/outModuleConcatSystem.js | 2 +- .../outModuleConcatSystem.sourcemap.txt | 4 +- .../reference/outModuleTripleSlashRefs.js | 2 +- .../outModuleTripleSlashRefs.sourcemap.txt | 4 +- tests/baselines/reference/overload1.js | 4 +- .../overloadOnConstConstraintChecks1.js | 6 +- .../overloadOnConstConstraintChecks2.js | 4 +- .../overloadOnConstConstraintChecks3.js | 4 +- .../overloadOnConstConstraintChecks4.js | 6 +- .../overloadOnConstantsInvalidOverload1.js | 6 +- .../baselines/reference/overloadResolution.js | 6 +- .../overloadResolutionClassConstructors.js | 6 +- .../overloadResolutionConstructors.js | 6 +- .../reference/overloadingOnConstants1.js | 6 +- .../reference/overloadingOnConstants2.js | 2 +- .../overridingPrivateStaticMembers.js | 2 +- .../reference/parseErrorInHeritageClause1.js | 2 +- tests/baselines/reference/parser509630.js | 2 +- tests/baselines/reference/parserAstSpans1.js | 2 +- .../reference/parserClassDeclaration1.js | 2 +- .../reference/parserClassDeclaration3.js | 2 +- .../reference/parserClassDeclaration4.js | 2 +- .../reference/parserClassDeclaration5.js | 2 +- .../reference/parserClassDeclaration6.js | 2 +- ...rrorRecovery_ExtendsOrImplementsClause2.js | 2 +- ...rrorRecovery_ExtendsOrImplementsClause4.js | 2 +- ...rrorRecovery_ExtendsOrImplementsClause5.js | 2 +- .../parserGenericsInTypeContexts1.js | 2 +- .../parserGenericsInTypeContexts2.js | 2 +- ...artiallyAnnotatedFunctionInferenceError.js | 2 +- ...tatedFunctionInferenceWithTypeParameter.js | 2 +- tests/baselines/reference/primitiveMembers.js | 2 +- tests/baselines/reference/privacyClass.js | 48 +++++----- .../privacyClassExtendsClauseDeclFile.js | 46 ++++----- tests/baselines/reference/privacyGloClass.js | 20 ++-- .../reference/privateAccessInSubclass1.js | 2 +- .../privateInstanceMemberAccessibility.js | 2 +- ...tedMembersAreNotAccessibleDestructuring.js | 2 +- .../privateStaticMemberAccessibility.js | 2 +- .../privateStaticNotAccessibleInClodule2.js | 2 +- .../amd/testGlo.js | 8 +- .../node/testGlo.js | 8 +- .../reference/project/prologueEmit/amd/out.js | 2 +- .../project/prologueEmit/node/out.js | 2 +- .../amd/m'ain.js | 2 +- .../node/m'ain.js | 2 +- .../reference/propertiesAndIndexers.js | 2 +- tests/baselines/reference/propertyAccess.js | 2 +- ...tyAccessOnTypeParameterWithConstraints2.js | 2 +- ...tyAccessOnTypeParameterWithConstraints3.js | 2 +- ...tyAccessOnTypeParameterWithConstraints5.js | 2 +- ...sPropertyAccessibleWithinNestedSubclass.js | 4 +- ...PropertyAccessibleWithinNestedSubclass1.js | 8 +- ...edClassPropertyAccessibleWithinSubclass.js | 2 +- ...dClassPropertyAccessibleWithinSubclass2.js | 8 +- ...dClassPropertyAccessibleWithinSubclass3.js | 2 +- .../protectedInstanceMemberAccessibility.js | 4 +- tests/baselines/reference/protectedMembers.js | 14 +-- ...icClassPropertyAccessibleWithinSubclass.js | 6 +- ...cClassPropertyAccessibleWithinSubclass2.js | 4 +- ...solution-does-not-affect-class-heritage.js | 2 +- .../reference/recursiveBaseCheck3.js | 4 +- .../reference/recursiveBaseCheck4.js | 2 +- .../reference/recursiveBaseCheck6.js | 2 +- .../recursiveBaseConstructorCreation1.js | 2 +- ...ssInstantiationsWithDefaultConstructors.js | 2 +- .../reference/recursiveClassReferenceTest.js | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 4 +- .../reference/recursiveComplicatedClasses.js | 6 +- ...sivelySpecializedConstructorDeclaration.js | 2 +- .../reference/reexportClassDefinition.js | 2 +- ...lassDeclarationWhenInBaseTypeResolution.js | 94 +++++++++---------- tests/baselines/reference/returnStatements.js | 2 +- ...peCheckExtendedClassInsidePublicMethod2.js | 2 +- ...peCheckExtendedClassInsideStaticMethod1.js | 2 +- .../reference/shadowPrivateMembers.js | 2 +- ...sWithDefaultConstructorAndExtendsClause.js | 2 +- ...hDefaultConstructorAndExtendsClause.js.map | 2 +- ...tConstructorAndExtendsClause.sourcemap.txt | 8 +- .../specializedInheritedConstructors1.js | 2 +- .../specializedOverloadWithRestParameters.js | 2 +- tests/baselines/reference/staticFactory1.js | 2 +- .../baselines/reference/staticInheritance.js | 2 +- .../staticMemberAccessOffDerivedType1.js | 2 +- tests/baselines/reference/staticPropSuper.js | 8 +- .../reference/strictModeInConstructor.js | 4 +- .../reference/strictModeReservedWord.js | 2 +- ...trictModeReservedWordInClassDeclaration.js | 4 +- ...gIndexerConstrainsPropertyDeclarations2.js | 2 +- ...ubSubClassCanAccessProtectedConstructor.js | 4 +- .../reference/subtypesOfTypeParameter.js | 2 +- .../subtypesOfTypeParameterWithConstraints.js | 58 ++++++------ ...subtypesOfTypeParameterWithConstraints4.js | 18 ++-- ...OfTypeParameterWithRecursiveConstraints.js | 36 +++---- .../reference/subtypingTransitivity.js | 4 +- .../reference/subtypingWithCallSignatures2.js | 6 +- .../reference/subtypingWithCallSignatures3.js | 6 +- .../reference/subtypingWithCallSignatures4.js | 6 +- .../subtypingWithConstructSignatures2.js | 6 +- .../subtypingWithConstructSignatures3.js | 6 +- .../subtypingWithConstructSignatures4.js | 6 +- .../subtypingWithConstructSignatures5.js | 6 +- .../subtypingWithConstructSignatures6.js | 6 +- .../reference/subtypingWithNumericIndexer.js | 12 +-- .../reference/subtypingWithNumericIndexer3.js | 14 +-- .../reference/subtypingWithNumericIndexer4.js | 6 +- .../reference/subtypingWithObjectMembers.js | 16 ++-- .../reference/subtypingWithObjectMembers4.js | 8 +- ...subtypingWithObjectMembersAccessibility.js | 8 +- ...ubtypingWithObjectMembersAccessibility2.js | 14 +-- .../reference/subtypingWithStringIndexer.js | 12 +-- .../reference/subtypingWithStringIndexer3.js | 14 +-- .../reference/subtypingWithStringIndexer4.js | 6 +- tests/baselines/reference/super.js | 4 +- tests/baselines/reference/super1.js | 10 +- tests/baselines/reference/super2.js | 8 +- tests/baselines/reference/superAccess.js | 2 +- .../reference/superAccessInFatArrow1.js | 2 +- .../reference/superCallAssignResult.js | 2 +- .../superCallBeforeThisAccessing3.js | 2 +- .../superCallBeforeThisAccessing4.js | 2 +- .../superCallBeforeThisAccessing5.js | 2 +- .../superCallBeforeThisAccessing7.js | 2 +- .../superCallBeforeThisAccessing8.js | 2 +- .../reference/superCallInStaticMethod.js | 2 +- .../superCallInsideClassDeclaration.js | 2 +- .../superCallInsideClassExpression.js | 2 +- .../superCallInsideObjectLiteralExpression.js | 2 +- .../superCallWithMissingBaseClass.js | 2 +- tests/baselines/reference/superCalls.js | 2 +- .../reference/superCallsInConstructor.js | 2 +- .../baselines/reference/superInCatchBlock1.js | 2 +- .../reference/superInConstructorParam1.js | 2 +- .../reference/superInObjectLiterals_ES5.js | 2 +- tests/baselines/reference/superNewCall1.js | 2 +- .../reference/superPropertyAccess.js | 2 +- ...essInComputedPropertiesOfNestedType_ES5.js | 2 +- .../reference/superPropertyAccess_ES5.js | 2 +- ...perPropertyInConstructorBeforeSuperCall.js | 2 +- .../reference/superSymbolIndexedAccess5.js | 2 +- .../reference/superSymbolIndexedAccess6.js | 2 +- .../reference/superWithTypeArgument.js | 2 +- .../reference/superWithTypeArgument2.js | 2 +- .../reference/superWithTypeArgument3.js | 2 +- ...side-object-literal-getters-and-setters.js | 2 +- tests/baselines/reference/switchStatements.js | 2 +- .../reference/systemModuleWithSuperClass.js | 2 +- .../reference/thisInInvalidContexts.js | 2 +- .../thisInInvalidContextsExternalModule.js | 2 +- .../reference/thisTypeInFunctions.js | 6 +- .../reference/thisTypeInFunctionsNegative.js | 4 +- .../tsxCorrectlyParseLessThanComparison1.js | 2 +- .../baselines/reference/tsxDynamicTagName5.js | 2 +- .../baselines/reference/tsxDynamicTagName7.js | 2 +- .../baselines/reference/tsxDynamicTagName8.js | 2 +- .../baselines/reference/tsxDynamicTagName9.js | 2 +- .../reference/tsxExternalModuleEmit1.js | 4 +- .../tsxStatelessFunctionComponents2.js | 2 +- .../reference/tsxUnionTypeComponent1.js | 4 +- tests/baselines/reference/typeAssertions.js | 2 +- .../baselines/reference/typeGuardFunction.js | 2 +- .../reference/typeGuardFunctionErrors.js | 2 +- .../reference/typeGuardFunctionGenerics.js | 2 +- .../reference/typeGuardFunctionOfFormThis.js | 12 +-- .../typeGuardFunctionOfFormThisErrors.js | 4 +- .../reference/typeGuardOfFormInstanceOf.js | 2 +- .../reference/typeGuardOfFormIsType.js | 2 +- .../reference/typeGuardOfFormThisMember.js | 2 +- .../typeGuardOfFormThisMemberErrors.js | 2 +- tests/baselines/reference/typeMatch2.js | 2 +- tests/baselines/reference/typeOfSuperCall.js | 2 +- .../reference/typeParameterAsBaseClass.js | 2 +- .../reference/typeParameterAsBaseType.js | 4 +- .../reference/typeParameterExtendingUnion1.js | 4 +- .../reference/typeParameterExtendingUnion2.js | 4 +- .../baselines/reference/typeRelationships.js | 2 +- .../baselines/reference/typeValueConflict1.js | 2 +- .../baselines/reference/typeValueConflict2.js | 4 +- tests/baselines/reference/typeofClass2.js | 2 +- .../typesWithSpecializedCallSignatures.js | 4 +- ...typesWithSpecializedConstructSignatures.js | 4 +- tests/baselines/reference/undeclaredBase.js | 2 +- .../undefinedIsSubtypeOfEverything.js | 44 ++++----- .../baselines/reference/underscoreMapFirst.js | 2 +- .../underscoreThisInDerivedClass01.js | 2 +- .../underscoreThisInDerivedClass02.js | 2 +- .../reference/unionTypeEquivalence.js | 2 +- .../reference/unionTypeFromArrayLiteral.js | 4 +- .../reference/unionTypesAssignability.js | 4 +- .../reference/unspecializedConstraints.js | 2 +- ...untypedFunctionCallsWithTypeParameters1.js | 2 +- .../reference/unusedClassesinNamespace4.js | 2 +- .../unusedIdentifiersConsolidated1.js | 2 +- 585 files changed, 1223 insertions(+), 1213 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index e559350202b..e8af4ecbc25 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1091,7 +1091,7 @@ namespace ts { } // Perform the capture. - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { @@ -1101,15 +1101,25 @@ namespace ts { return SuperCaptureResult.NoReplacement; } + function createActualThis() { + return setEmitFlags(createThis(), EmitFlags.NoSubstitution); + } + function createDefaultSuperCallOrThis() { - const actualThis = createThis(); - setEmitFlags(actualThis, EmitFlags.NoSubstitution); - const superCall = createFunctionApply( - createIdentifier("_super"), - actualThis, - createIdentifier("arguments"), + return createLogicalOr( + createLogicalAnd( + createStrictInequality( + createIdentifier("_super"), + createNull() + ), + createFunctionApply( + createIdentifier("_super"), + createActualThis(), + createIdentifier("arguments"), + ) + ), + createActualThis() ); - return createLogicalOr(superCall, actualThis); } /** diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index abdbe37f2e6..c3084700547 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -43,7 +43,7 @@ var A; var Point3d = (function (_super) { __extends(Point3d, _super); function Point3d() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Point3d; }(Point)); diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index c674c23ab84..fe4308281d1 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -46,7 +46,7 @@ var A; var Point3d = (function (_super) { __extends(Point3d, _super); function Point3d() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Point3d; }(Point)); diff --git a/tests/baselines/reference/abstractClassInLocalScope.js b/tests/baselines/reference/abstractClassInLocalScope.js index 111714fcc13..d841911b0bf 100644 --- a/tests/baselines/reference/abstractClassInLocalScope.js +++ b/tests/baselines/reference/abstractClassInLocalScope.js @@ -27,7 +27,7 @@ var __extends = (this && this.__extends) || (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js index 16e3e7c497d..a513ce3d88e 100644 --- a/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js +++ b/tests/baselines/reference/abstractClassInLocalScopeIsAbstract.js @@ -27,7 +27,7 @@ var __extends = (this && this.__extends) || (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/abstractProperty.js b/tests/baselines/reference/abstractProperty.js index 0cb89665b94..f4b2d432f24 100644 --- a/tests/baselines/reference/abstractProperty.js +++ b/tests/baselines/reference/abstractProperty.js @@ -40,7 +40,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.raw = "edge"; _this.ro = "readonly please"; return _this; diff --git a/tests/baselines/reference/abstractPropertyNegative.js b/tests/baselines/reference/abstractPropertyNegative.js index 1b0898de8e3..5ff6708b89a 100644 --- a/tests/baselines/reference/abstractPropertyNegative.js +++ b/tests/baselines/reference/abstractPropertyNegative.js @@ -62,7 +62,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.ro = "readonly please"; return _this; } @@ -83,7 +83,7 @@ var WrongTypeProperty = (function () { var WrongTypePropertyImpl = (function (_super) { __extends(WrongTypePropertyImpl, _super); function WrongTypePropertyImpl() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.num = "nope, wrong"; return _this; } @@ -97,7 +97,7 @@ var WrongTypeAccessor = (function () { var WrongTypeAccessorImpl = (function (_super) { __extends(WrongTypeAccessorImpl, _super); function WrongTypeAccessorImpl() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(WrongTypeAccessorImpl.prototype, "num", { get: function () { return "nope, wrong"; }, @@ -109,7 +109,7 @@ var WrongTypeAccessorImpl = (function (_super) { var WrongTypeAccessorImpl2 = (function (_super) { __extends(WrongTypeAccessorImpl2, _super); function WrongTypeAccessorImpl2() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.num = "nope, wrong"; return _this; } diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 50a498e278c..8d9ef160e2e 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -43,7 +43,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 87ce93aa104..41a2bb06664 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -51,7 +51,7 @@ var Backbone = require("./aliasUsage1_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index fa93daad9bc..1f3e1490332 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -45,7 +45,7 @@ var Backbone = require("./aliasUsageInArray_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 908480fb5b2..a6fc0e97f68 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -44,7 +44,7 @@ var Backbone = require("./aliasUsageInFunctionExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index f0625fde40a..a991207971c 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -48,7 +48,7 @@ var Backbone = require("./aliasUsageInGenericFunction_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 11a9a969a49..d57b2f6379d 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -50,7 +50,7 @@ var Backbone = require("./aliasUsageInIndexerOfClass_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index e82b58bab8f..15818c82cb9 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -45,7 +45,7 @@ var Backbone = require("./aliasUsageInObjectLiteral_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 4dc10ee726b..99360ea648d 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -48,7 +48,7 @@ var Backbone = require("./aliasUsageInOrExpression_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index e7c42281f4f..47f0c30d28b 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -48,7 +48,7 @@ var Backbone = require("./aliasUsageInTypeArgumentOfExtendsClause_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); @@ -74,7 +74,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = moduleA; return _this; } diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 1d1b1c51f2c..666e32e1546 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -44,7 +44,7 @@ var Backbone = require("./aliasUsageInVarAssignment_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 1f24276e2fb..12d0f01cf4a 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -27,7 +27,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index 7bbd61d6689..df266c20951 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -43,7 +43,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -56,7 +56,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index 2b835917fb4..16d43e8316c 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -33,7 +33,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index c080b83957b..511d37b1752 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -106,7 +106,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C2.prototype.C2M1 = function () { return null; }; return C2; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 5e2911b13fb..233ea1b1159 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -80,7 +80,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C2.prototype.C2M1 = function () { return null; }; return C2; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index bc78f629bcb..3a0ab1a5cf5 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -133,7 +133,7 @@ var EmptyTypes; var derived = (function (_super) { __extends(derived, _super); function derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); @@ -192,7 +192,7 @@ var NonEmptyTypes; var derived = (function (_super) { __extends(derived, _super); function derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index fc62da7d3a2..d9b830e8184 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -70,14 +70,14 @@ var Action = (function () { var ActionA = (function (_super) { __extends(ActionA, _super); function ActionA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ActionA; }(Action)); var ActionB = (function (_super) { __extends(ActionB, _super); function ActionB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ActionB; }(Action)); diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 8d69ab90dcf..8041ac399f0 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -75,7 +75,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); @@ -83,7 +83,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index bd1d38de4cb..8321a572178 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -44,7 +44,7 @@ var List = (function () { var DerivedList = (function (_super) { __extends(DerivedList, _super); function DerivedList() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return DerivedList; }(List)); diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js index 3e4e6d6a148..b2164a07b81 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.js @@ -38,14 +38,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(Array)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index f0c8557659b..58fd19326ee 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -119,21 +119,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 40c98239cbc..37030895006 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -120,21 +120,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index 2ac6493af4d..17ebf51308b 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -85,21 +85,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 1281cfc0f5d..905ef432786 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -62,21 +62,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 888a4939854..25f267c19c8 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -119,21 +119,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 32081f035e6..879b24a3dde 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -120,21 +120,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index 7c4e7ca53f3..b2d722c6791 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -85,21 +85,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index 5ac28d58024..6c68a3edbfe 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -62,21 +62,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index 59d173ebd71..e05538472fe 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -77,7 +77,7 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index afac7265036..6ea115fde33 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -64,7 +64,7 @@ b = a; // ok var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 9204c87a172..bdd502ee027 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -113,14 +113,14 @@ var OnlyDerived; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); @@ -172,14 +172,14 @@ var WithBase; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 1e539a9713b..b5274280b31 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -108,14 +108,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 3387a818b6f..e158a787878 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -110,14 +110,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index d296c256d17..8f3b23cfffb 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -87,7 +87,7 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -98,7 +98,7 @@ var Generics; var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js index 8bf88bd16e4..280e8a87916 100644 --- a/tests/baselines/reference/asyncImportedPromise_es5.js +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -24,7 +24,7 @@ var __extends = (this && this.__extends) || (function () { var Task = (function (_super) { __extends(Task, _super); function Task() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Task; }(Promise)); diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.js b/tests/baselines/reference/asyncMethodWithSuper_es5.js index 235f2763f9f..c68b1ed036f 100644 --- a/tests/baselines/reference/asyncMethodWithSuper_es5.js +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.js @@ -61,7 +61,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } // async method with only call/get on 'super' does not require a binding B.prototype.simple = function () { diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.js b/tests/baselines/reference/asyncQualifiedReturnType_es5.js index dd54f6ee833..3cae9ea6b56 100644 --- a/tests/baselines/reference/asyncQualifiedReturnType_es5.js +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.js @@ -13,7 +13,7 @@ var X; var MyPromise = (function (_super) { __extends(MyPromise, _super); function MyPromise() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyPromise; }(Promise)); diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5.js index b207ba08f8d..9cb8ce22f63 100644 --- a/tests/baselines/reference/awaitClassExpression_es5.js +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -17,7 +17,7 @@ function func() { _a = function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 82818ecafbe..e57e5272ade 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -43,7 +43,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index 57ee369a03c..06e7dd0c681 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -56,7 +56,7 @@ var Class1 = (function () { var Class2 = (function (_super) { __extends(Class2, _super); function Class2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Class2; }(Class1)); @@ -68,7 +68,7 @@ var Class3 = (function () { var Class4 = (function (_super) { __extends(Class4, _super); function Class4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Class4; }(Class3)); diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index d2087b3100a..7442d1e0e6a 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -46,7 +46,7 @@ var CBaseBase = (function () { var CBase = (function (_super) { __extends(CBase, _super); function CBase() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return CBase; }(CBaseBase)); @@ -64,7 +64,7 @@ var Wrapper = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.works = function () { new CBaseBase(this); diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index a1499143fd4..529eacfad04 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -41,7 +41,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - var _this; + var _this = this; _this.x; any; return _this; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index b31e773ff24..efd55a9ca18 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -49,14 +49,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 31d0c03a5dc..b68b5c3d97c 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -45,14 +45,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index 9b0c2be7b76..39712f873bc 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -51,7 +51,7 @@ var E = (function () { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return F; }(C)); @@ -64,7 +64,7 @@ var C1 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.i = "bar"; return _this; } diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 74b5bafad38..a71613bc545 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -89,21 +89,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 84b7e2d0a52..7f9d616281b 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -136,21 +136,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 04e8e2d6a2a..6c5d7508fc9 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -69,21 +69,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 9fabe405db0..fe260d62119 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -69,21 +69,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index 52e08ae4401..c6054d2411d 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -72,21 +72,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 4cff94b3b90..fea3bd9a238 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -64,7 +64,7 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(A)); @@ -72,7 +72,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return F; }(A)); diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 116fcd0f83d..c85845f6d35 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -41,7 +41,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index fc23b30e197..99bd90139ae 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -47,14 +47,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js index 8c59c4d6682..bbe56823ee5 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing2.js @@ -29,7 +29,7 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; _this.x = 100; _this = _super.call(this) || this; _this.x = 10; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js index 1699b3a0f35..dc7e0309ab6 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing3.js @@ -34,7 +34,7 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; var innver = (function () { function innver() { this.y = true; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js index 49dfb6e4a22..b8240b27aea 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing4.js @@ -38,7 +38,7 @@ var Based = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; (function () { _this; // No error }); diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js index 8931b0090cf..a40791a4eba 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing6.js @@ -33,7 +33,7 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var _this; + var _this = this; (function () { return _this; }); // No Error _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js index 77e4a4096d0..92f13921d2a 100644 --- a/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/checkSuperCallBeforeThisAccessing8.js @@ -33,7 +33,7 @@ var Base = (function () { var Super = (function (_super) { __extends(Super, _super); function Super() { - var _this; + var _this = this; var that = _this; _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index 27be18c2a28..7c05d6dc3d3 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -37,7 +37,7 @@ var B; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(B.a.C)); diff --git a/tests/baselines/reference/circularTypeofWithFunctionModule.js b/tests/baselines/reference/circularTypeofWithFunctionModule.js index 38bced08608..a94de5d55e2 100644 --- a/tests/baselines/reference/circularTypeofWithFunctionModule.js +++ b/tests/baselines/reference/circularTypeofWithFunctionModule.js @@ -36,7 +36,7 @@ function maker(value) { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Foo)); diff --git a/tests/baselines/reference/classAbstractConstructorAssignability.js b/tests/baselines/reference/classAbstractConstructorAssignability.js index 52335c203b2..5df6d169e04 100644 --- a/tests/baselines/reference/classAbstractConstructorAssignability.js +++ b/tests/baselines/reference/classAbstractConstructorAssignability.js @@ -33,14 +33,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/classAbstractCrashedOnce.js b/tests/baselines/reference/classAbstractCrashedOnce.js index dbad78fbd00..7801b61cdd9 100644 --- a/tests/baselines/reference/classAbstractCrashedOnce.js +++ b/tests/baselines/reference/classAbstractCrashedOnce.js @@ -29,7 +29,7 @@ var foo = (function () { var bar = (function (_super) { __extends(bar, _super); function bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } bar.prototype.test = function () { this. diff --git a/tests/baselines/reference/classAbstractExtends.js b/tests/baselines/reference/classAbstractExtends.js index e0fb7ad8189..69c962509db 100644 --- a/tests/baselines/reference/classAbstractExtends.js +++ b/tests/baselines/reference/classAbstractExtends.js @@ -36,28 +36,28 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(B)); var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.bar = function () { }; return E; diff --git a/tests/baselines/reference/classAbstractFactoryFunction.js b/tests/baselines/reference/classAbstractFactoryFunction.js index 89b77b62a9a..abc3235a3d3 100644 --- a/tests/baselines/reference/classAbstractFactoryFunction.js +++ b/tests/baselines/reference/classAbstractFactoryFunction.js @@ -36,7 +36,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classAbstractGeneric.js b/tests/baselines/reference/classAbstractGeneric.js index df6222f6495..6d20869ba73 100644 --- a/tests/baselines/reference/classAbstractGeneric.js +++ b/tests/baselines/reference/classAbstractGeneric.js @@ -44,28 +44,28 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); // error -- inherits abstract methods var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(A)); // error -- inherits abstract methods var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function () { return this.t; }; return E; @@ -73,7 +73,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } F.prototype.bar = function (t) { }; return F; @@ -81,7 +81,7 @@ var F = (function (_super) { var G = (function (_super) { __extends(G, _super); function G() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } G.prototype.foo = function () { return this.t; }; G.prototype.bar = function (t) { }; diff --git a/tests/baselines/reference/classAbstractInAModule.js b/tests/baselines/reference/classAbstractInAModule.js index 86e6b8e3153..4bbe7a40dc5 100644 --- a/tests/baselines/reference/classAbstractInAModule.js +++ b/tests/baselines/reference/classAbstractInAModule.js @@ -29,7 +29,7 @@ var M; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classAbstractInheritance.js b/tests/baselines/reference/classAbstractInheritance.js index a26a8170f53..a39ef662d76 100644 --- a/tests/baselines/reference/classAbstractInheritance.js +++ b/tests/baselines/reference/classAbstractInheritance.js @@ -40,14 +40,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); @@ -59,42 +59,42 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(AA)); var CC = (function (_super) { __extends(CC, _super); function CC() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return CC; }(AA)); var DD = (function (_super) { __extends(DD, _super); function DD() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return DD; }(BB)); var EE = (function (_super) { __extends(EE, _super); function EE() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return EE; }(BB)); var FF = (function (_super) { __extends(FF, _super); function FF() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return FF; }(CC)); var GG = (function (_super) { __extends(GG, _super); function GG() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return GG; }(CC)); diff --git a/tests/baselines/reference/classAbstractInstantiations1.js b/tests/baselines/reference/classAbstractInstantiations1.js index 101dca316df..6722665b62d 100644 --- a/tests/baselines/reference/classAbstractInstantiations1.js +++ b/tests/baselines/reference/classAbstractInstantiations1.js @@ -46,14 +46,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/classAbstractInstantiations2.js b/tests/baselines/reference/classAbstractInstantiations2.js index 8449689f84a..7d400c9fb05 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.js +++ b/tests/baselines/reference/classAbstractInstantiations2.js @@ -87,21 +87,21 @@ new x; // okay -- undefined behavior at runtime var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); // error -- not declared abstract var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(B)); // okay var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.bar = function () { return 1; }; return E; @@ -109,7 +109,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } F.prototype.bar = function () { return 2; }; return F; diff --git a/tests/baselines/reference/classAbstractOverrideWithAbstract.js b/tests/baselines/reference/classAbstractOverrideWithAbstract.js index 345ce20ca1f..496dc7f241a 100644 --- a/tests/baselines/reference/classAbstractOverrideWithAbstract.js +++ b/tests/baselines/reference/classAbstractOverrideWithAbstract.js @@ -43,7 +43,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -56,7 +56,7 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } BB.prototype.bar = function () { }; return BB; @@ -64,14 +64,14 @@ var BB = (function (_super) { var CC = (function (_super) { __extends(CC, _super); function CC() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return CC; }(BB)); // error var DD = (function (_super) { __extends(DD, _super); function DD() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } DD.prototype.foo = function () { }; return DD; diff --git a/tests/baselines/reference/classAbstractSuperCalls.js b/tests/baselines/reference/classAbstractSuperCalls.js index e569f90528e..125f5b3883f 100644 --- a/tests/baselines/reference/classAbstractSuperCalls.js +++ b/tests/baselines/reference/classAbstractSuperCalls.js @@ -47,7 +47,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { _super.prototype.foo.call(this); }; B.prototype.baz = function () { return this.foo; }; @@ -56,7 +56,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { return 2; }; C.prototype.qux = function () { return _super.prototype.foo.call(this) || _super.prototype.foo; }; // 2 errors, foo is abstract @@ -73,7 +73,7 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(AA)); diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js index 61b5fd6fd13..8781fc6c05f 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethod1.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethod1.js @@ -36,7 +36,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.foo = function () { return 1; }; return B; @@ -44,7 +44,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js index bd17fa96091..6016ab249f1 100644 --- a/tests/baselines/reference/classAbstractUsingAbstractMethods2.js +++ b/tests/baselines/reference/classAbstractUsingAbstractMethods2.js @@ -46,21 +46,21 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; return D; @@ -68,7 +68,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function () { }; return E; @@ -81,21 +81,21 @@ var AA = (function () { var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(AA)); var CC = (function (_super) { __extends(CC, _super); function CC() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return CC; }(AA)); var DD = (function (_super) { __extends(DD, _super); function DD() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } DD.prototype.foo = function () { }; return DD; diff --git a/tests/baselines/reference/classConstructorAccessibility4.js b/tests/baselines/reference/classConstructorAccessibility4.js index 73451f5fab4..f6370729971 100644 --- a/tests/baselines/reference/classConstructorAccessibility4.js +++ b/tests/baselines/reference/classConstructorAccessibility4.js @@ -56,7 +56,7 @@ var A = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); @@ -78,7 +78,7 @@ var D = (function () { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return F; }(D)); diff --git a/tests/baselines/reference/classConstructorAccessibility5.js b/tests/baselines/reference/classConstructorAccessibility5.js index a6738e229e0..d409265d89d 100644 --- a/tests/baselines/reference/classConstructorAccessibility5.js +++ b/tests/baselines/reference/classConstructorAccessibility5.js @@ -30,7 +30,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.make = function () { new Base(); }; // ok return Derived; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index a7fa44091c8..4a0edb610d5 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -38,7 +38,7 @@ var M; var O = (function (_super) { __extends(O, _super); function O() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return O; }(M.N)); diff --git a/tests/baselines/reference/classDeclaredBeforeClassFactory.js b/tests/baselines/reference/classDeclaredBeforeClassFactory.js index f6cc69037c4..40cfd576644 100644 --- a/tests/baselines/reference/classDeclaredBeforeClassFactory.js +++ b/tests/baselines/reference/classDeclaredBeforeClassFactory.js @@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(makeBaseClass())); diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index 9fc1aecd9b2..c1642125fe9 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -36,7 +36,7 @@ var StringTreeCollectionBase = (function () { var StringTreeCollection = (function (_super) { __extends(StringTreeCollection, _super); function StringTreeCollection() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return StringTreeCollection; }(StringTreeCollectionBase)); diff --git a/tests/baselines/reference/classExpression2.js b/tests/baselines/reference/classExpression2.js index 6973fbec816..7f48463e81a 100644 --- a/tests/baselines/reference/classExpression2.js +++ b/tests/baselines/reference/classExpression2.js @@ -21,7 +21,7 @@ var D = (function () { var v = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(D)); diff --git a/tests/baselines/reference/classExpression3.js b/tests/baselines/reference/classExpression3.js index 858238d24ee..2582aa80398 100644 --- a/tests/baselines/reference/classExpression3.js +++ b/tests/baselines/reference/classExpression3.js @@ -20,7 +20,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(class_1, _super); function class_1() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.c = 3; return _this; } @@ -28,7 +28,7 @@ var C = (function (_super) { }((function (_super) { __extends(class_2, _super); function class_2() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.b = 2; return _this; } diff --git a/tests/baselines/reference/classExpressionExtendingAbstractClass.js b/tests/baselines/reference/classExpressionExtendingAbstractClass.js index 1ce5078ed63..814753be4d7 100644 --- a/tests/baselines/reference/classExpressionExtendingAbstractClass.js +++ b/tests/baselines/reference/classExpressionExtendingAbstractClass.js @@ -27,7 +27,7 @@ var A = (function () { var C = (function (_super) { __extends(class_1, _super); function class_1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class_1; }(A)); diff --git a/tests/baselines/reference/classExtendingBuiltinType.js b/tests/baselines/reference/classExtendingBuiltinType.js index 2ddf4c8961d..6fdead50a44 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.js +++ b/tests/baselines/reference/classExtendingBuiltinType.js @@ -25,70 +25,70 @@ var __extends = (this && this.__extends) || (function () { var C1 = (function (_super) { __extends(C1, _super); function C1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C1; }(Object)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(Function)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(String)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(Boolean)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }(Number)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }(Date)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C7; }(RegExp)); var C8 = (function (_super) { __extends(C8, _super); function C8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C8; }(Error)); var C9 = (function (_super) { __extends(C9, _super); function C9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C9; }(Array)); var C10 = (function (_super) { __extends(C10, _super); function C10() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C10; }(Array)); diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index 22bb12d95ec..52b415ccb77 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -52,7 +52,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -71,7 +71,7 @@ var C2 = (function () { var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(C2)); diff --git a/tests/baselines/reference/classExtendingClassLikeType.js b/tests/baselines/reference/classExtendingClassLikeType.js index 564fd14da51..6ba82a0a08b 100644 --- a/tests/baselines/reference/classExtendingClassLikeType.js +++ b/tests/baselines/reference/classExtendingClassLikeType.js @@ -73,7 +73,7 @@ var __extends = (this && this.__extends) || (function () { var D0 = (function (_super) { __extends(D0, _super); function D0() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D0; }(Base)); @@ -112,7 +112,7 @@ var D3 = (function (_super) { var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(getBase())); @@ -120,7 +120,7 @@ var D4 = (function (_super) { var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(getBadBase())); diff --git a/tests/baselines/reference/classExtendingNonConstructor.js b/tests/baselines/reference/classExtendingNonConstructor.js index 2a2e0b5eebc..bfe716b0029 100644 --- a/tests/baselines/reference/classExtendingNonConstructor.js +++ b/tests/baselines/reference/classExtendingNonConstructor.js @@ -32,49 +32,49 @@ function foo() { var C1 = (function (_super) { __extends(C1, _super); function C1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C1; }(undefined)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(true)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(false)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(42)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }("hello")); var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }(x)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C7; }(foo)); diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index 4d9eaba615e..ebfcea3903b 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -17,14 +17,14 @@ var __extends = (this && this.__extends) || (function () { var C1 = (function (_super) { __extends(C1, _super); function C1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C1; }(null)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }((null))); diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index ade53d91a74..eb36a24aeaf 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -29,28 +29,28 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(number)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(string)); var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(boolean)); var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(Void)); @@ -63,28 +63,28 @@ void {}; var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }(Null)); var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5a; }(null)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }(undefined)); var C7 = (function (_super) { __extends(C7, _super); function C7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C7; }(Undefined)); @@ -95,7 +95,7 @@ var E; var C8 = (function (_super) { __extends(C8, _super); function C8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C8; }(E)); diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 4e2c314b2dd..0b1c14936ba 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -25,7 +25,7 @@ void {}; var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5a; }(null)); diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index 59a84ba3e0a..24c61fd0bd6 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -28,7 +28,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(M.C)); diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index b2b91a9aedb..633cd4d9ef4 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -29,7 +29,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(M.C)); diff --git a/tests/baselines/reference/classExtendsAcrossFiles.js b/tests/baselines/reference/classExtendsAcrossFiles.js index e8d4c530da1..6fcce5c5982 100644 --- a/tests/baselines/reference/classExtendsAcrossFiles.js +++ b/tests/baselines/reference/classExtendsAcrossFiles.js @@ -42,7 +42,7 @@ exports.b = { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -72,7 +72,7 @@ exports.a = { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index fb44ad9469a..3b835f86755 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -37,7 +37,7 @@ var Foo; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index d70305fe5ba..d0377bdfc18 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -28,7 +28,7 @@ var Foo; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index ef16075c727..946f2c70f91 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -30,14 +30,14 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(I)); // error var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }({ foo: string })); // error @@ -45,7 +45,7 @@ var x; var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(x)); // error @@ -56,7 +56,7 @@ var M; var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(M)); // error @@ -64,14 +64,14 @@ function foo() { } var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }(foo)); // error var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }([])); // error diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 507a9bbfcf9..d8dbdbb5721 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -17,14 +17,14 @@ var __extends = (this && this.__extends) || (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }({ foo: string })); // error var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }([])); // error diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index f291aedb4ec..cd86c42ae0b 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(Comparable)); @@ -34,7 +34,7 @@ var B = (function () { var A2 = (function (_super) { __extends(A2, _super); function A2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A2; }(Comparable2)); diff --git a/tests/baselines/reference/classExtendsInterfaceInExpression.js b/tests/baselines/reference/classExtendsInterfaceInExpression.js index b37daba7f7a..1bbdae0370e 100644 --- a/tests/baselines/reference/classExtendsInterfaceInExpression.js +++ b/tests/baselines/reference/classExtendsInterfaceInExpression.js @@ -25,7 +25,7 @@ function factory(a) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(factory(A))); diff --git a/tests/baselines/reference/classExtendsInterfaceInModule.js b/tests/baselines/reference/classExtendsInterfaceInModule.js index 2299df89ab7..96b2906e54f 100644 --- a/tests/baselines/reference/classExtendsInterfaceInModule.js +++ b/tests/baselines/reference/classExtendsInterfaceInModule.js @@ -29,21 +29,21 @@ var __extends = (this && this.__extends) || (function () { var C1 = (function (_super) { __extends(C1, _super); function C1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C1; }(M.I1)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(M.I2)); var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(Mod.Nested.I)); diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index 8f6aecec843..197f76edb80 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -19,21 +19,21 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(C)); // error var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(D)); // error var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(E)); // error diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index 4ca9186f89c..e5bd50ae80a 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -25,42 +25,42 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(E)); // error var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(D)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(E2)); // error var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(C2)); var E2 = (function (_super) { __extends(E2, _super); function E2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E2; }(D2)); diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 86d2cd60887..ae3bf4ed788 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -36,7 +36,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(N.E)); // error @@ -45,7 +45,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -56,7 +56,7 @@ var N; var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(M.D)); @@ -67,7 +67,7 @@ var O; var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(Q.E2)); // error @@ -76,7 +76,7 @@ var O; var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(C2)); @@ -87,7 +87,7 @@ var O; var E2 = (function (_super) { __extends(E2, _super); function E2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E2; }(P.D2)); diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index 1c42dc28634..8f004a44cfe 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -32,7 +32,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(E)); // error @@ -50,7 +50,7 @@ var __extends = (this && this.__extends) || (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -68,7 +68,7 @@ var __extends = (this && this.__extends) || (function () { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(D)); @@ -86,7 +86,7 @@ var __extends = (this && this.__extends) || (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(E2)); // error @@ -104,7 +104,7 @@ var __extends = (this && this.__extends) || (function () { var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(C2)); @@ -122,7 +122,7 @@ var __extends = (this && this.__extends) || (function () { var E2 = (function (_super) { __extends(E2, _super); function E2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E2; }(D2)); diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index a36ab4355ad..830bf6fb988 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -27,7 +27,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index 07618bead38..bd73122f450 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -34,7 +34,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; return Object.create(null); } return D; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index 908c91850e8..391a6e52fa3 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -30,7 +30,7 @@ var M; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index fbbb91d29ea..e6f9b389739 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -21,7 +21,7 @@ var x = new foo(); // can be used as a constructor function var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(foo)); // error, cannot extend it though diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 72779e9eb97..4d863741ada 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -22,7 +22,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 80acbd8d204..330a9a7dece 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -38,7 +38,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C2.prototype.foo = function () { return 1; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 4c2d096f465..649afb528a3 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -42,7 +42,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 49c43b8ef3a..0d7a8661ed1 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -45,7 +45,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index a10b08fad2d..4b5229bdfc6 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -47,7 +47,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index ec814464801..fb42e9451a7 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -52,7 +52,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index f50c50e4c90..344baf039e1 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -29,7 +29,7 @@ var C123 = (function () { var D123 = (function (_super) { __extends(D123, _super); function D123() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D123; }(C123)); diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index 61a2ce9f262..a43cf9c8bb8 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -16,14 +16,14 @@ var __extends = (this && this.__extends) || (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(A)); diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index ec7a1f1babf..adfa94b4b7e 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -34,14 +34,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index e7dd6959731..897089b8b57 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -33,7 +33,7 @@ var __extends = (this && this.__extends) || (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } A.prototype.foo = function () { this.bar(); }; return A; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index 5631152514f..71f407a14f5 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -40,7 +40,7 @@ var baz = (function () { var foo = (function (_super) { __extends(foo, _super); function foo() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return foo; }(baz)); diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index cb958b2e12e..549d9451199 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -38,7 +38,7 @@ var A = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(A)); diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index eb9541ab737..84a619d0461 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -162,7 +162,7 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.p1 = 0; return _this; } @@ -171,7 +171,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - var _this; + var _this = this; return _this; } // ERROR - super call required return F; @@ -210,7 +210,7 @@ var J = (function (_super) { var K = (function (_super) { __extends(K, _super); function K(p1) { - var _this; + var _this = this; _this.p1 = p1; var i = 0; _this = _super.call(this) || this; @@ -230,7 +230,7 @@ var L = (function (_super) { var M = (function (_super) { __extends(M, _super); function M(p1) { - var _this; + var _this = this; _this.p1 = p1; var i = 0; _this = _super.call(this) || this; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index 249fa099007..a9f7fbc7700 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -59,7 +59,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(Base)); @@ -74,7 +74,7 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(Base2)); @@ -85,7 +85,7 @@ var d2 = new D(1); // ok var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(Base2)); @@ -95,7 +95,7 @@ var d4 = new D(1); // ok var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(Base2)); diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index 07b592bf730..822f1e3014f 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -80,7 +80,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C2)); @@ -108,7 +108,7 @@ var Generics; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C2)); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 0a2bb39b449..2b12741d38f 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -53,7 +53,7 @@ C.g = function () { return ''; }; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.method = function () { // No errors diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 0e08046f8c2..e4f4805b42f 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -50,7 +50,7 @@ var r3 = r.foo; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index 97ccd8e1410..e1e1313dae2 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -141,7 +141,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); @@ -166,7 +166,7 @@ var m2; var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return c; }(b)); @@ -182,7 +182,7 @@ var m2; var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return c; }(m1.b)); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index a622261b685..e643ed17578 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -48,7 +48,7 @@ var Shape = (function () { var Path = (function (_super) { __extends(Path, _super); function Path() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Path; }(Shape)); diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index 5f7fc0cccdf..7d8e23cd508 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -73,7 +73,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "prop2", { get: function () { @@ -93,7 +93,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(c.prototype, "prop2", { get: function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 1401411ad8e..b211b3e4eac 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -55,7 +55,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.foo = function () { function _super() { @@ -68,7 +68,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } c.prototype.foo = function () { var x = function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 99fe7e8dcef..9701e9b4fc4 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -45,7 +45,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.prop2 = { doStuff: function () { function _super() { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 3278f9bd3a8..3a6e8b9e772 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -63,7 +63,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "prop2", { get: function () { @@ -81,7 +81,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(c.prototype, "prop2", { get: function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index 541035dd43b..c6cce551d93 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -41,7 +41,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.foo = function () { var _super = 10; // Should be error @@ -51,7 +51,7 @@ var b = (function (_super) { var c = (function (_super) { __extends(c, _super); function c() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } c.prototype.foo = function () { var x = function () { diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index 8371687ff34..b88513b53dd 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -43,7 +43,7 @@ var Foo = (function () { var b = (function (_super) { __extends(b, _super); function b() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.prop2 = { doStuff: function () { var _super = 10; // Should be error diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index 165943ec132..c35c30ec84e 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -32,7 +32,7 @@ var base = (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Foo.prototype.x = function () { console.log(_super); // Error as this doesnt not resolve to user defined _super diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 818f15b3f15..8bc3fc19b5b 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -28,7 +28,7 @@ var Foo = (function () { var Foo2 = (function (_super) { __extends(Foo2, _super); function Foo2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Foo2.prototype.x = function () { var lambda = function (_super) { diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index a5e68e4eaab..d0d5059adec 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -39,7 +39,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.foo = function () { var _this = this; @@ -51,7 +51,7 @@ var b = (function (_super) { var b2 = (function (_super) { __extends(b2, _super); function b2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b2.prototype.foo = function () { var _this = this; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 26150c60d12..53fcab2cf3f 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -263,7 +263,7 @@ c2_i = c3_i; var c4 = (function (_super) { __extends(c4, _super); function c4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return c4; }(c2)); diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 39a53a241c9..f017fe974bc 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -232,14 +232,14 @@ var Base = (function () { var A2 = (function (_super) { __extends(A2, _super); function A2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A2; }(Base)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 63bd4442479..b63b2fa7110 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -187,7 +187,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 05657e3ec5e..cecdb97e164 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -187,7 +187,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index 685fb769e99..6fc8effabd0 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -130,7 +130,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 48d598efe26..fd9f0ffabe1 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -168,7 +168,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index c5e512a735b..5898bdd6f2b 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -168,7 +168,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index e93fc8c7b50..1a3bdca7d95 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -278,7 +278,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index a0e7b1a424e..8f23651af05 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -240,7 +240,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index e8d706eb290..b77b5dd6e4a 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -126,7 +126,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 51e077113dd..b82063b4aed 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -183,7 +183,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index 86c6fb86be2..d83b7b2d5c0 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -183,7 +183,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 2cd9fc1bb29..e0befa2237e 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -97,7 +97,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -119,7 +119,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index 8a865e2d024..2bc345bd499 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -62,7 +62,7 @@ var __extends = (this && this.__extends) || (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.createEmpty = function () { var item = new Derived(); diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 5af6a97f781..bc9bbcdaa16 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -19,7 +19,7 @@ var __extends = (this && this.__extends) || (function () { var S18 = (function (_super) { __extends(S18, _super); function S18() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return S18; }(S18)); diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index ab1d81e8fb0..dd229bdcae2 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -30,7 +30,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype[_super.bar.call(this)] = function () { }; return C; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 6443c3cedb2..18ee07301e7 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -35,7 +35,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { var obj = (_a = {}, diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index a34bcef3b3d..78a7ef3af77 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -32,7 +32,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype[(_a = {}, _a[_super.bar.call(this)] = 1, _a)[0]] = function () { }; return C; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index 00d9c9f0f43..9af56a8835b 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -24,7 +24,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype[(_this = _super.call(this) || this, "prop")] = function () { }; return C; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index fd0db774e71..95caabc4bda 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -37,7 +37,7 @@ var Base = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { var _this = this; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index e49d4426cf7..100683519ec 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "get1", { // Computed properties diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index 46029ee5475..0291e337591 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -45,7 +45,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "set1", { set: function (p) { }, diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 7108935ab9e..3bc7e6e350d 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -46,7 +46,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "set1", { set: function (p) { }, diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 5c948261bb2..5d864bce0d6 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -68,7 +68,7 @@ var X = (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(X)); @@ -76,7 +76,7 @@ var A = (function (_super) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(X)); diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 01b0fe327fa..b5715163ad5 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -44,7 +44,7 @@ var X = (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(X)); @@ -52,7 +52,7 @@ var A = (function (_super) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(X)); diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index e204db38c28..f501623bae5 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -33,7 +33,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -41,7 +41,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -49,7 +49,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 22ca8603ffb..2a86fb0c9a3 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -34,7 +34,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -42,7 +42,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -50,7 +50,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index 074cfa49b47..5b69a2dfae1 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -45,7 +45,7 @@ var GenericBase = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(GenericBase)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 53ba73b8ba9..742a03577e5 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -89,21 +89,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index f6629487ff5..fd083159fb1 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -134,21 +134,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 3c20e2f96b5..f1fad68d4ca 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -79,21 +79,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index 1d8efafc234..dc08f25c912 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -69,21 +69,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index f6436b7d3e2..e755e3cacc3 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -72,21 +72,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 27ed085a009..323c9a4c6d8 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -38,14 +38,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index dae4e0bab23..64fa9d9099d 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -52,7 +52,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -71,7 +71,7 @@ var Generic; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index 8ba67658a08..94b29ad89ab 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -36,7 +36,7 @@ var __extends = (this && this.__extends) || (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo(x, y) { - var _this; + var _this = this; return _this; } Foo.prototype.bar1 = function () { }; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 3193d69ed3c..afdfa36e4a6 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -530,7 +530,7 @@ method2(); var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.method2 = function () { return this.method1(2); diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 4fda0eca214..5d8b40e39f0 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -33,14 +33,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index 6e6ea60691c..fd5ec50ebb4 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -34,14 +34,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index 0678ff5bf74..f5063fa003a 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -31,14 +31,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index b71997f21fe..725409c2c7f 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -30,7 +30,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index d46ff63f62a..9af5b3f3eae 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -17,7 +17,7 @@ var __extends = (this && this.__extends) || (function () { var ExtendsNull = (function (_super) { __extends(ExtendsNull, _super); function ExtendsNull() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ExtendsNull; }(null)); diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index 3d90e148d42..9bdd0fc09a7 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -28,7 +28,7 @@ var X = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(X)); diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index c2d7a1faf33..58d7bb774f1 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -31,7 +31,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index 8d7f16745c0..c17463a6d15 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -96,7 +96,7 @@ exports.g = C.F5(); var h = (function (_super) { __extends(h, _super); function h() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return h; }(C.A)); diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index da5177c89df..da1ebb2a8f3 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -40,7 +40,7 @@ var X; var W = (function (_super) { __extends(W, _super); function W() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return W; }(A.B.Base.W)); @@ -58,7 +58,7 @@ var X; var W = (function (_super) { __extends(W, _super); function W() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return W; }(X.Y.base.W)); diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index a396c81c27f..d369da3902b 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -49,7 +49,7 @@ var A; var ContextMenu = (function (_super) { __extends(ContextMenu, _super); function ContextMenu() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ContextMenu; }(B.EventManager)); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends.js b/tests/baselines/reference/declarationEmitExpressionInExtends.js index 7a0fe6ed603..884897a9cf6 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends.js @@ -34,7 +34,7 @@ var Q = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(x)); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends2.js b/tests/baselines/reference/declarationEmitExpressionInExtends2.js index 1df6168f09b..86c79dda8a8 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends2.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends2.js @@ -34,7 +34,7 @@ function getClass(c) { var MyClass = (function (_super) { __extends(MyClass, _super); function MyClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyClass; }(getClass(2))); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends3.js b/tests/baselines/reference/declarationEmitExpressionInExtends3.js index 2a291f273dc..960a7af6780 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends3.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends3.js @@ -75,7 +75,7 @@ function getExportedClass(c) { var MyClass = (function (_super) { __extends(MyClass, _super); function MyClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyClass; }(getLocalClass(undefined))); @@ -83,7 +83,7 @@ exports.MyClass = MyClass; var MyClass2 = (function (_super) { __extends(MyClass2, _super); function MyClass2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyClass2; }(getExportedClass(undefined))); @@ -91,7 +91,7 @@ exports.MyClass2 = MyClass2; var MyClass3 = (function (_super) { __extends(MyClass3, _super); function MyClass3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyClass3; }(getExportedClass(undefined))); @@ -99,7 +99,7 @@ exports.MyClass3 = MyClass3; var MyClass4 = (function (_super) { __extends(MyClass4, _super); function MyClass4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyClass4; }(getExportedClass(undefined))); diff --git a/tests/baselines/reference/declarationEmitExpressionInExtends4.js b/tests/baselines/reference/declarationEmitExpressionInExtends4.js index 9502f871476..d6c33023c12 100644 --- a/tests/baselines/reference/declarationEmitExpressionInExtends4.js +++ b/tests/baselines/reference/declarationEmitExpressionInExtends4.js @@ -38,21 +38,21 @@ function getSomething() { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(getSomething())); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(SomeUndefinedFunction())); var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(SomeUndefinedFunction)); diff --git a/tests/baselines/reference/declarationEmitNameConflicts3.js b/tests/baselines/reference/declarationEmitNameConflicts3.js index e4c81906681..f093ff5b3b2 100644 --- a/tests/baselines/reference/declarationEmitNameConflicts3.js +++ b/tests/baselines/reference/declarationEmitNameConflicts3.js @@ -68,7 +68,7 @@ var M; var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(C)); diff --git a/tests/baselines/reference/declarationEmitProtectedMembers.js b/tests/baselines/reference/declarationEmitProtectedMembers.js index 3d919912803..7b3b42e7c97 100644 --- a/tests/baselines/reference/declarationEmitProtectedMembers.js +++ b/tests/baselines/reference/declarationEmitProtectedMembers.js @@ -93,7 +93,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C2.prototype.f = function () { return _super.prototype.f.call(this) + this.x; @@ -107,7 +107,7 @@ var C2 = (function (_super) { var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C3.prototype.f = function () { return _super.prototype.f.call(this); diff --git a/tests/baselines/reference/declarationEmitThisPredicates01.js b/tests/baselines/reference/declarationEmitThisPredicates01.js index 22656ecbda5..04c49422c5c 100644 --- a/tests/baselines/reference/declarationEmitThisPredicates01.js +++ b/tests/baselines/reference/declarationEmitThisPredicates01.js @@ -33,7 +33,7 @@ exports.C = C; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js index c3d5754963e..79156f795ea 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName01.js @@ -33,7 +33,7 @@ exports.C = C; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/declareDottedExtend.js b/tests/baselines/reference/declareDottedExtend.js index b0913b1f3e5..1256602ee1e 100644 --- a/tests/baselines/reference/declareDottedExtend.js +++ b/tests/baselines/reference/declareDottedExtend.js @@ -26,14 +26,14 @@ var ab = A.B; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(ab.C)); var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(A.B.C)); diff --git a/tests/baselines/reference/decoratorOnClassConstructor4.js b/tests/baselines/reference/decoratorOnClassConstructor4.js index a9b30440f6b..75286943417 100644 --- a/tests/baselines/reference/decoratorOnClassConstructor4.js +++ b/tests/baselines/reference/decoratorOnClassConstructor4.js @@ -54,7 +54,7 @@ B = __decorate([ var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js index e5b5747ee2b..c9ff30307f0 100644 --- a/tests/baselines/reference/decoratorOnClassMethod12.js +++ b/tests/baselines/reference/decoratorOnClassMethod12.js @@ -37,7 +37,7 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.method = function () { }; return C; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 51cca070d1f..960fea90a0c 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -52,7 +52,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; return _this; } return Derived; @@ -65,7 +65,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - var _this; + var _this = this; var r2 = function () { return _this = _super.call(this) || this; }; // error for misplaced super call (nested function) return _this; } @@ -74,7 +74,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var _this; + var _this = this; var r = function () { _this = _super.call(this) || this; }; // error return _this; } @@ -83,7 +83,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - var _this; + var _this = this; var r = _this = _super.call(this) || this; // ok return _this; } diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index 35dd1e197e2..23a4233d124 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -43,7 +43,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.x = function () { return 1; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index 03310fcfc4c..8d2010b3346 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -73,7 +73,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -94,7 +94,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index 36ad6580c18..fceefd905cc 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -37,7 +37,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -50,7 +50,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index c14783c8337..642453857c5 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -34,7 +34,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -46,7 +46,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index dc9059f956e..6eef011e0f4 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -136,7 +136,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index 8e90218b063..594e8166e5e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -35,14 +35,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived1)); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 3bbd661c704..af9a013a3d8 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -134,7 +134,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index b53c736b857..fa7eb924653 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -42,7 +42,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -54,7 +54,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index c127b1993ef..d8d93e35078 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -114,7 +114,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived(y) { - var _this; + var _this = this; var a = 1; _this = _super.call(this) || this; // ok return _this; @@ -124,7 +124,7 @@ var Derived = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2(y) { - var _this; + var _this = this; _this.y = y; var a = 1; _this = _super.call(this) || this; // error @@ -145,7 +145,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(y) { - var _this; + var _this = this; _this.a = 1; var b = 2; _this = _super.call(this) || this; // error @@ -166,7 +166,7 @@ var Derived5 = (function (_super) { var Derived6 = (function (_super) { __extends(Derived6, _super); function Derived6(y) { - var _this; + var _this = this; _this.a = 1; var b = 2; _this = _super.call(this) || this; // error: "super" has to be called before "this" accessing @@ -177,7 +177,7 @@ var Derived6 = (function (_super) { var Derived7 = (function (_super) { __extends(Derived7, _super); function Derived7(y) { - var _this; + var _this = this; _this.a = 1; _this.a = 3; _this.b = 3; @@ -206,7 +206,7 @@ var Base2 = (function () { var Derived9 = (function (_super) { __extends(Derived9, _super); function Derived9(y) { - var _this; + var _this = this; _this.a = 1; _this.a = 3; _this.b = 3; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 92ef489cd4c..8703215a631 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -51,7 +51,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.a = _this = _super.call(this) || this; return _this; } diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index 2809d899351..83a750c707d 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; // ok to drop parameters return D; @@ -49,7 +49,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function (x) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index 8b69ea00102..7cd7d73d604 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { }; // ok to drop parameters return D; @@ -49,7 +49,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function (x, y) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index 98e4bdd4b43..35a080f1800 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { }; // ok to drop parameters return D; @@ -49,7 +49,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function (x, y) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index 315d0322ed2..e0f82d55a7c 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; // ok to drop parameters return D; @@ -49,7 +49,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo = function (x) { }; // ok to add optional parameters return E; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index dd89a166cc1..c8ed8ce5cad 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -96,7 +96,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "X", { get: function () { @@ -124,7 +124,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(E.prototype, "X", { get: function () { return ''; }, diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index c38b9b3bd00..07cc9c43539 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -51,7 +51,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index a50008d4142..36c6cb56563 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -61,7 +61,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 1680b9178ff..52a50a8aa77 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -50,7 +50,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 2b65181cea9..6e39028ce34 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -63,7 +63,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.fn = function () { return ''; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index ca746223e1b..1fd02f5ba62 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -46,7 +46,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 1; _this.y = 'hello'; return _this; @@ -64,7 +64,7 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 2; _this.y = null; return _this; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index 492682b67bc..178ca2be16d 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -54,7 +54,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 1; _this.y = 'hello'; return _this; @@ -74,7 +74,7 @@ var Base2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 2; _this.y = null; return _this; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index cf4d5cadecc..86f69433504 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -78,7 +78,7 @@ var Derived = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 1; _this.y = 'hello'; return _this; @@ -107,7 +107,7 @@ var D = (function (_super) { var D2 = (function (_super) { __extends(D2, _super); function D2() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 2; _this.y = null; return _this; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index 3bb1f7793ef..b23161d00d2 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -44,7 +44,7 @@ var __extends = (this && this.__extends) || (function () { var Red = (function (_super) { __extends(Red, _super); function Red() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Red.prototype.shade = function () { var _this = this; @@ -63,7 +63,7 @@ var Color = (function () { var Blue = (function (_super) { __extends(Blue, _super); function Blue() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Blue.prototype.shade = function () { var _this = this; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index bab2879b229..0cf4c316a44 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -69,7 +69,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(D.prototype, "X", { get: function () { @@ -97,7 +97,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(E.prototype, "X", { get: function () { return ''; } // error diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index 9d076ad63a7..a190b26901c 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -39,7 +39,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.foo = function (x) { return null; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index faa148c65a5..26f4408e41e 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -44,7 +44,7 @@ var Derived = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index 16712fb82cf..2d800d562c2 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -48,7 +48,7 @@ var User = (function () { var RegisteredUser = (function (_super) { __extends(RegisteredUser, _super); function RegisteredUser() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } RegisteredUser.prototype.f = function () { (function () { diff --git a/tests/baselines/reference/emptyModuleName.js b/tests/baselines/reference/emptyModuleName.js index 7a22f87cfb4..1d8401803a7 100644 --- a/tests/baselines/reference/emptyModuleName.js +++ b/tests/baselines/reference/emptyModuleName.js @@ -19,7 +19,7 @@ var A = require(""); var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index c5403b4d685..27f05f3f8ea 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -35,7 +35,7 @@ var base = (function () { var derived = (function (_super) { __extends(derived, _super); function derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 17a96d335f3..ebe9de27f42 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -137,7 +137,7 @@ var Derived = (function (_super) { __extends(Derived, _super); //super call with type arguments function Derived() { - var _this; + var _this = this; _super.prototype..call(_this); _this = _super.call(this) || this; return _this; @@ -152,7 +152,7 @@ var OtherBase = (function () { var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; //super call in class member initializer of derived type _this.t = _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 04ce626be32..b33755e245a 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -252,7 +252,7 @@ var SomeDerived2 = (function (_super) { var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SomeDerived3.fn = function () { _super.publicStaticMember = 3; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 49ddbe58dac..2e54d0cf71c 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -140,7 +140,7 @@ var testClass6 = (function () { var testClass7 = (function (_super) { __extends(testClass7, _super); function testClass7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return testClass7; }(Foo)); // error: could not find symbol V diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index c909a68ccf7..1945726d218 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -33,7 +33,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; if (true) { _this = _super.call(this, 'a1', 'b1') || this; } diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index 5133757348b..e86d04bccd0 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -319,7 +319,7 @@ var BaseClassWithConstructor = (function () { var ChildClassWithoutConstructor = (function (_super) { __extends(ChildClassWithoutConstructor, _super); function ChildClassWithoutConstructor() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ChildClassWithoutConstructor; }(BaseClassWithConstructor)); diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 48937285684..8251d5ec476 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -22,7 +22,7 @@ var __extends = (this && this.__extends) || (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(M.Foo)); diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index f9ffa44e82c..bab7c815f19 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -39,7 +39,7 @@ define(["require", "exports", "exportAssignmentOfGenericType1_0"], function (req var M = (function (_super) { __extends(M, _super); function M() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return M; }(q)); diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index c1827d0df9e..dde865bd2c7 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -37,7 +37,7 @@ var Bbb = (function () { var Aaa = (function (_super) { __extends(Aaa, _super); function Aaa() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Aaa; }(Bbb)); diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index 3424f39bd16..6cf7b42962e 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -42,7 +42,7 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); @@ -52,7 +52,7 @@ var M; var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(M.B)); @@ -63,7 +63,7 @@ var N; var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C3; }(M.B)); diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index ffc3249d7bf..7ef8adec3df 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -26,7 +26,7 @@ var N; var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(M.B)); @@ -37,7 +37,7 @@ var M; var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }(B)); diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index ed5232d88c9..d2942220bf1 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -33,7 +33,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index e9f37d718ff..40b3425966e 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -38,7 +38,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 3a755b0e6f6..28c9ef2f22e 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -17,7 +17,7 @@ var __extends = (this && this.__extends) || (function () { var derived = (function (_super) { __extends(derived, _super); function derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return derived; }(base)); diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js index 6e6943d5766..7353c6970e8 100644 --- a/tests/baselines/reference/extendClassExpressionFromModule.js +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -36,7 +36,7 @@ var x = foo1; var y = (function (_super) { __extends(y, _super); function y() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return y; }(x)); diff --git a/tests/baselines/reference/extendConstructSignatureInInterface.js b/tests/baselines/reference/extendConstructSignatureInInterface.js index 30c1151c332..3067fdc706e 100644 --- a/tests/baselines/reference/extendConstructSignatureInInterface.js +++ b/tests/baselines/reference/extendConstructSignatureInInterface.js @@ -25,7 +25,7 @@ var CStatic; var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(CStatic)); diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index 066d19560b6..b4e59aa9711 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -24,7 +24,7 @@ var x = A; var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(x)); // error, could not find symbol xs diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index b82c3e2233b..f029193175f 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -23,7 +23,7 @@ var x = new Foo(); // legal, considered a constructor function var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(Foo)); // error, could not find symbol Foo diff --git a/tests/baselines/reference/extendPrivateConstructorClass.js b/tests/baselines/reference/extendPrivateConstructorClass.js index 21968a3c47b..12540d9cd38 100644 --- a/tests/baselines/reference/extendPrivateConstructorClass.js +++ b/tests/baselines/reference/extendPrivateConstructorClass.js @@ -23,7 +23,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(abc.XYZ)); diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index b689e9b2640..2d1add18ae0 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -56,7 +56,7 @@ var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); @@ -77,7 +77,7 @@ var Backbone = require("./extendingClassFromAliasAndUsageInIndexer_backbone"); var VisualizationModel = (function (_super) { __extends(VisualizationModel, _super); function VisualizationModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return VisualizationModel; }(Backbone.Model)); diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index ec727e6b757..f6e43d5ddc6 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -25,7 +25,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index 7b960bb97eb..99bccf44479 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -25,7 +25,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.baz = function () { }; return D; diff --git a/tests/baselines/reference/fluentClasses.js b/tests/baselines/reference/fluentClasses.js index ae117674a81..f9c8181aa49 100644 --- a/tests/baselines/reference/fluentClasses.js +++ b/tests/baselines/reference/fluentClasses.js @@ -40,7 +40,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return this; @@ -50,7 +50,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.baz = function () { return this; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 44e7cf24bf4..18ccb37b416 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -131,7 +131,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.boz = function () { for (var x in this.biz()) { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 437e3fb9aef..d70da450f08 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -112,7 +112,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.boz = function () { for (var x in this.biz()) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index ea3bee7b12b..27284f8b272 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -73,7 +73,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 4a641451815..e227693b386 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -139,14 +139,14 @@ var AnotherClass = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index 26468d8af80..994ff36da56 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -241,7 +241,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -292,7 +292,7 @@ function f6() { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index 83b889fa22b..a4b43c3a1a1 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -37,7 +37,7 @@ var EventBase = (function () { var StringEvent = (function (_super) { __extends(StringEvent, _super); function StringEvent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } StringEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index bc49c602acb..829440c12d4 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -37,7 +37,7 @@ var EventBase = (function () { var StringEvent = (function (_super) { __extends(StringEvent, _super); function StringEvent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } StringEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 782f3e985a1..f8dc2863470 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -374,14 +374,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index 35c31bb6677..0c3a5ee6129 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -31,7 +31,7 @@ var BaseClass = (function () { var SubClass = (function (_super) { __extends(SubClass, _super); function SubClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubClass.prototype.Error = function () { var x = this._getValue1(); diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index 8e91f9e228d..e2ef30f9ce8 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -40,7 +40,7 @@ var BaseCollection2 = (function () { var DataView2 = (function (_super) { __extends(DataView2, _super); function DataView2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } DataView2.prototype.fillItems = function (item) { this._itemsByKey['dummy'] = item; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index d7564d3e052..3ccdb5b6b55 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -127,14 +127,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index 28c0fbcec7e..c5de24019b2 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -51,14 +51,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index 32e7bc1e74c..a4f8172a312 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -59,7 +59,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index f54727317e5..074b25fdeea 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -57,14 +57,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index cba1152fb02..b7b9e35a543 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -51,7 +51,7 @@ var M; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(C1)); diff --git a/tests/baselines/reference/genericClassExpressionInFunction.js b/tests/baselines/reference/genericClassExpressionInFunction.js index 41252322414..e1a47ffaac7 100644 --- a/tests/baselines/reference/genericClassExpressionInFunction.js +++ b/tests/baselines/reference/genericClassExpressionInFunction.js @@ -52,7 +52,7 @@ function B1() { return (function (_super) { __extends(class_1, _super); function class_1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class_1; }(A)); @@ -62,7 +62,7 @@ var B2 = (function () { this.anon = (function (_super) { __extends(class_2, _super); function class_2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class_2; }(A)); @@ -73,7 +73,7 @@ function B3() { return (function (_super) { __extends(Inner, _super); function Inner() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Inner; }(A)); @@ -82,14 +82,14 @@ function B3() { var K = (function (_super) { __extends(K, _super); function K() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return K; }(B1())); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }((new B2().anon))); @@ -97,7 +97,7 @@ var b3Number = B3(); var S = (function (_super) { __extends(S, _super); function S() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return S; }(b3Number)); diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index d91a43805e3..c8a5b3ac0c4 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -19,14 +19,14 @@ var __extends = (this && this.__extends) || (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(B)); var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(C)); diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index ea236e40203..803950f58df 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -31,7 +31,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Bar.getFoo = function () { }; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 94c22c1241f..95eb5db106a 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -36,7 +36,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 1e231a172c3..cd028bb28b2 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 2438206cbf2..694bc87c453 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericInheritedDefaultConstructors.js b/tests/baselines/reference/genericInheritedDefaultConstructors.js index 6d4112fb666..15848c10874 100644 --- a/tests/baselines/reference/genericInheritedDefaultConstructors.js +++ b/tests/baselines/reference/genericInheritedDefaultConstructors.js @@ -29,7 +29,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index dd494b1bdcd..66f058090dc 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -34,7 +34,7 @@ var BaseEvent = (function () { var MyEvent = (function (_super) { __extends(MyEvent, _super); function MyEvent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyEvent; }(BaseEvent)); @@ -46,7 +46,7 @@ var BaseEventWrapper = (function () { var MyEventWrapper = (function (_super) { __extends(MyEventWrapper, _super); function MyEventWrapper() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyEventWrapper; }(BaseEventWrapper)); diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index 45e39d173a1..1fef7a9b407 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -33,7 +33,7 @@ var BaseEvent = (function () { var MyEvent = (function (_super) { __extends(MyEvent, _super); function MyEvent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyEvent; }(BaseEvent)); @@ -45,7 +45,7 @@ var BaseEventWrapper = (function () { var MyEventWrapper = (function (_super) { __extends(MyEventWrapper, _super); function MyEventWrapper() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyEventWrapper; }(BaseEventWrapper)); diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index 558f6034b16..22886334aad 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -62,7 +62,7 @@ var TypeScript2; var PullTypeSymbol = (function (_super) { __extends(PullTypeSymbol, _super); function PullTypeSymbol() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PullTypeSymbol; }(PullSymbol)); diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index bea6d81dbaa..d0bf08113d2 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -63,7 +63,7 @@ var TypeScript; var PullTypeSymbol = (function (_super) { __extends(PullTypeSymbol, _super); function PullTypeSymbol() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this._elementType = null; return _this; } diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index bcdaaa3958b..160967e83de 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -33,7 +33,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return null; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index a2a7548bb63..991db3822ac 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -45,7 +45,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return 1; }; return B; @@ -53,7 +53,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.baz = function () { return 1; }; return C; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index cdeb709fdfb..069e567ab10 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -49,7 +49,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.g = function (x) { var a = x; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 8704103d530..8fc00dcc08f 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -65,7 +65,7 @@ var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -81,7 +81,7 @@ var M; var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(M.E)); diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 75317fe0c81..9730afdee04 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -60,14 +60,14 @@ var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(I)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(M.C)); diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index f91d9b5d6cf..5498d3d1fad 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -36,7 +36,7 @@ define(["require", "exports"], function (require, exports) { var List = (function (_super) { __extends(List, _super); function List() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } List.prototype.Bar = function () { }; return List; @@ -51,7 +51,7 @@ define(["require", "exports"], function (require, exports) { var ListItem = (function (_super) { __extends(ListItem, _super); function ListItem() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ListItem; }(CollectionItem)); diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index e15125ed70e..f65fac6fb5d 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -165,14 +165,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 83e40177434..22dd78a9687 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -182,7 +182,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 7e138dbf4a1..bb29e857e9b 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -39,7 +39,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; var r2 = function () { return _this = _super.call(this) || this; }; var r3 = function () { _this = _super.call(this) || this; }; var r4 = function () { _this = _super.call(this) || this; }; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index 20a95fbcdc8..8c6c591138e 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -21,7 +21,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 07819ad752c..d492e7fa7e2 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -104,21 +104,21 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Foo)); var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar3; }(Foo)); @@ -133,28 +133,28 @@ var M; var Baz = (function (_super) { __extends(Baz, _super); function Baz() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Baz; }(Foo)); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Foo)); var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar3; }(Foo)); @@ -170,14 +170,14 @@ var M2; var Baz = (function (_super) { __extends(Baz, _super); function Baz() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Baz; }(Foo)); var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Foo)); @@ -188,14 +188,14 @@ var M2; var Bar2 = (function (_super) { __extends(Bar2, _super); function Bar2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar2; }(Foo)); var Bar3 = (function (_super) { __extends(Bar3, _super); function Bar3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar3; }(Foo)); diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index d79ae31ac25..6bffdf9d4e7 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -80,28 +80,28 @@ var Bar4 = (function () { var Bar5 = (function (_super) { __extends(Bar5, _super); function Bar5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar5; }(Foo)); var Bar6 = (function (_super) { __extends(Bar6, _super); function Bar6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar6; }(Foo)); var Bar7 = (function (_super) { __extends(Bar7, _super); function Bar7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar7; }(Foo)); var Bar8 = (function (_super) { __extends(Bar8, _super); function Bar8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar8; }(Foo)); diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 290e331b3f1..75d6e68d4c5 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -35,7 +35,7 @@ var Greeter = require("./importAsBaseClass_0"); var Hello = (function (_super) { __extends(Hello, _super); function Hello() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Hello; }(Greeter)); diff --git a/tests/baselines/reference/importHelpers.js b/tests/baselines/reference/importHelpers.js index 571bdb4fa4b..fea4ee2db27 100644 --- a/tests/baselines/reference/importHelpers.js +++ b/tests/baselines/reference/importHelpers.js @@ -45,7 +45,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -97,7 +97,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersAmd.js b/tests/baselines/reference/importHelpersAmd.js index fea93840fa9..6054e147386 100644 --- a/tests/baselines/reference/importHelpersAmd.js +++ b/tests/baselines/reference/importHelpersAmd.js @@ -32,7 +32,7 @@ define(["require", "exports", "tslib", "./a"], function (require, exports, tslib var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/importHelpersInIsolatedModules.js b/tests/baselines/reference/importHelpersInIsolatedModules.js index 5c395ea0b9f..429a71c1ab8 100644 --- a/tests/baselines/reference/importHelpersInIsolatedModules.js +++ b/tests/baselines/reference/importHelpersInIsolatedModules.js @@ -45,7 +45,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -77,7 +77,7 @@ var A = (function () { var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersNoHelpers.js b/tests/baselines/reference/importHelpersNoHelpers.js index 832cfeaf519..53b4b326819 100644 --- a/tests/baselines/reference/importHelpersNoHelpers.js +++ b/tests/baselines/reference/importHelpersNoHelpers.js @@ -44,7 +44,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -99,7 +99,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersNoModule.js b/tests/baselines/reference/importHelpersNoModule.js index bd658b703f1..f84666ae198 100644 --- a/tests/baselines/reference/importHelpersNoModule.js +++ b/tests/baselines/reference/importHelpersNoModule.js @@ -37,7 +37,7 @@ exports.A = A; var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -89,7 +89,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/importHelpersOutFile.js b/tests/baselines/reference/importHelpersOutFile.js index a45f6285782..572115ba4bb 100644 --- a/tests/baselines/reference/importHelpersOutFile.js +++ b/tests/baselines/reference/importHelpersOutFile.js @@ -35,7 +35,7 @@ define("b", ["require", "exports", "tslib", "a"], function (require, exports, ts var B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); @@ -46,7 +46,7 @@ define("c", ["require", "exports", "tslib", "a"], function (require, exports, ts var C = (function (_super) { tslib_2.__extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(a_2.A)); diff --git a/tests/baselines/reference/importHelpersSystem.js b/tests/baselines/reference/importHelpersSystem.js index 20f2d299c52..b7c10ee3c34 100644 --- a/tests/baselines/reference/importHelpersSystem.js +++ b/tests/baselines/reference/importHelpersSystem.js @@ -51,7 +51,7 @@ System.register(["tslib", "./a"], function (exports_1, context_1) { B = (function (_super) { tslib_1.__extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index cb3f0378328..94be0dfd5a0 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -36,7 +36,7 @@ define(["require", "exports", "Foo"], function (require, exports, Error) { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Error)); diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index c19e5be7e13..4075719c9c5 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -36,7 +36,7 @@ var foo = require("./importUsedInExtendsList1_require"); var Sub = (function (_super) { __extends(Sub, _super); function Sub() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Sub; }(foo.Super)); diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index 2dfc6d69e06..4336fd2ff32 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -47,7 +47,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -60,7 +60,7 @@ var F = (function () { var G = (function (_super) { __extends(G, _super); function G() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return G; }(F)); @@ -73,7 +73,7 @@ var H = (function () { var I = (function (_super) { __extends(I, _super); function I() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return I; }(H)); @@ -86,7 +86,7 @@ var J = (function () { var K = (function (_super) { __extends(K, _super); function K() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return K; }(J)); diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index d912f07c145..6410e463dbb 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -16,14 +16,14 @@ var __extends = (this && this.__extends) || (function () { var a = (function (_super) { __extends(a, _super); function a() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return a; }(b)); var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index 7c362a384aa..695970159d9 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -16,14 +16,14 @@ var __extends = (this && this.__extends) || (function () { var a = (function (_super) { __extends(a, _super); function a() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return a; }(b)); var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index 4589d2d9671..fd9bbac1623 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -48,7 +48,7 @@ var Base = (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(Base)); diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index 4e58f0b490d..f8145ec2c01 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(T)); diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index 15cdaba7d01..138e3aa5694 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -29,14 +29,14 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(B)); diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 72fa6c80a81..48d96b10f9c 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -58,14 +58,14 @@ var B2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(B2)); @@ -77,7 +77,7 @@ var N = (function () { var ND = (function (_super) { __extends(ND, _super); function ND() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ND; }(N)); @@ -91,7 +91,7 @@ var Good = (function () { var Baad = (function (_super) { __extends(Baad, _super); function Baad() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Baad.prototype.f = function () { return 0; }; Baad.prototype.g = function (n) { return 0; }; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index b3d87d0452f..a00330e8556 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -80,7 +80,7 @@ var Control = (function () { var Button = (function (_super) { __extends(Button, _super); function Button() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Button.prototype.select = function () { }; return Button; @@ -88,7 +88,7 @@ var Button = (function (_super) { var TextBox = (function (_super) { __extends(TextBox, _super); function TextBox() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } TextBox.prototype.select = function () { }; return TextBox; @@ -96,14 +96,14 @@ var TextBox = (function (_super) { var ImageBase = (function (_super) { __extends(ImageBase, _super); function ImageBase() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ImageBase; }(Control)); var Image1 = (function (_super) { __extends(Image1, _super); function Image1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Image1; }(Control)); diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 5c1568663dc..52ab48573fd 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -30,14 +30,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index f35305b2bcc..c64a0e4259c 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -30,14 +30,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index 8a6de50ee60..9ac0fe18592 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -30,14 +30,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.myMethod = function () { }; return C; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index be1cecd939d..fae79488dce 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -45,7 +45,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index 76829925c62..3fc6417afaf 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -36,7 +36,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index fff0dd7b832..1d0a8f09a40 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b.prototype, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index 085b3966541..93b72b73c8b 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -42,7 +42,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index fc405638f0f..0f189aa50cc 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -33,7 +33,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 94ea69a7fba..996138a53d9 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.prototype.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index 866323cd204..97b856980ea 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -42,7 +42,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index fe8c0457240..c7c6c84f9d0 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index e431d295d01..c8e9c5ef9d4 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 1e1a7c69a08..62355930d92 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -26,7 +26,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 01370a3183c..12c5eac07e9 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -45,7 +45,7 @@ var N; var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(M.C1)); @@ -53,7 +53,7 @@ var N; var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(M.C2)); diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index bff113f80e3..4af25e03d13 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -45,7 +45,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index 773f97c2bc9..904868fecd9 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -36,7 +36,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index 73eb1021d62..cf6e23685f1 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(b, "x", { get: function () { diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index 8d2aab0bbd1..91946af7478 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -42,7 +42,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index c41281eecc4..9b7e0dd925c 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -37,7 +37,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index cdbc3913a22..7e50c2c0318 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -33,7 +33,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index 77a8e21dc74..fab0f4fb579 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 0f0eb43fdd6..b973095e5b8 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return "20"; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index fd92a887219..017adeea3c7 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -28,7 +28,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } b.x = function () { return new b().x; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 7a74aea52d6..96416e977fa 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index f1805811345..15f3298f2cc 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index 435bf6d0a8d..79d2e88b646 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -41,7 +41,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index ee69b89dd4c..1ec8e5f5f65 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -31,7 +31,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index 7fd7cca98c4..6c83789d51d 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -26,7 +26,7 @@ var a = (function () { var b = (function (_super) { __extends(b, _super); function b() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return b; }(a)); diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index a11136ba6b7..5e7e3736885 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -37,7 +37,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 7d06886f562..c27b723b562 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -58,14 +58,14 @@ var BaseBase2 = (function () { var Base = (function (_super) { __extends(Base, _super); function Base() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Base; }(BaseBase)); var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 3a20f4313b6..be7aec77731 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -43,7 +43,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -57,7 +57,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.bar = function () { return this.foo(); diff --git a/tests/baselines/reference/instanceOfAssignability.js b/tests/baselines/reference/instanceOfAssignability.js index a0b15b0e287..db5554596af 100644 --- a/tests/baselines/reference/instanceOfAssignability.js +++ b/tests/baselines/reference/instanceOfAssignability.js @@ -120,14 +120,14 @@ var Animal = (function () { var Mammal = (function (_super) { __extends(Mammal, _super); function Mammal() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Mammal; }(Animal)); var Giraffe = (function (_super) { __extends(Giraffe, _super); function Giraffe() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Giraffe; }(Mammal)); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index b80c8f0ff13..44c781c8c98 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -74,7 +74,7 @@ var NonGeneric; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -106,7 +106,7 @@ var Generic; var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index c42f071ddb9..0a02162d707 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -26,7 +26,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js index 32c15674984..b7d2ec46914 100644 --- a/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js +++ b/tests/baselines/reference/instanceofWithStructurallyIdenticalTypes.js @@ -133,7 +133,7 @@ var A = (function () { var A1 = (function (_super) { __extends(A1, _super); function A1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A1; }(A)); @@ -145,7 +145,7 @@ var A2 = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 7eed6d7f5fc..52f96561f20 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -52,7 +52,7 @@ var c = (function () { var d = (function (_super) { __extends(d, _super); function d() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } d.prototype.foo = function () { return null; diff --git a/tests/baselines/reference/interfaceClassMerging.js b/tests/baselines/reference/interfaceClassMerging.js index 4cca8c1c8b9..e2167776f22 100644 --- a/tests/baselines/reference/interfaceClassMerging.js +++ b/tests/baselines/reference/interfaceClassMerging.js @@ -62,7 +62,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Bar.prototype.method = function (a) { return this.optionalProperty; diff --git a/tests/baselines/reference/interfaceClassMerging2.js b/tests/baselines/reference/interfaceClassMerging2.js index 8d860ae95e7..4c879ba4cab 100644 --- a/tests/baselines/reference/interfaceClassMerging2.js +++ b/tests/baselines/reference/interfaceClassMerging2.js @@ -58,7 +58,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Bar.prototype.classBarMethod = function () { return this; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index fc5afcdddac..69560e82557 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -37,7 +37,7 @@ var Control = (function () { var Button = (function (_super) { __extends(Button, _super); function Button() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Button.prototype.select = function () { }; return Button; @@ -45,7 +45,7 @@ var Button = (function (_super) { var TextBox = (function (_super) { __extends(TextBox, _super); function TextBox() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } TextBox.prototype.select = function () { }; return TextBox; @@ -53,7 +53,7 @@ var TextBox = (function (_super) { var Image = (function (_super) { __extends(Image, _super); function Image() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Image; }(Control)); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index 334ac5cd292..12d1539bb3d 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -48,7 +48,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function (x) { return x; }; D.prototype.other = function (x) { return x; }; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index cc3e8163d18..cec3eed8497 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -44,7 +44,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 2; _this.y = 3; return _this; @@ -57,7 +57,7 @@ var D = (function (_super) { var D2 = (function (_super) { __extends(D2, _super); function D2() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = ""; return _this; } diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index aa9bf7b4cf8..c966cdc2c14 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -69,21 +69,21 @@ var C3 = (function () { var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(C1)); var C5 = (function (_super) { __extends(C5, _super); function C5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C5; }(C2)); var C6 = (function (_super) { __extends(C6, _super); function C6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C6; }(C3)); @@ -95,7 +95,7 @@ var C7 = (function () { var C8 = (function (_super) { __extends(C8, _super); function C8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C8; }(C7)); diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 897fa17c4e5..2ca72edf3c1 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -100,7 +100,7 @@ var Y; var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(A)); @@ -115,7 +115,7 @@ var Y2; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(AA)); @@ -149,7 +149,7 @@ var YY; var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(A)); @@ -164,7 +164,7 @@ var YY2; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(AA)); @@ -198,7 +198,7 @@ var YYY; var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(A)); @@ -213,7 +213,7 @@ var YYY2; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(AA)); diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 466d7eb9049..7e1616cfca4 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -72,7 +72,7 @@ var C = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C)); diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index a61d036d9ed..af20c18c853 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -46,7 +46,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/isolatedModulesImportExportElision.js b/tests/baselines/reference/isolatedModulesImportExportElision.js index 7c295a315f9..80f47941e60 100644 --- a/tests/baselines/reference/isolatedModulesImportExportElision.js +++ b/tests/baselines/reference/isolatedModulesImportExportElision.js @@ -31,7 +31,7 @@ var ns = require("module"); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(module_2.c2.C)); diff --git a/tests/baselines/reference/jsxInExtendsClause.js b/tests/baselines/reference/jsxInExtendsClause.js index aa1c611783a..779b2d4cf8a 100644 --- a/tests/baselines/reference/jsxInExtendsClause.js +++ b/tests/baselines/reference/jsxInExtendsClause.js @@ -25,13 +25,13 @@ var __extends = (this && this.__extends) || (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Foo; }(createComponentClass(function () { return (function (_super) { __extends(class_1, _super); function class_1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } class_1.prototype.render = function () { return React.createElement("span", null, "Hello, world!"); diff --git a/tests/baselines/reference/jsxViaImport.2.js b/tests/baselines/reference/jsxViaImport.2.js index 635754599b1..7310da92e92 100644 --- a/tests/baselines/reference/jsxViaImport.2.js +++ b/tests/baselines/reference/jsxViaImport.2.js @@ -40,7 +40,7 @@ var BaseComponent_1 = require("BaseComponent"); var TestComponent = (function (_super) { __extends(TestComponent, _super); function TestComponent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } TestComponent.prototype.render = function () { return ; diff --git a/tests/baselines/reference/jsxViaImport.js b/tests/baselines/reference/jsxViaImport.js index 92d8b063a44..cee60d848ab 100644 --- a/tests/baselines/reference/jsxViaImport.js +++ b/tests/baselines/reference/jsxViaImport.js @@ -40,7 +40,7 @@ var BaseComponent = require("BaseComponent"); var TestComponent = (function (_super) { __extends(TestComponent, _super); function TestComponent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } TestComponent.prototype.render = function () { return ; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index bcd36b0e651..537c8b9d524 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -450,7 +450,7 @@ var Shape = (function () { var TaggedShape = (function (_super) { __extends(TaggedShape, _super); function TaggedShape() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return TaggedShape; }(Shape)); diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index f138aa162bd..9a903b513d9 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -61,7 +61,7 @@ var Event = (function () { var ItemSetEvent = (function (_super) { __extends(ItemSetEvent, _super); function ItemSetEvent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ItemSetEvent.prototype.add = function (listener) { _super.prototype.add.call(this, listener); diff --git a/tests/baselines/reference/localTypes1.js b/tests/baselines/reference/localTypes1.js index b0aaed7906a..d356bd58e20 100644 --- a/tests/baselines/reference/localTypes1.js +++ b/tests/baselines/reference/localTypes1.js @@ -305,7 +305,7 @@ function f6() { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -313,7 +313,7 @@ function f6() { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index be611c2e5cd..d5fd319b993 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -47,7 +47,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/mergedDeclarations5.js b/tests/baselines/reference/mergedDeclarations5.js index d393ec00e2c..a1e144fc223 100644 --- a/tests/baselines/reference/mergedDeclarations5.js +++ b/tests/baselines/reference/mergedDeclarations5.js @@ -32,7 +32,7 @@ var __extends = (this && this.__extends) || (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.foo = function () { }; return B; diff --git a/tests/baselines/reference/mergedDeclarations6.js b/tests/baselines/reference/mergedDeclarations6.js index 2b1f468c873..4452165c3e6 100644 --- a/tests/baselines/reference/mergedDeclarations6.js +++ b/tests/baselines/reference/mergedDeclarations6.js @@ -52,7 +52,7 @@ define(["require", "exports", "./a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.setProtected = function () { }; diff --git a/tests/baselines/reference/mergedInheritedClassInterface.js b/tests/baselines/reference/mergedInheritedClassInterface.js index 29d140f3f68..25ad2b8be75 100644 --- a/tests/baselines/reference/mergedInheritedClassInterface.js +++ b/tests/baselines/reference/mergedInheritedClassInterface.js @@ -66,7 +66,7 @@ var BaseClass = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Child.prototype.method = function () { }; return Child; @@ -80,7 +80,7 @@ var ChildNoBaseClass = (function () { var Grandchild = (function (_super) { __extends(Grandchild, _super); function Grandchild() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Grandchild; }(ChildNoBaseClass)); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index b705d58e1eb..4390bc251cd 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -55,14 +55,14 @@ var C2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(C2)); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index c002a30a828..8ad8a27dc8f 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -62,7 +62,7 @@ var C2 = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 24a04eff872..2a3ee8f4585 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -18,7 +18,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(M)); diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index 57087e49aa1..26d262a76fe 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -36,7 +36,7 @@ define(["require", "exports"], function (require, exports) { var Test1 = (function (_super) { __extends(Test1, _super); function Test1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Test1; }(C1)); diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index cedfcd8b86c..00838f25beb 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -84,14 +84,14 @@ var A; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(AA)); var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(A)); @@ -135,7 +135,7 @@ var Y; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(AA)); @@ -143,7 +143,7 @@ var Y; var BB = (function (_super) { __extends(BB, _super); function BB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return BB; }(A)); diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 536f694ba17..59abc8cd469 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -62,28 +62,28 @@ var B2 = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B1)); var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(B2)); var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(D1)); @@ -95,7 +95,7 @@ var N = (function () { var ND = (function (_super) { __extends(ND, _super); function ND() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ND; }(N)); @@ -109,7 +109,7 @@ var Good = (function () { var Baad = (function (_super) { __extends(Baad, _super); function Baad() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Baad.prototype.f = function () { return 0; }; Baad.prototype.g = function (n) { return 0; }; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 0e846877cb8..7977134b2ed 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -30,7 +30,7 @@ var foo = (function () { var foo2 = (function (_super) { __extends(foo2, _super); function foo2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return foo2; }(foo)); diff --git a/tests/baselines/reference/noEmitHelpers.js b/tests/baselines/reference/noEmitHelpers.js index fdb7cbab7d4..1a9ad2579b9 100644 --- a/tests/baselines/reference/noEmitHelpers.js +++ b/tests/baselines/reference/noEmitHelpers.js @@ -13,7 +13,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js index 12859100009..7dc7e4dafb3 100644 --- a/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingGetAccessor.js @@ -31,7 +31,7 @@ var Parent = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Child.prototype, "message", { set: function (str) { diff --git a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js index bb6e1e53f0f..31d7e65ed9b 100644 --- a/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js +++ b/tests/baselines/reference/noImplicitAnyMissingSetAccessor.js @@ -30,7 +30,7 @@ var Parent = (function () { var Child = (function (_super) { __extends(Child, _super); function Child() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Child.prototype, "message", { get: function () { diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 132145dbf3f..c088787717c 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -24,7 +24,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(Foo)); // Valid diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 046414eba34..9e501b5d92c 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -66,7 +66,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; }; return B; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index ebe02d70f7d..9e733e593fd 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index fda23bce27c..4546db0b8a4 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -31,7 +31,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index f87198f32a7..8bcc5ac61c4 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -31,7 +31,7 @@ var I = (function () { var I2 = (function (_super) { __extends(I2, _super); function I2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return I2; }(I)); diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index ffe2ca6ab7e..22a852e156c 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -73,7 +73,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index 550ef48125d..d7db8d271bd 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -152,14 +152,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index 249c39be6d3..6af5cb75146 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -145,7 +145,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -167,14 +167,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index 7f16c30799f..0441cc85dcf 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -152,14 +152,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index b1902922277..294d879ce24 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -150,14 +150,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 8de254e15c1..d151af230f6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -58,7 +58,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 6970f06854b..7fc23f7255c 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -44,7 +44,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C1)); @@ -58,7 +58,7 @@ var C3 = (function () { var C4 = (function (_super) { __extends(C4, _super); function C4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C4; }(C3)); diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index 3c45a453d88..9bf7aca342b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -152,14 +152,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index e9dce1d5366..f8aa1127e4e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -145,7 +145,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -167,14 +167,14 @@ var C = (function () { var PA = (function (_super) { __extends(PA, _super); function PA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PA; }(A)); var PB = (function (_super) { __extends(PB, _super); function PB() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return PB; }(B)); diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index c18a38ec343..2412ce67ffe 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -30,7 +30,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); diff --git a/tests/baselines/reference/optionalMethods.js b/tests/baselines/reference/optionalMethods.js index e79c6f85fd3..a3685175f66 100644 --- a/tests/baselines/reference/optionalMethods.js +++ b/tests/baselines/reference/optionalMethods.js @@ -114,7 +114,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.a = 1; return _this; } diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index 03db09eac1a..601cb4d6f1e 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -27,7 +27,7 @@ var Z = (function () { var Y = (function (_super) { __extends(Y, _super); function Y() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Y.prototype.func = function (value) { }; return Y; diff --git a/tests/baselines/reference/outModuleConcatAmd.js b/tests/baselines/reference/outModuleConcatAmd.js index 810cd73b502..b30cf93786c 100644 --- a/tests/baselines/reference/outModuleConcatAmd.js +++ b/tests/baselines/reference/outModuleConcatAmd.js @@ -33,7 +33,7 @@ define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt index 6e905832277..a8a11fcadc0 100644 --- a/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatAmd.sourcemap.txt @@ -97,11 +97,11 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(24, 9) Source(2, 1) + SourceIndex(1) --- ->>> return _super.apply(this, arguments) || this; +>>> return _super !== null && _super.apply(this, arguments) || this; >>> } 1->^^^^^^^^ 2 > ^ diff --git a/tests/baselines/reference/outModuleConcatSystem.js b/tests/baselines/reference/outModuleConcatSystem.js index ff8f1f6fd0a..1648748a168 100644 --- a/tests/baselines/reference/outModuleConcatSystem.js +++ b/tests/baselines/reference/outModuleConcatSystem.js @@ -49,7 +49,7 @@ System.register("b", ["ref/a"], function (exports_2, context_2) { B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt index 1a25b6358fa..a8dd4bb55e7 100644 --- a/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt +++ b/tests/baselines/reference/outModuleConcatSystem.sourcemap.txt @@ -114,11 +114,11 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(40, 17) Source(2, 1) + SourceIndex(1) --- ->>> return _super.apply(this, arguments) || this; +>>> return _super !== null && _super.apply(this, arguments) || this; >>> } 1->^^^^^^^^^^^^^^^^ 2 > ^ diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.js b/tests/baselines/reference/outModuleTripleSlashRefs.js index b144c6e74c8..33e970af54b 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.js +++ b/tests/baselines/reference/outModuleTripleSlashRefs.js @@ -62,7 +62,7 @@ define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(a_1.A)); diff --git a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt index 0f20e86cd00..f2076c34482 100644 --- a/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt +++ b/tests/baselines/reference/outModuleTripleSlashRefs.sourcemap.txt @@ -171,11 +171,11 @@ sourceFile:tests/cases/compiler/b.ts --- >>> function B() { 1 >^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(31, 9) Source(2, 1) + SourceIndex(2) --- ->>> return _super.apply(this, arguments) || this; +>>> return _super !== null && _super.apply(this, arguments) || this; >>> } 1->^^^^^^^^ 2 > ^ diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index eddb4181ad6..fc898b4e870 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -61,7 +61,7 @@ var O; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -69,7 +69,7 @@ var O; var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index 058a294833c..6a4cc01bf85 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -42,7 +42,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -50,7 +50,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -58,7 +58,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index 9cbbedfabb3..379de55da88 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -30,14 +30,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 5f710f17837..de843b9f44c 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -32,14 +32,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index afa8d83cb13..3f7664ff6c8 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -32,7 +32,7 @@ var Z = (function () { var A = (function (_super) { __extends(A, _super); function A() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = 1; return _this; } @@ -41,14 +41,14 @@ var A = (function (_super) { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.foo = function () { }; return C; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index 534a4f9dde8..5488ea03ee8 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -31,7 +31,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -39,7 +39,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -47,7 +47,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index b154ceff837..32040c082ee 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -113,21 +113,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 45d07483f4f..5a8c7c0838b 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -120,21 +120,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 4a64e8be917..32f350bdc2e 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -121,21 +121,21 @@ var SomeBase = (function () { var SomeDerived1 = (function (_super) { __extends(SomeDerived1, _super); function SomeDerived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived1; }(SomeBase)); var SomeDerived2 = (function (_super) { __extends(SomeDerived2, _super); function SomeDerived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived2; }(SomeBase)); var SomeDerived3 = (function (_super) { __extends(SomeDerived3, _super); function SomeDerived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived3; }(SomeBase)); diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index 774436ba5ee..c741abade66 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -45,7 +45,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; @@ -53,7 +53,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.baz = function () { }; return Derived2; @@ -61,7 +61,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.biz = function () { }; return Derived3; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 6cc20caa80e..f415df84a47 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -47,7 +47,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index f7fb709cda2..0b4e5672b5e 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -26,7 +26,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index 647ddb733a7..735c756fd1f 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index 6676b2499dd..8b963bf0674 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -26,7 +26,7 @@ var Type = (function () { var Any = (function (_super) { __extends(Any, _super); function Any() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Any; }(Type)); diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index ae274f3dcbb..ed4943046fa 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -368,7 +368,7 @@ c2_i.nc_f1(); var c4 = (function (_super) { __extends(c4, _super); function c4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return c4; }(c2)); diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 11c087cf568..85fe94e04cc 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index 886fce51892..d627784985d 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(B)); diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index d9f1f1acbed..318833c5e91 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index 38fa87e2ce1..e5b2c337214 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index a4720967984..0d6049c9ba9 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index 231b4fb3d06..30f2e7f5698 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 584088cd511..42947c5fcb8 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 97dd2af2925..1e62709949d 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index a072e9c3565..ef5452a1638 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -31,7 +31,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index 7e8694e9416..9302db655bf 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -31,7 +31,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js index e09713cfdfa..88439493a50 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceError.js @@ -34,7 +34,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js index 2647bd4d8ee..6a46935b224 100644 --- a/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js +++ b/tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.js @@ -53,7 +53,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index d378e5abee0..163c5c8873d 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -68,7 +68,7 @@ var baz = (function () { var foo = (function (_super) { __extends(foo, _super); function foo() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } foo.prototype.bar = function () { return undefined; }; ; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index 154e4ad453d..4e79f019e5d 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -157,21 +157,21 @@ var m1; var m1_C1_private = (function (_super) { __extends(m1_C1_private, _super); function m1_C1_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C1_private; }(m1_c_public)); var m1_C2_private = (function (_super) { __extends(m1_C2_private, _super); function m1_C2_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C2_private; }(m1_c_private)); var m1_C3_public = (function (_super) { __extends(m1_C3_public, _super); function m1_C3_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C3_public; }(m1_c_public)); @@ -179,7 +179,7 @@ var m1; var m1_C4_public = (function (_super) { __extends(m1_C4_public, _super); function m1_C4_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C4_public; }(m1_c_private)); @@ -209,21 +209,21 @@ var m1; var m1_C9_private = (function (_super) { __extends(m1_C9_private, _super); function m1_C9_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C9_private; }(m1_c_public)); var m1_C10_private = (function (_super) { __extends(m1_C10_private, _super); function m1_C10_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C10_private; }(m1_c_private)); var m1_C11_public = (function (_super) { __extends(m1_C11_public, _super); function m1_C11_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C11_public; }(m1_c_public)); @@ -231,7 +231,7 @@ var m1; var m1_C12_public = (function (_super) { __extends(m1_C12_public, _super); function m1_C12_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C12_public; }(m1_c_private)); @@ -255,21 +255,21 @@ var m2; var m2_C1_private = (function (_super) { __extends(m2_C1_private, _super); function m2_C1_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C1_private; }(m2_c_public)); var m2_C2_private = (function (_super) { __extends(m2_C2_private, _super); function m2_C2_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C2_private; }(m2_c_private)); var m2_C3_public = (function (_super) { __extends(m2_C3_public, _super); function m2_C3_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C3_public; }(m2_c_public)); @@ -277,7 +277,7 @@ var m2; var m2_C4_public = (function (_super) { __extends(m2_C4_public, _super); function m2_C4_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C4_public; }(m2_c_private)); @@ -307,21 +307,21 @@ var m2; var m2_C9_private = (function (_super) { __extends(m2_C9_private, _super); function m2_C9_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C9_private; }(m2_c_public)); var m2_C10_private = (function (_super) { __extends(m2_C10_private, _super); function m2_C10_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C10_private; }(m2_c_private)); var m2_C11_public = (function (_super) { __extends(m2_C11_public, _super); function m2_C11_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C11_public; }(m2_c_public)); @@ -329,7 +329,7 @@ var m2; var m2_C12_public = (function (_super) { __extends(m2_C12_public, _super); function m2_C12_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m2_C12_public; }(m2_c_private)); @@ -351,21 +351,21 @@ var glo_c_private = (function () { var glo_C1_private = (function (_super) { __extends(glo_C1_private, _super); function glo_C1_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C1_private; }(glo_c_public)); var glo_C2_private = (function (_super) { __extends(glo_C2_private, _super); function glo_C2_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C2_private; }(glo_c_private)); var glo_C3_public = (function (_super) { __extends(glo_C3_public, _super); function glo_C3_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C3_public; }(glo_c_public)); @@ -373,7 +373,7 @@ exports.glo_C3_public = glo_C3_public; var glo_C4_public = (function (_super) { __extends(glo_C4_public, _super); function glo_C4_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C4_public; }(glo_c_private)); @@ -403,21 +403,21 @@ exports.glo_C8_public = glo_C8_public; var glo_C9_private = (function (_super) { __extends(glo_C9_private, _super); function glo_C9_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C9_private; }(glo_c_public)); var glo_C10_private = (function (_super) { __extends(glo_C10_private, _super); function glo_C10_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C10_private; }(glo_c_private)); var glo_C11_public = (function (_super) { __extends(glo_C11_public, _super); function glo_C11_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C11_public; }(glo_c_public)); @@ -425,7 +425,7 @@ exports.glo_C11_public = glo_C11_public; var glo_C12_public = (function (_super) { __extends(glo_C12_public, _super); function glo_C12_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C12_public; }(glo_c_private)); diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index 04f18d61340..3e5b20923df 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -127,21 +127,21 @@ var publicModule; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPublicModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPublicModule)); @@ -149,7 +149,7 @@ var publicModule; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); @@ -157,14 +157,14 @@ var publicModule; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -188,21 +188,21 @@ var privateModule; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPrivateModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPrivateModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPrivateModule)); @@ -210,7 +210,7 @@ var privateModule; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPrivateModule)); @@ -218,14 +218,14 @@ var privateModule; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -247,21 +247,21 @@ var privateClass = (function () { var privateClassExtendingPublicClass = (function (_super) { __extends(privateClassExtendingPublicClass, _super); function privateClassExtendingPublicClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPublicClass; }(publicClass)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClass)); var publicClassExtendingPublicClass = (function (_super) { __extends(publicClassExtendingPublicClass, _super); function publicClassExtendingPublicClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPublicClass; }(publicClass)); @@ -269,7 +269,7 @@ exports.publicClassExtendingPublicClass = publicClassExtendingPublicClass; var publicClassExtendingPrivateClass = (function (_super) { __extends(publicClassExtendingPrivateClass, _super); function publicClassExtendingPrivateClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClass; }(privateClass)); @@ -277,14 +277,14 @@ exports.publicClassExtendingPrivateClass = publicClassExtendingPrivateClass; var privateClassExtendingFromPrivateModuleClass = (function (_super) { __extends(privateClassExtendingFromPrivateModuleClass, _super); function privateClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); var publicClassExtendingFromPrivateModuleClass = (function (_super) { __extends(publicClassExtendingFromPrivateModuleClass, _super); function publicClassExtendingFromPrivateModuleClass() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingFromPrivateModuleClass; }(privateModule.publicClassInPrivateModule)); @@ -318,21 +318,21 @@ var publicModuleInGlobal; var privateClassExtendingPublicClassInModule = (function (_super) { __extends(privateClassExtendingPublicClassInModule, _super); function privateClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPublicClassInModule; }(publicClassInPublicModule)); var privateClassExtendingPrivateClassInModule = (function (_super) { __extends(privateClassExtendingPrivateClassInModule, _super); function privateClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return privateClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); var publicClassExtendingPublicClassInModule = (function (_super) { __extends(publicClassExtendingPublicClassInModule, _super); function publicClassExtendingPublicClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInModule; }(publicClassInPublicModule)); @@ -340,7 +340,7 @@ var publicModuleInGlobal; var publicClassExtendingPrivateClassInModule = (function (_super) { __extends(publicClassExtendingPrivateClassInModule, _super); function publicClassExtendingPrivateClassInModule() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPrivateClassInModule; }(privateClassInPublicModule)); @@ -354,7 +354,7 @@ var publicClassInGlobal = (function () { var publicClassExtendingPublicClassInGlobal = (function (_super) { __extends(publicClassExtendingPublicClassInGlobal, _super); function publicClassExtendingPublicClassInGlobal() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return publicClassExtendingPublicClassInGlobal; }(publicClassInGlobal)); diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index 017bd375b54..85acba1148b 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -89,21 +89,21 @@ var m1; var m1_C1_private = (function (_super) { __extends(m1_C1_private, _super); function m1_C1_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C1_private; }(m1_c_public)); var m1_C2_private = (function (_super) { __extends(m1_C2_private, _super); function m1_C2_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C2_private; }(m1_c_private)); var m1_C3_public = (function (_super) { __extends(m1_C3_public, _super); function m1_C3_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C3_public; }(m1_c_public)); @@ -111,7 +111,7 @@ var m1; var m1_C4_public = (function (_super) { __extends(m1_C4_public, _super); function m1_C4_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C4_public; }(m1_c_private)); @@ -141,21 +141,21 @@ var m1; var m1_C9_private = (function (_super) { __extends(m1_C9_private, _super); function m1_C9_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C9_private; }(m1_c_public)); var m1_C10_private = (function (_super) { __extends(m1_C10_private, _super); function m1_C10_private() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C10_private; }(m1_c_private)); var m1_C11_public = (function (_super) { __extends(m1_C11_public, _super); function m1_C11_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C11_public; }(m1_c_public)); @@ -163,7 +163,7 @@ var m1; var m1_C12_public = (function (_super) { __extends(m1_C12_public, _super); function m1_C12_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return m1_C12_public; }(m1_c_private)); @@ -179,7 +179,7 @@ var glo_c_public = (function () { var glo_C3_public = (function (_super) { __extends(glo_C3_public, _super); function glo_C3_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C3_public; }(glo_c_public)); @@ -191,7 +191,7 @@ var glo_C7_public = (function () { var glo_C11_public = (function (_super) { __extends(glo_C11_public, _super); function glo_C11_public() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return glo_C11_public; }(glo_c_public)); diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index cf1a6cb1d44..bab68b8d67e 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -28,7 +28,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.myMethod = function () { this.options; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index 72f1ea01f0d..8448f142bbb 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -32,7 +32,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.x = _super.prototype.foo; // error _this.z = _super.prototype.foo; // error return _this; diff --git a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js index 96808c3daeb..be01293a2cd 100644 --- a/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js +++ b/tests/baselines/reference/privateProtectedMembersAreNotAccessibleDestructuring.js @@ -45,7 +45,7 @@ var K = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.prototype.m2 = function () { var a = this.priv; // error diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index 19da5064fbb..92a8713ef8f 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -27,7 +27,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.bing = function () { return Base.foo; }; // error return _this; } diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index eceda383092..c4af30f1456 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -34,7 +34,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index bf8401f6b4d..1c181a2feae 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -19,7 +19,7 @@ var m2; var class1 = (function (_super) { __extends(class1, _super); function class1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class1; }(m2.mExported.me.class1)); @@ -32,7 +32,7 @@ var m2; var class2 = (function (_super) { __extends(class2, _super); function class2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class2; }(m2.mExported.me.class1)); @@ -45,7 +45,7 @@ var m2; var class3 = (function (_super) { __extends(class3, _super); function class3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class3; }(mNonExported.mne.class1)); @@ -58,7 +58,7 @@ var m2; var class4 = (function (_super) { __extends(class4, _super); function class4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class4; }(mNonExported.mne.class1)); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index bf8401f6b4d..1c181a2feae 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -19,7 +19,7 @@ var m2; var class1 = (function (_super) { __extends(class1, _super); function class1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class1; }(m2.mExported.me.class1)); @@ -32,7 +32,7 @@ var m2; var class2 = (function (_super) { __extends(class2, _super); function class2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class2; }(m2.mExported.me.class1)); @@ -45,7 +45,7 @@ var m2; var class3 = (function (_super) { __extends(class3, _super); function class3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class3; }(mNonExported.mne.class1)); @@ -58,7 +58,7 @@ var m2; var class4 = (function (_super) { __extends(class4, _super); function class4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class4; }(mNonExported.mne.class1)); diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index 5fdfd475186..45dfb93c458 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -23,7 +23,7 @@ var m; var child = (function (_super) { __extends(child, _super); function child() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return child; }(base)); diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index 5fdfd475186..45dfb93c458 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -23,7 +23,7 @@ var m; var child = (function (_super) { __extends(child, _super); function child() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return child; }(base)); diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index 2fe4870822f..ce5681ae1c9 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -12,7 +12,7 @@ var __extends = (this && this.__extends) || (function () { var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ClassC; }(test.ClassA)); diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index 2fe4870822f..ce5681ae1c9 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -12,7 +12,7 @@ var __extends = (this && this.__extends) || (function () { var ClassC = (function (_super) { __extends(ClassC, _super); function ClassC() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ClassC; }(test.ClassA)); diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 899390cc913..2c678ba258f 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -70,7 +70,7 @@ var P = (function () { var Q = (function (_super) { __extends(Q, _super); function Q() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Q; }(P)); diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index f9b92420a70..5904d66c372 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -169,7 +169,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index b3464d30f9c..08e1a9ceb11 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -102,7 +102,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index a43b44c4b2b..0d945197957 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -77,7 +77,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 604131ef7b7..a7cc39b7f05 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -64,7 +64,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js index 0756ef8ca9b..47d329909fd 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass.js @@ -57,7 +57,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(C.prototype, "y", { get: function () { return this.x; }, @@ -98,7 +98,7 @@ var C = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return E; }(C)); diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js index 6d0c068039f..8273b7e31bd 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinNestedSubclass1.js @@ -152,7 +152,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.method1 = function () { var B = (function () { @@ -178,7 +178,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.method2 = function () { var C = (function () { @@ -204,7 +204,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.method3 = function () { var D = (function () { @@ -230,7 +230,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived4.prototype.method4 = function () { var E = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index c2f072b213b..a2d35914cbe 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -39,7 +39,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(C.prototype, "y", { get: function () { return this.x; }, diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index b7421c6161c..7a9ee9f2268 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -125,7 +125,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.method1 = function () { var b; @@ -144,7 +144,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.prototype.method2 = function () { var b; @@ -163,7 +163,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.prototype.method3 = function () { var b; @@ -182,7 +182,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived4.prototype.method4 = function () { var b; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 72cf5039e6c..2b9faf6282c 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -35,7 +35,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.method1 = function () { this.x; // OK, accessed within a subclass of the declaring class diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index dc74f3ed190..6617636aa45 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -66,7 +66,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.g = function () { var t1 = this.x; @@ -98,7 +98,7 @@ var B = (function (_super) { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index fddbdf80bcc..7684ff8e658 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -142,7 +142,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C2.prototype.f = function () { return _super.prototype.f.call(this) + this.x; @@ -156,7 +156,7 @@ var C2 = (function (_super) { var C3 = (function (_super) { __extends(C3, _super); function C3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C3.prototype.f = function () { return _super.prototype.f.call(this); @@ -192,14 +192,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } C.foo = function (a, b, c, d, e) { a.x = 1; // Error, access must be through C or type derived from C @@ -213,7 +213,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -244,7 +244,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -257,7 +257,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index 9564b6e35b9..238c0dc2384 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -68,7 +68,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.staticMethod1 = function () { Base.x; // OK, accessed within a class derived from their declaring class @@ -81,7 +81,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.staticMethod2 = function () { Base.x; // OK, accessed within a class derived from their declaring class @@ -94,7 +94,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived3.staticMethod3 = function () { Base.x; // OK, accessed within a class derived from their declaring class diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index ca6af2bc4ed..969b7ebd7dc 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -43,7 +43,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.staticMethod1 = function () { this.x; // OK, accessed within a class derived from their declaring class @@ -54,7 +54,7 @@ var Derived1 = (function (_super) { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived2.staticMethod3 = function () { this.x; // OK, accessed within a class derived from their declaring class diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index ff51753f683..f7b49b4219a 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -24,7 +24,7 @@ var Alpha; var Beta = (function (_super) { __extends(Beta, _super); function Beta() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Beta; }(Alpha.x)); diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index 84b40e2f035..a9ea849cea0 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -18,14 +18,14 @@ var __extends = (this && this.__extends) || (function () { var A = (function (_super) { __extends(A, _super); function A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return A; }(C)); var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index 5db14dcf42d..7b0be057441 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var M = (function (_super) { __extends(M, _super); function M() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return M; }(M)); diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index e1ac79b3a63..6e639130839 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var S18 = (function (_super) { __extends(S18, _super); function S18() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return S18; }(S18)); diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index 32a6a6c4de1..c8507944ed7 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -26,7 +26,7 @@ var C1 = (function () { var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(C1)); diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 1c33cf9f2c7..704c39891e6 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -33,7 +33,7 @@ var TypeScript2; var MemberNameArray = (function (_super) { __extends(MemberNameArray, _super); function MemberNameArray() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MemberNameArray; }(MemberName)); diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index bb711d95ce7..2d44740ac73 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -193,7 +193,7 @@ var AbstractMode = (function () { var Mode = (function (_super) { __extends(Mode, _super); function Mode() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } // scenario 2 Mode.prototype.getInitialState = function () { diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 10d04ca9719..4196b08c609 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -1623,11 +1623,11 @@ sourceFile:recursiveClassReferenceTest.ts --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(90, 21) Source(91, 2) + SourceIndex(0) --- ->>> return _super.apply(this, arguments) || this; +>>> return _super !== null && _super.apply(this, arguments) || this; >>> } 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^ diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index c81d10ed99b..cb46865c46f 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -56,21 +56,21 @@ var Symbol = (function () { var InferenceSymbol = (function (_super) { __extends(InferenceSymbol, _super); function InferenceSymbol() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return InferenceSymbol; }(Symbol)); var ParameterSymbol = (function (_super) { __extends(ParameterSymbol, _super); function ParameterSymbol() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ParameterSymbol; }(InferenceSymbol)); var TypeSymbol = (function (_super) { __extends(TypeSymbol, _super); function TypeSymbol() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return TypeSymbol; }(InferenceSymbol)); diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index e75661c2ea9..ee976ff3da1 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -57,7 +57,7 @@ var MsPortal; var ViewModel = (function (_super) { __extends(ViewModel, _super); function ViewModel() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ViewModel; }(ItemValue)); diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js index 5566d296883..0242a57d4f5 100644 --- a/tests/baselines/reference/reexportClassDefinition.js +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -47,7 +47,7 @@ var foo2 = require("./foo2"); var x = (function (_super) { __extends(x, _super); function x() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return x; }(foo2.x)); diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 6145c8927e0..1a9a3dacbba 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1035,7 +1035,7 @@ var rionegrensis; var caniventer = (function (_super) { __extends(caniventer, _super); function caniventer() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } caniventer.prototype.salomonseni = function () { var _this = this; @@ -1073,7 +1073,7 @@ var rionegrensis; var veraecrucis = (function (_super) { __extends(veraecrucis, _super); function veraecrucis() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } veraecrucis.prototype.naso = function () { var _this = this; @@ -1252,7 +1252,7 @@ var julianae; var oralis = (function (_super) { __extends(oralis, _super); function oralis() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } oralis.prototype.cepapi = function () { var _this = this; @@ -1338,7 +1338,7 @@ var julianae; var sumatrana = (function (_super) { __extends(sumatrana, _super); function sumatrana() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } sumatrana.prototype.wolffsohni = function () { var _this = this; @@ -1538,7 +1538,7 @@ var julianae; var durangae = (function (_super) { __extends(durangae, _super); function durangae() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } durangae.prototype.Californium = function () { var _this = this; @@ -1612,7 +1612,7 @@ var Lanthanum; var nitidus = (function (_super) { __extends(nitidus, _super); function nitidus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } nitidus.prototype.granatensis = function () { var _this = this; @@ -1680,7 +1680,7 @@ var Lanthanum; var megalonyx = (function (_super) { __extends(megalonyx, _super); function megalonyx() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } megalonyx.prototype.phillipsii = function () { var _this = this; @@ -1829,7 +1829,7 @@ var rendalli; var zuluensis = (function (_super) { __extends(zuluensis, _super); function zuluensis() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } zuluensis.prototype.telfairi = function () { var _this = this; @@ -1987,7 +1987,7 @@ var rendalli; var crenulata = (function (_super) { __extends(crenulata, _super); function crenulata() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } crenulata.prototype.salvanius = function () { var _this = this; @@ -2070,7 +2070,7 @@ var trivirgatus; var mixtus = (function (_super) { __extends(mixtus, _super); function mixtus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } mixtus.prototype.ochrogaster = function () { var _this = this; @@ -2311,7 +2311,7 @@ var quasiater; var americanus = (function (_super) { __extends(americanus, _super); function americanus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } americanus.prototype.nasoloi = function () { var _this = this; @@ -2346,7 +2346,7 @@ var lavali; var wilsoni = (function (_super) { __extends(wilsoni, _super); function wilsoni() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } wilsoni.prototype.setiger = function () { var _this = this; @@ -2438,7 +2438,7 @@ var lavali; var otion = (function (_super) { __extends(otion, _super); function otion() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } otion.prototype.bonaerensis = function () { var _this = this; @@ -2602,7 +2602,7 @@ var lavali; var thaeleri = (function (_super) { __extends(thaeleri, _super); function thaeleri() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } thaeleri.prototype.coromandra = function () { var _this = this; @@ -2658,7 +2658,7 @@ var lavali; var lepturus = (function (_super) { __extends(lepturus, _super); function lepturus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } lepturus.prototype.ferrumequinum = function () { var _this = this; @@ -2681,7 +2681,7 @@ var dogramacii; var robustulus = (function (_super) { __extends(robustulus, _super); function robustulus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } robustulus.prototype.fossor = function () { var _this = this; @@ -2896,7 +2896,7 @@ var lutreolus; var schlegeli = (function (_super) { __extends(schlegeli, _super); function schlegeli() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } schlegeli.prototype.mittendorfi = function () { var _this = this; @@ -3123,7 +3123,7 @@ var panglima; var amphibius = (function (_super) { __extends(amphibius, _super); function amphibius() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } amphibius.prototype.bottegi = function () { var _this = this; @@ -3167,7 +3167,7 @@ var panglima; var fundatus = (function (_super) { __extends(fundatus, _super); function fundatus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } fundatus.prototype.crassulus = function () { var _this = this; @@ -3193,7 +3193,7 @@ var panglima; var abidi = (function (_super) { __extends(abidi, _super); function abidi() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } abidi.prototype.greyii = function () { var _this = this; @@ -3284,7 +3284,7 @@ var minutus; var himalayana = (function (_super) { __extends(himalayana, _super); function himalayana() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } himalayana.prototype.simoni = function () { var _this = this; @@ -3367,7 +3367,7 @@ var caurinus; var mahaganus = (function (_super) { __extends(mahaganus, _super); function mahaganus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } mahaganus.prototype.martiniquensis = function () { var _this = this; @@ -3441,7 +3441,7 @@ var howi; var angulatus = (function (_super) { __extends(angulatus, _super); function angulatus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } angulatus.prototype.pennatus = function () { var _this = this; @@ -3523,7 +3523,7 @@ var sagitta; var walkeri = (function (_super) { __extends(walkeri, _super); function walkeri() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } walkeri.prototype.maracajuensis = function () { var _this = this; @@ -3539,7 +3539,7 @@ var sagitta; var inez = (function (_super) { __extends(inez, _super); function inez() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } inez.prototype.vexillaris = function () { var _this = this; @@ -3555,7 +3555,7 @@ var sagitta; var konganensis = (function (_super) { __extends(konganensis, _super); function konganensis() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return konganensis; }(imperfecta.lasiurus)); @@ -3566,7 +3566,7 @@ var panamensis; var linulus = (function (_super) { __extends(linulus, _super); function linulus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } linulus.prototype.goslingi = function () { var _this = this; @@ -3717,7 +3717,7 @@ var samarensis; var pelurus = (function (_super) { __extends(pelurus, _super); function pelurus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } pelurus.prototype.Palladium = function () { var _this = this; @@ -3803,7 +3803,7 @@ var samarensis; var fuscus = (function (_super) { __extends(fuscus, _super); function fuscus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } fuscus.prototype.planifrons = function () { var _this = this; @@ -3963,7 +3963,7 @@ var samarensis; var leptoceros = (function (_super) { __extends(leptoceros, _super); function leptoceros() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } leptoceros.prototype.victus = function () { var _this = this; @@ -4003,7 +4003,7 @@ var samarensis; var nigricans = (function (_super) { __extends(nigricans, _super); function nigricans() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } nigricans.prototype.woosnami = function () { var _this = this; @@ -4028,7 +4028,7 @@ var dammermani; var pygmaea = (function (_super) { __extends(pygmaea, _super); function pygmaea() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } pygmaea.prototype.pajeros = function () { var _this = this; @@ -4057,7 +4057,7 @@ var chrysaeolus; var sarasinorum = (function (_super) { __extends(sarasinorum, _super); function sarasinorum() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } sarasinorum.prototype.belzebul = function () { var _this = this; @@ -4159,7 +4159,7 @@ var chrysaeolus; var oreas = (function (_super) { __extends(oreas, _super); function oreas() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } oreas.prototype.salamonis = function () { var _this = this; @@ -4385,7 +4385,7 @@ var provocax; var melanoleuca = (function (_super) { __extends(melanoleuca, _super); function melanoleuca() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } melanoleuca.prototype.Neodymium = function () { var _this = this; @@ -4427,7 +4427,7 @@ var provocax; var marcanoi = (function (_super) { __extends(marcanoi, _super); function marcanoi() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } marcanoi.prototype.formosae = function () { var _this = this; @@ -4829,7 +4829,7 @@ var gabriellae; var klossii = (function (_super) { __extends(klossii, _super); function klossii() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return klossii; }(imperfecta.lasiurus)); @@ -5032,7 +5032,7 @@ var imperfecta; var ciliolabrum = (function (_super) { __extends(ciliolabrum, _super); function ciliolabrum() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ciliolabrum.prototype.leschenaultii = function () { var _this = this; @@ -5092,7 +5092,7 @@ var imperfecta; var sodyi = (function (_super) { __extends(sodyi, _super); function sodyi() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } sodyi.prototype.saundersiae = function () { var _this = this; @@ -5156,7 +5156,7 @@ var imperfecta; var megaphyllus = (function (_super) { __extends(megaphyllus, _super); function megaphyllus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } megaphyllus.prototype.montana = function () { var _this = this; @@ -5326,7 +5326,7 @@ var imperfecta; var cor = (function (_super) { __extends(cor, _super); function cor() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } cor.prototype.antinorii = function () { var _this = this; @@ -5416,7 +5416,7 @@ var imperfecta; var germaini = (function (_super) { __extends(germaini, _super); function germaini() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } germaini.prototype.sharpei = function () { var _this = this; @@ -5512,7 +5512,7 @@ var imperfecta; var melanops = (function (_super) { __extends(melanops, _super); function melanops() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } melanops.prototype.blarina = function () { var _this = this; @@ -5600,7 +5600,7 @@ var imperfecta; var peninsulae = (function (_super) { __extends(peninsulae, _super); function peninsulae() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } peninsulae.prototype.aitkeni = function () { var _this = this; @@ -5744,7 +5744,7 @@ var imperfecta; var Praseodymium = (function (_super) { __extends(Praseodymium, _super); function Praseodymium() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Praseodymium.prototype.clara = function () { var _this = this; @@ -5832,7 +5832,7 @@ var imperfecta; var johorensis = (function (_super) { __extends(johorensis, _super); function johorensis() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } johorensis.prototype.maini = function () { var _this = this; @@ -5956,7 +5956,7 @@ var imperfecta; var psilurus = (function (_super) { __extends(psilurus, _super); function psilurus() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } psilurus.prototype.socialis = function () { var _this = this; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index d3ebb904355..617911be759 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -53,7 +53,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 81f97455a1f..c72fe6dde7d 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -27,7 +27,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.c = function () { v = 1; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 5532c363050..34c1698a3ea 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -27,7 +27,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.c = function () { v = 1; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 20be8a60287..ce0fd333b91 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -23,7 +23,7 @@ var base = (function () { var derived = (function (_super) { __extends(derived, _super); function derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } derived.prototype.n = function () { }; return derived; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index 177c96a551a..44638fa007e 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -26,7 +26,7 @@ var AbstractGreeter = (function () { var Greeter = (function (_super) { __extends(Greeter, _super); function Greeter() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.a = 10; _this.nameA = "Ten"; return _this; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map index 6de0ba822fa..60e19fc95d2 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js.map] -{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,kDAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js","sourceRoot":"","sources":["sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IAAA;IACA,CAAC;IAAD,sBAAC;AAAD,CAAC,AADD,IACC;AAED;IAAsB,2BAAe;IAArC;QAAA,qEAGC;QAFU,OAAC,GAAG,EAAE,CAAC;QACP,WAAK,GAAG,KAAK,CAAC;;IACzB,CAAC;IAAD,cAAC;AAAD,CAAC,AAHD,CAAsB,eAAe,GAGpC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 94fa02e8e6b..9fa37bcff06 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -82,20 +82,20 @@ sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts --- >>> function Greeter() { 1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 1 >Emitted(18, 5) Source(4, 1) + SourceIndex(0) --- ->>> var _this = _super.apply(this, arguments) || this; +>>> var _this = _super !== null && _super.apply(this, arguments) || this; 1->^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > class Greeter extends AbstractGreeter { > public a = 10; > public nameA = "Ten"; > } 1->Emitted(19, 9) Source(4, 1) + SourceIndex(0) -2 >Emitted(19, 59) Source(7, 2) + SourceIndex(0) +2 >Emitted(19, 78) Source(7, 2) + SourceIndex(0) --- >>> _this.a = 10; 1 >^^^^^^^^ diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 1a9b07b4ca1..cd137e6dcae 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -41,7 +41,7 @@ var Model = (function () { var MyView = (function (_super) { __extends(MyView, _super); function MyView() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyView; }(View)); diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index 245fe1d40a9..892f30441f8 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -32,7 +32,7 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived1.prototype.bar = function () { }; return Derived1; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index 9e0d218ca50..b73dce8a0cf 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -36,7 +36,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Derived.prototype.foo = function () { return 2; }; return Derived; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index 6e76a0b3155..780e5e98782 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -32,7 +32,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.p1 = doThing(A); // OK _this.p2 = doThing(B); // OK return _this; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index ae6e906c635..41f2da7f4af 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -31,7 +31,7 @@ var SomeBase = (function () { var P = (function (_super) { __extends(P, _super); function P() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return P; }(SomeBase)); diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index ba54ed851c1..5c22232534f 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -54,7 +54,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; var x = 1; // should not error _this = _super.call(this) || this; return _this; @@ -65,7 +65,7 @@ B.s = 9; var C = (function (_super) { __extends(C, _super); function C() { - var _this; + var _this = this; _this.p = 10; var x = 1; // should error return _this; @@ -75,7 +75,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _this.p = 11; var x = 1; // should error return _this; @@ -85,7 +85,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - var _this; + var _this = this; _this.p = 12; var x = 1; // should error return _this; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index 83ddc4bcf4e..65426391967 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -99,7 +99,7 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _this.s = 9; var x = 1; // Error _this = _super.call(this) || this; @@ -130,7 +130,7 @@ Cs.s = 9; var Ds = (function (_super) { __extends(Ds, _super); function Ds() { - var _this; + var _this = this; var x = 1; // no Error _this = _super.call(this) || this; "use strict"; diff --git a/tests/baselines/reference/strictModeReservedWord.js b/tests/baselines/reference/strictModeReservedWord.js index ed33097cb83..07b514da9b7 100644 --- a/tests/baselines/reference/strictModeReservedWord.js +++ b/tests/baselines/reference/strictModeReservedWord.js @@ -53,7 +53,7 @@ function foo() { var myClass = (function (_super) { __extends(package, _super); function package() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return package; }(public)); diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index d40175b6d77..2539ce5dbbb 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -80,14 +80,14 @@ var F1 = (function () { var G = (function (_super) { __extends(G, _super); function G() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return G; }(package)); var H = (function (_super) { __extends(H, _super); function H() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return H; }(package.A)); diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index 376574cc3dd..f9942aff042 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -60,7 +60,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function () { return ''; }; return B; diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js index f3e5175c4a3..5036df4a330 100644 --- a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js @@ -36,7 +36,7 @@ var Base = (function () { var Subclass = (function (_super) { __extends(Subclass, _super); function Subclass() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.instance1_1 = new Base(); // allowed _this.instance1_2 = new Subclass(); // allowed return _this; @@ -46,7 +46,7 @@ var Subclass = (function (_super) { var SubclassOfSubclass = (function (_super) { __extends(SubclassOfSubclass, _super); function SubclassOfSubclass() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.instance2_1 = new Base(); // allowed _this.instance2_2 = new Subclass(); // allowed _this.instance2_3 = new SubclassOfSubclass(); // allowed diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 469288cc968..3c3a17d8f84 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -125,7 +125,7 @@ var C3 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(C3)); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 90f362d9bc6..b594eea6e4d 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -187,28 +187,28 @@ var C3 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(C3)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(C3)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(C3)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(C3)); @@ -218,21 +218,21 @@ var D4 = (function (_super) { var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(C3)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D6; }(C3)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D7; }(C3)); @@ -241,21 +241,21 @@ var D7 = (function (_super) { var D8 = (function (_super) { __extends(D8, _super); function D8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D8; }(C3)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D9; }(C3)); var D10 = (function (_super) { __extends(D10, _super); function D10() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D10; }(C3)); @@ -264,21 +264,21 @@ var D10 = (function (_super) { var D11 = (function (_super) { __extends(D11, _super); function D11() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D11; }(C3)); var D12 = (function (_super) { __extends(D12, _super); function D12() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D12; }(C3)); var D13 = (function (_super) { __extends(D13, _super); function D13() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D13; }(C3)); @@ -288,28 +288,28 @@ var D13 = (function (_super) { var D14 = (function (_super) { __extends(D14, _super); function D14() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D14; }(C3)); var D15 = (function (_super) { __extends(D15, _super); function D15() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D15; }(C3)); var D16 = (function (_super) { __extends(D16, _super); function D16() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D16; }(C3)); var D17 = (function (_super) { __extends(D17, _super); function D17() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D17; }(C3)); @@ -318,28 +318,28 @@ var D17 = (function (_super) { var D18 = (function (_super) { __extends(D18, _super); function D18() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D18; }(C3)); var D19 = (function (_super) { __extends(D19, _super); function D19() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D19; }(C3)); var D20 = (function (_super) { __extends(D20, _super); function D20() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D20; }(C3)); var D21 = (function (_super) { __extends(D21, _super); function D21() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D21; }(C3)); @@ -348,28 +348,28 @@ var D21 = (function (_super) { var D22 = (function (_super) { __extends(D22, _super); function D22() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D22; }(C3)); var D23 = (function (_super) { __extends(D23, _super); function D23() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D23; }(C3)); var D24 = (function (_super) { __extends(D24, _super); function D24() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D24; }(C3)); var D25 = (function (_super) { __extends(D25, _super); function D25() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D25; }(C3)); @@ -378,28 +378,28 @@ var D25 = (function (_super) { var D26 = (function (_super) { __extends(D26, _super); function D26() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D26; }(C3)); var D27 = (function (_super) { __extends(D27, _super); function D27() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D27; }(C3)); var D28 = (function (_super) { __extends(D28, _super); function D28() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D28; }(C3)); var D29 = (function (_super) { __extends(D29, _super); function D29() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D29; }(C3)); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index 3239afebe41..b3fa5971898 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -123,63 +123,63 @@ var B1 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(B1)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(B1)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(B1)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(B1)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(B1)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D6; }(B1)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D7; }(B1)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D8; }(B1)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D9; }(B1)); diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index d55bffe2c80..3d2fb052b41 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -222,63 +222,63 @@ var M1; var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(Base)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(Base)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(Base)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(Base)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(Base)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D6; }(Base)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D7; }(Base)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D8; }(Base)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D9; }(Base)); @@ -293,63 +293,63 @@ var M2; var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(Base2)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(Base2)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(Base2)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(Base2)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(Base2)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D6; }(Base2)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D7; }(Base2)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D8; }(Base2)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D9; }(Base2)); diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 9292d1fb878..cbacd85a779 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -38,14 +38,14 @@ var B = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(B)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(B)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index aa919f2e737..dfe34ca35f0 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -192,21 +192,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index c597a841828..d479bdbe618 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -141,21 +141,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index 9b6939167ef..09c5e8056ba 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -131,21 +131,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index e2653d77593..55624b63f42 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -192,21 +192,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index 820d2221638..a7a7f620389 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -143,21 +143,21 @@ var Errors; var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index 604604a59cf..e8ca51f317a 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -131,21 +131,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 6473bbeafd8..c99e215bc89 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -69,21 +69,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index dba21a9a3e2..cbd8eebf47c 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -72,21 +72,21 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return OtherDerived; }(Base)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index ceae3b0f84e..7f140917935 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -59,14 +59,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); @@ -80,28 +80,28 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B4; }(A)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 6f77e8a5d13..e8fbc59bed7 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -63,14 +63,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); @@ -84,35 +84,35 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B4; }(A)); var B5 = (function (_super) { __extends(B5, _super); function B5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B5; }(A)); diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index c25e7abb329..ce3ed4fb4de 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -47,7 +47,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -61,14 +61,14 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index c7a2c5a938e..7f1c9e9e492 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -86,14 +86,14 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Derived)); @@ -107,7 +107,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -119,7 +119,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -131,7 +131,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); @@ -145,7 +145,7 @@ var TwoLevels; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -157,7 +157,7 @@ var TwoLevels; var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -169,7 +169,7 @@ var TwoLevels; var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 4952a1e25ff..e453b508c34 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -53,7 +53,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -65,7 +65,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -77,7 +77,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -89,7 +89,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index 3b7b643b35e..fae7c452edc 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -53,7 +53,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -65,7 +65,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -77,7 +77,7 @@ var A2 = (function () { var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -89,7 +89,7 @@ var A3 = (function () { var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 40910f393f7..6fd845d2277 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -81,7 +81,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived; }(Base)); @@ -95,7 +95,7 @@ var ExplicitPublic; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -107,7 +107,7 @@ var ExplicitPublic; var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -119,7 +119,7 @@ var ExplicitPublic; var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); @@ -134,7 +134,7 @@ var ImplicitPublic; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -146,7 +146,7 @@ var ImplicitPublic; var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A2)); @@ -158,7 +158,7 @@ var ImplicitPublic; var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A3)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index bfdb583ac8d..36382a4ff91 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -60,14 +60,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); @@ -81,28 +81,28 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B4; }(A)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index 3385ea5a792..ed8e027e7c5 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -63,14 +63,14 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); @@ -84,35 +84,35 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B2 = (function (_super) { __extends(B2, _super); function B2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B2; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); var B4 = (function (_super) { __extends(B4, _super); function B4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B4; }(A)); var B5 = (function (_super) { __extends(B5, _super); function B5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B5; }(A)); diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index 04075c906f4..d8a9693e1a1 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -47,7 +47,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); @@ -61,14 +61,14 @@ var Generics; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(A)); var B3 = (function (_super) { __extends(B3, _super); function B3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B3; }(A)); diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 98c38569c37..3dd0e9ed538 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -63,7 +63,7 @@ var Base = (function () { var Sub1 = (function (_super) { __extends(Sub1, _super); function Sub1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Sub1.prototype.foo = function () { return "sub1" + _super.prototype.foo.call(this) + _super.prototype.bar.call(this); @@ -73,7 +73,7 @@ var Sub1 = (function (_super) { var SubSub1 = (function (_super) { __extends(SubSub1, _super); function SubSub1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubSub1.prototype.foo = function () { return "subsub1" + _super.prototype.foo.call(this); diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index 7d695c2aeca..1ed0edbe051 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -89,7 +89,7 @@ var Base1 = (function () { var Sub1 = (function (_super) { __extends(Sub1, _super); function Sub1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Sub1.prototype.bar = function () { return "base"; @@ -99,7 +99,7 @@ var Sub1 = (function (_super) { var SubSub1 = (function (_super) { __extends(SubSub1, _super); function SubSub1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubSub1.prototype.bar = function () { return _super.prototype["super"].foo; @@ -118,7 +118,7 @@ var Base2 = (function () { var SubE2 = (function (_super) { __extends(SubE2, _super); function SubE2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubE2.prototype.bar = function () { return _super.prototype.prototype.foo = null; @@ -137,7 +137,7 @@ var Base3 = (function () { var SubE3 = (function (_super) { __extends(SubE3, _super); function SubE3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubE3.prototype.bar = function () { return _super.prototype.bar.call(this); @@ -158,7 +158,7 @@ var Base4; var SubSub4 = (function (_super) { __extends(SubSub4, _super); function SubSub4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubSub4.prototype.x = function () { return _super.prototype.x.call(this); diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index 80bfbe0d8be..0f2101bc4dd 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -76,7 +76,7 @@ var Base5 = (function () { var Sub5 = (function (_super) { __extends(Sub5, _super); function Sub5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Sub5.prototype.x = function () { return "SubX"; @@ -86,7 +86,7 @@ var Sub5 = (function (_super) { var SubSub5 = (function (_super) { __extends(SubSub5, _super); function SubSub5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubSub5.prototype.x = function () { return _super.prototype.x.call(this); @@ -108,7 +108,7 @@ var Base6 = (function () { var Sub6 = (function (_super) { __extends(Sub6, _super); function Sub6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Sub6.prototype.y = function () { return "SubY"; @@ -118,7 +118,7 @@ var Sub6 = (function (_super) { var SubSub6 = (function (_super) { __extends(SubSub6, _super); function SubSub6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SubSub6.prototype.y = function () { return _super.prototype.y.call(this); diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index a1303185739..468e2155e48 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -35,7 +35,7 @@ MyBase.S1 = 5; var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MyDerived.prototype.foo = function () { var l3 = _super.prototype.S1; // Expected => Error: Only public instance methods of the base class are accessible via the 'super' keyword diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index b4e81c65da5..ebbf9ccf8d2 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -39,7 +39,7 @@ var test; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.bar = function (callback) { }; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index ef0493d3b2b..a4525cb6ec8 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -29,7 +29,7 @@ var E = (function () { var H = (function (_super) { __extends(H, _super); function H() { - var _this; + var _this = this; var x = _this = _super.call(this, 5) || this; // Should be of type void, not E. x = 5; return _this; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing3.js b/tests/baselines/reference/superCallBeforeThisAccessing3.js index 99feb79042c..0bf37369b7e 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing3.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing3.js @@ -32,7 +32,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var x = function () { _this._t; }; x(); // no error; we only check super is called before this when the container is a constructor _this._t; // error diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 0ee568c527e..2e97c7c2a0e 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -29,7 +29,7 @@ var __extends = (this && this.__extends) || (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _this._t; _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 8cd5cda0520..50c3fcd6b4a 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -21,7 +21,7 @@ var __extends = (this && this.__extends) || (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _this._t; // No error return _this; } diff --git a/tests/baselines/reference/superCallBeforeThisAccessing7.js b/tests/baselines/reference/superCallBeforeThisAccessing7.js index af649aa4c30..90bc4e5c466 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing7.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing7.js @@ -32,7 +32,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var x = { j: _this._t }; diff --git a/tests/baselines/reference/superCallBeforeThisAccessing8.js b/tests/baselines/reference/superCallBeforeThisAccessing8.js index ae115d0ffbd..2bf73681986 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing8.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing8.js @@ -32,7 +32,7 @@ var Base = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var x = { k: _this = _super.call(this, undefined) || this, j: _this._t diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index 4e2610414b7..c07c64304df 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -67,7 +67,7 @@ var Doing = (function () { var Other = (function (_super) { __extends(Other, _super); function Other() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } // in static method Other.staticMethod = function () { diff --git a/tests/baselines/reference/superCallInsideClassDeclaration.js b/tests/baselines/reference/superCallInsideClassDeclaration.js index 1533df5f305..ff822037647 100644 --- a/tests/baselines/reference/superCallInsideClassDeclaration.js +++ b/tests/baselines/reference/superCallInsideClassDeclaration.js @@ -40,7 +40,7 @@ var C = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/superCallInsideClassExpression.js b/tests/baselines/reference/superCallInsideClassExpression.js index 1f3242c8b1e..e1d146aa131 100644 --- a/tests/baselines/reference/superCallInsideClassExpression.js +++ b/tests/baselines/reference/superCallInsideClassExpression.js @@ -40,7 +40,7 @@ var C = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; var D = (function (_super) { __extends(class_1, _super); function class_1() { diff --git a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js index eb7df511e05..541539d39ac 100644 --- a/tests/baselines/reference/superCallInsideObjectLiteralExpression.js +++ b/tests/baselines/reference/superCallInsideObjectLiteralExpression.js @@ -33,7 +33,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; var x = { x: _this = _super.call(this) || this }; diff --git a/tests/baselines/reference/superCallWithMissingBaseClass.js b/tests/baselines/reference/superCallWithMissingBaseClass.js index a10281c4d3c..71c408f6df8 100644 --- a/tests/baselines/reference/superCallWithMissingBaseClass.js +++ b/tests/baselines/reference/superCallWithMissingBaseClass.js @@ -23,7 +23,7 @@ var __extends = (this && this.__extends) || (function () { var Foo = (function (_super) { __extends(Foo, _super); function Foo() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Foo.prototype.m1 = function () { return _super.prototype.m1.call(this); diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index e5c014a4e16..8c1e70e0c9d 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -69,7 +69,7 @@ var OtherBase = (function () { var OtherDerived = (function (_super) { __extends(OtherDerived, _super); function OtherDerived() { - var _this; + var _this = this; var p = ''; _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 2290ff746cd..b5d653dc34f 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -46,7 +46,7 @@ var Base = (function () { var Derived = (function (_super) { __extends(Derived, _super); function Derived() { - var _this; + var _this = this; with (new C()) { foo(); _this = _super.call(this) || this; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index 31015ee9cfc..1f7375fe360 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -33,7 +33,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.m = function () { try { diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index e860585ada7..89f88c43c4a 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -33,7 +33,7 @@ var C = (function (_super) { __extends(C, _super); function C(a) { if (a === void 0) { a = _super.prototype.foo.call(_this); } - var _this; + var _this = this; return _this; } return C; diff --git a/tests/baselines/reference/superInObjectLiterals_ES5.js b/tests/baselines/reference/superInObjectLiterals_ES5.js index 7ca5cbc9e8b..81d8c09da0d 100644 --- a/tests/baselines/reference/superInObjectLiterals_ES5.js +++ b/tests/baselines/reference/superInObjectLiterals_ES5.js @@ -105,7 +105,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.f = function () { var _this = this; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index 311f3bb6acc..a7a94deb6dc 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -32,7 +32,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - var _this; + var _this = this; new _super.prototype(function (value) { return String(value); }); return _this; } diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 0c01882e6ad..342e39b9885 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -66,7 +66,7 @@ var MyBase = (function () { var MyDerived = (function (_super) { __extends(MyDerived, _super); function MyDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MyDerived.prototype.foo = function () { _super.prototype.m1.call(this, "hi"); // Should be allowed, method on base prototype diff --git a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js index 1b906baa3bb..cf256fa91ec 100644 --- a/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js +++ b/tests/baselines/reference/superPropertyAccessInComputedPropertiesOfNestedType_ES5.js @@ -34,7 +34,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } B.prototype.foo = function () { return 2; }; B.prototype.bar = function () { diff --git a/tests/baselines/reference/superPropertyAccess_ES5.js b/tests/baselines/reference/superPropertyAccess_ES5.js index 6d10e60f1c0..1b74519464a 100644 --- a/tests/baselines/reference/superPropertyAccess_ES5.js +++ b/tests/baselines/reference/superPropertyAccess_ES5.js @@ -77,7 +77,7 @@ var A = (function () { var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(B.prototype, "property", { set: function (value) { diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js index 2bb37a6a22c..eb698f1ae7e 100644 --- a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -35,7 +35,7 @@ var B = (function () { var C1 = (function (_super) { __extends(C1, _super); function C1() { - var _this; + var _this = this; _super.prototype.x.call(_this); _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/superSymbolIndexedAccess5.js b/tests/baselines/reference/superSymbolIndexedAccess5.js index 715c6568a2f..5820c56504d 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess5.js +++ b/tests/baselines/reference/superSymbolIndexedAccess5.js @@ -36,7 +36,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Bar.prototype[symbol] = function () { return _super.prototype[symbol].call(this); diff --git a/tests/baselines/reference/superSymbolIndexedAccess6.js b/tests/baselines/reference/superSymbolIndexedAccess6.js index c92ecda44c1..45984298202 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess6.js +++ b/tests/baselines/reference/superSymbolIndexedAccess6.js @@ -36,7 +36,7 @@ var Foo = (function () { var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Bar[symbol] = function () { return _super[symbol].call(this); diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 158799cc93d..34cb3137ee8 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -28,7 +28,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _super.prototype..call(_this); return _this; } diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index 349589625fb..e382f1923c9 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -28,7 +28,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D(x) { - var _this; + var _this = this; _super.prototype..call(_this, x); return _this; } diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index a8325a5a594..d5c61d54fb6 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -33,7 +33,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; _super.prototype..call(_this); return _this; } diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index e5c8546d0a1..140f8258669 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -62,7 +62,7 @@ var F = (function () { var SuperObjectTest = (function (_super) { __extends(SuperObjectTest, _super); function SuperObjectTest() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } SuperObjectTest.prototype.testing = function () { var test = { diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 7d8c2477b68..6bce62c108b 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -103,7 +103,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); diff --git a/tests/baselines/reference/systemModuleWithSuperClass.js b/tests/baselines/reference/systemModuleWithSuperClass.js index 76c4648daa1..8ac8770d8b1 100644 --- a/tests/baselines/reference/systemModuleWithSuperClass.js +++ b/tests/baselines/reference/systemModuleWithSuperClass.js @@ -54,7 +54,7 @@ System.register(["./foo"], function (exports_1, context_1) { Bar = (function (_super) { __extends(Bar, _super); function Bar() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Bar; }(foo_1.Foo)); diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index f438e039ba4..25350fb78cf 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -103,7 +103,7 @@ genericFunc(undefined); // Should be an error var ErrClass3 = (function (_super) { __extends(ErrClass3, _super); function ErrClass3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ErrClass3; }(this)); diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index 63056e497c4..070d5597fcc 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -104,7 +104,7 @@ genericFunc(undefined); // Should be an error var ErrClass3 = (function (_super) { __extends(ErrClass3, _super); function ErrClass3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return ErrClass3; }(this)); diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js index 8a09f18b3f1..68513c151d9 100644 --- a/tests/baselines/reference/thisTypeInFunctions.js +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -232,7 +232,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D; }(C)); @@ -341,7 +341,7 @@ var Base1 = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base1)); @@ -355,7 +355,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js index c68aa2ee0a0..6cf6f477827 100644 --- a/tests/baselines/reference/thisTypeInFunctionsNegative.js +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -301,7 +301,7 @@ var Base1 = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base1)); @@ -315,7 +315,7 @@ var Base2 = (function () { var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base2)); diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js index b092b4c96d5..8135af8731f 100644 --- a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.js @@ -34,7 +34,7 @@ var __extends = (this && this.__extends) || (function () { var ShortDetails = (function (_super) { __extends(ShortDetails, _super); function ShortDetails() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ShortDetails.prototype.render = function () { if (this.props.id < 1) { diff --git a/tests/baselines/reference/tsxDynamicTagName5.js b/tests/baselines/reference/tsxDynamicTagName5.js index d40e84c9078..00ecc955865 100644 --- a/tests/baselines/reference/tsxDynamicTagName5.js +++ b/tests/baselines/reference/tsxDynamicTagName5.js @@ -35,7 +35,7 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this._tagName = 'div'; return _this; } diff --git a/tests/baselines/reference/tsxDynamicTagName7.js b/tests/baselines/reference/tsxDynamicTagName7.js index 8e051ec9012..2e7802ea94f 100644 --- a/tests/baselines/reference/tsxDynamicTagName7.js +++ b/tests/baselines/reference/tsxDynamicTagName7.js @@ -35,7 +35,7 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this._tagName = 'div'; return _this; } diff --git a/tests/baselines/reference/tsxDynamicTagName8.js b/tests/baselines/reference/tsxDynamicTagName8.js index 6f247113055..3b2e43fede7 100644 --- a/tests/baselines/reference/tsxDynamicTagName8.js +++ b/tests/baselines/reference/tsxDynamicTagName8.js @@ -35,7 +35,7 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this._tagName = 'div'; return _this; } diff --git a/tests/baselines/reference/tsxDynamicTagName9.js b/tests/baselines/reference/tsxDynamicTagName9.js index 652d6334216..1b13845dc18 100644 --- a/tests/baselines/reference/tsxDynamicTagName9.js +++ b/tests/baselines/reference/tsxDynamicTagName9.js @@ -35,7 +35,7 @@ var React = require("react"); var Text = (function (_super) { __extends(Text, _super); function Text() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this._tagName = 'div'; return _this; } diff --git a/tests/baselines/reference/tsxExternalModuleEmit1.js b/tests/baselines/reference/tsxExternalModuleEmit1.js index b030df4f253..5b27360d14c 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit1.js +++ b/tests/baselines/reference/tsxExternalModuleEmit1.js @@ -47,7 +47,7 @@ var React = require("react"); var Button = (function (_super) { __extends(Button, _super); function Button() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Button.prototype.render = function () { return ; @@ -73,7 +73,7 @@ var button_1 = require("./button"); var App = (function (_super) { __extends(App, _super); function App() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } App.prototype.render = function () { return ; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponents2.js b/tests/baselines/reference/tsxStatelessFunctionComponents2.js index e0165faa36a..a7507a15d8b 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponents2.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponents2.js @@ -57,7 +57,7 @@ function Greet(x) { var BigGreeter = (function (_super) { __extends(BigGreeter, _super); function BigGreeter() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } BigGreeter.prototype.render = function () { return
; diff --git a/tests/baselines/reference/tsxUnionTypeComponent1.js b/tests/baselines/reference/tsxUnionTypeComponent1.js index 601be253e50..b73b1f35361 100644 --- a/tests/baselines/reference/tsxUnionTypeComponent1.js +++ b/tests/baselines/reference/tsxUnionTypeComponent1.js @@ -40,7 +40,7 @@ var React = require("react"); var MyComponent = (function (_super) { __extends(MyComponent, _super); function MyComponent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MyComponent.prototype.render = function () { var AnyComponent = this.props.AnyComponent; @@ -54,7 +54,7 @@ React.createElement(MyComponent, { AnyComponent: function () { return React.crea var MyButtonComponent = (function (_super) { __extends(MyButtonComponent, _super); function MyButtonComponent() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return MyButtonComponent; }(React.Component)); diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index 84101c7db2d..694fc617c5b 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -79,7 +79,7 @@ var SomeBase = (function () { var SomeDerived = (function (_super) { __extends(SomeDerived, _super); function SomeDerived() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return SomeDerived; }(SomeBase)); diff --git a/tests/baselines/reference/typeGuardFunction.js b/tests/baselines/reference/typeGuardFunction.js index 8ce969eaa80..682143ee132 100644 --- a/tests/baselines/reference/typeGuardFunction.js +++ b/tests/baselines/reference/typeGuardFunction.js @@ -107,7 +107,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionErrors.js b/tests/baselines/reference/typeGuardFunctionErrors.js index 1471a235b89..c5f01189e7a 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.js +++ b/tests/baselines/reference/typeGuardFunctionErrors.js @@ -169,7 +169,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionGenerics.js b/tests/baselines/reference/typeGuardFunctionGenerics.js index 9fec88b1959..af444cfc20a 100644 --- a/tests/baselines/reference/typeGuardFunctionGenerics.js +++ b/tests/baselines/reference/typeGuardFunctionGenerics.js @@ -57,7 +57,7 @@ var B = (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(A)); diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThis.js b/tests/baselines/reference/typeGuardFunctionOfFormThis.js index 58b9c9027fa..7ebee44cc30 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThis.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThis.js @@ -166,7 +166,7 @@ var RoyalGuard = (function () { var LeadGuard = (function (_super) { __extends(LeadGuard, _super); function LeadGuard() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } LeadGuard.prototype.lead = function () { }; ; @@ -175,7 +175,7 @@ var LeadGuard = (function (_super) { var FollowerGuard = (function (_super) { __extends(FollowerGuard, _super); function FollowerGuard() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } FollowerGuard.prototype.follow = function () { }; ; @@ -229,7 +229,7 @@ var ArrowGuard = (function () { var ArrowElite = (function (_super) { __extends(ArrowElite, _super); function ArrowElite() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ArrowElite.prototype.defend = function () { }; return ArrowElite; @@ -237,7 +237,7 @@ var ArrowElite = (function (_super) { var ArrowMedic = (function (_super) { __extends(ArrowMedic, _super); function ArrowMedic() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } ArrowMedic.prototype.heal = function () { }; return ArrowMedic; @@ -271,7 +271,7 @@ var MimicGuard = (function () { var MimicLeader = (function (_super) { __extends(MimicLeader, _super); function MimicLeader() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MimicLeader.prototype.lead = function () { }; return MimicLeader; @@ -279,7 +279,7 @@ var MimicLeader = (function (_super) { var MimicFollower = (function (_super) { __extends(MimicFollower, _super); function MimicFollower() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MimicFollower.prototype.follow = function () { }; return MimicFollower; diff --git a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js index b53f3ca511a..e25c9a2dc9d 100644 --- a/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js +++ b/tests/baselines/reference/typeGuardFunctionOfFormThisErrors.js @@ -84,7 +84,7 @@ var RoyalGuard = (function () { var LeadGuard = (function (_super) { __extends(LeadGuard, _super); function LeadGuard() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } LeadGuard.prototype.lead = function () { }; ; @@ -93,7 +93,7 @@ var LeadGuard = (function (_super) { var FollowerGuard = (function (_super) { __extends(FollowerGuard, _super); function FollowerGuard() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } FollowerGuard.prototype.follow = function () { }; ; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 23a1770d564..1c11ce87d66 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -96,7 +96,7 @@ var C2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(C1)); diff --git a/tests/baselines/reference/typeGuardOfFormIsType.js b/tests/baselines/reference/typeGuardOfFormIsType.js index 3ea3839651e..c1f3946face 100644 --- a/tests/baselines/reference/typeGuardOfFormIsType.js +++ b/tests/baselines/reference/typeGuardOfFormIsType.js @@ -61,7 +61,7 @@ var C2 = (function () { var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(C1)); diff --git a/tests/baselines/reference/typeGuardOfFormThisMember.js b/tests/baselines/reference/typeGuardOfFormThisMember.js index 6540c298766..ef9e51d7a77 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMember.js +++ b/tests/baselines/reference/typeGuardOfFormThisMember.js @@ -133,7 +133,7 @@ var Test; var Directory = (function (_super) { __extends(Directory, _super); function Directory() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Directory; }(FileSystemObject)); diff --git a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js index 9e4fd71e1ec..5dc77a29ec2 100644 --- a/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js +++ b/tests/baselines/reference/typeGuardOfFormThisMemberErrors.js @@ -83,7 +83,7 @@ var Test; var Directory = (function (_super) { __extends(Directory, _super); function Directory() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Directory; }(FileSystemObject)); diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index b051cdf506f..8d42126fb1f 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -70,7 +70,7 @@ var Animal = (function () { var Giraffe = (function (_super) { __extends(Giraffe, _super); function Giraffe() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Giraffe; }(Animal)); diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 48f57c4c9f7..c1598be5c32 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -27,7 +27,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var x = _this = _super.call(this) || this; return _this; } diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 444e44c3687..ad48f6f37bc 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(T)); diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index 00d8781efca..68eea323f0b 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -26,14 +26,14 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(T)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(U)); diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 7b456983f2e..b582877f35c 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -32,14 +32,14 @@ var Animal = (function () { var Cat = (function (_super) { __extends(Cat, _super); function Cat() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Cat; }(Animal)); var Dog = (function (_super) { __extends(Dog, _super); function Dog() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Dog; }(Animal)); diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index 508eb8e0616..b96298c574f 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -32,14 +32,14 @@ var Animal = (function () { var Cat = (function (_super) { __extends(Cat, _super); function Cat() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Cat; }(Animal)); var Dog = (function (_super) { __extends(Dog, _super); function Dog() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Dog; }(Animal)); diff --git a/tests/baselines/reference/typeRelationships.js b/tests/baselines/reference/typeRelationships.js index 93d920a6c8c..5227a109b17 100644 --- a/tests/baselines/reference/typeRelationships.js +++ b/tests/baselines/reference/typeRelationships.js @@ -77,7 +77,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.self1 = _this; _this.self2 = _this.self; _this.self3 = _this.foo(); diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index 065c2968a12..e0b829faf61 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -38,7 +38,7 @@ var M2; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(M1.A)); diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 6cbcc708a0d..6782384b895 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -45,7 +45,7 @@ var M2; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(M1.A)); @@ -56,7 +56,7 @@ var M3; var B = (function (_super) { __extends(B, _super); function B() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return B; }(M1.A)); diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index e829411ed32..f5b11e0c833 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -42,7 +42,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.baz = function (x) { }; D.prototype.foo = function () { }; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index 282a3f72f15..7a006e1a8ce 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -61,14 +61,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index b27eaf2725c..b3de7f2efc5 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -59,14 +59,14 @@ var Base = (function () { var Derived1 = (function (_super) { __extends(Derived1, _super); function Derived1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived1; }(Base)); var Derived2 = (function (_super) { __extends(Derived2, _super); function Derived2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return Derived2; }(Base)); diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index ed2f2d66d93..fcb8ed39595 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -19,7 +19,7 @@ var M; var C = (function (_super) { __extends(C, _super); function C() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C; }(M.I)); diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index c00281f2b8c..c5b08f061fd 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -141,105 +141,105 @@ var Base = (function () { var D0 = (function (_super) { __extends(D0, _super); function D0() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D0; }(Base)); var DA = (function (_super) { __extends(DA, _super); function DA() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return DA; }(Base)); var D1 = (function (_super) { __extends(D1, _super); function D1() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1; }(Base)); var D1A = (function (_super) { __extends(D1A, _super); function D1A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D1A; }(Base)); var D2 = (function (_super) { __extends(D2, _super); function D2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2; }(Base)); var D2A = (function (_super) { __extends(D2A, _super); function D2A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D2A; }(Base)); var D3 = (function (_super) { __extends(D3, _super); function D3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3; }(Base)); var D3A = (function (_super) { __extends(D3A, _super); function D3A() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D3A; }(Base)); var D4 = (function (_super) { __extends(D4, _super); function D4() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D4; }(Base)); var D5 = (function (_super) { __extends(D5, _super); function D5() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D5; }(Base)); var D6 = (function (_super) { __extends(D6, _super); function D6() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D6; }(Base)); var D7 = (function (_super) { __extends(D7, _super); function D7() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D7; }(Base)); var D8 = (function (_super) { __extends(D8, _super); function D8() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D8; }(Base)); var D9 = (function (_super) { __extends(D9, _super); function D9() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D9; }(Base)); var D10 = (function (_super) { __extends(D10, _super); function D10() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D10; }(Base)); @@ -250,7 +250,7 @@ var E; var D11 = (function (_super) { __extends(D11, _super); function D11() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D11; }(Base)); @@ -261,7 +261,7 @@ function f() { } var D12 = (function (_super) { __extends(D12, _super); function D12() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D12; }(Base)); @@ -276,21 +276,21 @@ var c = (function () { var D13 = (function (_super) { __extends(D13, _super); function D13() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D13; }(Base)); var D14 = (function (_super) { __extends(D14, _super); function D14() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D14; }(Base)); var D15 = (function (_super) { __extends(D15, _super); function D15() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D15; }(Base)); @@ -300,14 +300,14 @@ var D15 = (function (_super) { var D16 = (function (_super) { __extends(D16, _super); function D16() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D16; }(Base)); var D17 = (function (_super) { __extends(D17, _super); function D17() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return D17; }(Base)); diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index c0b6cf1b6da..dcd95f85a12 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -62,7 +62,7 @@ var __extends = (this && this.__extends) || (function () { var MyView = (function (_super) { __extends(MyView, _super); function MyView() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } MyView.prototype.getDataSeries = function () { var data = this.model.get("data"); diff --git a/tests/baselines/reference/underscoreThisInDerivedClass01.js b/tests/baselines/reference/underscoreThisInDerivedClass01.js index 410503dc6fc..412364e55dd 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass01.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass01.js @@ -52,7 +52,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var _this = "uh-oh?"; _this = _super.call(this) || this; return _this; diff --git a/tests/baselines/reference/underscoreThisInDerivedClass02.js b/tests/baselines/reference/underscoreThisInDerivedClass02.js index 365ba64a2c6..cb51f248e07 100644 --- a/tests/baselines/reference/underscoreThisInDerivedClass02.js +++ b/tests/baselines/reference/underscoreThisInDerivedClass02.js @@ -41,7 +41,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this; + var _this = this; var _this = "uh-oh?"; return _this; } diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index a11476152f9..11ef3a7974e 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -39,7 +39,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo = function () { }; return D; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index 9b42b1b7532..11f53a8b985 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -59,7 +59,7 @@ var D = (function () { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo3 = function () { }; return E; @@ -67,7 +67,7 @@ var E = (function (_super) { var F = (function (_super) { __extends(F, _super); function F() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } F.prototype.foo4 = function () { }; return F; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index 87be4dbb4fd..a26de7d2747 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -93,7 +93,7 @@ var C = (function () { var D = (function (_super) { __extends(D, _super); function D() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } D.prototype.foo1 = function () { }; return D; @@ -101,7 +101,7 @@ var D = (function (_super) { var E = (function (_super) { __extends(E, _super); function E() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } E.prototype.foo2 = function () { }; return E; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index 53b4fcf2f22..4c459c29be1 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -174,7 +174,7 @@ var ts; var Type = (function (_super) { __extends(Type, _super); function Type() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } Type.prototype.equals = function (that) { if (this === that) diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 2adb8dae89f..a4f2d1ff2fc 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -75,7 +75,7 @@ var r4 = c2(); // should be an error var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return C2; }(Function)); // error diff --git a/tests/baselines/reference/unusedClassesinNamespace4.js b/tests/baselines/reference/unusedClassesinNamespace4.js index 85c5cc6aae7..1a54b1de535 100644 --- a/tests/baselines/reference/unusedClassesinNamespace4.js +++ b/tests/baselines/reference/unusedClassesinNamespace4.js @@ -41,7 +41,7 @@ var Validation; var c3 = (function (_super) { __extends(c3, _super); function c3() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return c3; }(c1)); diff --git a/tests/baselines/reference/unusedIdentifiersConsolidated1.js b/tests/baselines/reference/unusedIdentifiersConsolidated1.js index 6615c45cf29..4e21d1c5ab1 100644 --- a/tests/baselines/reference/unusedIdentifiersConsolidated1.js +++ b/tests/baselines/reference/unusedIdentifiersConsolidated1.js @@ -173,7 +173,7 @@ var Greeter; var class2 = (function (_super) { __extends(class2, _super); function class2() { - return _super.apply(this, arguments) || this; + return _super !== null && _super.apply(this, arguments) || this; } return class2; }(class1)); From c67d1a444588a41cf4c70b93949d73c8b004c883 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Wed, 4 Jan 2017 12:59:05 -0800 Subject: [PATCH 219/289] Let fourslash tests support extended tsconfig --- src/harness/fourslash.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 3dd6b504615..3de0dba4fdf 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -262,23 +262,12 @@ namespace FourSlash { // Initialize the language service with all the scripts let startResolveFileRef: FourSlashFile; + let configFileName: string; ts.forEach(testData.files, file => { // Create map between fileName and its content for easily looking up when resolveReference flag is specified this.inputFiles[file.fileName] = file.content; - if (ts.getBaseFileName(file.fileName).toLowerCase() === "tsconfig.json") { - const configJson = ts.parseConfigFileTextToJson(file.fileName, file.content); - assert.isTrue(configJson.config !== undefined); - - // Extend our existing compiler options so that we can also support tsconfig only options - if (configJson.config.compilerOptions) { - const baseDirectory = ts.normalizePath(ts.getDirectoryPath(file.fileName)); - const tsConfig = ts.convertCompilerOptionsFromJson(configJson.config.compilerOptions, baseDirectory, file.fileName); - - if (!tsConfig.errors || !tsConfig.errors.length) { - compilationOptions = ts.extend(compilationOptions, tsConfig.options); - } - } + configFileName = file.fileName; } if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") { @@ -290,6 +279,21 @@ namespace FourSlash { } }); + if (configFileName) { + const baseDir = ts.normalizePath(ts.getDirectoryPath(configFileName)); + const host = new Utils.MockParseConfigHost(baseDir, /*ignoreCase*/ false, this.inputFiles); + + const configJsonObj = ts.parseConfigFileTextToJson(configFileName, this.inputFiles[configFileName]); + assert.isTrue(configJsonObj.config !== undefined); + + const { options, errors } = ts.parseJsonConfigFileContent(configJsonObj.config, host, baseDir); + + // Extend our existing compiler options so that we can also support tsconfig only options + if (!errors || errors.length === 0) { + compilationOptions = ts.extend(compilationOptions, options); + } + } + if (compilationOptions.typeRoots) { compilationOptions.typeRoots = compilationOptions.typeRoots.map(p => ts.getNormalizedAbsolutePath(p, this.basePath)); From b19a949ce49abc55c9ee5194dbb56b496d70434a Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Wed, 4 Jan 2017 13:35:42 -0800 Subject: [PATCH 220/289] Support path that specified index --- src/services/codefixes/importFixes.ts | 3 +- .../importNameCodeFixNewImportPaths2.ts | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 3dc33e39897..3627d60492d 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -443,6 +443,7 @@ namespace ts.codefix { return undefined; } + const relativeNameWithIndex = removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { @@ -462,7 +463,7 @@ namespace ts.codefix { return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } diff --git a/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts b/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts new file mode 100644 index 00000000000..b455538de08 --- /dev/null +++ b/tests/cases/fourslash/importNameCodeFixNewImportPaths2.ts @@ -0,0 +1,28 @@ +/// + +//// [|foo/*0*/();|] + +// @Filename: folder_b/index.ts +//// export function foo() {}; + +// @Filename: tsconfig.path.json +//// { +//// "compilerOptions": { +//// "baseUrl": ".", +//// "paths": { +//// "b": [ "folder_b/index" ] +//// } +//// } +//// } + +// @Filename: tsconfig.json +//// { +//// "extends": "./tsconfig.path", +//// "compilerOptions": { } +//// } + +verify.importFixAtPosition([ +`import { foo } from "b"; + +foo();` +]); \ No newline at end of file From 3a9a136e515db9f0ef1bdd0839a6dc25f9dca171 Mon Sep 17 00:00:00 2001 From: Joel Day Date: Wed, 4 Jan 2017 15:56:16 -0800 Subject: [PATCH 221/289] Changes based on feedback. Whitespace cleanup. Switching back to protocol.ts and reenabling stripInternal. Marking internal symbols indirectly exported by dependencies of protocol.ts as internal. --- Gulpfile.ts | 2 +- Jakefile.js | 13 ++++++++----- src/server/editorServices.ts | 3 +++ src/server/project.ts | 2 ++ src/server/session.ts | 24 ++++++++++++++++++++++++ src/server/tsconfig.library.json | 7 ++----- src/server/types.ts | 1 + 7 files changed, 41 insertions(+), 11 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index 22bf020a435..ef65454bc23 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -473,7 +473,7 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => { .pipe(gulp.dest(".")), dts.pipe(prependCopyright(/*outputCopyright*/true)) .pipe(insert.transform((content) => { - return content + "\r\nexport = ts;"; + return content + "\r\nexport = ts;\r\nexport as namespace ts;"; })) .pipe(gulp.dest(".")) ]); diff --git a/Jakefile.js b/Jakefile.js index b810477d861..093d6f16893 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -719,13 +719,16 @@ compileFile( [builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets), /*prefixes*/[copyright], /*useBuiltCompiler*/ true, - { noOutFile: false, generateDeclarations: true }, - /*callback*/ function () { - + { noOutFile: false, generateDeclarations: true, stripInternal: true }, + /*callback*/ function () { prependFile(copyright, tsserverLibraryDefinitionFile); - // Appending 'export = ts;' at the end of the server library file to turn it into an external module - var tsserverLibraryDefinitionFileContents = fs.readFileSync(tsserverLibraryDefinitionFile).toString() + "\r\nexport = ts;"; + // Appending exports at the end of the server library + var tsserverLibraryDefinitionFileContents = + fs.readFileSync(tsserverLibraryDefinitionFile).toString() + + "\r\nexport = ts;" + + "\r\nexport as namespace ts;"; + fs.writeFileSync(tsserverLibraryDefinitionFile, tsserverLibraryDefinitionFileContents); }); diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 00df53e1e35..38873a38aba 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -293,6 +293,7 @@ namespace ts.server { this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames, host.getCurrentDirectory()); } + /* @internal */ getChangedFiles_TestOnly() { return this.changedFiles; } @@ -1274,6 +1275,7 @@ namespace ts.server { } } + /* @internal */ synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[] { const files: ProjectFilesWithTSDiagnostics[] = []; this.collectChanges(knownProjects, this.externalProjects, files); @@ -1282,6 +1284,7 @@ namespace ts.server { return files; } + /* @internal */ applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void { const recordChangedFiles = changedFiles && !openFiles && !closedFiles; if (openFiles) { diff --git a/src/server/project.ts b/src/server/project.ts index 6085ee05159..ff2dd582b89 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -58,6 +58,7 @@ namespace ts.server { return counts.ts === 0 && counts.tsx === 0; } + /* @internal */ export interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles { projectErrors: Diagnostic[]; } @@ -593,6 +594,7 @@ namespace ts.server { return false; } + /* @internal */ getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics { this.updateGraph(); diff --git a/src/server/session.ts b/src/server/session.ts index 5c382aae7d3..b8eeb9219db 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -88,50 +88,65 @@ namespace ts.server { export namespace CommandNames { export const Brace: protocol.CommandTypes.Brace = "brace"; + /* @internal */ export const BraceFull: protocol.CommandTypes.BraceFull = "brace-full"; export const BraceCompletion: protocol.CommandTypes.BraceCompletion = "braceCompletion"; export const Change: protocol.CommandTypes.Change = "change"; export const Close: protocol.CommandTypes.Close = "close"; export const Completions: protocol.CommandTypes.Completions = "completions"; + /* @internal */ export const CompletionsFull: protocol.CommandTypes.CompletionsFull = "completions-full"; export const CompletionDetails: protocol.CommandTypes.CompletionDetails = "completionEntryDetails"; export const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; export const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile = "compileOnSaveEmitFile"; export const Configure: protocol.CommandTypes.Configure = "configure"; export const Definition: protocol.CommandTypes.Definition = "definition"; + /* @internal */ export const DefinitionFull: protocol.CommandTypes.DefinitionFull = "definition-full"; export const Exit: protocol.CommandTypes.Exit = "exit"; export const Format: protocol.CommandTypes.Format = "format"; export const Formatonkey: protocol.CommandTypes.Formatonkey = "formatonkey"; + /* @internal */ export const FormatFull: protocol.CommandTypes.FormatFull = "format-full"; + /* @internal */ export const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull = "formatonkey-full"; + /* @internal */ export const FormatRangeFull: protocol.CommandTypes.FormatRangeFull = "formatRange-full"; export const Geterr: protocol.CommandTypes.Geterr = "geterr"; export const GeterrForProject: protocol.CommandTypes.GeterrForProject = "geterrForProject"; export const Implementation: protocol.CommandTypes.Implementation = "implementation"; + /* @internal */ export const ImplementationFull: protocol.CommandTypes.ImplementationFull = "implementation-full"; export const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync = "semanticDiagnosticsSync"; export const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; export const NavBar: protocol.CommandTypes.NavBar = "navbar"; + /* @internal */ export const NavBarFull: protocol.CommandTypes.NavBarFull = "navbar-full"; export const NavTree: protocol.CommandTypes.NavTree = "navtree"; export const NavTreeFull: protocol.CommandTypes.NavTreeFull = "navtree-full"; export const Navto: protocol.CommandTypes.Navto = "navto"; + /* @internal */ export const NavtoFull: protocol.CommandTypes.NavtoFull = "navto-full"; export const Occurrences: protocol.CommandTypes.Occurrences = "occurrences"; export const DocumentHighlights: protocol.CommandTypes.DocumentHighlights = "documentHighlights"; + /* @internal */ export const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull = "documentHighlights-full"; export const Open: protocol.CommandTypes.Open = "open"; export const Quickinfo: protocol.CommandTypes.Quickinfo = "quickinfo"; + /* @internal */ export const QuickinfoFull: protocol.CommandTypes.QuickinfoFull = "quickinfo-full"; export const References: protocol.CommandTypes.References = "references"; + /* @internal */ export const ReferencesFull: protocol.CommandTypes.ReferencesFull = "references-full"; export const Reload: protocol.CommandTypes.Reload = "reload"; export const Rename: protocol.CommandTypes.Rename = "rename"; + /* @internal */ export const RenameInfoFull: protocol.CommandTypes.RenameInfoFull = "rename-full"; + /* @internal */ export const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull = "renameLocations-full"; export const Saveto: protocol.CommandTypes.Saveto = "saveto"; export const SignatureHelp: protocol.CommandTypes.SignatureHelp = "signatureHelp"; + /* @internal */ export const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull = "signatureHelp-full"; export const TypeDefinition: protocol.CommandTypes.TypeDefinition = "typeDefinition"; export const ProjectInfo: protocol.CommandTypes.ProjectInfo = "projectInfo"; @@ -140,19 +155,28 @@ namespace ts.server { export const OpenExternalProject: protocol.CommandTypes.OpenExternalProject = "openExternalProject"; export const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects = "openExternalProjects"; export const CloseExternalProject: protocol.CommandTypes.CloseExternalProject = "closeExternalProject"; + /* @internal */ export const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList = "synchronizeProjectList"; + /* @internal */ export const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; + /* @internal */ export const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; + /* @internal */ export const Cleanup: protocol.CommandTypes.Cleanup = "cleanup"; + /* @internal */ export const OutliningSpans: protocol.CommandTypes.OutliningSpans = "outliningSpans"; export const TodoComments: protocol.CommandTypes.TodoComments = "todoComments"; export const Indentation: protocol.CommandTypes.Indentation = "indentation"; export const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate = "docCommentTemplate"; + /* @internal */ export const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; + /* @internal */ export const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan = "nameOrDottedNameSpan"; + /* @internal */ export const BreakpointStatement: protocol.CommandTypes.BreakpointStatement = "breakpointStatement"; export const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; export const GetCodeFixes: protocol.CommandTypes.GetCodeFixes = "getCodeFixes"; + /* @internal */ export const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull = "getCodeFixes-full"; export const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes = "getSupportedCodeFixes"; } diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index 397211e6ff4..76d700dd291 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -2,14 +2,11 @@ "compilerOptions": { "noImplicitAny": true, "noImplicitThis": true, - "removeComments": false, "preserveConstEnums": true, "pretty": true, "outFile": "../../built/local/tsserverlibrary.js", "sourceMap": true, - "types": [ - "node" - ], + "stripInternal": true, "target": "es5", "noUnusedLocals": true, "noUnusedParameters": true, @@ -19,7 +16,7 @@ "editorServices.ts", "lsHost.ts", "project.ts", - "protocol.d.ts", + "protocol.ts", "scriptInfo.ts", "scriptVersionCache.ts", "session.ts", diff --git a/src/server/types.ts b/src/server/types.ts index 9f53fa8def1..2c18f275202 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -82,6 +82,7 @@ declare namespace ts.server { readonly installSuccess: boolean; } + /* @internal */ export interface InstallTypingHost extends JsTyping.TypingResolutionHost { writeFile(path: string, content: string): void; createDirectory(path: string): void; From 9abcddc21e4dd9bb9b0519b6938f5f662c8c7b6c Mon Sep 17 00:00:00 2001 From: rbuckton Date: Wed, 4 Jan 2017 19:16:33 -0800 Subject: [PATCH 222/289] Simplify emit for syntactic 'extends null' case --- src/compiler/transformers/es2015.ts | 11 +++++++---- tests/baselines/reference/classExtendingNull.js | 2 -- tests/baselines/reference/classExtendingPrimitive.js | 1 - tests/baselines/reference/classExtendingPrimitive2.js | 1 - tests/baselines/reference/classExtendsNull.js | 3 +-- tests/baselines/reference/declFileClassExtendsNull.js | 1 - .../reference/superCallBeforeThisAccessing4.js | 9 +++------ .../reference/superCallBeforeThisAccessing5.js | 4 +--- 8 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index e8af4ecbc25..072be8b1dfc 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -925,7 +925,10 @@ namespace ts { } - const superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + const isDerivedClass = extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== SyntaxKind.NullKeyword; + const superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); // The last statement expression was replaced. Skip it. if (superCaptureStatus === SuperCaptureResult.ReplaceSuperCapture || superCaptureStatus === SuperCaptureResult.ReplaceWithReturn) { @@ -942,7 +945,7 @@ namespace ts { // Return `_this` unless we're sure enough that it would be pointless to add a return statement. // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== SuperCaptureResult.ReplaceWithReturn && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push( @@ -1011,11 +1014,11 @@ namespace ts { function declareOrCaptureOrReturnThisForConstructorIfNeeded( statements: Statement[], ctor: ConstructorDeclaration | undefined, - hasExtendsClause: boolean, + isDerivedClass: boolean, hasSynthesizedSuper: boolean, statementOffset: number) { // If this isn't a derived class, just capture 'this' for arrow functions if necessary. - if (!hasExtendsClause) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } diff --git a/tests/baselines/reference/classExtendingNull.js b/tests/baselines/reference/classExtendingNull.js index ebfcea3903b..6725bcc7d9e 100644 --- a/tests/baselines/reference/classExtendingNull.js +++ b/tests/baselines/reference/classExtendingNull.js @@ -17,14 +17,12 @@ var __extends = (this && this.__extends) || (function () { var C1 = (function (_super) { __extends(C1, _super); function C1() { - return _super !== null && _super.apply(this, arguments) || this; } return C1; }(null)); var C2 = (function (_super) { __extends(C2, _super); function C2() { - return _super !== null && _super.apply(this, arguments) || this; } return C2; }((null))); diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index eb36a24aeaf..fac6ada65ec 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -70,7 +70,6 @@ var C5 = (function (_super) { var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - return _super !== null && _super.apply(this, arguments) || this; } return C5a; }(null)); diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 0b1c14936ba..2b9cd6de6b6 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -25,7 +25,6 @@ void {}; var C5a = (function (_super) { __extends(C5a, _super); function C5a() { - return _super !== null && _super.apply(this, arguments) || this; } return C5a; }(null)); diff --git a/tests/baselines/reference/classExtendsNull.js b/tests/baselines/reference/classExtendsNull.js index bd73122f450..674b212f98e 100644 --- a/tests/baselines/reference/classExtendsNull.js +++ b/tests/baselines/reference/classExtendsNull.js @@ -26,7 +26,7 @@ var __extends = (this && this.__extends) || (function () { var C = (function (_super) { __extends(C, _super); function C() { - var _this = _super.call(this) || this; + _this = _super.call(this) || this; return Object.create(null); } return C; @@ -34,7 +34,6 @@ var C = (function (_super) { var D = (function (_super) { __extends(D, _super); function D() { - var _this = this; return Object.create(null); } return D; diff --git a/tests/baselines/reference/declFileClassExtendsNull.js b/tests/baselines/reference/declFileClassExtendsNull.js index 9af5b3f3eae..a7ea02011fe 100644 --- a/tests/baselines/reference/declFileClassExtendsNull.js +++ b/tests/baselines/reference/declFileClassExtendsNull.js @@ -17,7 +17,6 @@ var __extends = (this && this.__extends) || (function () { var ExtendsNull = (function (_super) { __extends(ExtendsNull, _super); function ExtendsNull() { - return _super !== null && _super.apply(this, arguments) || this; } return ExtendsNull; }(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing4.js b/tests/baselines/reference/superCallBeforeThisAccessing4.js index 2e97c7c2a0e..80a71d02d4d 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing4.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing4.js @@ -29,19 +29,16 @@ var __extends = (this && this.__extends) || (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = this; - _this._t; + this._t; _this = _super.call(this) || this; - return _this; } return D; }(null)); var E = (function (_super) { __extends(E, _super); function E() { - var _this = _super.call(this) || this; - _this._t; - return _this; + _this = _super.call(this) || this; + this._t; } return E; }(null)); diff --git a/tests/baselines/reference/superCallBeforeThisAccessing5.js b/tests/baselines/reference/superCallBeforeThisAccessing5.js index 50c3fcd6b4a..42049ff2b32 100644 --- a/tests/baselines/reference/superCallBeforeThisAccessing5.js +++ b/tests/baselines/reference/superCallBeforeThisAccessing5.js @@ -21,9 +21,7 @@ var __extends = (this && this.__extends) || (function () { var D = (function (_super) { __extends(D, _super); function D() { - var _this = this; - _this._t; // No error - return _this; + this._t; // No error } return D; }(null)); From 4086bd13c7b459ab4302c48fc3ac428cc2078e08 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 5 Jan 2017 11:01:12 -0800 Subject: [PATCH 223/289] Update LKG --- lib/lib.d.ts | 3 +- lib/lib.es5.d.ts | 3 +- lib/lib.es6.d.ts | 3 +- lib/protocol.d.ts | 2 + lib/tsc.js | 4848 +++++++++++++---------- lib/tsserver.js | 6730 +++++++++++++++++-------------- lib/tsserverlibrary.d.ts | 369 +- lib/tsserverlibrary.js | 6725 +++++++++++++++++-------------- lib/typescript.d.ts | 255 +- lib/typescript.js | 7491 ++++++++++++++++++++--------------- lib/typescriptServices.d.ts | 255 +- lib/typescriptServices.js | 7491 ++++++++++++++++++++--------------- lib/typingsInstaller.js | 396 +- 13 files changed, 19912 insertions(+), 14659 deletions(-) diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 5b1f3d7c393..6a4e8ec5216 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -1191,8 +1191,9 @@ interface Array { /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. */ - splice(start: number): T[]; + splice(start: number, deleteCount?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 4d48fed85ed..2ce9151e289 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -1191,8 +1191,9 @@ interface Array { /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. */ - splice(start: number): T[]; + splice(start: number, deleteCount?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 9530bf7bfbc..1c5224c0cc8 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -1191,8 +1191,9 @@ interface Array { /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. */ - splice(start: number): T[]; + splice(start: number, deleteCount?: number): T[]; /** * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. * @param start The zero-based location in the array from which to start removing elements. diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index f3737c76c46..d6c0246af34 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -1722,12 +1722,14 @@ declare namespace ts.server.protocol { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } diff --git a/lib/tsc.js b/lib/tsc.js index 840e832f3bf..c1ab6d062f5 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -201,7 +201,7 @@ var ts; ts.toPath = toPath; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -220,7 +220,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -230,7 +230,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -240,7 +240,7 @@ var ts; } ts.find = find; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -263,7 +263,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -273,7 +273,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -976,6 +976,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2470,7 +2471,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2627,6 +2628,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2856,6 +2858,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2865,6 +2869,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2916,6 +2921,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3084,6 +3091,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -3097,10 +3105,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -3149,6 +3157,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3205,22 +3215,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); var ts; @@ -3601,7 +3614,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3787,7 +3800,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -4891,7 +4904,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { + while (node && node.kind !== 262) { node = node.parent; } return node; @@ -4899,11 +4912,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: return true; } return false; @@ -4968,18 +4981,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 292 && node._children.length > 0) { + if (node.kind === 293 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; + return node.kind >= 263 && node.kind <= 289; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; + return node.kind >= 279 && node.kind <= 292; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -5073,11 +5086,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + return node.kind === 224 && node.parent.kind === 257; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 && + return node && node.kind === 231 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -5086,11 +5099,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); + return node.kind === 231 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || + return node.kind === 262 || + node.kind === 231 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -5103,9 +5116,9 @@ var ts; return false; } switch (node.parent.kind) { - case 261: + case 262: return ts.isExternalModule(node.parent); - case 231: + case 232: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -5117,22 +5130,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261: - case 232: - case 256: - case 230: - case 211: + case 262: + case 233: + case 257: + case 231: case 212: case 213: + case 214: case 150: case 149: case 151: case 152: - case 225: + case 226: case 184: case 185: return true; - case 204: + case 205: return parentNode && !isFunctionLike(parentNode); } return false; @@ -5210,7 +5223,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { + if (node.body && node.body.kind === 205) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -5222,26 +5235,26 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261: + case 262: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: + case 224: case 174: - case 226: - case 197: case 227: + case 197: + case 228: + case 231: case 230: - case 229: - case 260: - case 225: + case 261: + case 226: case 184: case 149: case 151: case 152: - case 228: + case 229: errorNode = node.name; break; case 185: @@ -5265,7 +5278,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + return node.kind === 230 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -5282,7 +5295,7 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 + return node.kind === 208 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -5354,9 +5367,9 @@ var ts; case 147: case 146: case 144: - case 223: + case 224: return node === parent_1.type; - case 225: + case 226: case 184: case 185: case 150: @@ -5381,27 +5394,41 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 190; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216: + case 217: return visitor(node); - case 232: - case 204: - case 208: + case 233: + case 205: case 209: case 210: case 211: case 212: case 213: - case 217: + case 214: case 218: - case 253: - case 254: case 219: - case 221: - case 256: + case 254: + case 255: + case 220: + case 222: + case 257: return ts.forEachChild(node, traverse); } } @@ -5417,11 +5444,11 @@ var ts; if (operand) { traverse(operand); } - case 229: - case 227: case 230: case 228: - case 226: + case 231: + case 229: + case 227: case 197: return; default: @@ -5455,13 +5482,13 @@ var ts; if (node) { switch (node.kind) { case 174: - case 260: + case 261: case 144: - case 257: + case 258: case 147: case 146: - case 258: - case 223: + case 259: + case 224: return true; } } @@ -5473,7 +5500,7 @@ var ts; } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + return node && (node.kind === 227 || node.kind === 197); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -5484,7 +5511,7 @@ var ts; switch (kind) { case 150: case 184: - case 225: + case 226: case 185: case 149: case 148: @@ -5507,7 +5534,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: return true; } @@ -5516,20 +5543,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211: case 212: case 213: - case 209: + case 214: case 210: + case 211: return true; - case 219: + case 220: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatmentOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 220) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + return node && node.kind === 205 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -5593,9 +5632,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 225: + case 226: case 184: - case 230: + case 231: case 147: case 146: case 149: @@ -5606,13 +5645,26 @@ var ts; case 153: case 154: case 155: - case 229: - case 261: + case 230: + case 262: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 150: + case 226: + case 184: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -5623,7 +5675,7 @@ var ts; case 142: node = node.parent; break; - case 225: + case 226: case 184: case 185: if (!stopOnFunctions) { @@ -5672,7 +5724,7 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 157: - case 272: + case 273: return node.typeName; case 199: return isEntityNameExpression(node.expression) @@ -5706,21 +5758,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226: + case 227: return true; case 147: - return node.parent.kind === 226; + return node.parent.kind === 227; case 151: case 152: case 149: return node.body !== undefined - && node.parent.kind === 226; + && node.parent.kind === 227; case 144: return node.parent.body !== undefined && (node.parent.kind === 150 || node.parent.kind === 149 || node.parent.kind === 152) - && node.parent.parent.kind === 226; + && node.parent.parent.kind === 227; } return false; } @@ -5736,7 +5788,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226: + case 227: return ts.forEach(node.members, nodeOrChildIsDecorated); case 149: case 152: @@ -5746,9 +5798,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { + if (parent.kind === 249 || + parent.kind === 248 || + parent.kind === 250) { return parent.tagName === node; } return false; @@ -5787,10 +5839,11 @@ var ts; case 194: case 12: case 198: - case 246: case 247: + case 248: case 195: case 189: + case 202: return true; case 141: while (node.parent.kind === 141) { @@ -5806,46 +5859,46 @@ var ts; case 98: var parent_3 = node.parent; switch (parent_3.kind) { - case 223: + case 224: case 144: case 147: case 146: - case 260: - case 257: + case 261: + case 258: case 174: return parent_3.initializer === node; - case 207: case 208: case 209: case 210: - case 216: + case 211: case 217: case 218: - case 253: - case 220: - case 218: + case 219: + case 254: + case 221: + case 219: return parent_3.expression === node; - case 211: + case 212: var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || forStatement.condition === node || forStatement.incrementor === node; - case 212: case 213: + case 214: var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || forInStatement.expression === node; case 182: case 200: return node === parent_3.expression; - case 202: + case 203: return node === parent_3.expression; case 142: return node === parent_3.expression; case 145: + case 253: case 252: - case 251: - case 259: + case 260: return true; case 199: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -5865,7 +5918,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + return node.kind === 235 && node.moduleReference.kind === 246; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5874,7 +5927,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + return node.kind === 235 && node.moduleReference.kind !== 246; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5898,7 +5951,7 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { + if (s.valueDeclaration && s.valueDeclaration.kind === 224) { var declaration = s.valueDeclaration; return declaration.initializer && declaration.initializer.kind === 184; } @@ -5945,35 +5998,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node.moduleSpecifier; } - if (node.kind === 234) { + if (node.kind === 235) { var reference = node.moduleReference; - if (reference.kind === 245) { + if (reference.kind === 246) { return reference.expression; } } - if (node.kind === 241) { + if (node.kind === 242) { return node.moduleSpecifier; } - if (node.kind === 230 && node.name.kind === 9) { + if (node.kind === 231 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 + return node.kind === 236 && node.importClause && !!node.importClause.name; } @@ -5984,8 +6037,8 @@ var ts; case 144: case 149: case 148: + case 259: case 258: - case 257: case 147: case 146: return node.questionToken !== undefined; @@ -5995,9 +6048,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 && + return node.kind === 275 && node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + node.parameters[0].type.kind === 277; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -6010,7 +6063,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281) { + if (doc.kind === 282) { if (doc.kind === kind) { result.push(doc); } @@ -6036,9 +6089,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205; + parent.parent.parent.kind === 206; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; + parent.parent.kind === 206; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -6048,13 +6101,13 @@ var ts; var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 192 && parent.operatorToken.kind === 57 && - parent.parent.kind === 207; + parent.parent.kind === 208; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; + var isModuleDeclaration = node.kind === 231 && + parent && parent.kind === 231; + var isPropertyAssignmentExpression = parent && parent.kind === 258; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } @@ -6072,17 +6125,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281); + var tags = getJSDocTags(func, 282); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_6; }); + return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_6; }); } else { return undefined; @@ -6090,7 +6143,7 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 144) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -6101,15 +6154,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 281); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -6122,8 +6175,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { + if (node.type && node.type.kind === 276 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { return true; } } @@ -6147,19 +6200,19 @@ var ts; case 191: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: case 213: + case 214: return parent.initializer === node ? 1 : 0; case 183: case 175: case 196: node = parent; break; - case 258: + case 259: if (parent.name !== node) { return 0; } - case 257: + case 258: node = parent.parent; break; default: @@ -6173,6 +6226,17 @@ var ts; return getAssignmentTargetKind(node) !== 0; } ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 177 && node.kind !== 178) { + return false; + } + node = node.parent; + while (node && node.kind === 183) { + node = node.parent; + } + return node && node.kind === 186; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -6184,7 +6248,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -6197,7 +6261,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { + if (parent.kind === 240 || parent.kind === 244) { if (parent.propertyName) { return true; } @@ -6223,8 +6287,8 @@ var ts; case 148: case 151: case 152: - case 260: - case 257: + case 261: + case 258: case 177: return parent.name === node; case 141: @@ -6236,22 +6300,22 @@ var ts; } return false; case 174: - case 239: + case 240: return parent.propertyName === node; - case 243: + case 244: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || - node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + return node.kind === 235 || + node.kind === 234 || + node.kind === 237 && !!node.name || + node.kind === 238 || + node.kind === 240 || + node.kind === 244 || + node.kind === 241 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -6431,13 +6495,13 @@ var ts; var kind = node.kind; return kind === 150 || kind === 184 - || kind === 225 + || kind === 226 || kind === 185 || kind === 149 || kind === 151 || kind === 152 - || kind === 230 - || kind === 261; + || kind === 231 + || kind === 262; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -6559,14 +6623,13 @@ var ts; case 184: case 185: case 197: - case 246: case 247: + case 248: case 11: case 12: case 194: case 183: case 198: - case 297: return 19; case 181: case 177: @@ -6740,13 +6803,12 @@ var ts; "\u0085": "\\u0085" }); function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -7622,8 +7684,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229: case 230: + case 231: return parseNode === parseNode.parent.name; } } @@ -7641,7 +7703,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { + if (declaration.kind === 227 && declaration !== node) { return true; } } @@ -7692,6 +7754,10 @@ var ts; return node.kind === 70; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { return isIdentifier(node) && node.autoGenerateKind > 0; } @@ -7759,18 +7825,18 @@ var ts; || kind === 151 || kind === 152 || kind === 155 - || kind === 203; + || kind === 204; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 - || kind === 258 + return kind === 258 || kind === 259 + || kind === 260 || kind === 149 || kind === 151 || kind === 152 - || kind === 244; + || kind === 245; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { @@ -7823,7 +7889,7 @@ var ts; ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223: + case 224: case 144: case 174: return true; @@ -7901,8 +7967,8 @@ var ts; || kind === 178 || kind === 180 || kind === 179 - || kind === 246 || kind === 247 + || kind === 248 || kind === 181 || kind === 175 || kind === 183 @@ -7921,7 +7987,7 @@ var ts; || kind === 100 || kind === 96 || kind === 201 - || kind === 297; + || kind === 202; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -7949,7 +8015,6 @@ var ts; || kind === 196 || kind === 200 || kind === 198 - || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -7963,11 +8028,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294; + return node.kind === 295; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293; + return node.kind === 294; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -7980,11 +8045,11 @@ var ts; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 202; + return node.kind === 203; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 204; + return node.kind === 205; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -8002,121 +8067,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223; + return node.kind === 224; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232; + return node.kind === 233; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 - || kind === 230; + return kind === 232 + || kind === 231; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236; + return node.kind === 237; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239; + return node.kind === 240; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242; + return node.kind === 243; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243; + return node.kind === 244; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; + return node.kind === 231 || node.kind === 230; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { return kind === 185 || kind === 174 - || kind === 226 + || kind === 227 || kind === 197 || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 + || kind === 230 + || kind === 261 + || kind === 244 + || kind === 226 || kind === 184 || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 - || kind === 227 + || kind === 237 + || kind === 235 + || kind === 240 + || kind === 228 || kind === 149 || kind === 148 - || kind === 230 - || kind === 233 - || kind === 237 + || kind === 231 + || kind === 234 + || kind === 238 || kind === 144 - || kind === 257 + || kind === 258 || kind === 147 || kind === 146 || kind === 152 - || kind === 258 - || kind === 228 + || kind === 259 + || kind === 229 || kind === 143 - || kind === 223 - || kind === 285; + || kind === 224 + || kind === 286; } function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 + return kind === 226 + || kind === 245 || kind === 227 || kind === 228 || kind === 229 || kind === 230 + || kind === 231 + || kind === 236 || kind === 235 - || kind === 234 + || kind === 242 || kind === 241 - || kind === 240 - || kind === 233; + || kind === 234; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 - || kind === 214 - || kind === 222 - || kind === 209 - || kind === 207 - || kind === 206 - || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 - || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 + return kind === 216 + || kind === 215 + || kind === 223 || kind === 210 + || kind === 208 + || kind === 207 + || kind === 213 + || kind === 214 + || kind === 212 + || kind === 209 + || kind === 220 || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; + || kind === 219 + || kind === 221 + || kind === 222 + || kind === 206 + || kind === 211 + || kind === 218 + || kind === 294 + || kind === 297 + || kind === 296; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -8134,22 +8199,22 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204; + || kind === 205; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 245 + return kind === 246 || kind === 141 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 248; + return node.kind === 249; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { @@ -8161,60 +8226,60 @@ var ts; ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 + return kind === 247 + || kind === 253 + || kind === 248 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 - || kind === 251; + return kind === 251 + || kind === 252; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 252; + || kind === 253; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 - || kind === 254; + return kind === 254 + || kind === 255; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255; + return node.kind === 256; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 261; + return node.kind === 262; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -8355,7 +8420,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 143) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { return current; } } @@ -8375,14 +8440,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= ts.getModifierFlags(node); } return flags; @@ -8391,14 +8456,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= node.flags; } return flags; @@ -8457,7 +8522,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 + var ConstructorForKind = kind === 262 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -9153,7 +9218,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + var node = createNode(203, location); node.expression = expression; node.literal = literal; return node; @@ -9167,7 +9232,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + var block = createNode(205, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -9183,7 +9248,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + var node = createNode(206, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -9198,7 +9263,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -9211,7 +9276,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); + var node = createNode(224, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -9226,11 +9291,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(206, location); + return createNode(207, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); + var node = createNode(208, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -9243,7 +9308,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + var node = createNode(209, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -9258,7 +9323,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.statement = statement; node.expression = expression; return node; @@ -9272,7 +9337,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.expression = expression; node.statement = statement; return node; @@ -9286,7 +9351,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + var node = createNode(212, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -9302,7 +9367,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + var node = createNode(213, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -9317,7 +9382,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -9332,7 +9397,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(214, location); + var node = createNode(215, location); if (label) { node.label = label; } @@ -9347,7 +9412,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -9362,7 +9427,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(216, location); + var node = createNode(217, location); node.expression = expression; return node; } @@ -9375,7 +9440,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; node.statement = statement; return node; @@ -9389,7 +9454,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -9403,7 +9468,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -9417,7 +9482,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.expression = expression; return node; } @@ -9430,7 +9495,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -9445,7 +9510,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(232, location); + var node = createNode(233, location); node.clauses = createNodeArray(clauses); return node; } @@ -9458,7 +9523,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -9478,7 +9543,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); + var node = createNode(227, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -9496,7 +9561,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); + var node = createNode(236, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -9512,7 +9577,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -9526,7 +9591,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; return node; } @@ -9539,7 +9604,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.elements = createNodeArray(elements); return node; } @@ -9552,7 +9617,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.propertyName = propertyName; node.name = name; return node; @@ -9566,7 +9631,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -9582,7 +9647,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -9598,7 +9663,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.elements = createNodeArray(elements); return node; } @@ -9611,7 +9676,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -9625,7 +9690,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + var node = createNode(247, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -9640,7 +9705,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -9654,7 +9719,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -9668,7 +9733,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; return node; } @@ -9681,7 +9746,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.name = name; node.initializer = initializer; return node; @@ -9695,7 +9760,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.expression = expression; return node; } @@ -9707,21 +9772,22 @@ var ts; return node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(expression, dotDotDotToken, location) { + var node = createNode(253, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.token = token; node.types = createNodeArray(types); return node; @@ -9735,7 +9801,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -9749,7 +9815,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.statements = createNodeArray(statements); return node; } @@ -9762,7 +9828,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -9776,7 +9842,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -9791,14 +9857,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -9819,7 +9885,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createNode(262, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -9879,27 +9945,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createNode(294, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + var node = createNode(295, location || original); node.expression = expression; node.original = original; return node; @@ -9912,12 +9978,6 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; - return node; - } - ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -10081,6 +10141,19 @@ var ts; return setEmitFlags(createIdentifier(name), 4096 | 2); } ts.getHelperName = getHelperName; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -10180,9 +10253,9 @@ var ts; case 151: case 152: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: - return createExpressionForPropertyAssignment(property, receiver); case 258: + return createExpressionForPropertyAssignment(property, receiver); + case 259: return createExpressionForShorthandPropertyAssignment(property, receiver); case 149: return createExpressionForMethodDeclaration(property, receiver); @@ -10540,7 +10613,7 @@ var ts; case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -10588,7 +10661,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -10648,7 +10721,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { + if (node.kind === 262) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -10839,10 +10912,10 @@ var ts; var name_9 = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { + if (node.kind === 236 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { + if (node.kind === 242 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -10906,11 +10979,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 258: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: + return bindingElement.name; + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -10930,7 +11003,7 @@ var ts; case 174: return bindingElement.dotDotDotToken; case 196: - case 259: + case 260: return bindingElement; } return undefined; @@ -10946,7 +11019,7 @@ var ts; : propertyName; } break; - case 257: + case 258: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -10954,7 +11027,7 @@ var ts; : propertyName; } break; - case 259: + case 260: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -11059,15 +11132,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 236: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 235: + if (node.moduleReference.kind === 246) { externalImports.push(node); } break; - case 241: + case 242: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -11094,12 +11167,12 @@ var ts; } } break; - case 240: + case 241: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 206: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -11107,7 +11180,7 @@ var ts; } } break; - case 225: + case 226: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -11125,7 +11198,7 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -11173,7 +11246,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 262) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { @@ -11222,20 +11295,20 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 258: + case 259: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 260: return visitNode(cbNode, node.expression); case 144: case 147: case 146: - case 257: - case 223: + case 258: + case 224: case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -11261,7 +11334,7 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -11353,6 +11426,8 @@ var ts; visitNode(cbNode, node.type); case 201: return visitNode(cbNode, node.expression); + case 202: + return visitNode(cbNode, node.name); case 193: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || @@ -11361,84 +11436,77 @@ var ts; visitNode(cbNode, node.whenFalse); case 196: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 205: + case 232: return visitNodes(cbNodes, node.statements); - case 261: + case 262: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 206: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 225: return visitNodes(cbNodes, node.declarations); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 210: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 211: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 212: return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 214: - case 215: - return visitNode(cbNode, node.label); - case 216: - return visitNode(cbNode, node.expression); - case 217: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 215: + case 216: + return visitNode(cbNode, node.label); + case 217: + return visitNode(cbNode, node.expression); case 218: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 233: return visitNodes(cbNodes, node.clauses); - case 253: + case 254: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 255: return visitNodes(cbNodes, node.statements); - case 219: + case 220: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: - return visitNode(cbNode, node.expression); case 221: + return visitNode(cbNode, node.expression); + case 222: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 257: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 145: return visitNode(cbNode, node.expression); - case 226: - case 197: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 227: + case 197: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -11450,143 +11518,151 @@ var ts; visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 260: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 230: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 261: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 237: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: - return visitNode(cbNode, node.name); - case 237: + case 234: return visitNode(cbNode, node.name); case 238: - case 242: + return visitNode(cbNode, node.name); + case 239: + case 243: return visitNodes(cbNodes, node.elements); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 240: + case 244: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 241: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 142: return visitNode(cbNode, node.expression); - case 255: + case 256: return visitNodes(cbNodes, node.types); case 199: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: - return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNode(cbNode, node.expression); + case 245: + return visitNodes(cbNodes, node.decorators); + case 247: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: case 248: + case 249: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 250: + case 251: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.expression); - case 249: + case 253: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 250: return visitNode(cbNode, node.tagName); - case 262: + case 263: return visitNode(cbNode, node.type); - case 266: - return visitNodes(cbNodes, node.types); case 267: return visitNodes(cbNodes, node.types); - case 265: + case 268: + return visitNodes(cbNodes, node.types); + case 266: return visitNode(cbNode, node.elementType); + case 270: + return visitNode(cbNode, node.type); case 269: return visitNode(cbNode, node.type); - case 268: - return visitNode(cbNode, node.type); - case 270: + case 271: return visitNode(cbNode, node.literal); - case 272: + case 273: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: - return visitNode(cbNode, node.type); case 274: + return visitNode(cbNode, node.type); + case 275: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: - return visitNode(cbNode, node.type); case 276: return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); - case 271: + case 278: + return visitNode(cbNode, node.type); + case 272: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 279: return visitNodes(cbNodes, node.tags); - case 281: + case 282: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); case 283: return visitNode(cbNode, node.typeExpression); - case 280: - return visitNode(cbNode, node.typeExpression); case 284: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 281: + return visitNode(cbNode, node.typeExpression); case 285: + return visitNodes(cbNodes, node.typeParameters); + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 288: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 289: return visitNode(cbNode, node.literal); } } @@ -11750,7 +11826,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -12369,7 +12445,7 @@ var ts; case 151: case 152: case 147: - case 203: + case 204: return true; case 149: var methodDeclaration = node; @@ -12383,8 +12459,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: case 254: + case 255: return true; } } @@ -12393,42 +12469,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: + case 226: + case 206: case 205: - case 204: + case 209: case 208: - case 207: - case 220: + case 221: + case 217: + case 219: case 216: - case 218: case 215: + case 213: case 214: case 212: - case 213: case 211: - case 210: - case 217: - case 206: - case 221: - case 219: - case 209: + case 218: + case 207: case 222: + case 220: + case 210: + case 223: + case 236: case 235: - case 234: + case 242: case 241: - case 240: - case 230: - case 226: + case 231: case 227: - case 229: case 228: + case 230: + case 229: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } function isReusableTypeMember(node) { if (node) { @@ -12444,7 +12520,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 224) { return false; } var variableDeclarator = node; @@ -12576,7 +12652,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(203); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -13701,8 +13777,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 249) { + var node = createNode(247, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -13712,7 +13788,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 248); result = opening; } if (inExpressionContext && token() === 26) { @@ -13772,7 +13848,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(249, fullStart); scanJsxText(); } else { @@ -13784,7 +13860,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(248, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -13803,9 +13879,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(253); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -13822,7 +13899,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(251); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -13837,7 +13914,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(252); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -13845,7 +13922,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(250); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -14062,7 +14139,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(260, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -14081,7 +14158,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(259, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -14092,7 +14169,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(258, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -14138,8 +14215,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(202, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(180, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -14148,7 +14232,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(205); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -14179,12 +14263,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(207); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(209); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14194,7 +14278,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -14205,7 +14289,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14228,21 +14312,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(212, pos); + var forInStatement = createNode(213, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + var forOfStatement = createNode(214, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(212, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -14260,7 +14344,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 216 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -14268,7 +14352,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -14277,7 +14361,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -14286,7 +14370,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(254); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -14294,7 +14378,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -14304,12 +14388,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(233, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -14317,14 +14401,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(221); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -14335,7 +14419,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(257); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -14345,7 +14429,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -14354,13 +14438,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(220, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(208, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -14512,9 +14596,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); - case 71: return parseBreakOrContinueStatement(215); + case 71: + return parseBreakOrContinueStatement(216); case 95: return parseReturnStatement(); case 106: @@ -14593,7 +14677,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -14665,7 +14749,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(224); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -14674,7 +14758,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(225); switch (token()) { case 103: break; @@ -14703,7 +14787,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(206, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -14711,7 +14795,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(226, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -14896,7 +14980,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(204); nextToken(); return finishNode(result); } @@ -14930,7 +15014,7 @@ var ts; return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -14965,7 +15049,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(255); + var node = createNode(256); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -14988,7 +15072,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -14999,7 +15083,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(136); @@ -15011,13 +15095,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(261, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -15032,7 +15116,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(232, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -15043,7 +15127,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -15055,7 +15139,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (token() === 139) { @@ -15100,7 +15184,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(234, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -15116,7 +15200,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); + var importEqualsDeclaration = createNode(235, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -15126,7 +15210,7 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(235, fullStart); + var importDeclaration = createNode(236, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || @@ -15140,13 +15224,13 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(237, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); } return finishNode(importClause); } @@ -15156,7 +15240,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(246); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -15174,7 +15258,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(238); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -15182,14 +15266,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(244); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(240); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -15208,13 +15292,13 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 240 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { @@ -15222,7 +15306,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); + node.exportClause = parseNamedImportsOrExports(243); if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(138); node.moduleSpecifier = parseModuleSpecifier(); @@ -15232,7 +15316,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(241, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -15311,10 +15395,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 + || node.kind === 235 && node.moduleReference.kind === 246 + || node.kind === 236 || node.kind === 241 + || node.kind === 242 ? node : undefined; }); @@ -15350,7 +15434,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(263, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -15361,12 +15445,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(267, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(274, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -15377,20 +15461,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(266, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(269, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(270, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -15442,27 +15526,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(277); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(276); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(275); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -15483,7 +15567,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(273); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -15523,18 +15607,18 @@ var ts; return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(271); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(270); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -15548,7 +15632,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(267); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -15564,12 +15648,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(264); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(289); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -15582,11 +15666,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(265, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(269, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -15730,7 +15814,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(279, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -15840,7 +15924,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -15895,7 +15979,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -15906,20 +15990,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -15934,7 +16018,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -15943,7 +16027,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -15952,7 +16036,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -15966,7 +16050,7 @@ var ts; typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 273) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { var name_14 = jsDocTypeReference.name; @@ -15984,7 +16068,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -16025,7 +16109,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(231, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -16069,7 +16153,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); @@ -16092,7 +16176,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -16384,7 +16468,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -16411,16 +16495,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 228 || node.kind === 229) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 232) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -16436,7 +16520,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 231) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -16545,7 +16629,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { symbol.valueDeclaration = node; } } @@ -16576,9 +16660,9 @@ var ts; return "__new"; case 155: return "__index"; - case 241: + case 242: return "__export"; - case 240: + case 241: return node.isExportEquals ? "export=" : "default"; case 192: switch (ts.getSpecialPropertyAssignmentKind(node)) { @@ -16592,20 +16676,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: case 226: + case 227: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 275: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 144: - ts.Debug.assert(node.parent.kind === 274); + ts.Debug.assert(node.parent.kind === 275); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 286: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 206) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -16649,7 +16733,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -16669,7 +16753,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -16677,7 +16761,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -16738,7 +16822,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 262) { node.flags |= emitFlags; } if (isIIFE) { @@ -16814,43 +16898,43 @@ var ts; return; } switch (node.kind) { - case 210: + case 211: bindWhileStatement(node); break; - case 209: + case 210: bindDoStatement(node); break; - case 211: + case 212: bindForStatement(node); break; - case 212: case 213: + case 214: bindForInOrForOfStatement(node); break; - case 208: + case 209: bindIfStatement(node); break; - case 216: - case 220: + case 217: + case 221: bindReturnOrThrow(node); break; + case 216: case 215: - case 214: bindBreakOrContinueStatement(node); break; - case 221: + case 222: bindTryStatement(node); break; - case 218: + case 219: bindSwitchStatement(node); break; - case 232: + case 233: bindCaseBlock(node); break; - case 253: + case 254: bindCaseClause(node); break; - case 219: + case 220: bindLabeledStatement(node); break; case 190: @@ -16868,7 +16952,7 @@ var ts; case 193: bindConditionalExpressionFlow(node); break; - case 223: + case 224: bindVariableDeclarationFlow(node); break; case 179: @@ -17034,11 +17118,11 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: - case 210: case 209: - return parent.expression === node; case 211: + case 210: + return parent.expression === node; + case 212: case 193: return parent.condition === node; } @@ -17102,7 +17186,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 220 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -17137,7 +17221,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 225) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -17159,7 +17243,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 217) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -17179,7 +17263,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 216 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -17236,7 +17320,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -17301,7 +17385,7 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 210) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } @@ -17332,13 +17416,13 @@ var ts; else if (node.kind === 176) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 258) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 259) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.expression); } } @@ -17438,7 +17522,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { bindInitializedVariableFlow(node); } } @@ -17465,28 +17549,28 @@ var ts; function getContainerFlags(node) { switch (node.kind) { case 197: - case 226: - case 229: + case 227: + case 230: case 176: case 161: - case 287: - case 270: + case 288: + case 271: return 1; - case 227: - return 1 | 64; - case 274: - case 230: case 228: + return 1 | 64; + case 275: + case 231: + case 229: case 170: return 1 | 32; - case 261: + case 262: return 1 | 4 | 32; case 149: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } case 150: - case 225: + case 226: case 148: case 151: case 152: @@ -17499,17 +17583,17 @@ var ts; case 184: case 185: return 1 | 4 | 32 | 8 | 16; - case 231: + case 232: return 4; case 147: return node.initializer ? 4 : 0; - case 256: - case 211: + case 257: case 212: case 213: - case 232: + case 214: + case 233: return 2; - case 204: + case 205: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -17525,20 +17609,20 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 231: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 262: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 197: - case 226: + case 227: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 230: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 161: case 176: - case 227: - case 270: - case 287: + case 228: + case 271: + case 288: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -17550,11 +17634,11 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: case 185: - case 274: - case 228: + case 275: + case 229: case 170: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } @@ -17570,11 +17654,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 262 ? node : node.body; + if (body && (body.kind === 262 || body.kind === 232)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 242 || stat.kind === 241) { return true; } } @@ -17650,11 +17734,11 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 260 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -17676,10 +17760,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 231: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 262: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -17769,8 +17853,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 262 && + blockScopeContainer.kind !== 231 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -17853,14 +17937,14 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 286) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -17892,7 +17976,7 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 256: + case 257: return checkStrictModeCatchClause(node); case 186: return checkStrictModeDeleteExpression(node); @@ -17902,7 +17986,7 @@ var ts; return checkStrictModePostfixUnaryExpression(node); case 190: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 218: return checkStrictModeWithStatement(node); case 167: seenThisKeyword = true; @@ -17913,22 +17997,22 @@ var ts; return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: return bindParameter(node); - case 223: + case 224: case 174: return bindVariableDeclarationOrBindingElement(node); case 147: case 146: - case 271: + case 272: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 287: return bindJSDocProperty(node); - case 257: case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 260: - return bindPropertyOrMethodOrAccessor(node, 8, 900095); case 259: - case 251: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 261: + return bindPropertyOrMethodOrAccessor(node, 8, 900095); + case 260: + case 252: var root = container; var hasRest = false; while (root.parent) { @@ -17949,7 +18033,7 @@ var ts; case 149: case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + case 226: return bindFunctionDeclaration(node); case 150: return declareSymbolAndAddToSymbolTable(node, 16384, 0); @@ -17959,12 +18043,12 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 158: case 159: - case 274: + case 275: return bindFunctionOrConstructorType(node); case 161: case 170: - case 287: - case 270: + case 288: + case 271: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: return bindObjectLiteralExpression(node); @@ -17977,43 +18061,43 @@ var ts; } break; case 197: - case 226: + case 227: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 228: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 286: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: - return bindBlockScopedDeclaration(node, 524288, 793064); case 229: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 230: + return bindEnumDeclaration(node); + case 231: return bindModuleDeclaration(node); - case 234: - case 237: - case 239: - case 243: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: - return bindNamespaceExportDeclaration(node); - case 236: - return bindImportClause(node); - case 241: - return bindExportDeclaration(node); + case 235: + case 238: case 240: + case 244: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 234: + return bindNamespaceExportDeclaration(node); + case 237: + return bindImportClause(node); + case 242: + return bindExportDeclaration(node); + case 241: return bindExportAssignment(node); - case 261: + case 262: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 205: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 232: return updateStrictModeStatementList(node.statements); } } @@ -18041,7 +18125,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -18051,7 +18135,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 262) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -18100,7 +18184,7 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { + if (container.kind === 226 || container.kind === 184) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } @@ -18136,7 +18220,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 226) { + if (node.kind === 227) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -18246,15 +18330,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || + node.kind === 227 || + (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 206 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -18272,13 +18356,13 @@ var ts; return computeCallExpression(node, subtreeFlags); case 180: return computeNewExpression(node, subtreeFlags); - case 230: + case 231: return computeModuleDeclaration(node, subtreeFlags); case 183: return computeParenthesizedExpression(node, subtreeFlags); case 192: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 208: return computeExpressionStatement(node, subtreeFlags); case 144: return computeParameter(node, subtreeFlags); @@ -18286,23 +18370,23 @@ var ts; return computeArrowFunction(node, subtreeFlags); case 184: return computeFunctionExpression(node, subtreeFlags); - case 225: - return computeFunctionDeclaration(node, subtreeFlags); - case 223: - return computeVariableDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclarationList(node, subtreeFlags); - case 205: - return computeVariableStatement(node, subtreeFlags); - case 219: - return computeLabeledStatement(node, subtreeFlags); case 226: + return computeFunctionDeclaration(node, subtreeFlags); + case 224: + return computeVariableDeclaration(node, subtreeFlags); + case 225: + return computeVariableDeclarationList(node, subtreeFlags); + case 206: + return computeVariableStatement(node, subtreeFlags); + case 220: + return computeLabeledStatement(node, subtreeFlags); + case 227: return computeClassDeclaration(node, subtreeFlags); case 197: return computeClassExpression(node, subtreeFlags); - case 255: - return computeHeritageClause(node, subtreeFlags); case 256: + return computeHeritageClause(node, subtreeFlags); + case 257: return computeCatchClause(node, subtreeFlags); case 199: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -18315,7 +18399,7 @@ var ts; case 151: case 152: return computeAccessor(node, subtreeFlags); - case 234: + case 235: return computeImportEquals(node, subtreeFlags); case 177: return computePropertyAccess(node, subtreeFlags); @@ -18703,25 +18787,25 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: + case 230: + case 261: case 182: case 200: case 201: case 130: transformFlags |= 3; break; - case 246: case 247: case 248: - case 10: case 249: + case 10: case 250: case 251: case 252: + case 253: transformFlags |= 4; break; - case 213: + case 214: transformFlags |= 8; case 12: case 13: @@ -18729,8 +18813,9 @@ var ts; case 15: case 194: case 181: - case 258: + case 259: case 114: + case 202: transformFlags |= 192; break; case 195: @@ -18760,8 +18845,8 @@ var ts; case 164: case 165: case 166: - case 227: case 228: + case 229: case 167: case 168: case 169: @@ -18779,7 +18864,7 @@ var ts; case 196: transformFlags |= 192 | 524288; break; - case 259: + case 260: transformFlags |= 8 | 1048576; break; case 96: @@ -18827,22 +18912,22 @@ var ts; transformFlags |= 192; } break; - case 209: case 210: case 211: case 212: + case 213: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 262: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 216: - case 214: + case 217: case 215: + case 216: transformFlags |= 33554432; break; } @@ -18858,18 +18943,18 @@ var ts; case 180: case 175: return 537396545; - case 230: + case 231: return 574674241; case 144: return 536872257; case 185: return 601249089; case 184: - case 225: - return 601281857; - case 224: - return 546309441; case 226: + return 601281857; + case 225: + return 546309441; + case 227: case 197: return 539358529; case 150: @@ -18891,12 +18976,12 @@ var ts; case 153: case 154: case 155: - case 227: case 228: + case 229: return -3; case 176: return 540087617; - case 256: + case 257: return 537920833; case 172: case 173: @@ -18917,6 +19002,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -18924,9 +19015,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -18938,13 +19026,13 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2: - case 0: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -19006,6 +19094,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -19060,7 +19149,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -19076,7 +19169,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -19117,31 +19211,115 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_5 = ts.getDirectoryPath(current); + if (parent_5 === current || directoryPathMap.contains(parent_5)) { + break; + } + directoryPathMap.set(parent_5, result); + current = parent_5; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -19266,33 +19444,33 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -19309,10 +19487,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -19340,11 +19541,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -19353,19 +19554,21 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -19374,16 +19577,22 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -19393,73 +19602,117 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -19471,10 +19724,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -19548,9 +19804,11 @@ var ts; getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getTypeFromTypeNode: getTypeFromTypeNode, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -19559,6 +19817,7 @@ var ts; getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + signatureToString: signatureToString, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -19581,7 +19840,8 @@ var ts; tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -19675,6 +19935,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var typeofEQFacts = ts.createMap({ @@ -19820,7 +20081,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -19915,7 +20176,7 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -19959,25 +20220,35 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174) { + var errorBindingElement = ts.getAncestor(usage, 174); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + } + else if (declaration.kind === 224) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); return isUsedInFunctionOrNonStaticProperty(usage, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: - case 213: + case 206: + case 212: + case 214: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: case 213: + case 214: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -20004,6 +20275,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -20017,7 +20297,7 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 144 || @@ -20040,13 +20320,13 @@ var ts; } } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 231: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { + if (location.kind === 262 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -20056,7 +20336,7 @@ var ts; } if (moduleExports[name] && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + ts.getDeclarationOfKind(moduleExports[name], 244)) { break; } } @@ -20064,7 +20344,7 @@ var ts; break loop; } break; - case 229: + case 230: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } @@ -20080,9 +20360,9 @@ var ts; } } break; - case 226: - case 197: case 227: + case 197: + case 228: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -20100,7 +20380,7 @@ var ts; break; case 142: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 228) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -20112,7 +20392,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; @@ -20176,7 +20456,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 234) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -20256,7 +20536,7 @@ var ts; 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"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -20273,10 +20553,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } - while (node && node.kind !== 235) { + while (node && node.kind !== 236) { node = node.parent; } return node; @@ -20286,7 +20566,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + if (node.moduleReference.kind === 246) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -20390,19 +20670,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 234: + case 235: return getTargetOfImportEqualsDeclaration(node); - case 236: - return getTargetOfImportClause(node); case 237: + return getTargetOfImportClause(node); + case 238: return getTargetOfNamespaceImport(node); - case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); case 240: + return getTargetOfImportSpecifier(node); + case 244: + return getTargetOfExportSpecifier(node); + case 241: return getTargetOfExportAssignment(node); - case 233: + case 234: return getTargetOfNamespaceExportDeclaration(node); } } @@ -20446,10 +20726,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 241) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 244) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -20465,7 +20745,7 @@ var ts; return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 235); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -20762,11 +21042,11 @@ var ts; } } switch (location_1.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 230: + case 231: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -20810,7 +21090,7 @@ var ts; return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -20842,7 +21122,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -20915,7 +21195,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -20953,7 +21233,7 @@ var ts; meaning = 107455 | 1048576; } else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + entityName.parent.kind === 235) { meaning = 1920; } else { @@ -21048,7 +21328,7 @@ var ts; while (node.kind === 166) { node = node.parent; } - if (node.kind === 228) { + if (node.kind === 229) { return getSymbolOfNode(node); } } @@ -21056,7 +21336,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 232 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { @@ -21125,9 +21405,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_6) { + walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -21260,12 +21540,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -21324,7 +21604,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 262 || declaration.parent.kind === 232; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -21337,25 +21617,6 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); @@ -21438,8 +21699,8 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -21618,6 +21879,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -21630,7 +21895,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -21648,6 +21912,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 134); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -21658,6 +21948,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -21674,27 +21965,27 @@ var ts; switch (node.kind) { case 174: return isDeclarationVisible(node.parent.parent); - case 223: + case 224: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: + case 231: case 227: case 228: - case 225: case 229: - case 234: + case 226: + case 230: + case 235: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent_8 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { + return isGlobalSourceFile(parent_8); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent_8); case 147: case 146: case 151: @@ -21709,7 +22000,7 @@ var ts; case 153: case 155: case 144: - case 231: + case 232: case 158: case 159: case 161: @@ -21720,15 +22011,15 @@ var ts; case 165: case 166: return isDeclarationVisible(node.parent); - case 236: case 237: - case 239: + case 238: + case 240: return false; case 143: - case 261: - case 233: + case 262: + case 234: return true; - case 240: + case 241: return false; default: return false; @@ -21737,10 +22028,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 241) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 244) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -21818,12 +22109,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 223: case 224: + case 225: + case 240: case 239: case 238: case 237: - case 236: node = node.parent; break; default: @@ -21842,9 +22133,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); @@ -21979,11 +22267,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 213) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -21993,7 +22281,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -22031,7 +22319,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -22106,7 +22394,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 258) { return type; } return getWidenedType(type); @@ -22134,10 +22422,10 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 241) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -22344,8 +22632,8 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || + if (node.kind === 227 || node.kind === 197 || + node.kind === 226 || node.kind === 184 || node.kind === 149 || node.kind === 185) { var declarations = node.typeParameters; if (declarations) { @@ -22355,15 +22643,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 228 || node.kind === 227 || + node.kind === 197 || node.kind === 229) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -22496,7 +22784,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -22525,7 +22813,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 228) { if (declaration.flags & 64) { return false; } @@ -22575,7 +22863,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 286); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -22586,7 +22874,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 229); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -22618,7 +22906,7 @@ var ts; function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -22646,7 +22934,7 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -23121,8 +23409,8 @@ var ts; else { var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); - var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; @@ -23393,7 +23681,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 273) { + if (node.type && node.type.kind === 274) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -23404,7 +23692,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 274; } } } @@ -23456,7 +23744,7 @@ var ts; var thisParameter = undefined; var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -23539,12 +23827,12 @@ var ts; if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -23555,7 +23843,7 @@ var ts; case 152: case 184: case 185: - case 274: + case 275: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -23827,7 +24115,7 @@ var ts; switch (node.kind) { case 157: return node.typeName; - case 272: + case 273: return node.name; case 199: var expr = node.expression; @@ -23853,7 +24141,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 273) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -23863,7 +24151,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { + if (node.kind === 273) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -23898,9 +24186,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 226: case 227: - case 229: + case 228: + case 230: return declaration; } } @@ -24074,8 +24362,9 @@ var ts; return false; } 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, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -24185,8 +24474,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; addTypeToIntersection(typeSet, type); } } @@ -24304,7 +24593,7 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -24416,7 +24705,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -24539,7 +24828,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { if (!(ts.getModifierFlags(container) & 32) && (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -24558,8 +24847,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: case 264: + case 265: return anyType; case 134: return stringType; @@ -24577,21 +24866,21 @@ var ts; return nullType; case 129: return neverType; - case 289: - return nullType; case 290: - return undefinedType; + return nullType; case 291: + return undefinedType; + case 292: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 288: + case 289: return getTypeFromLiteralTypeNode(node.literal); case 157: - case 272: + case 273: return getTypeFromTypeReference(node); case 156: return booleanType; @@ -24600,29 +24889,29 @@ var ts; case 160: return getTypeFromTypeQueryNode(node); case 162: - case 265: + case 266: return getTypeFromArrayTypeNode(node); case 163: return getTypeFromTupleTypeNode(node); case 164: - case 266: + case 267: return getTypeFromUnionTypeNode(node); case 165: return getTypeFromIntersectionTypeNode(node); case 166: - case 268: case 269: - case 276: - case 277: - case 273: - return getTypeFromTypeNode(node.type); case 270: + case 277: + case 278: + case 274: + return getTypeFromTypeNode(node.type); + case 271: return getTypeFromTypeNode(node.literal); case 158: case 159: case 161: - case 287: - case 274: + case 288: + case 275: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: return getTypeFromTypeOperatorNode(node); @@ -24634,9 +24923,9 @@ var ts; case 141: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 268: return getTypeFromJSDocTupleType(node); - case 275: + case 276: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -24785,17 +25074,19 @@ var ts; var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { var typeVariable_1 = constraintType.type; - var mappedTypeVariable = instantiateType(typeVariable_1, mapper); - if (typeVariable_1 !== mappedTypeVariable) { - return mapType(mappedTypeVariable, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -24816,12 +25107,12 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -24832,10 +25123,10 @@ var ts; case 152: case 184: case 185: - case 226: - case 197: case 227: + case 197: case 228: + case 229: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -24845,15 +25136,24 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 228) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: + case 275: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 231: + case 262: return false; } node = node.parent; @@ -24863,7 +25163,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 262 || parentKind === 232; } return false; } @@ -24930,7 +25230,7 @@ var ts; case 192: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 258: return isContextSensitive(node.initializer); case 149: case 148: @@ -24986,7 +25286,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -25688,8 +25988,11 @@ var ts; } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -25840,7 +26143,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -26049,8 +26352,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -26058,8 +26361,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -26150,8 +26453,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; result |= getFalsyFlags(t); } return result; @@ -26310,7 +26613,7 @@ var ts; case 174: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 226: case 149: case 148: case 151: @@ -26651,8 +26954,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -26768,7 +27071,7 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 224 || target.kind === 174) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; @@ -26866,8 +27169,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getTypeFacts(t); } return result; @@ -26953,7 +27256,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + return node.parent.kind === 175 || node.parent.kind === 258 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -26972,9 +27275,9 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: - return stringType; case 213: + return stringType; + case 214: return checkRightHandSideOfForOf(parent.expression) || unknownType; case 192: return getAssignedTypeOfBinaryExpression(parent); @@ -26984,9 +27287,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 196: return getAssignedTypeOfSpreadExpression(parent); - case 257: - return getAssignedTypeOfPropertyAssignment(parent); case 258: + return getAssignedTypeOfPropertyAssignment(parent); + case 259: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -27009,26 +27312,26 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 213) { return stringType; } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 224 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 224 || node.kind === 174 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 224 && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 174 && node.parent.kind === 192 && isEmptyArrayLiteral(node.parent.right); @@ -27055,7 +27358,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 254) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -27157,8 +27460,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -27700,8 +28003,8 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || + node.kind === 232 || + node.kind === 262 || node.kind === 147) { return node; } @@ -27771,7 +28074,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 227 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -27799,6 +28102,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -27826,7 +28130,7 @@ var ts; flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); if (type === autoType || type === autoArrayType) { @@ -27857,7 +28161,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 257) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -27875,8 +28179,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 212 && + ts.getAncestor(symbol.valueDeclaration, 225).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -27966,10 +28270,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 230: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 150: @@ -28027,9 +28331,9 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 275) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -28323,8 +28627,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -28394,13 +28698,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { + if (attribute.kind === 251) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 251) { + else if (attribute.kind === 252) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -28418,14 +28722,14 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: + case 224: case 144: case 147: case 146: case 174: return getContextualTypeForInitializerExpression(node); case 185: - case 216: + case 217: return getContextualTypeForReturnExpression(node); case 195: return getContextualTypeForYieldOperand(parent); @@ -28437,22 +28741,22 @@ var ts; return getTypeFromTypeNode(parent.type); case 192: return getContextualTypeForBinaryOperand(node); - case 257: case 258: + case 259: return getContextualTypeForObjectLiteralElement(parent); case 175: return getContextualTypeForElementExpression(node); case 193: return getContextualTypeForConditionalOperand(node); - case 202: + case 203: ts.Debug.assert(parent.parent.kind === 194); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 183: return getContextualType(parent); - case 252: + case 253: return getContextualType(parent); - case 250: case 251: + case 252: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -28504,8 +28808,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -28648,25 +28952,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 258 || + memberDecl.kind === 259 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { + if (memberDecl.kind === 258) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 149) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 258); + ts.Debug.assert(memberDecl.kind === 259); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -28692,7 +28996,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(memberDecl, 2); } @@ -28792,13 +29096,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 253: checkJsxExpression(child); break; - case 246: + case 247: checkJsxElement(child); break; - case 247: + case 248: checkJsxSelfClosingElement(child); break; } @@ -29093,11 +29397,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { + if (node.attributes[i].kind === 251) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 251); + ts.Debug.assert(node.attributes[i].kind === 252); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -29116,7 +29420,11 @@ var ts; } function checkJsxExpression(node) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -29134,7 +29442,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 177 || node.kind === 224 ? node.name : node.right; if (left.kind === 96) { @@ -29280,7 +29588,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 225) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -29302,7 +29610,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 213 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -29398,19 +29706,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent_9; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent_9; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -29630,7 +29938,7 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 145) { switch (node.parent.kind) { - case 226: + case 227: case 197: return 1; case 147: @@ -29651,7 +29959,7 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } @@ -29672,7 +29980,7 @@ var ts; return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -29709,7 +30017,7 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -30070,7 +30378,7 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: + case 227: case 197: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 144: @@ -30180,9 +30488,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 226 : resolvedRequire.flags & 3 - ? 223 + ? 224 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -30208,6 +30516,23 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + ts.Debug.assert(node.keywordToken === 93 && node.name.text === "target", "Unrecognized meta-property."); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 150) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -30315,7 +30640,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 204) { + if (func.body.kind !== 205) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -30394,7 +30719,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -30440,7 +30765,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -30506,6 +30831,7 @@ var ts; if (produceDiagnostics && node.kind !== 149) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } @@ -30520,7 +30846,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 205) { checkSourceElement(node.body); } else { @@ -30573,7 +30899,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 238; } } } @@ -30589,6 +30915,16 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 177 && expr.kind !== 178) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { @@ -30659,8 +30995,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -30674,8 +31010,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -30684,8 +31020,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { + var t = types_18[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -30732,7 +31068,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { + if (property.kind === 258 || property.kind === 259) { var name_20 = property.name; if (name_20.kind === 142) { checkComputedPropertyName(name_20); @@ -30747,7 +31083,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 259) { return checkDestructuringAssignment(property, type); } else { @@ -30758,7 +31094,7 @@ var ts; error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } - else if (property.kind === 259) { + else if (property.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -30826,7 +31162,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 259) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -30854,7 +31190,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + var error = target.parent.kind === 260 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -30883,8 +31219,8 @@ var ts; case 176: case 187: case 201: + case 248: case 247: - case 246: return true; case 193: return isSideEffectFree(node.whenTrue) && @@ -31318,6 +31654,8 @@ var ts; return checkAssertion(node); case 201: return checkNonNullAssertion(node); + case 202: + return checkMetaProperty(node); case 186: return checkDeleteExpression(node); case 188: @@ -31338,13 +31676,13 @@ var ts; return undefinedWideningType; case 195: return checkYieldExpression(node); - case 252: + case 253: return checkJsxExpression(node); - case 246: - return checkJsxElement(node); case 247: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 248: + return checkJsxSelfClosingElement(node); + case 249: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -31389,7 +31727,7 @@ var ts; return false; } return node.kind === 149 || - node.kind === 225 || + node.kind === 226 || node.kind === 184; } function getTypePredicateParameterIndex(parameterList, parameter) { @@ -31448,14 +31786,14 @@ var ts; switch (node.parent.kind) { case 185: case 153: - case 225: + case 226: case 184: case 158: case 149: case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; } } } @@ -31483,7 +31821,7 @@ var ts; if (node.kind === 155) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || + else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || node.kind === 153 || node.kind === 150 || node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); @@ -31605,7 +31943,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 228) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -31687,7 +32025,7 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 184 && n.kind !== 226) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -31712,7 +32050,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -31861,8 +32199,8 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && + if (n.parent.kind !== 228 && + n.parent.kind !== 227 && n.parent.kind !== 197 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { @@ -31973,11 +32311,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -32088,16 +32426,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 228: return 2097152; - case 230: + case 231: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 227: + case 230: return 2097152 | 1048576; - case 234: + case 235: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -32109,7 +32447,8 @@ var ts; } function checkNonThenableType(type, location, message) { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + var apparentType = getApparentType(type); + if ((apparentType.flags & (1 | 8192)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -32244,7 +32583,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 227: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -32299,7 +32638,7 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 227: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -32332,6 +32671,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -32382,28 +32722,28 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 262: + case 231: checkUnusedModuleMembers(node); break; - case 226: + case 227: case 197: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 228: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: checkUnusedLocalsAndParameters(node); break; case 150: case 184: - case 225: + case 226: case 185: case 149: case 151: @@ -32427,7 +32767,7 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { @@ -32460,9 +32800,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 224 && + (declaration.parent.parent.kind === 213 || + declaration.parent.parent.kind === 214)) { return; } } @@ -32523,7 +32863,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -32531,7 +32871,7 @@ var ts; } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 205) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -32575,6 +32915,11 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; while (current) { @@ -32591,6 +32936,22 @@ var ts; current = current.parent; } } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -32600,8 +32961,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -32616,11 +32977,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -32628,11 +32989,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -32640,7 +33001,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 224 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -32650,15 +33011,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); + var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || + (container.kind === 205 && ts.isFunctionLike(container.parent) || + container.kind === 232 || container.kind === 231 || - container.kind === 230 || - container.kind === 261); + container.kind === 262); if (!namesShareScope) { var name_23 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_23, name_23); @@ -32691,7 +33052,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 144 || + symbol.valueDeclaration.kind === 174) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -32729,19 +33091,19 @@ var ts; } } if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5) { + if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); var name_24 = node.propertyName || node.name; var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -32752,7 +33114,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -32761,7 +33123,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -32781,18 +33143,19 @@ var ts; } if (node.kind !== 147 && node.kind !== 146) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 224 || node.kind === 174) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 144 && right.kind === 224) || + (left.kind === 224 && right.kind === 144)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -32838,7 +33201,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 207) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -32855,12 +33218,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 225) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -32878,7 +33241,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { checkForInOrForOfVariableDeclaration(node); } else { @@ -32903,7 +33266,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -33160,7 +33523,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 255 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -33172,7 +33535,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 254) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -33198,7 +33561,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 220 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -33321,7 +33684,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -33341,7 +33704,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { + if (declaration.kind === 227 || declaration.kind === 228) { if (!firstDecl) { firstDecl = declaration; } @@ -33374,6 +33737,7 @@ var ts; if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33409,7 +33773,7 @@ var ts; checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { + baseType_1.symbol.valueDeclaration.kind === 227) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -33536,7 +33900,7 @@ var ts; if (!list1 || !list2 || list1.length !== list2.length) { return false; } - for (var i = 0, len = list1.length; i < len; i++) { + for (var i = 0; i < list1.length; i++) { var tp1 = list1[i]; var tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -33594,7 +33958,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -33725,6 +34089,7 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; case 183: return evalConstant(e.expression); @@ -33798,6 +34163,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -33818,7 +34184,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 230) { return false; } var enumDeclaration = declaration; @@ -33841,8 +34207,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 227 || + (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -33901,7 +34267,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 227); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -33944,22 +34310,22 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 206: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: case 241: + case 242: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: case 235: + case 236: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 174: - case 223: + case 224: var name_25 = node.name; if (ts.isBindingPattern(name_25)) { for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { @@ -33968,12 +34334,12 @@ var ts; } break; } - case 226: - case 229: - case 225: case 227: case 230: + case 226: case 228: + case 231: + case 229: if (isGlobalAugmentation) { return; } @@ -34009,9 +34375,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { + error(moduleName, node.kind === 242 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -34032,7 +34398,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 244 ? 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)); @@ -34059,7 +34425,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 238) { checkImportBinding(importClause.namedBindings); } else { @@ -34110,8 +34476,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -34124,7 +34490,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -34147,9 +34513,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 262 ? node.parent : node.parent.parent; + if (container.kind === 231 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -34215,7 +34586,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 226 && declaration.kind !== 149) || !!declaration.body; } } @@ -34226,10 +34597,10 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 231: case 227: - case 225: + case 228: + case 226: cancellationToken.throwIfCancellationRequested(); } } @@ -34278,71 +34649,71 @@ var ts; return checkIndexedAccessType(node); case 170: return checkMappedType(node); - case 225: + case 226: return checkFunctionDeclaration(node); - case 204: - case 231: - return checkBlock(node); case 205: + case 232: + return checkBlock(node); + case 206: return checkVariableStatement(node); - case 207: - return checkExpressionStatement(node); case 208: - return checkIfStatement(node); + return checkExpressionStatement(node); case 209: - return checkDoStatement(node); + return checkIfStatement(node); case 210: - return checkWhileStatement(node); + return checkDoStatement(node); case 211: - return checkForStatement(node); + return checkWhileStatement(node); case 212: - return checkForInStatement(node); + return checkForStatement(node); case 213: - return checkForOfStatement(node); + return checkForInStatement(node); case 214: + return checkForOfStatement(node); case 215: - return checkBreakOrContinueStatement(node); case 216: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 217: - return checkWithStatement(node); + return checkReturnStatement(node); case 218: - return checkSwitchStatement(node); + return checkWithStatement(node); case 219: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 220: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 221: + return checkThrowStatement(node); + case 222: return checkTryStatement(node); - case 223: + case 224: return checkVariableDeclaration(node); case 174: return checkBindingElement(node); - case 226: - return checkClassDeclaration(node); case 227: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 228: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 229: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 230: + return checkEnumDeclaration(node); + case 231: return checkModuleDeclaration(node); - case 235: + case 236: return checkImportDeclaration(node); - case 234: + case 235: return checkImportEqualsDeclaration(node); - case 241: + case 242: return checkExportDeclaration(node); - case 240: + case 241: return checkExportAssignment(node); - case 206: + case 207: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 223: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 245: return checkMissingDeclaration(node); } } @@ -34385,6 +34756,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -34404,6 +34776,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -34448,7 +34824,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 218 && node.parent.statement === node) { return true; } node = node.parent; @@ -34470,14 +34846,14 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 230: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; case 197: @@ -34485,8 +34861,8 @@ var ts; if (className) { copySymbol(location.symbol, meaning); } - case 226: case 227: + case 228: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } @@ -34531,10 +34907,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 143: - case 226: case 227: case 228: case 229: + case 230: return true; } } @@ -34543,7 +34919,7 @@ var ts; while (node.parent && node.parent.kind === 141) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -34570,10 +34946,10 @@ var ts; while (nodeOnRightSide.parent.kind === 141) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 235) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 241) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -34597,11 +34973,11 @@ var ts; default: } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + var importEqualsDeclaration = ts.getAncestor(entityName, 235); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -34648,10 +35024,10 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 251) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 156) { @@ -34660,7 +35036,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 262) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -34713,7 +35089,7 @@ var ts; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 236 || node.parent.kind === 242) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -34735,7 +35111,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 259) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -34786,7 +35162,7 @@ var ts; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { + if (expr.parent.kind === 214) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } @@ -34794,7 +35170,7 @@ var ts; var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 258) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -34905,7 +35281,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -34943,7 +35319,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -34983,16 +35359,16 @@ var ts; return true; } switch (node.kind) { - case 234: - case 236: + case 235: case 237: - case 239: - case 243: + case 238: + case 240: + case 244: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241: + case 242: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 241: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -35002,7 +35378,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -35053,7 +35429,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 261) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -35147,9 +35523,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent_12 = reference.parent; + if (ts.isDeclaration(parent_12) && reference === parent_12.name) { + location = getDeclarationContainer(parent_12); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -35262,15 +35638,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -35289,7 +35665,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 262); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -35466,7 +35842,7 @@ var ts; } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 230 && node.parent.kind === 227) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -35492,7 +35868,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -35515,7 +35891,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 144) { @@ -35550,7 +35926,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 144) { @@ -35565,13 +35941,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 144) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -35581,14 +35957,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { + if (node.kind !== 227) { if (node.kind !== 149 && node.kind !== 147 && node.kind !== 151 && node.kind !== 152) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -35630,7 +36006,7 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 236 || node.kind === 235) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { @@ -35660,29 +36036,29 @@ var ts; case 149: case 148: case 155: - case 230: + case 231: + case 236: case 235: - case 234: + case 242: case 241: - case 240: case 184: case 185: case 144: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 232 || node.parent.kind === 262) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); case 226: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 116); case 228: - return true; + case 206: case 229: + return true; + case 230: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -35696,7 +36072,7 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 149: - case 225: + case 226: case 184: case 185: if (!node.asteriskToken) { @@ -35902,7 +36278,7 @@ var ts; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || + ts.Debug.assert(node.kind === 226 || node.kind === 184 || node.kind === 149); if (ts.isInAmbientContext(node)) { @@ -35929,14 +36305,14 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 260) { continue; } var name_28 = prop.name; if (name_28.kind === 142) { checkGrammarComputedPropertyName(name_28); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -35948,7 +36324,7 @@ var ts; } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 258 || prop.kind === 259) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_28.kind === 8) { checkGrammarNumericLiteral(name_28); @@ -35997,7 +36373,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 252) { continue; } var jsxAttr = attr; @@ -36009,7 +36385,7 @@ var ts; return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 253 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -36018,7 +36394,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.initializer.kind === 225) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -36026,20 +36402,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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); @@ -36123,7 +36499,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 161) { @@ -36137,9 +36513,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 220: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 215 && !ts.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); @@ -36147,8 +36523,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 219: + if (node.kind === 216 && !node.label) { return false; } break; @@ -36161,13 +36537,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 216 ? 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 === 215 + var message = node.kind === 216 ? 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); @@ -36193,7 +36569,7 @@ var ts; expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -36250,15 +36626,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: case 209: case 210: - case 217: case 211: + case 218: case 212: case 213: + case 214: return false; - case 219: + case 220: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -36273,6 +36649,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -36313,7 +36696,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -36334,13 +36717,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 228 || + node.kind === 229 || + node.kind === 236 || node.kind === 235 || - node.kind === 234 || + node.kind === 242 || node.kind === 241 || - node.kind === 240 || - node.kind === 233 || + node.kind === 234 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -36349,7 +36732,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 206) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -36368,7 +36751,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 === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 205 || node.parent.kind === 232 || node.parent.kind === 262) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -36379,8 +36762,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 171)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 261)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -36425,31 +36822,31 @@ var ts; _a[201] = [ { name: "expression", test: ts.isLeftHandSideExpression } ], - _a[229] = [ + _a[230] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "members", test: ts.isEnumMember } ], - _a[230] = [ + _a[231] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isModuleName }, { name: "body", test: ts.isModuleBody } ], - _a[231] = [ + _a[232] = [ { name: "statements", test: ts.isStatement } ], - _a[234] = [ + _a[235] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "moduleReference", test: ts.isModuleReference } ], - _a[245] = [ + _a[246] = [ { name: "expression", test: ts.isExpression, optional: true } ], - _a[260] = [ + _a[261] = [ { name: "name", test: ts.isPropertyName }, { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } ], @@ -36475,11 +36872,11 @@ var ts; } var result = initial; switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: - case 293: + case 223: + case 294: break; case 142: result = reduceNode(node.expression, cbNode, result); @@ -36620,72 +37017,72 @@ var ts; result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 202: + case 203: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 204: + case 205: result = reduceNodes(node.statements, cbNodes, result); break; - case 205: + case 206: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207: + case 208: result = reduceNode(node.expression, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; case 210: - case 217: - result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 211: + case 218: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 212: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: case 213: + case 214: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216: - case 220: + case 217: + case 221: result = reduceNode(node.expression, cbNode, result); break; - case 218: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221: + case 222: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223: + case 224: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224: + case 225: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225: + case 226: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36694,7 +37091,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -36702,92 +37099,92 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 232: + case 233: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235: + case 236: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236: + case 237: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - break; case 238: - case 242: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 239: case 243: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 240: + case 244: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240: + case 241: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 246: + case 247: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247: case 248: + case 249: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); break; - case 250: + case 251: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251: - result = reduceNode(node.expression, cbNode, result); - break; case 252: result = reduceNode(node.expression, cbNode, result); break; case 253: result = reduceNode(node.expression, cbNode, result); + break; case 254: + result = reduceNode(node.expression, cbNode, result); + case 255: result = reduceNodes(node.statements, cbNodes, result); break; - case 255: + case 256: result = reduceNodes(node.types, cbNodes, result); break; - case 256: + case 257: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 257: + case 258: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.expression, cbNode, result); break; - case 261: + case 262: result = reduceNodes(node.statements, cbNodes, result); break; - case 294: + case 295: result = reduceNode(node.expression, cbNode, result); break; default: @@ -36928,10 +37325,10 @@ var ts; return node; } switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: + case 223: return node; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); @@ -36999,101 +37396,101 @@ var ts; return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 199: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 202: + case 203: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 205: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 206: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 221: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 222: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 226: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 227: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232: + case 233: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 243: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 244: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 259: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 260: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 261: + case 262: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: + case 295: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -37181,7 +37578,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -37585,15 +37982,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: + case 262: + case 233: case 232: - case 231: - case 204: + case 205: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 227: case 226: - case 225: if (ts.hasModifier(node, 2)) { break; } @@ -37618,13 +38015,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 240: - return visitExportAssignment(node); case 241: + return visitExportAssignment(node); + case 242: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -37634,11 +38031,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || + if (node.kind === 242 || node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + node.kind === 237 || + (node.kind === 235 && + node.moduleReference.kind === 246)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -37662,7 +38059,7 @@ var ts; case 152: case 149: return visitorWorker(node); - case 203: + case 204: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -37719,18 +38116,18 @@ var ts; case 171: case 155: case 145: - case 228: + case 229: case 147: return undefined; case 150: return visitConstructor(node); - case 227: + case 228: return ts.createNotEmittedStatement(node); - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); - case 255: + case 256: return visitHeritageClause(node); case 199: return visitExpressionWithTypeArguments(node); @@ -37740,7 +38137,7 @@ var ts; return visitGetAccessor(node); case 152: return visitSetAccessor(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -37759,15 +38156,15 @@ var ts; return visitNewExpression(node); case 201: return visitNonNullExpression(node); - case 229: - return visitEnumDeclaration(node); - case 205: - return visitVariableStatement(node); - case 223: - return visitVariableDeclaration(node); case 230: + return visitEnumDeclaration(node); + case 206: + return visitVariableStatement(node); + case 224: + return visitVariableDeclaration(node); + case 231: return visitModuleDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -37921,7 +38318,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -38206,7 +38603,7 @@ var ts; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 226: + case 227: case 197: return ts.getFirstConstructorWithBody(node) !== undefined; case 149: @@ -38224,7 +38621,7 @@ var ts; return serializeTypeNode(node.type); case 152: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: + case 227: case 197: case 149: return ts.createIdentifier("Function"); @@ -38281,6 +38678,9 @@ var ts; } switch (node.kind) { case 104: + case 137: + case 94: + case 129: return ts.createVoidZero(); case 166: return serializeTypeNode(node.type); @@ -38319,29 +38719,7 @@ var ts; return serializeTypeReferenceNode(node); case 165: case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } + return serializeUnionOrIntersectionType(node); case 160: case 168: case 169: @@ -38356,6 +38734,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -38682,7 +39086,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 230) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -38742,8 +39146,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 232) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -38765,13 +39169,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + if (body.kind !== 232) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 231) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -38791,7 +39195,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 238) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -38926,15 +39330,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(259); + context.enableEmitNotification(231); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 230; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -39007,9 +39411,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 262) { + var substitute = (applicableSubstitutions & 2 && container.kind === 231) || + (applicableSubstitutions & 8 && container.kind === 230); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -39124,11 +39528,11 @@ var ts; return visitObjectLiteralExpression(node); case 192: return visitBinaryExpression(node, noDestructuringValue); - case 223: + case 224: return visitVariableDeclaration(node); - case 213: + case 214: return visitForOfStatement(node); - case 211: + case 212: return visitForStatement(node); case 188: return visitVoidExpression(node); @@ -39140,7 +39544,7 @@ var ts; return visitGetAccessorDeclaration(node); case 152: return visitSetAccessorDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -39148,7 +39552,7 @@ var ts; return visitArrowFunction(node); case 144: return visitParameter(node); - case 207: + case 208: return visitExpressionStatement(node); case 183: return visitParenthesizedExpression(node, noDestructuringValue); @@ -39161,7 +39565,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 259) { + if (e.kind === 260) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -39173,7 +39577,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257) { + if (e.kind === 258) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -39346,11 +39750,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: - return visitJsxElement(node, false); case 247: + return visitJsxElement(node, false); + case 248: return visitJsxSelfClosingElement(node, false); - case 252: + case 253: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -39360,11 +39764,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 253: return visitJsxExpression(node); - case 246: - return visitJsxElement(node, true); case 247: + return visitJsxElement(node, true); + case 248: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -39418,7 +39822,10 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 252) { + else if (node.kind === 253) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } return visitJsxExpression(node); } else { @@ -39483,7 +39890,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 247) { return getTagName(node.openingElement); } else { @@ -39802,7 +40209,7 @@ var ts; return visitAwaitExpression(node); case 149: return visitMethodDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -39901,7 +40308,7 @@ var ts; context.enableSubstitution(179); context.enableSubstitution(177); context.enableSubstitution(178); - context.enableEmitNotification(226); + context.enableEmitNotification(227); context.enableEmitNotification(149); context.enableEmitNotification(151); context.enableEmitNotification(152); @@ -39957,7 +40364,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 226 + return kind === 227 || kind === 150 || kind === 149 || kind === 151 @@ -40096,15 +40503,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; var convertedLoopState; var enabledSubstitutions; return transformSourceFile; @@ -40114,178 +40513,104 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; + return hierarchyFacts & 4096 + && node.kind === 217 + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); case 144: return visitParameter(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 185: return visitArrowFunction(node); case 184: return visitFunctionExpression(node); - case 223: + case 224: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 225: return visitVariableDeclarationList(node); case 219: + return visitSwitchStatement(node); + case 233: + return visitCaseBlock(node); + case 205: + return visitBlock(node, false); + case 216: + case 215: + return visitBreakOrContinueStatement(node); + case 220: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); + return visitDoOrWhileStatement(node, undefined); case 212: - return visitForInStatement(node); + return visitForStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForInStatement(node, undefined); + case 214: + return visitForOfStatement(node, undefined); + case 208: return visitExpressionStatement(node); case 176: return visitObjectLiteralExpression(node); - case 256: + case 257: return visitCatchClause(node); - case 258: + case 259: return visitShorthandPropertyAssignment(node); + case 142: + return visitComputedPropertyName(node); case 175: return visitArrayLiteralExpression(node); case 179: @@ -40310,51 +40635,80 @@ var ts; case 196: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 202: + return visitMetaProperty(node); case 149: return visitMethodDeclaration(node); - case 205: + case 151: + case 152: + return visitAccessorDeclaration(node); + case 206: return visitVariableStatement(node); + case 217: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); addCaptureThisForNodeIfNeeded(statements, node); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); + exitSubtree(ancestorFacts, 0, 0); return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -40370,13 +40724,13 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; + var jump = node.kind === 216 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 216) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -40386,7 +40740,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 216) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -40485,6 +40839,9 @@ var ts; } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); @@ -40492,6 +40849,8 @@ var ts; ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -40512,23 +40871,26 @@ var ts; addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { ts.setEmitFlags(block, 1536); @@ -40536,17 +40898,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 217) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 209) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 205) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -40554,8 +40916,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -40575,9 +40937,8 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } if (superCallExpression @@ -40592,17 +40953,17 @@ var ts; statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { @@ -40698,21 +41059,53 @@ var ts; ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 185: + return statements; + case 149: + case 151: + case 152: + newTarget = ts.createVoidZero(); + break; + case 150: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 226: + case 184: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 204: statements.push(transformSemicolonClassElementToStatement(member)); break; case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 151: case 152: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; case 150: @@ -40726,26 +41119,29 @@ var ts; function transformSemicolonClassElementToStatement(member) { return ts.createEmptyStatement(member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false), ts.getSourceMapRange(accessors.firstAccessor)); ts.setEmitFlags(statement, 1536); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -40754,7 +41150,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -40762,7 +41158,7 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); @@ -40778,35 +41174,69 @@ var ts; if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body, location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -40853,6 +41283,7 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } @@ -40866,6 +41297,21 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -40890,9 +41336,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -40909,49 +41358,54 @@ var ts; } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -40967,48 +41421,51 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels[node.label.text] = node.label.text; + } + function resetLabel(node) { + convertedLoopState.labels[node.label.text] = undefined; + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, convertForOfToFor); } - function convertForOfToFor(node, convertedLoopBodyStatements) { + function convertForOfToFor(node, outermostLabeledStatement, convertedLoopBodyStatements) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var initializer = node.initializer; var statements = []; @@ -41071,31 +41528,53 @@ var ts; ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); ts.setEmitFlags(forStatement, 256); - return forStatement; + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 210: + case 211: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 212: + return visitForStatement(node, outermostLabeledStatement); + case 213: + return visitForInStatement(node, outermostLabeledStatement); + case 214: + return visitForOfStatement(node, outermostLabeledStatement); + } } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 142) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -41119,14 +41598,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -41135,11 +41616,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: case 212: case 213: + case 214: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 225) { loopInitializer = initializer; } break; @@ -41166,7 +41647,7 @@ var ts; } } startLexicalEnvironment(); - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; @@ -41178,11 +41659,13 @@ var ts; ts.addRange(statements_4, lexicalEnvironment); loopBody = ts.createBlock(statements_4, undefined, true); } - if (!ts.isBlock(loopBody)) { + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = ts.createBlock([loopBody], undefined, true); } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -41241,19 +41724,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -41367,17 +41849,17 @@ var ts; case 152: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: - expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); + case 149: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; case 258: - expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); + expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); + case 259: + expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: ts.Debug.failBadSyntaxKind(node); @@ -41399,21 +41881,31 @@ var ts; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container), method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -41421,21 +41913,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; + } function visitShorthandPropertyAssignment(node) { return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; + } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -41447,25 +41961,27 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; @@ -41563,21 +42079,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(emitContext, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -41595,7 +42124,7 @@ var ts; context.enableEmitNotification(152); context.enableEmitNotification(185); context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(226); } } function onSubstituteNode(emitContext, node) { @@ -41621,9 +42150,9 @@ var ts; var parent = node.parent; switch (parent.kind) { case 174: - case 226: - case 229: - case 223: + case 227: + case 230: + case 224: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -41649,8 +42178,7 @@ var ts; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { + && hierarchyFacts & 16) { return ts.createIdentifier("_this", node); } return node; @@ -41667,7 +42195,7 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { return false; } var statementExpression = statement.expression; @@ -41698,7 +42226,7 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; @@ -41775,13 +42303,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 218: - return visitSwitchStatement(node); case 219: + return visitSwitchStatement(node); + case 220: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -41789,24 +42317,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); case 151: case 152: return visitAccessorDeclaration(node); - case 205: + case 206: return visitVariableStatement(node); - case 211: - return visitForStatement(node); case 212: + return visitForStatement(node); + case 213: return visitForInStatement(node); - case 215: - return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitBreakStatement(node); + case 215: + return visitContinueStatement(node); + case 217: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -41844,7 +42372,7 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -42031,10 +42559,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -42096,7 +42624,7 @@ var ts; emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); @@ -42156,10 +42684,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -42202,35 +42730,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 205: return transformAndEmitBlock(node); - case 207: - return transformAndEmitExpressionStatement(node); case 208: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 210: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 211: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 212: + return transformAndEmitForStatement(node); + case 213: return transformAndEmitForInStatement(node); - case 214: - return transformAndEmitContinueStatement(node); case 215: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 217: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 218: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 219: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 220: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 221: + return transformAndEmitThrowStatement(node); + case 222: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -42250,7 +42778,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name_37 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_37, variable.name); + hoistVariableDeclaration(name_37); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -42280,7 +42810,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -42514,7 +43044,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 255 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -42524,7 +43054,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 254) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -42645,12 +43175,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_37) { - var clone_6 = ts.getMutableClone(name_37); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_38) { + var clone_7 = ts.getMutableClone(name_38); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -43260,41 +43790,41 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)]), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ]), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)]), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ]), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -43319,15 +43849,40 @@ var ts; var ts; (function (ts) { function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(249); + context.enableEmitNotification(250); + context.enableEmitNotification(248); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(177); - context.enableSubstitution(257); + context.enableSubstitution(258); return transformSourceFile; function transformSourceFile(node) { return node; } + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 249: + case 250: + case 248: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } node = previousOnSubstituteNode(emitContext, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); @@ -43369,7 +43924,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); + context.enableEmitNotification(262); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -43394,9 +43949,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234: + case 235: return undefined; - case 240: + case 241: return visitExportAssignment(node); } return node; @@ -43448,7 +44003,7 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableEmitNotification(261); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var exportFunctionsMap = ts.createMap(); @@ -43548,7 +44103,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { + if (externalImport.kind === 242 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -43571,7 +44126,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241) { + if (externalImport.kind !== 242) { continue; } var exportDecl = externalImport; @@ -43623,15 +44178,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235: + case 236: if (!entry.importClause) { break; } - case 234: + case 235: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241: + case 242: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -43653,13 +44208,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return undefined; - case 240: + case 241: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -43780,7 +44335,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 + && (enclosingBlockScopedContainer.kind === 262 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -43802,7 +44357,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -43835,10 +44390,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -43937,43 +44492,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitForStatement(node); case 213: + return visitForInStatement(node); + case 214: return visitForOfStatement(node); - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 219: + case 220: return visitLabeledStatement(node); - case 217: - return visitWithStatement(node); case 218: + return visitWithStatement(node); + case 219: return visitSwitchStatement(node); - case 232: + case 233: return visitCaseBlock(node); - case 253: - return visitCaseClause(node); case 254: + return visitCaseClause(node); + case 255: return visitDefaultClause(node); - case 221: + case 222: return visitTryStatement(node); - case 256: + case 257: return visitCatchClause(node); - case 204: + case 205: return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -44101,7 +44656,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; + return container !== undefined && container.kind === 262; } else { return false; @@ -44116,7 +44671,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -44228,7 +44783,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -44271,8 +44826,8 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); + context.enableSubstitution(259); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var currentSourceFile; @@ -44310,14 +44865,7 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); - } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; return ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ ts.createArrayLiteral([ @@ -44331,6 +44879,36 @@ var ts; ]))) ], node.statements)); } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], undefined, true)); + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ], node.statements)); + } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { var aliasedModuleNames = []; var unaliasedModuleNames = []; @@ -44390,23 +44968,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return visitExportDeclaration(node); - case 240: + case 241: return visitExportAssignment(node); - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return node; @@ -44604,7 +45182,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -44636,10 +45214,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -44747,7 +45325,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = ts.createMap(); @@ -44807,7 +45385,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -44816,8 +45394,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_38 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), node); + var name_39 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), node); } } } @@ -44881,7 +45459,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -45245,7 +45822,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -45258,7 +45835,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -45402,7 +45979,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -45416,7 +45993,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 225) { declarationListContainerEnd = end; } } @@ -45691,7 +46268,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 236); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -45763,10 +46340,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 224) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -45777,7 +46354,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 236) { moduleElementEmitInfo.isVisible = true; } else { @@ -45785,12 +46362,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -45961,7 +46538,7 @@ var ts; } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); @@ -46078,9 +46655,9 @@ var ts; var count = 0; while (true) { count++; - var name_39 = baseName + "_" + count; - if (!(name_39 in currentIdentifiers)) { - return name_39; + var name_40 = baseName + "_" + count; + if (!(name_40 in currentIdentifiers)) { + return name_40; } } } @@ -46124,10 +46701,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 235 || + (node.parent.kind === 262 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -46136,7 +46713,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 236) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -46154,30 +46731,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: - return writeFunctionDeclaration(node); - case 205: - return writeVariableStatement(node); - case 227: - return writeInterfaceDeclaration(node); case 226: - return writeClassDeclaration(node); + return writeFunctionDeclaration(node); + case 206: + return writeVariableStatement(node); case 228: - return writeTypeAliasDeclaration(node); + return writeInterfaceDeclaration(node); + case 227: + return writeClassDeclaration(node); case 229: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 230: + return writeEnumDeclaration(node); + case 231: return writeModuleDeclaration(node); - case 234: - return writeImportEqualsDeclaration(node); case 235: + return writeImportEqualsDeclaration(node); + case 236: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 262) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -46185,7 +46762,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 228 && !noDeclare) { write("declare "); } } @@ -46235,7 +46812,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 238) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -46258,7 +46835,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 238) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -46275,13 +46852,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 235) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 231) { moduleSpecifier = parent.name; } else { @@ -46349,7 +46926,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 232) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -46447,10 +47024,10 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 154: @@ -46464,17 +47041,17 @@ var ts; if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 227) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 226: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -46511,7 +47088,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 227) { 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; @@ -46594,7 +47171,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -46617,7 +47194,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 224) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -46632,7 +47209,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -46792,13 +47369,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 226) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 149 || node.kind === 150) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 226) { write("function "); writeTextOfNode(currentText, node.name); } @@ -46892,7 +47469,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -46905,7 +47482,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 226: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -46982,7 +47559,7 @@ var ts; 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 === 226) { + else if (node.parent.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -46994,7 +47571,7 @@ var ts; 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; } - case 225: + case 226: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47046,19 +47623,19 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: - case 227: case 226: - case 228: - case 229: - return emitModuleElement(node, isModuleElementVisible(node)); - case 205: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 231: case 235: + case 228: + case 227: + case 229: + case 230: + return emitModuleElement(node, isModuleElementVisible(node)); + case 206: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 236: return emitModuleElement(node, !node.importClause); - case 241: + case 242: return emitExportDeclaration(node); case 150: case 149: @@ -47074,11 +47651,11 @@ var ts; case 147: case 146: return emitPropertyDeclaration(node); - case 260: - return emitEnumMemberDeclaration(node); - case 240: - return emitExportAssignment(node); case 261: + return emitEnumMemberDeclaration(node); + case 241: + return emitExportAssignment(node); + case 262: return emitSourceFile(node); } } @@ -47286,7 +47863,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 261: + case 262: return emitSourceFile(node); } } @@ -47409,119 +47986,119 @@ var ts; return emitArrayBindingPattern(node); case 174: return emitBindingElement(node); - case 202: - return emitTemplateSpan(node); case 203: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 204: - return emitBlock(node); + return emitSemicolonClassElement(); case 205: - return emitVariableStatement(node); + return emitBlock(node); case 206: - return emitEmptyStatement(); + return emitVariableStatement(node); case 207: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 208: - return emitIfStatement(node); + return emitExpressionStatement(node); case 209: - return emitDoStatement(node); + return emitIfStatement(node); case 210: - return emitWhileStatement(node); + return emitDoStatement(node); case 211: - return emitForStatement(node); + return emitWhileStatement(node); case 212: - return emitForInStatement(node); + return emitForStatement(node); case 213: - return emitForOfStatement(node); + return emitForInStatement(node); case 214: - return emitContinueStatement(node); + return emitForOfStatement(node); case 215: - return emitBreakStatement(node); + return emitContinueStatement(node); case 216: - return emitReturnStatement(node); + return emitBreakStatement(node); case 217: - return emitWithStatement(node); + return emitReturnStatement(node); case 218: - return emitSwitchStatement(node); + return emitWithStatement(node); case 219: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 220: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 221: - return emitTryStatement(node); + return emitThrowStatement(node); case 222: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 223: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 224: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 225: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 226: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 227: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 228: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 229: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 230: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 231: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 232: + return emitModuleBlock(node); + case 233: return emitCaseBlock(node); - case 234: - return emitImportEqualsDeclaration(node); case 235: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 236: - return emitImportClause(node); + return emitImportDeclaration(node); case 237: - return emitNamespaceImport(node); + return emitImportClause(node); case 238: - return emitNamedImports(node); + return emitNamespaceImport(node); case 239: - return emitImportSpecifier(node); + return emitNamedImports(node); case 240: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 241: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 242: - return emitNamedExports(node); + return emitExportDeclaration(node); case 243: - return emitExportSpecifier(node); + return emitNamedExports(node); case 244: - return; + return emitExportSpecifier(node); case 245: + return; + case 246: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: - return emitJsxOpeningElement(node); case 249: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 250: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 251: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 252: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 253: - return emitCaseClause(node); + return emitJsxExpression(node); case 254: - return emitDefaultClause(node); + return emitCaseClause(node); case 255: - return emitHeritageClause(node); + return emitDefaultClause(node); case 256: - return emitCatchClause(node); + return emitHeritageClause(node); case 257: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 258: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 259: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 260: + return emitSpreadAssignment(node); + case 261: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -47598,14 +48175,14 @@ var ts; return emitAsExpression(node); case 201: return emitNonNullExpression(node); - case 246: - return emitJsxElement(node); + case 202: + return emitMetaProperty(node); case 247: + return emitJsxElement(node); + case 248: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -48050,6 +48627,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -48092,27 +48674,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 209) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -48122,7 +48704,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -48134,7 +48716,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -48144,7 +48726,7 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -48154,11 +48736,11 @@ var ts; write(" of "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224) { + if (node.kind === 225) { emit(node); } else { @@ -48185,7 +48767,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97, node.pos); @@ -48209,9 +48791,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -48387,7 +48972,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230) { + while (body.kind === 231) { write("."); emit(body.name); body = body.body; @@ -48538,6 +49123,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -48737,8 +49325,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { write(" "); emit(node); } @@ -48867,6 +49455,14 @@ var ts; write(getClosingBracket(format)); } } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } + else { + writeLine(); + } + } function writeIfAny(nodes, text) { if (nodes && nodes.length > 0) { write(text); @@ -49047,21 +49643,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_40 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_40)) { + var name_41 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_41)) { tempFlags |= flags; - return name_40; + return name_41; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_41 = count < 26 + var name_42 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_41)) { - return name_41; + if (isUniqueName(name_42)) { + return name_42; } } } @@ -49095,22 +49691,32 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(0); + } function generateNameForNode(node) { switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 231: case 230: - case 229: return generateNameForModuleOrEnum(node); - case 235: - case 241: + case 236: + case 242: return generateNameForImportOrExportDeclaration(node); - case 225: case 226: - case 240: + case 227: + case 241: return generateNameForExportDefault(); case 197: return generateNameForClassExpression(); + case 149: + case 151: + case 152: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); } @@ -49141,11 +49747,14 @@ var ts; } return node; } + function generateNameForNodeCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } function getGeneratedIdentifier(name) { if (name.autoGenerateKind === 4) { var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { var autoGenerateId = name.autoGenerateId; @@ -49214,7 +49823,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { return true; @@ -49397,10 +50007,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_42 = names_1[_i]; - var result = name_42 in cache - ? cache[name_42] - : cache[name_42] = loader(name_42, containingFile); + var name_43 = names_1[_i]; + var result = name_43 in cache + ? cache[name_43] + : cache[name_43] = loader(name_43, containingFile); resolutions.push(result); } return resolutions; @@ -49425,6 +50035,7 @@ var ts; var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -49437,7 +50048,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -49473,6 +50085,7 @@ var ts; } } } + moduleResolutionCache = undefined; oldProgram = undefined; program = { getRootFileNames: function () { return rootNames; }, @@ -49679,7 +50292,7 @@ var ts; newSourceFile.resolvedModules = oldSourceFile.resolvedModules; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -49837,42 +50450,42 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: - case 223: + case 226: + case 224: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 234: + case 235: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240: + case 241: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255: + case 256: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227: + case 228: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case 182: @@ -49890,23 +50503,23 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226: + case 227: case 149: case 148: case 150: case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: + case 226: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 205: + case 206: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); + return checkModifiers(nodes, parent.kind === 206); } break; case 147: @@ -50018,7 +50631,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); + var importDecl = ts.createSynthesizedNode(236); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -50036,9 +50649,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 236: case 235: - case 234: - case 241: + case 242: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -50050,7 +50663,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230: + case 231: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -51207,9 +51820,9 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_43 in options) { - if (ts.hasProperty(options, name_43)) { - switch (name_43) { + for (var name_44 in options) { + if (ts.hasProperty(options, name_44)) { + switch (name_44) { case "init": case "watch": case "version": @@ -51217,12 +51830,12 @@ var ts; case "project": break; default: - var value = options[name_43]; - var optionDefinition = optionsNameMap[name_43.toLowerCase()]; + var value = options[name_44]; + var optionDefinition = optionsNameMap[name_44.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { - result[name_43] = value; + result[name_44] = value; } else { if (optionDefinition.type === "list") { @@ -51231,10 +51844,10 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_43] = convertedValue; + result[name_44] = convertedValue; } else { - result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -51268,6 +51881,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -52084,17 +52698,17 @@ var ts; var nameSize = 0; var valueSize = 0; for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name_44 = _a.name, value = _a.value; - if (name_44.length > nameSize) { - nameSize = name_44.length; + var _a = statistics_1[_i], name_45 = _a.name, value = _a.value; + if (name_45.length > nameSize) { + nameSize = name_45.length; } if (value.length > valueSize) { valueSize = value.length; } } for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name_45 = _c.name, value = _c.value; - ts.sys.write(padRight(name_45 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); + var _c = statistics_2[_b], name_46 = _c.name, value = _c.value; + ts.sys.write(padRight(name_46 + ":", nameSize + 2) + padLeft(value.toString(), valueSize) + ts.sys.newLine); } } function reportStatisticalValue(name, value) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 9c17684ed0a..2d477ca2dcf 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { var OperationCanceledException = (function () { @@ -206,7 +211,7 @@ var ts; ts.toPath = toPath; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -225,7 +230,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +240,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -245,7 +250,7 @@ var ts; } ts.find = find; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +273,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +283,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -981,6 +986,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2475,7 +2481,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2632,6 +2638,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2861,6 +2868,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2870,6 +2879,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2921,6 +2931,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3089,6 +3101,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -3102,10 +3115,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -3154,6 +3167,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3210,22 +3225,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); var ts; @@ -3606,7 +3624,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3792,7 +3810,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -5539,6 +5557,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -6156,6 +6175,7 @@ var ts; newLineCharacter: host.newLine || "\n", convertTabsToSpaces: true, indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, insertSpaceAfterCommaDelimiter: true, insertSpaceAfterSemicolonInForStatements: true, insertSpaceBeforeAndAfterBinaryOperators: true, @@ -6163,8 +6183,10 @@ var ts; insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, placeOpenBraceOnNewLineForFunctions: false, placeOpenBraceOnNewLineForControlBlocks: false, }; @@ -6293,6 +6315,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -6300,9 +6328,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -6314,13 +6339,13 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2: - case 0: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -6382,6 +6407,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -6436,7 +6462,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -6452,7 +6482,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -6493,31 +6524,115 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_1 = ts.getDirectoryPath(current); + if (parent_1 === current || directoryPathMap.contains(parent_1)) { + break; + } + directoryPathMap.set(parent_1, result); + current = parent_1; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -6642,33 +6757,33 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -6685,10 +6800,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -6716,11 +6854,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -6729,19 +6867,21 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -6750,16 +6890,22 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -6769,73 +6915,117 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -6847,10 +7037,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -6981,7 +7174,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { + while (node && node.kind !== 262) { node = node.parent; } return node; @@ -6989,11 +7182,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: return true; } return false; @@ -7058,18 +7251,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 292 && node._children.length > 0) { + if (node.kind === 293 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; + return node.kind >= 263 && node.kind <= 289; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; + return node.kind >= 279 && node.kind <= 292; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7163,11 +7356,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + return node.kind === 224 && node.parent.kind === 257; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 && + return node && node.kind === 231 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -7176,11 +7369,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); + return node.kind === 231 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || + return node.kind === 262 || + node.kind === 231 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -7193,9 +7386,9 @@ var ts; return false; } switch (node.parent.kind) { - case 261: + case 262: return ts.isExternalModule(node.parent); - case 231: + case 232: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -7207,22 +7400,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261: - case 232: - case 256: - case 230: - case 211: + case 262: + case 233: + case 257: + case 231: case 212: case 213: + case 214: case 150: case 149: case 151: case 152: - case 225: + case 226: case 184: case 185: return true; - case 204: + case 205: return parentNode && !isFunctionLike(parentNode); } return false; @@ -7300,7 +7493,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { + if (node.body && node.body.kind === 205) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7312,26 +7505,26 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261: + case 262: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: + case 224: case 174: - case 226: - case 197: case 227: + case 197: + case 228: + case 231: case 230: - case 229: - case 260: - case 225: + case 261: + case 226: case 184: case 149: case 151: case 152: - case 228: + case 229: errorNode = node.name; break; case 185: @@ -7355,7 +7548,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + return node.kind === 230 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7372,7 +7565,7 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 + return node.kind === 208 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7429,24 +7622,24 @@ var ts; case 141: case 177: case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { + var parent_2 = node.parent; + if (parent_2.kind === 160) { return false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { + if (156 <= parent_2.kind && parent_2.kind <= 171) { return true; } - switch (parent_1.kind) { + switch (parent_2.kind) { case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); case 143: - return node === parent_1.constraint; + return node === parent_2.constraint; case 147: case 146: case 144: - case 223: - return node === parent_1.type; - case 225: + case 224: + return node === parent_2.type; + case 226: case 184: case 185: case 150: @@ -7454,16 +7647,16 @@ var ts; case 148: case 151: case 152: - return node === parent_1.type; + return node === parent_2.type; case 153: case 154: case 155: - return node === parent_1.type; + return node === parent_2.type; case 182: - return node === parent_1.type; + return node === parent_2.type; case 179: case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0; case 181: return false; } @@ -7471,27 +7664,41 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 190; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216: + case 217: return visitor(node); - case 232: - case 204: - case 208: + case 233: + case 205: case 209: case 210: case 211: case 212: case 213: - case 217: + case 214: case 218: - case 253: - case 254: case 219: - case 221: - case 256: + case 254: + case 255: + case 220: + case 222: + case 257: return ts.forEachChild(node, traverse); } } @@ -7507,11 +7714,11 @@ var ts; if (operand) { traverse(operand); } - case 229: - case 227: case 230: case 228: - case 226: + case 231: + case 229: + case 227: case 197: return; default: @@ -7545,13 +7752,13 @@ var ts; if (node) { switch (node.kind) { case 174: - case 260: + case 261: case 144: - case 257: + case 258: case 147: case 146: - case 258: - case 223: + case 259: + case 224: return true; } } @@ -7563,7 +7770,7 @@ var ts; } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + return node && (node.kind === 227 || node.kind === 197); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7574,7 +7781,7 @@ var ts; switch (kind) { case 150: case 184: - case 225: + case 226: case 185: case 149: case 148: @@ -7597,7 +7804,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: return true; } @@ -7606,20 +7813,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211: case 212: case 213: - case 209: + case 214: case 210: + case 211: return true; - case 219: + case 220: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatmentOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 220) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + return node && node.kind === 205 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -7683,9 +7902,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 225: + case 226: case 184: - case 230: + case 231: case 147: case 146: case 149: @@ -7696,13 +7915,26 @@ var ts; case 153: case 154: case 155: - case 229: - case 261: + case 230: + case 262: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 150: + case 226: + case 184: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -7713,7 +7945,7 @@ var ts; case 142: node = node.parent; break; - case 225: + case 226: case 184: case 185: if (!stopOnFunctions) { @@ -7742,13 +7974,13 @@ var ts; function getImmediatelyInvokedFunctionExpression(func) { if (func.kind === 184 || func.kind === 185) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent_3 = func.parent; + while (parent_3.kind === 183) { + prev = parent_3; + parent_3 = parent_3.parent; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + if (parent_3.kind === 179 && parent_3.expression === prev) { + return parent_3; } } } @@ -7762,7 +7994,7 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 157: - case 272: + case 273: return node.typeName; case 199: return isEntityNameExpression(node.expression) @@ -7796,21 +8028,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226: + case 227: return true; case 147: - return node.parent.kind === 226; + return node.parent.kind === 227; case 151: case 152: case 149: return node.body !== undefined - && node.parent.kind === 226; + && node.parent.kind === 227; case 144: return node.parent.body !== undefined && (node.parent.kind === 150 || node.parent.kind === 149 || node.parent.kind === 152) - && node.parent.parent.kind === 226; + && node.parent.parent.kind === 227; } return false; } @@ -7826,7 +8058,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226: + case 227: return ts.forEach(node.members, nodeOrChildIsDecorated); case 149: case 152: @@ -7836,9 +8068,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { + if (parent.kind === 249 || + parent.kind === 248 || + parent.kind === 250) { return parent.tagName === node; } return false; @@ -7877,10 +8109,11 @@ var ts; case 194: case 12: case 198: - case 246: case 247: + case 248: case 195: case 189: + case 202: return true; case 141: while (node.parent.kind === 141) { @@ -7894,53 +8127,53 @@ var ts; case 8: case 9: case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223: + var parent_4 = node.parent; + switch (parent_4.kind) { + case 224: case 144: case 147: case 146: - case 260: - case 257: + case 261: + case 258: case 174: - return parent_3.initializer === node; - case 207: + return parent_4.initializer === node; case 208: case 209: case 210: - case 216: + case 211: case 217: case 218: - case 253: - case 220: - case 218: - return parent_3.expression === node; - case 211: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || + case 219: + case 254: + case 221: + case 219: + return parent_4.expression === node; + case 212: + var forStatement = parent_4; + return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || forStatement.condition === node || forStatement.incrementor === node; - case 212: case 213: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || + case 214: + var forInStatement = parent_4; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || forInStatement.expression === node; case 182: case 200: - return node === parent_3.expression; - case 202: - return node === parent_3.expression; + return node === parent_4.expression; + case 203: + return node === parent_4.expression; case 142: - return node === parent_3.expression; + return node === parent_4.expression; case 145: + case 253: case 252: - case 251: - case 259: + case 260: return true; case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent_4)) { return true; } } @@ -7955,7 +8188,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + return node.kind === 235 && node.moduleReference.kind === 246; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7964,7 +8197,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + return node.kind === 235 && node.moduleReference.kind !== 246; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7988,7 +8221,7 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { + if (s.valueDeclaration && s.valueDeclaration.kind === 224) { var declaration = s.valueDeclaration; return declaration.initializer && declaration.initializer.kind === 184; } @@ -8035,35 +8268,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node.moduleSpecifier; } - if (node.kind === 234) { + if (node.kind === 235) { var reference = node.moduleReference; - if (reference.kind === 245) { + if (reference.kind === 246) { return reference.expression; } } - if (node.kind === 241) { + if (node.kind === 242) { return node.moduleSpecifier; } - if (node.kind === 230 && node.name.kind === 9) { + if (node.kind === 231 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 + return node.kind === 236 && node.importClause && !!node.importClause.name; } @@ -8074,8 +8307,8 @@ var ts; case 144: case 149: case 148: + case 259: case 258: - case 257: case 147: case 146: return node.questionToken !== undefined; @@ -8085,9 +8318,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 && + return node.kind === 275 && node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + node.parameters[0].type.kind === 277; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -8100,7 +8333,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281) { + if (doc.kind === 282) { if (doc.kind === kind) { result.push(doc); } @@ -8126,9 +8359,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205; + parent.parent.parent.kind === 206; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; + parent.parent.kind === 206; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -8138,13 +8371,13 @@ var ts; var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 192 && parent.operatorToken.kind === 57 && - parent.parent.kind === 207; + parent.parent.kind === 208; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; + var isModuleDeclaration = node.kind === 231 && + parent && parent.kind === 231; + var isPropertyAssignmentExpression = parent && parent.kind === 258; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } @@ -8162,17 +8395,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281); + var tags = getJSDocTags(func, 282); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); + return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_8; }); } else { return undefined; @@ -8180,7 +8413,7 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 144) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -8191,15 +8424,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 281); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -8212,8 +8445,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { + if (node.type && node.type.kind === 276 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { return true; } } @@ -8237,19 +8470,19 @@ var ts; case 191: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: case 213: + case 214: return parent.initializer === node ? 1 : 0; case 183: case 175: case 196: node = parent; break; - case 258: + case 259: if (parent.name !== node) { return 0; } - case 257: + case 258: node = parent.parent; break; default: @@ -8263,6 +8496,17 @@ var ts; return getAssignmentTargetKind(node) !== 0; } ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 177 && node.kind !== 178) { + return false; + } + node = node.parent; + while (node && node.kind === 183) { + node = node.parent; + } + return node && node.kind === 186; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -8274,7 +8518,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8287,7 +8531,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { + if (parent.kind === 240 || parent.kind === 244) { if (parent.propertyName) { return true; } @@ -8313,8 +8557,8 @@ var ts; case 148: case 151: case 152: - case 260: - case 257: + case 261: + case 258: case 177: return parent.name === node; case 141: @@ -8326,22 +8570,22 @@ var ts; } return false; case 174: - case 239: + case 240: return parent.propertyName === node; - case 243: + case 244: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || - node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + return node.kind === 235 || + node.kind === 234 || + node.kind === 237 && !!node.name || + node.kind === 238 || + node.kind === 240 || + node.kind === 244 || + node.kind === 241 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8521,13 +8765,13 @@ var ts; var kind = node.kind; return kind === 150 || kind === 184 - || kind === 225 + || kind === 226 || kind === 185 || kind === 149 || kind === 151 || kind === 152 - || kind === 230 - || kind === 261; + || kind === 231 + || kind === 262; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8649,14 +8893,13 @@ var ts; case 184: case 185: case 197: - case 246: case 247: + case 248: case 11: case 12: case 194: case 183: case 198: - case 297: return 19; case 181: case 177: @@ -8830,13 +9073,12 @@ var ts; "\u0085": "\\u0085" }); function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -9712,8 +9954,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229: case 230: + case 231: return parseNode === parseNode.parent.name; } } @@ -9731,7 +9973,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { + if (declaration.kind === 227 && declaration !== node) { return true; } } @@ -9782,6 +10024,10 @@ var ts; return node.kind === 70; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { return isIdentifier(node) && node.autoGenerateKind > 0; } @@ -9849,18 +10095,18 @@ var ts; || kind === 151 || kind === 152 || kind === 155 - || kind === 203; + || kind === 204; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 - || kind === 258 + return kind === 258 || kind === 259 + || kind === 260 || kind === 149 || kind === 151 || kind === 152 - || kind === 244; + || kind === 245; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { @@ -9913,7 +10159,7 @@ var ts; ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223: + case 224: case 144: case 174: return true; @@ -9991,8 +10237,8 @@ var ts; || kind === 178 || kind === 180 || kind === 179 - || kind === 246 || kind === 247 + || kind === 248 || kind === 181 || kind === 175 || kind === 183 @@ -10011,7 +10257,7 @@ var ts; || kind === 100 || kind === 96 || kind === 201 - || kind === 297; + || kind === 202; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10039,7 +10285,6 @@ var ts; || kind === 196 || kind === 200 || kind === 198 - || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10053,11 +10298,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294; + return node.kind === 295; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293; + return node.kind === 294; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10070,11 +10315,11 @@ var ts; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 202; + return node.kind === 203; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 204; + return node.kind === 205; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10092,121 +10337,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223; + return node.kind === 224; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232; + return node.kind === 233; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 - || kind === 230; + return kind === 232 + || kind === 231; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236; + return node.kind === 237; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239; + return node.kind === 240; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242; + return node.kind === 243; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243; + return node.kind === 244; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; + return node.kind === 231 || node.kind === 230; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { return kind === 185 || kind === 174 - || kind === 226 + || kind === 227 || kind === 197 || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 + || kind === 230 + || kind === 261 + || kind === 244 + || kind === 226 || kind === 184 || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 - || kind === 227 + || kind === 237 + || kind === 235 + || kind === 240 + || kind === 228 || kind === 149 || kind === 148 - || kind === 230 - || kind === 233 - || kind === 237 + || kind === 231 + || kind === 234 + || kind === 238 || kind === 144 - || kind === 257 + || kind === 258 || kind === 147 || kind === 146 || kind === 152 - || kind === 258 - || kind === 228 + || kind === 259 + || kind === 229 || kind === 143 - || kind === 223 - || kind === 285; + || kind === 224 + || kind === 286; } function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 + return kind === 226 + || kind === 245 || kind === 227 || kind === 228 || kind === 229 || kind === 230 + || kind === 231 + || kind === 236 || kind === 235 - || kind === 234 + || kind === 242 || kind === 241 - || kind === 240 - || kind === 233; + || kind === 234; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 - || kind === 214 - || kind === 222 - || kind === 209 - || kind === 207 - || kind === 206 - || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 - || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 + return kind === 216 + || kind === 215 + || kind === 223 || kind === 210 + || kind === 208 + || kind === 207 + || kind === 213 + || kind === 214 + || kind === 212 + || kind === 209 + || kind === 220 || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; + || kind === 219 + || kind === 221 + || kind === 222 + || kind === 206 + || kind === 211 + || kind === 218 + || kind === 294 + || kind === 297 + || kind === 296; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10224,22 +10469,22 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204; + || kind === 205; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 245 + return kind === 246 || kind === 141 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 248; + return node.kind === 249; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { @@ -10251,60 +10496,60 @@ var ts; ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 + return kind === 247 + || kind === 253 + || kind === 248 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 - || kind === 251; + return kind === 251 + || kind === 252; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 252; + || kind === 253; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 - || kind === 254; + return kind === 254 + || kind === 255; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255; + return node.kind === 256; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 261; + return node.kind === 262; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10445,7 +10690,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 143) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { return current; } } @@ -10465,14 +10710,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= ts.getModifierFlags(node); } return flags; @@ -10481,14 +10726,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= node.flags; } return flags; @@ -10547,7 +10792,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 + var ConstructorForKind = kind === 262 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -11243,7 +11488,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + var node = createNode(203, location); node.expression = expression; node.literal = literal; return node; @@ -11257,7 +11502,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + var block = createNode(205, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11273,7 +11518,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + var node = createNode(206, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11288,7 +11533,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11301,7 +11546,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); + var node = createNode(224, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11316,11 +11561,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(206, location); + return createNode(207, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); + var node = createNode(208, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11333,7 +11578,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + var node = createNode(209, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11348,7 +11593,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.statement = statement; node.expression = expression; return node; @@ -11362,7 +11607,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.expression = expression; node.statement = statement; return node; @@ -11376,7 +11621,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + var node = createNode(212, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11392,7 +11637,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + var node = createNode(213, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11407,7 +11652,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11422,7 +11667,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(214, location); + var node = createNode(215, location); if (label) { node.label = label; } @@ -11437,7 +11682,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -11452,7 +11697,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(216, location); + var node = createNode(217, location); node.expression = expression; return node; } @@ -11465,7 +11710,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; node.statement = statement; return node; @@ -11479,7 +11724,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11493,7 +11738,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11507,7 +11752,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.expression = expression; return node; } @@ -11520,7 +11765,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11535,7 +11780,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(232, location); + var node = createNode(233, location); node.clauses = createNodeArray(clauses); return node; } @@ -11548,7 +11793,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11568,7 +11813,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); + var node = createNode(227, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11586,7 +11831,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); + var node = createNode(236, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11602,7 +11847,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11616,7 +11861,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; return node; } @@ -11629,7 +11874,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.elements = createNodeArray(elements); return node; } @@ -11642,7 +11887,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.propertyName = propertyName; node.name = name; return node; @@ -11656,7 +11901,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11672,7 +11917,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11688,7 +11933,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.elements = createNodeArray(elements); return node; } @@ -11701,7 +11946,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11715,7 +11960,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + var node = createNode(247, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11730,7 +11975,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11744,7 +11989,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11758,7 +12003,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; return node; } @@ -11771,7 +12016,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.name = name; node.initializer = initializer; return node; @@ -11785,7 +12030,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.expression = expression; return node; } @@ -11797,21 +12042,22 @@ var ts; return node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(expression, dotDotDotToken, location) { + var node = createNode(253, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11825,7 +12071,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11839,7 +12085,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.statements = createNodeArray(statements); return node; } @@ -11852,7 +12098,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11866,7 +12112,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11881,14 +12127,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -11909,7 +12155,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createNode(262, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -11969,27 +12215,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createNode(294, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + var node = createNode(295, location || original); node.expression = expression; node.original = original; return node; @@ -12002,12 +12248,6 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; - return node; - } - ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -12171,6 +12411,19 @@ var ts; return setEmitFlags(createIdentifier(name), 4096 | 2); } ts.getHelperName = getHelperName; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12270,9 +12523,9 @@ var ts; case 151: case 152: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: - return createExpressionForPropertyAssignment(property, receiver); case 258: + return createExpressionForPropertyAssignment(property, receiver); + case 259: return createExpressionForShorthandPropertyAssignment(property, receiver); case 149: return createExpressionForMethodDeclaration(property, receiver); @@ -12630,7 +12883,7 @@ var ts; case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -12678,7 +12931,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -12738,7 +12991,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { + if (node.kind === 262) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -12929,10 +13182,10 @@ var ts; var name_11 = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { + if (node.kind === 236 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { + if (node.kind === 242 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -12996,11 +13249,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 258: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: + return bindingElement.name; + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -13020,7 +13273,7 @@ var ts; case 174: return bindingElement.dotDotDotToken; case 196: - case 259: + case 260: return bindingElement; } return undefined; @@ -13036,7 +13289,7 @@ var ts; : propertyName; } break; - case 257: + case 258: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13044,7 +13297,7 @@ var ts; : propertyName; } break; - case 259: + case 260: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -13149,15 +13402,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 236: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 235: + if (node.moduleReference.kind === 246) { externalImports.push(node); } break; - case 241: + case 242: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13184,12 +13437,12 @@ var ts; } } break; - case 240: + case 241: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 206: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13197,7 +13450,7 @@ var ts; } } break; - case 225: + case 226: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -13215,7 +13468,7 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -13263,7 +13516,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 262) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { @@ -13312,20 +13565,20 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 258: + case 259: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 260: return visitNode(cbNode, node.expression); case 144: case 147: case 146: - case 257: - case 223: + case 258: + case 224: case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13351,7 +13604,7 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13443,6 +13696,8 @@ var ts; visitNode(cbNode, node.type); case 201: return visitNode(cbNode, node.expression); + case 202: + return visitNode(cbNode, node.name); case 193: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || @@ -13451,84 +13706,77 @@ var ts; visitNode(cbNode, node.whenFalse); case 196: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 205: + case 232: return visitNodes(cbNodes, node.statements); - case 261: + case 262: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 206: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 225: return visitNodes(cbNodes, node.declarations); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 210: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 211: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 212: return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 214: - case 215: - return visitNode(cbNode, node.label); - case 216: - return visitNode(cbNode, node.expression); - case 217: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 215: + case 216: + return visitNode(cbNode, node.label); + case 217: + return visitNode(cbNode, node.expression); case 218: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 233: return visitNodes(cbNodes, node.clauses); - case 253: + case 254: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 255: return visitNodes(cbNodes, node.statements); - case 219: + case 220: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: - return visitNode(cbNode, node.expression); case 221: + return visitNode(cbNode, node.expression); + case 222: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 257: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 145: return visitNode(cbNode, node.expression); - case 226: - case 197: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 227: + case 197: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -13540,143 +13788,151 @@ var ts; visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 260: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 230: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 261: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 237: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: - return visitNode(cbNode, node.name); - case 237: + case 234: return visitNode(cbNode, node.name); case 238: - case 242: + return visitNode(cbNode, node.name); + case 239: + case 243: return visitNodes(cbNodes, node.elements); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 240: + case 244: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 241: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 142: return visitNode(cbNode, node.expression); - case 255: + case 256: return visitNodes(cbNodes, node.types); case 199: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: - return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNode(cbNode, node.expression); + case 245: + return visitNodes(cbNodes, node.decorators); + case 247: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: case 248: + case 249: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 250: + case 251: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.expression); - case 249: + case 253: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 250: return visitNode(cbNode, node.tagName); - case 262: + case 263: return visitNode(cbNode, node.type); - case 266: - return visitNodes(cbNodes, node.types); case 267: return visitNodes(cbNodes, node.types); - case 265: + case 268: + return visitNodes(cbNodes, node.types); + case 266: return visitNode(cbNode, node.elementType); + case 270: + return visitNode(cbNode, node.type); case 269: return visitNode(cbNode, node.type); - case 268: - return visitNode(cbNode, node.type); - case 270: + case 271: return visitNode(cbNode, node.literal); - case 272: + case 273: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: - return visitNode(cbNode, node.type); case 274: + return visitNode(cbNode, node.type); + case 275: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: - return visitNode(cbNode, node.type); case 276: return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); - case 271: + case 278: + return visitNode(cbNode, node.type); + case 272: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 279: return visitNodes(cbNodes, node.tags); - case 281: + case 282: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); case 283: return visitNode(cbNode, node.typeExpression); - case 280: - return visitNode(cbNode, node.typeExpression); case 284: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 281: + return visitNode(cbNode, node.typeExpression); case 285: + return visitNodes(cbNodes, node.typeParameters); + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 288: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 289: return visitNode(cbNode, node.literal); } } @@ -13840,7 +14096,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14459,7 +14715,7 @@ var ts; case 151: case 152: case 147: - case 203: + case 204: return true; case 149: var methodDeclaration = node; @@ -14473,8 +14729,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: case 254: + case 255: return true; } } @@ -14483,42 +14739,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: + case 226: + case 206: case 205: - case 204: + case 209: case 208: - case 207: - case 220: + case 221: + case 217: + case 219: case 216: - case 218: case 215: + case 213: case 214: case 212: - case 213: case 211: - case 210: - case 217: - case 206: - case 221: - case 219: - case 209: + case 218: + case 207: case 222: + case 220: + case 210: + case 223: + case 236: case 235: - case 234: + case 242: case 241: - case 240: - case 230: - case 226: + case 231: case 227: - case 229: case 228: + case 230: + case 229: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } function isReusableTypeMember(node) { if (node) { @@ -14534,7 +14790,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 224) { return false; } var variableDeclarator = node; @@ -14666,7 +14922,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(203); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -15791,8 +16047,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 249) { + var node = createNode(247, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15802,7 +16058,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 248); result = opening; } if (inExpressionContext && token() === 26) { @@ -15862,7 +16118,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(249, fullStart); scanJsxText(); } else { @@ -15874,7 +16130,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(248, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15893,9 +16149,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(253); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -15912,7 +16169,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(251); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15927,7 +16184,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(252); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15935,7 +16192,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(250); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -16152,7 +16409,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(260, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16171,7 +16428,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(259, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16182,7 +16439,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(258, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16228,8 +16485,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(202, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(180, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16238,7 +16502,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(205); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16269,12 +16533,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(207); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(209); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16284,7 +16548,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16295,7 +16559,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16318,21 +16582,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(212, pos); + var forInStatement = createNode(213, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + var forOfStatement = createNode(214, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(212, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16350,7 +16614,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 216 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16358,7 +16622,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16367,7 +16631,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16376,7 +16640,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(254); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16384,7 +16648,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16394,12 +16658,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(233, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16407,14 +16671,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(221); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16425,7 +16689,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(257); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16435,7 +16699,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16444,13 +16708,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(220, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(208, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16602,9 +16866,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); - case 71: return parseBreakOrContinueStatement(215); + case 71: + return parseBreakOrContinueStatement(216); case 95: return parseReturnStatement(); case 106: @@ -16683,7 +16947,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16755,7 +17019,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(224); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16764,7 +17028,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(225); switch (token()) { case 103: break; @@ -16793,7 +17057,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(206, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16801,7 +17065,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(226, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16986,7 +17250,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(204); nextToken(); return finishNode(result); } @@ -17020,7 +17284,7 @@ var ts; return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -17055,7 +17319,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(255); + var node = createNode(256); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -17078,7 +17342,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -17089,7 +17353,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(136); @@ -17101,13 +17365,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(261, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17122,7 +17386,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(232, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17133,7 +17397,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17145,7 +17409,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (token() === 139) { @@ -17190,7 +17454,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(234, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17206,7 +17470,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); + var importEqualsDeclaration = createNode(235, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -17216,7 +17480,7 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(235, fullStart); + var importDeclaration = createNode(236, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || @@ -17230,13 +17494,13 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(237, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); } return finishNode(importClause); } @@ -17246,7 +17510,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(246); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17264,7 +17528,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(238); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17272,14 +17536,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(244); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(240); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17298,13 +17562,13 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 240 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { @@ -17312,7 +17576,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); + node.exportClause = parseNamedImportsOrExports(243); if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(138); node.moduleSpecifier = parseModuleSpecifier(); @@ -17322,7 +17586,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(241, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17401,10 +17665,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 + || node.kind === 235 && node.moduleReference.kind === 246 + || node.kind === 236 || node.kind === 241 + || node.kind === 242 ? node : undefined; }); @@ -17440,7 +17704,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(263, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17451,12 +17715,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(267, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(274, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17467,20 +17731,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(266, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(269, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(270, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17532,27 +17796,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(277); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(276); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(275); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17573,7 +17837,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(273); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17613,18 +17877,18 @@ var ts; return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(271); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(270); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17638,7 +17902,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(267); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17654,12 +17918,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(264); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(289); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17672,11 +17936,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(265, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(269, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17820,7 +18084,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(279, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -17930,7 +18194,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -17985,7 +18249,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -17996,20 +18260,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -18024,7 +18288,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -18033,7 +18297,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -18042,7 +18306,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -18056,7 +18320,7 @@ var ts; typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 273) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { var name_16 = jsDocTypeReference.name; @@ -18074,7 +18338,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18115,7 +18379,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(231, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18159,7 +18423,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); @@ -18182,7 +18446,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18474,7 +18738,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -18501,16 +18765,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 228 || node.kind === 229) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 232) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18526,7 +18790,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 231) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18635,7 +18899,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { symbol.valueDeclaration = node; } } @@ -18666,9 +18930,9 @@ var ts; return "__new"; case 155: return "__index"; - case 241: + case 242: return "__export"; - case 240: + case 241: return node.isExportEquals ? "export=" : "default"; case 192: switch (ts.getSpecialPropertyAssignmentKind(node)) { @@ -18682,20 +18946,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: case 226: + case 227: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 275: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 144: - ts.Debug.assert(node.parent.kind === 274); + ts.Debug.assert(node.parent.kind === 275); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 286: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 206) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18739,7 +19003,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18759,7 +19023,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18767,7 +19031,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18828,7 +19092,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 262) { node.flags |= emitFlags; } if (isIIFE) { @@ -18904,43 +19168,43 @@ var ts; return; } switch (node.kind) { - case 210: + case 211: bindWhileStatement(node); break; - case 209: + case 210: bindDoStatement(node); break; - case 211: + case 212: bindForStatement(node); break; - case 212: case 213: + case 214: bindForInOrForOfStatement(node); break; - case 208: + case 209: bindIfStatement(node); break; - case 216: - case 220: + case 217: + case 221: bindReturnOrThrow(node); break; + case 216: case 215: - case 214: bindBreakOrContinueStatement(node); break; - case 221: + case 222: bindTryStatement(node); break; - case 218: + case 219: bindSwitchStatement(node); break; - case 232: + case 233: bindCaseBlock(node); break; - case 253: + case 254: bindCaseClause(node); break; - case 219: + case 220: bindLabeledStatement(node); break; case 190: @@ -18958,7 +19222,7 @@ var ts; case 193: bindConditionalExpressionFlow(node); break; - case 223: + case 224: bindVariableDeclarationFlow(node); break; case 179: @@ -19124,11 +19388,11 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: - case 210: case 209: - return parent.expression === node; case 211: + case 210: + return parent.expression === node; + case 212: case 193: return parent.condition === node; } @@ -19192,7 +19456,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 220 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19227,7 +19491,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 225) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19249,7 +19513,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 217) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19269,7 +19533,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 216 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19326,7 +19590,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19391,7 +19655,7 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 210) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } @@ -19422,13 +19686,13 @@ var ts; else if (node.kind === 176) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 258) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 259) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.expression); } } @@ -19528,7 +19792,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { bindInitializedVariableFlow(node); } } @@ -19555,28 +19819,28 @@ var ts; function getContainerFlags(node) { switch (node.kind) { case 197: - case 226: - case 229: + case 227: + case 230: case 176: case 161: - case 287: - case 270: + case 288: + case 271: return 1; - case 227: - return 1 | 64; - case 274: - case 230: case 228: + return 1 | 64; + case 275: + case 231: + case 229: case 170: return 1 | 32; - case 261: + case 262: return 1 | 4 | 32; case 149: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } case 150: - case 225: + case 226: case 148: case 151: case 152: @@ -19589,17 +19853,17 @@ var ts; case 184: case 185: return 1 | 4 | 32 | 8 | 16; - case 231: + case 232: return 4; case 147: return node.initializer ? 4 : 0; - case 256: - case 211: + case 257: case 212: case 213: - case 232: + case 214: + case 233: return 2; - case 204: + case 205: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19615,20 +19879,20 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 231: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 262: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 197: - case 226: + case 227: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 230: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 161: case 176: - case 227: - case 270: - case 287: + case 228: + case 271: + case 288: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -19640,11 +19904,11 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: case 185: - case 274: - case 228: + case 275: + case 229: case 170: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } @@ -19660,11 +19924,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 262 ? node : node.body; + if (body && (body.kind === 262 || body.kind === 232)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 242 || stat.kind === 241) { return true; } } @@ -19740,11 +20004,11 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 260 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -19766,10 +20030,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 231: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 262: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19859,8 +20123,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 262 && + blockScopeContainer.kind !== 231 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19943,14 +20207,14 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 286) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -19982,7 +20246,7 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 256: + case 257: return checkStrictModeCatchClause(node); case 186: return checkStrictModeDeleteExpression(node); @@ -19992,7 +20256,7 @@ var ts; return checkStrictModePostfixUnaryExpression(node); case 190: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 218: return checkStrictModeWithStatement(node); case 167: seenThisKeyword = true; @@ -20003,22 +20267,22 @@ var ts; return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: return bindParameter(node); - case 223: + case 224: case 174: return bindVariableDeclarationOrBindingElement(node); case 147: case 146: - case 271: + case 272: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 287: return bindJSDocProperty(node); - case 257: case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 260: - return bindPropertyOrMethodOrAccessor(node, 8, 900095); case 259: - case 251: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 261: + return bindPropertyOrMethodOrAccessor(node, 8, 900095); + case 260: + case 252: var root = container; var hasRest = false; while (root.parent) { @@ -20039,7 +20303,7 @@ var ts; case 149: case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + case 226: return bindFunctionDeclaration(node); case 150: return declareSymbolAndAddToSymbolTable(node, 16384, 0); @@ -20049,12 +20313,12 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 158: case 159: - case 274: + case 275: return bindFunctionOrConstructorType(node); case 161: case 170: - case 287: - case 270: + case 288: + case 271: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: return bindObjectLiteralExpression(node); @@ -20067,43 +20331,43 @@ var ts; } break; case 197: - case 226: + case 227: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 228: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 286: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: - return bindBlockScopedDeclaration(node, 524288, 793064); case 229: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 230: + return bindEnumDeclaration(node); + case 231: return bindModuleDeclaration(node); - case 234: - case 237: - case 239: - case 243: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: - return bindNamespaceExportDeclaration(node); - case 236: - return bindImportClause(node); - case 241: - return bindExportDeclaration(node); + case 235: + case 238: case 240: + case 244: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 234: + return bindNamespaceExportDeclaration(node); + case 237: + return bindImportClause(node); + case 242: + return bindExportDeclaration(node); + case 241: return bindExportAssignment(node); - case 261: + case 262: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 205: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 232: return updateStrictModeStatementList(node.statements); } } @@ -20131,7 +20395,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20141,17 +20405,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 262) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_5.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20190,7 +20454,7 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { + if (container.kind === 226 || container.kind === 184) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } @@ -20226,7 +20490,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 226) { + if (node.kind === 227) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -20336,15 +20600,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || + node.kind === 227 || + (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 206 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20362,13 +20626,13 @@ var ts; return computeCallExpression(node, subtreeFlags); case 180: return computeNewExpression(node, subtreeFlags); - case 230: + case 231: return computeModuleDeclaration(node, subtreeFlags); case 183: return computeParenthesizedExpression(node, subtreeFlags); case 192: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 208: return computeExpressionStatement(node, subtreeFlags); case 144: return computeParameter(node, subtreeFlags); @@ -20376,23 +20640,23 @@ var ts; return computeArrowFunction(node, subtreeFlags); case 184: return computeFunctionExpression(node, subtreeFlags); - case 225: - return computeFunctionDeclaration(node, subtreeFlags); - case 223: - return computeVariableDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclarationList(node, subtreeFlags); - case 205: - return computeVariableStatement(node, subtreeFlags); - case 219: - return computeLabeledStatement(node, subtreeFlags); case 226: + return computeFunctionDeclaration(node, subtreeFlags); + case 224: + return computeVariableDeclaration(node, subtreeFlags); + case 225: + return computeVariableDeclarationList(node, subtreeFlags); + case 206: + return computeVariableStatement(node, subtreeFlags); + case 220: + return computeLabeledStatement(node, subtreeFlags); + case 227: return computeClassDeclaration(node, subtreeFlags); case 197: return computeClassExpression(node, subtreeFlags); - case 255: - return computeHeritageClause(node, subtreeFlags); case 256: + return computeHeritageClause(node, subtreeFlags); + case 257: return computeCatchClause(node, subtreeFlags); case 199: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -20405,7 +20669,7 @@ var ts; case 151: case 152: return computeAccessor(node, subtreeFlags); - case 234: + case 235: return computeImportEquals(node, subtreeFlags); case 177: return computePropertyAccess(node, subtreeFlags); @@ -20793,25 +21057,25 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: + case 230: + case 261: case 182: case 200: case 201: case 130: transformFlags |= 3; break; - case 246: case 247: case 248: - case 10: case 249: + case 10: case 250: case 251: case 252: + case 253: transformFlags |= 4; break; - case 213: + case 214: transformFlags |= 8; case 12: case 13: @@ -20819,8 +21083,9 @@ var ts; case 15: case 194: case 181: - case 258: + case 259: case 114: + case 202: transformFlags |= 192; break; case 195: @@ -20850,8 +21115,8 @@ var ts; case 164: case 165: case 166: - case 227: case 228: + case 229: case 167: case 168: case 169: @@ -20869,7 +21134,7 @@ var ts; case 196: transformFlags |= 192 | 524288; break; - case 259: + case 260: transformFlags |= 8 | 1048576; break; case 96: @@ -20917,22 +21182,22 @@ var ts; transformFlags |= 192; } break; - case 209: case 210: case 211: case 212: + case 213: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 262: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 216: - case 214: + case 217: case 215: + case 216: transformFlags |= 33554432; break; } @@ -20948,18 +21213,18 @@ var ts; case 180: case 175: return 537396545; - case 230: + case 231: return 574674241; case 144: return 536872257; case 185: return 601249089; case 184: - case 225: - return 601281857; - case 224: - return 546309441; case 226: + return 601281857; + case 225: + return 546309441; + case 227: case 197: return 539358529; case 150: @@ -20981,12 +21246,12 @@ var ts; case 153: case 154: case 155: - case 227: case 228: + case 229: return -3; case 176: return 540087617; - case 256: + case 257: return 537920833; case 172: case 173: @@ -21056,9 +21321,11 @@ var ts; getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getTypeFromTypeNode: getTypeFromTypeNode, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -21067,6 +21334,7 @@ var ts; getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + signatureToString: signatureToString, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -21089,7 +21357,8 @@ var ts; tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -21183,6 +21452,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var typeofEQFacts = ts.createMap({ @@ -21328,7 +21598,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -21423,7 +21693,7 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -21467,25 +21737,35 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174) { + var errorBindingElement = ts.getAncestor(usage, 174); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + } + else if (declaration.kind === 224) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); return isUsedInFunctionOrNonStaticProperty(usage, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: - case 213: + case 206: + case 212: + case 214: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: case 213: + case 214: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -21512,6 +21792,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -21525,7 +21814,7 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 144 || @@ -21548,13 +21837,13 @@ var ts; } } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 231: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { + if (location.kind === 262 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -21564,7 +21853,7 @@ var ts; } if (moduleExports[name] && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + ts.getDeclarationOfKind(moduleExports[name], 244)) { break; } } @@ -21572,7 +21861,7 @@ var ts; break loop; } break; - case 229: + case 230: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } @@ -21588,9 +21877,9 @@ var ts; } } break; - case 226: - case 197: case 227: + case 197: + case 228: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -21608,7 +21897,7 @@ var ts; break; case 142: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 228) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -21620,7 +21909,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; @@ -21684,7 +21973,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 234) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -21764,7 +22053,7 @@ var ts; 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"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -21781,10 +22070,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } - while (node && node.kind !== 235) { + while (node && node.kind !== 236) { node = node.parent; } return node; @@ -21794,7 +22083,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + if (node.moduleReference.kind === 246) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -21898,19 +22187,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 234: + case 235: return getTargetOfImportEqualsDeclaration(node); - case 236: - return getTargetOfImportClause(node); case 237: + return getTargetOfImportClause(node); + case 238: return getTargetOfNamespaceImport(node); - case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); case 240: + return getTargetOfImportSpecifier(node); + case 244: + return getTargetOfExportSpecifier(node); + case 241: return getTargetOfExportAssignment(node); - case 233: + case 234: return getTargetOfNamespaceExportDeclaration(node); } } @@ -21954,10 +22243,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 241) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 244) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21973,7 +22262,7 @@ var ts; return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 235); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -22270,11 +22559,11 @@ var ts; } } switch (location_1.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 230: + case 231: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -22318,7 +22607,7 @@ var ts; return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -22350,7 +22639,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22423,7 +22712,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22461,7 +22750,7 @@ var ts; meaning = 107455 | 1048576; } else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + entityName.parent.kind === 235) { meaning = 1920; } else { @@ -22556,7 +22845,7 @@ var ts; while (node.kind === 166) { node = node.parent; } - if (node.kind === 228) { + if (node.kind === 229) { return getSymbolOfNode(node); } } @@ -22564,7 +22853,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 232 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { @@ -22633,9 +22922,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_6) { + walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22768,12 +23057,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22832,7 +23121,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 262 || declaration.parent.kind === 232; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -22845,25 +23134,6 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); @@ -22946,8 +23216,8 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -23126,6 +23396,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -23138,7 +23412,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -23156,6 +23429,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 134); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -23166,6 +23465,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -23182,27 +23482,27 @@ var ts; switch (node.kind) { case 174: return isDeclarationVisible(node.parent.parent); - case 223: + case 224: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: + case 231: case 227: case 228: - case 225: case 229: - case 234: + case 226: + case 230: + case 235: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent_8 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { + return isGlobalSourceFile(parent_8); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent_8); case 147: case 146: case 151: @@ -23217,7 +23517,7 @@ var ts; case 153: case 155: case 144: - case 231: + case 232: case 158: case 159: case 161: @@ -23228,15 +23528,15 @@ var ts; case 165: case 166: return isDeclarationVisible(node.parent); - case 236: case 237: - case 239: + case 238: + case 240: return false; case 143: - case 261: - case 233: + case 262: + case 234: return true; - case 240: + case 241: return false; default: return false; @@ -23245,10 +23545,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 241) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 244) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23326,12 +23626,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 223: case 224: + case 225: + case 240: case 239: case 238: case 237: - case 236: node = node.parent; break; default: @@ -23350,9 +23650,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); @@ -23487,11 +23784,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 213) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -23501,7 +23798,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23539,7 +23836,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23614,7 +23911,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 258) { return type; } return getWidenedType(type); @@ -23642,10 +23939,10 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 241) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -23852,8 +24149,8 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || + if (node.kind === 227 || node.kind === 197 || + node.kind === 226 || node.kind === 184 || node.kind === 149 || node.kind === 185) { var declarations = node.typeParameters; if (declarations) { @@ -23863,15 +24160,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 228 || node.kind === 227 || + node.kind === 197 || node.kind === 229) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -24004,7 +24301,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -24033,7 +24330,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 228) { if (declaration.flags & 64) { return false; } @@ -24083,7 +24380,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 286); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24094,7 +24391,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 229); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24126,7 +24423,7 @@ var ts; function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24154,7 +24451,7 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24629,8 +24926,8 @@ var ts; else { var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); - var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; @@ -24901,7 +25198,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 273) { + if (node.type && node.type.kind === 274) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24912,7 +25209,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 274; } } } @@ -24964,7 +25261,7 @@ var ts; var thisParameter = undefined; var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -25047,12 +25344,12 @@ var ts; if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -25063,7 +25360,7 @@ var ts; case 152: case 184: case 185: - case 274: + case 275: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25335,7 +25632,7 @@ var ts; switch (node.kind) { case 157: return node.typeName; - case 272: + case 273: return node.name; case 199: var expr = node.expression; @@ -25361,7 +25658,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 273) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -25371,7 +25668,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { + if (node.kind === 273) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -25406,9 +25703,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 226: case 227: - case 229: + case 228: + case 230: return declaration; } } @@ -25582,8 +25879,9 @@ var ts; return false; } 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, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -25693,8 +25991,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; addTypeToIntersection(typeSet, type); } } @@ -25812,7 +26110,7 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -25924,7 +26222,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -26047,7 +26345,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { if (!(ts.getModifierFlags(container) & 32) && (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -26066,8 +26364,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: case 264: + case 265: return anyType; case 134: return stringType; @@ -26085,21 +26383,21 @@ var ts; return nullType; case 129: return neverType; - case 289: - return nullType; case 290: - return undefinedType; + return nullType; case 291: + return undefinedType; + case 292: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 288: + case 289: return getTypeFromLiteralTypeNode(node.literal); case 157: - case 272: + case 273: return getTypeFromTypeReference(node); case 156: return booleanType; @@ -26108,29 +26406,29 @@ var ts; case 160: return getTypeFromTypeQueryNode(node); case 162: - case 265: + case 266: return getTypeFromArrayTypeNode(node); case 163: return getTypeFromTupleTypeNode(node); case 164: - case 266: + case 267: return getTypeFromUnionTypeNode(node); case 165: return getTypeFromIntersectionTypeNode(node); case 166: - case 268: case 269: - case 276: - case 277: - case 273: - return getTypeFromTypeNode(node.type); case 270: + case 277: + case 278: + case 274: + return getTypeFromTypeNode(node.type); + case 271: return getTypeFromTypeNode(node.literal); case 158: case 159: case 161: - case 287: - case 274: + case 288: + case 275: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: return getTypeFromTypeOperatorNode(node); @@ -26142,9 +26440,9 @@ var ts; case 141: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 268: return getTypeFromJSDocTupleType(node); - case 275: + case 276: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26293,17 +26591,19 @@ var ts; var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { var typeVariable_1 = constraintType.type; - var mappedTypeVariable = instantiateType(typeVariable_1, mapper); - if (typeVariable_1 !== mappedTypeVariable) { - return mapType(mappedTypeVariable, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -26324,12 +26624,12 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -26340,10 +26640,10 @@ var ts; case 152: case 184: case 185: - case 226: - case 197: case 227: + case 197: case 228: + case 229: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26353,15 +26653,24 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 228) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: + case 275: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 231: + case 262: return false; } node = node.parent; @@ -26371,7 +26680,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 262 || parentKind === 232; } return false; } @@ -26438,7 +26747,7 @@ var ts; case 192: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 258: return isContextSensitive(node.initializer); case 149: case 148: @@ -26494,7 +26803,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -27196,8 +27505,11 @@ var ts; } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -27348,7 +27660,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -27557,8 +27869,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27566,8 +27878,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27658,8 +27970,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; result |= getFalsyFlags(t); } return result; @@ -27818,7 +28130,7 @@ var ts; case 174: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 226: case 149: case 148: case 151: @@ -28159,8 +28471,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28276,7 +28588,7 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 224 || target.kind === 174) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; @@ -28374,8 +28686,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getTypeFacts(t); } return result; @@ -28461,7 +28773,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + return node.parent.kind === 175 || node.parent.kind === 258 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -28480,9 +28792,9 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: - return stringType; case 213: + return stringType; + case 214: return checkRightHandSideOfForOf(parent.expression) || unknownType; case 192: return getAssignedTypeOfBinaryExpression(parent); @@ -28492,9 +28804,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 196: return getAssignedTypeOfSpreadExpression(parent); - case 257: - return getAssignedTypeOfPropertyAssignment(parent); case 258: + return getAssignedTypeOfPropertyAssignment(parent); + case 259: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28517,26 +28829,26 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 213) { return stringType; } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 224 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 224 || node.kind === 174 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 224 && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 174 && node.parent.kind === 192 && isEmptyArrayLiteral(node.parent.right); @@ -28563,7 +28875,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 254) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28665,8 +28977,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -29208,8 +29520,8 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || + node.kind === 232 || + node.kind === 262 || node.kind === 147) { return node; } @@ -29279,7 +29591,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 227 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29307,6 +29619,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -29334,7 +29647,7 @@ var ts; flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); if (type === autoType || type === autoArrayType) { @@ -29365,7 +29678,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 257) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29383,8 +29696,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 212 && + ts.getAncestor(symbol.valueDeclaration, 225).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29474,10 +29787,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 230: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 150: @@ -29535,9 +29848,9 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 275) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -29831,8 +30144,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -29902,13 +30215,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { + if (attribute.kind === 251) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 251) { + else if (attribute.kind === 252) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -29926,14 +30239,14 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: + case 224: case 144: case 147: case 146: case 174: return getContextualTypeForInitializerExpression(node); case 185: - case 216: + case 217: return getContextualTypeForReturnExpression(node); case 195: return getContextualTypeForYieldOperand(parent); @@ -29945,22 +30258,22 @@ var ts; return getTypeFromTypeNode(parent.type); case 192: return getContextualTypeForBinaryOperand(node); - case 257: case 258: + case 259: return getContextualTypeForObjectLiteralElement(parent); case 175: return getContextualTypeForElementExpression(node); case 193: return getContextualTypeForConditionalOperand(node); - case 202: + case 203: ts.Debug.assert(parent.parent.kind === 194); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 183: return getContextualType(parent); - case 252: + case 253: return getContextualType(parent); - case 250: case 251: + case 252: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -30012,8 +30325,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -30156,25 +30469,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 258 || + memberDecl.kind === 259 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { + if (memberDecl.kind === 258) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 149) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 258); + ts.Debug.assert(memberDecl.kind === 259); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -30200,7 +30513,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(memberDecl, 2); } @@ -30300,13 +30613,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 253: checkJsxExpression(child); break; - case 246: + case 247: checkJsxElement(child); break; - case 247: + case 248: checkJsxSelfClosingElement(child); break; } @@ -30601,11 +30914,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { + if (node.attributes[i].kind === 251) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 251); + ts.Debug.assert(node.attributes[i].kind === 252); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -30624,7 +30937,11 @@ var ts; } function checkJsxExpression(node) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -30642,7 +30959,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 177 || node.kind === 224 ? node.name : node.right; if (left.kind === 96) { @@ -30788,7 +31105,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 225) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30810,7 +31127,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 213 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30906,19 +31223,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent_9; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent_9; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -31138,7 +31455,7 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 145) { switch (node.parent.kind) { - case 226: + case 227: case 197: return 1; case 147: @@ -31159,7 +31476,7 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } @@ -31180,7 +31497,7 @@ var ts; return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -31217,7 +31534,7 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -31578,7 +31895,7 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: + case 227: case 197: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 144: @@ -31688,9 +32005,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 226 : resolvedRequire.flags & 3 - ? 223 + ? 224 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31716,6 +32033,23 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + ts.Debug.assert(node.keywordToken === 93 && node.name.text === "target", "Unrecognized meta-property."); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 150) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -31823,7 +32157,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 204) { + if (func.body.kind !== 205) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -31902,7 +32236,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -31948,7 +32282,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -32014,6 +32348,7 @@ var ts; if (produceDiagnostics && node.kind !== 149) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } @@ -32028,7 +32363,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 205) { checkSourceElement(node.body); } else { @@ -32081,7 +32416,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 238; } } } @@ -32097,6 +32432,16 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 177 && expr.kind !== 178) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { @@ -32167,8 +32512,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32182,8 +32527,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32192,8 +32537,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { + var t = types_18[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32240,7 +32585,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { + if (property.kind === 258 || property.kind === 259) { var name_22 = property.name; if (name_22.kind === 142) { checkComputedPropertyName(name_22); @@ -32255,7 +32600,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 259) { return checkDestructuringAssignment(property, type); } else { @@ -32266,7 +32611,7 @@ var ts; error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); } } - else if (property.kind === 259) { + else if (property.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -32334,7 +32679,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 259) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -32362,7 +32707,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + var error = target.parent.kind === 260 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32391,8 +32736,8 @@ var ts; case 176: case 187: case 201: + case 248: case 247: - case 246: return true; case 193: return isSideEffectFree(node.whenTrue) && @@ -32826,6 +33171,8 @@ var ts; return checkAssertion(node); case 201: return checkNonNullAssertion(node); + case 202: + return checkMetaProperty(node); case 186: return checkDeleteExpression(node); case 188: @@ -32846,13 +33193,13 @@ var ts; return undefinedWideningType; case 195: return checkYieldExpression(node); - case 252: + case 253: return checkJsxExpression(node); - case 246: - return checkJsxElement(node); case 247: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 248: + return checkJsxSelfClosingElement(node); + case 249: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -32897,7 +33244,7 @@ var ts; return false; } return node.kind === 149 || - node.kind === 225 || + node.kind === 226 || node.kind === 184; } function getTypePredicateParameterIndex(parameterList, parameter) { @@ -32956,14 +33303,14 @@ var ts; switch (node.parent.kind) { case 185: case 153: - case 225: + case 226: case 184: case 158: case 149: case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; } } } @@ -32991,7 +33338,7 @@ var ts; if (node.kind === 155) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || + else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || node.kind === 153 || node.kind === 150 || node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); @@ -33113,7 +33460,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 228) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -33195,7 +33542,7 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 184 && n.kind !== 226) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -33220,7 +33567,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33369,8 +33716,8 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && + if (n.parent.kind !== 228 && + n.parent.kind !== 227 && n.parent.kind !== 197 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { @@ -33481,11 +33828,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33596,16 +33943,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 228: return 2097152; - case 230: + case 231: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 227: + case 230: return 2097152 | 1048576; - case 234: + case 235: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33617,7 +33964,8 @@ var ts; } function checkNonThenableType(type, location, message) { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + var apparentType = getApparentType(type); + if ((apparentType.flags & (1 | 8192)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -33752,7 +34100,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 227: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -33807,7 +34155,7 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 227: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -33840,6 +34188,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33890,28 +34239,28 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 262: + case 231: checkUnusedModuleMembers(node); break; - case 226: + case 227: case 197: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 228: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: checkUnusedLocalsAndParameters(node); break; case 150: case 184: - case 225: + case 226: case 185: case 149: case 151: @@ -33935,7 +34284,7 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { @@ -33968,9 +34317,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 224 && + (declaration.parent.parent.kind === 213 || + declaration.parent.parent.kind === 214)) { return; } } @@ -34031,7 +34380,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -34039,7 +34388,7 @@ var ts; } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 205) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -34083,6 +34432,11 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; while (current) { @@ -34099,6 +34453,22 @@ var ts; current = current.parent; } } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -34108,8 +34478,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -34124,11 +34494,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34136,11 +34506,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34148,7 +34518,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 224 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -34158,15 +34528,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); + var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || + (container.kind === 205 && ts.isFunctionLike(container.parent) || + container.kind === 232 || container.kind === 231 || - container.kind === 230 || - container.kind === 261); + container.kind === 262); if (!namesShareScope) { var name_25 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); @@ -34199,7 +34569,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 144 || + symbol.valueDeclaration.kind === 174) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -34237,19 +34608,19 @@ var ts; } } if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5) { + if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); var name_26 = node.propertyName || node.name; var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -34260,7 +34631,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34269,7 +34640,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34289,18 +34660,19 @@ var ts; } if (node.kind !== 147 && node.kind !== 146) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 224 || node.kind === 174) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 144 && right.kind === 224) || + (left.kind === 224 && right.kind === 144)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34346,7 +34718,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 207) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34363,12 +34735,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 225) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34386,7 +34758,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { checkForInOrForOfVariableDeclaration(node); } else { @@ -34411,7 +34783,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -34668,7 +35040,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 255 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34680,7 +35052,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 254) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34706,7 +35078,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 220 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -34829,7 +35201,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -34849,7 +35221,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { + if (declaration.kind === 227 || declaration.kind === 228) { if (!firstDecl) { firstDecl = declaration; } @@ -34882,6 +35254,7 @@ var ts; if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -34917,7 +35290,7 @@ var ts; checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { + baseType_1.symbol.valueDeclaration.kind === 227) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -35044,7 +35417,7 @@ var ts; if (!list1 || !list2 || list1.length !== list2.length) { return false; } - for (var i = 0, len = list1.length; i < len; i++) { + for (var i = 0; i < list1.length; i++) { var tp1 = list1[i]; var tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -35102,7 +35475,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35233,6 +35606,7 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; case 183: return evalConstant(e.expression); @@ -35306,6 +35680,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -35326,7 +35701,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 230) { return false; } var enumDeclaration = declaration; @@ -35349,8 +35724,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 227 || + (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35409,7 +35784,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 227); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35452,22 +35827,22 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 206: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: case 241: + case 242: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: case 235: + case 236: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 174: - case 223: + case 224: var name_27 = node.name; if (ts.isBindingPattern(name_27)) { for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { @@ -35476,12 +35851,12 @@ var ts; } break; } - case 226: - case 229: - case 225: case 227: case 230: + case 226: case 228: + case 231: + case 229: if (isGlobalAugmentation) { return; } @@ -35517,9 +35892,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { + error(moduleName, node.kind === 242 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35540,7 +35915,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 244 ? 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)); @@ -35567,7 +35942,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 238) { checkImportBinding(importClause.namedBindings); } else { @@ -35618,8 +35993,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35632,7 +36007,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35655,9 +36030,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 262 ? node.parent : node.parent.parent; + if (container.kind === 231 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -35723,7 +36103,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 226 && declaration.kind !== 149) || !!declaration.body; } } @@ -35734,10 +36114,10 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 231: case 227: - case 225: + case 228: + case 226: cancellationToken.throwIfCancellationRequested(); } } @@ -35786,71 +36166,71 @@ var ts; return checkIndexedAccessType(node); case 170: return checkMappedType(node); - case 225: + case 226: return checkFunctionDeclaration(node); - case 204: - case 231: - return checkBlock(node); case 205: + case 232: + return checkBlock(node); + case 206: return checkVariableStatement(node); - case 207: - return checkExpressionStatement(node); case 208: - return checkIfStatement(node); + return checkExpressionStatement(node); case 209: - return checkDoStatement(node); + return checkIfStatement(node); case 210: - return checkWhileStatement(node); + return checkDoStatement(node); case 211: - return checkForStatement(node); + return checkWhileStatement(node); case 212: - return checkForInStatement(node); + return checkForStatement(node); case 213: - return checkForOfStatement(node); + return checkForInStatement(node); case 214: + return checkForOfStatement(node); case 215: - return checkBreakOrContinueStatement(node); case 216: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 217: - return checkWithStatement(node); + return checkReturnStatement(node); case 218: - return checkSwitchStatement(node); + return checkWithStatement(node); case 219: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 220: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 221: + return checkThrowStatement(node); + case 222: return checkTryStatement(node); - case 223: + case 224: return checkVariableDeclaration(node); case 174: return checkBindingElement(node); - case 226: - return checkClassDeclaration(node); case 227: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 228: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 229: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 230: + return checkEnumDeclaration(node); + case 231: return checkModuleDeclaration(node); - case 235: + case 236: return checkImportDeclaration(node); - case 234: + case 235: return checkImportEqualsDeclaration(node); - case 241: + case 242: return checkExportDeclaration(node); - case 240: + case 241: return checkExportAssignment(node); - case 206: + case 207: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 223: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 245: return checkMissingDeclaration(node); } } @@ -35893,6 +36273,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -35912,6 +36293,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -35956,7 +36341,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 218 && node.parent.statement === node) { return true; } node = node.parent; @@ -35978,14 +36363,14 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 230: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; case 197: @@ -35993,8 +36378,8 @@ var ts; if (className) { copySymbol(location.symbol, meaning); } - case 226: case 227: + case 228: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } @@ -36039,10 +36424,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 143: - case 226: case 227: case 228: case 229: + case 230: return true; } } @@ -36051,7 +36436,7 @@ var ts; while (node.parent && node.parent.kind === 141) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -36078,10 +36463,10 @@ var ts; while (nodeOnRightSide.parent.kind === 141) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 235) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 241) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -36105,11 +36490,11 @@ var ts; default: } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + var importEqualsDeclaration = ts.getAncestor(entityName, 235); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -36156,10 +36541,10 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 251) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 156) { @@ -36168,7 +36553,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 262) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -36221,7 +36606,7 @@ var ts; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 236 || node.parent.kind === 242) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36243,7 +36628,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 259) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36294,7 +36679,7 @@ var ts; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { + if (expr.parent.kind === 214) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } @@ -36302,7 +36687,7 @@ var ts; var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 258) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -36413,7 +36798,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -36451,7 +36836,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36491,16 +36876,16 @@ var ts; return true; } switch (node.kind) { - case 234: - case 236: + case 235: case 237: - case 239: - case 243: + case 238: + case 240: + case 244: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241: + case 242: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 241: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36510,7 +36895,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36561,7 +36946,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 261) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36655,9 +37040,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent_12 = reference.parent; + if (ts.isDeclaration(parent_12) && reference === parent_12.name) { + location = getDeclarationContainer(parent_12); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36770,15 +37155,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36797,7 +37182,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 262); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -36974,7 +37359,7 @@ var ts; } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 230 && node.parent.kind === 227) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -37000,7 +37385,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -37023,7 +37408,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 144) { @@ -37058,7 +37443,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 144) { @@ -37073,13 +37458,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 144) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -37089,14 +37474,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { + if (node.kind !== 227) { if (node.kind !== 149 && node.kind !== 147 && node.kind !== 151 && node.kind !== 152) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -37138,7 +37523,7 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 236 || node.kind === 235) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { @@ -37168,29 +37553,29 @@ var ts; case 149: case 148: case 155: - case 230: + case 231: + case 236: case 235: - case 234: + case 242: case 241: - case 240: case 184: case 185: case 144: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 232 || node.parent.kind === 262) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); case 226: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 116); case 228: - return true; + case 206: case 229: + return true; + case 230: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37204,7 +37589,7 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 149: - case 225: + case 226: case 184: case 185: if (!node.asteriskToken) { @@ -37410,7 +37795,7 @@ var ts; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || + ts.Debug.assert(node.kind === 226 || node.kind === 184 || node.kind === 149); if (ts.isInAmbientContext(node)) { @@ -37437,14 +37822,14 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 260) { continue; } var name_30 = prop.name; if (name_30.kind === 142) { checkGrammarComputedPropertyName(name_30); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -37456,7 +37841,7 @@ var ts; } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 258 || prop.kind === 259) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_30.kind === 8) { checkGrammarNumericLiteral(name_30); @@ -37505,7 +37890,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 252) { continue; } var jsxAttr = attr; @@ -37517,7 +37902,7 @@ var ts; return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 253 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37526,7 +37911,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.initializer.kind === 225) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37534,20 +37919,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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); @@ -37631,7 +38016,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 161) { @@ -37645,9 +38030,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 220: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 215 && !ts.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); @@ -37655,8 +38040,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 219: + if (node.kind === 216 && !node.label) { return false; } break; @@ -37669,13 +38054,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 216 ? 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 === 215 + var message = node.kind === 216 ? 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); @@ -37701,7 +38086,7 @@ var ts; expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37758,15 +38143,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: case 209: case 210: - case 217: case 211: + case 218: case 212: case 213: + case 214: return false; - case 219: + case 220: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -37781,6 +38166,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -37821,7 +38213,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37842,13 +38234,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 228 || + node.kind === 229 || + node.kind === 236 || node.kind === 235 || - node.kind === 234 || + node.kind === 242 || node.kind === 241 || - node.kind === 240 || - node.kind === 233 || + node.kind === 234 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -37857,7 +38249,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 206) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -37876,7 +38268,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 === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 205 || node.parent.kind === 232 || node.parent.kind === 262) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -37887,8 +38279,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 171)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 261)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -37933,31 +38339,31 @@ var ts; _a[201] = [ { name: "expression", test: ts.isLeftHandSideExpression } ], - _a[229] = [ + _a[230] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "members", test: ts.isEnumMember } ], - _a[230] = [ + _a[231] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isModuleName }, { name: "body", test: ts.isModuleBody } ], - _a[231] = [ + _a[232] = [ { name: "statements", test: ts.isStatement } ], - _a[234] = [ + _a[235] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "moduleReference", test: ts.isModuleReference } ], - _a[245] = [ + _a[246] = [ { name: "expression", test: ts.isExpression, optional: true } ], - _a[260] = [ + _a[261] = [ { name: "name", test: ts.isPropertyName }, { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } ], @@ -37983,11 +38389,11 @@ var ts; } var result = initial; switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: - case 293: + case 223: + case 294: break; case 142: result = reduceNode(node.expression, cbNode, result); @@ -38128,72 +38534,72 @@ var ts; result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 202: + case 203: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 204: + case 205: result = reduceNodes(node.statements, cbNodes, result); break; - case 205: + case 206: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207: + case 208: result = reduceNode(node.expression, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; case 210: - case 217: - result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 211: + case 218: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 212: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: case 213: + case 214: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216: - case 220: + case 217: + case 221: result = reduceNode(node.expression, cbNode, result); break; - case 218: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221: + case 222: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223: + case 224: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224: + case 225: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225: + case 226: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38202,7 +38608,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38210,92 +38616,92 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 232: + case 233: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235: + case 236: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236: + case 237: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - break; case 238: - case 242: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 239: case 243: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 240: + case 244: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240: + case 241: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 246: + case 247: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247: case 248: + case 249: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); break; - case 250: + case 251: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251: - result = reduceNode(node.expression, cbNode, result); - break; case 252: result = reduceNode(node.expression, cbNode, result); break; case 253: result = reduceNode(node.expression, cbNode, result); + break; case 254: + result = reduceNode(node.expression, cbNode, result); + case 255: result = reduceNodes(node.statements, cbNodes, result); break; - case 255: + case 256: result = reduceNodes(node.types, cbNodes, result); break; - case 256: + case 257: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 257: + case 258: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.expression, cbNode, result); break; - case 261: + case 262: result = reduceNodes(node.statements, cbNodes, result); break; - case 294: + case 295: result = reduceNode(node.expression, cbNode, result); break; default: @@ -38436,10 +38842,10 @@ var ts; return node; } switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: + case 223: return node; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); @@ -38507,101 +38913,101 @@ var ts; return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 199: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 202: + case 203: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 205: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 206: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 221: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 222: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 226: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 227: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232: + case 233: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 243: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 244: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 259: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 260: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 261: + case 262: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: + case 295: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -38689,7 +39095,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -39093,15 +39499,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: + case 262: + case 233: case 232: - case 231: - case 204: + case 205: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 227: case 226: - case 225: if (ts.hasModifier(node, 2)) { break; } @@ -39126,13 +39532,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 240: - return visitExportAssignment(node); case 241: + return visitExportAssignment(node); + case 242: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -39142,11 +39548,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || + if (node.kind === 242 || node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + node.kind === 237 || + (node.kind === 235 && + node.moduleReference.kind === 246)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -39170,7 +39576,7 @@ var ts; case 152: case 149: return visitorWorker(node); - case 203: + case 204: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39227,18 +39633,18 @@ var ts; case 171: case 155: case 145: - case 228: + case 229: case 147: return undefined; case 150: return visitConstructor(node); - case 227: + case 228: return ts.createNotEmittedStatement(node); - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); - case 255: + case 256: return visitHeritageClause(node); case 199: return visitExpressionWithTypeArguments(node); @@ -39248,7 +39654,7 @@ var ts; return visitGetAccessor(node); case 152: return visitSetAccessor(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -39267,15 +39673,15 @@ var ts; return visitNewExpression(node); case 201: return visitNonNullExpression(node); - case 229: - return visitEnumDeclaration(node); - case 205: - return visitVariableStatement(node); - case 223: - return visitVariableDeclaration(node); case 230: + return visitEnumDeclaration(node); + case 206: + return visitVariableStatement(node); + case 224: + return visitVariableDeclaration(node); + case 231: return visitModuleDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39429,7 +39835,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39714,7 +40120,7 @@ var ts; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 226: + case 227: case 197: return ts.getFirstConstructorWithBody(node) !== undefined; case 149: @@ -39732,7 +40138,7 @@ var ts; return serializeTypeNode(node.type); case 152: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: + case 227: case 197: case 149: return ts.createIdentifier("Function"); @@ -39789,6 +40195,9 @@ var ts; } switch (node.kind) { case 104: + case 137: + case 94: + case 129: return ts.createVoidZero(); case 166: return serializeTypeNode(node.type); @@ -39827,29 +40236,7 @@ var ts; return serializeTypeReferenceNode(node); case 165: case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } + return serializeUnionOrIntersectionType(node); case 160: case 168: case 169: @@ -39864,6 +40251,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -40190,7 +40603,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 230) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40250,8 +40663,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 232) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -40273,13 +40686,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + if (body.kind !== 232) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 231) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40299,7 +40712,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 238) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40434,15 +40847,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(259); + context.enableEmitNotification(231); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 230; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -40515,9 +40928,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 262) { + var substitute = (applicableSubstitutions & 2 && container.kind === 231) || + (applicableSubstitutions & 8 && container.kind === 230); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -40632,11 +41045,11 @@ var ts; return visitObjectLiteralExpression(node); case 192: return visitBinaryExpression(node, noDestructuringValue); - case 223: + case 224: return visitVariableDeclaration(node); - case 213: + case 214: return visitForOfStatement(node); - case 211: + case 212: return visitForStatement(node); case 188: return visitVoidExpression(node); @@ -40648,7 +41061,7 @@ var ts; return visitGetAccessorDeclaration(node); case 152: return visitSetAccessorDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -40656,7 +41069,7 @@ var ts; return visitArrowFunction(node); case 144: return visitParameter(node); - case 207: + case 208: return visitExpressionStatement(node); case 183: return visitParenthesizedExpression(node, noDestructuringValue); @@ -40669,7 +41082,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 259) { + if (e.kind === 260) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -40681,7 +41094,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257) { + if (e.kind === 258) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -40854,11 +41267,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: - return visitJsxElement(node, false); case 247: + return visitJsxElement(node, false); + case 248: return visitJsxSelfClosingElement(node, false); - case 252: + case 253: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40868,11 +41281,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 253: return visitJsxExpression(node); - case 246: - return visitJsxElement(node, true); case 247: + return visitJsxElement(node, true); + case 248: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -40926,7 +41339,10 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 252) { + else if (node.kind === 253) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } return visitJsxExpression(node); } else { @@ -40991,7 +41407,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 247) { return getTagName(node.openingElement); } else { @@ -41310,7 +41726,7 @@ var ts; return visitAwaitExpression(node); case 149: return visitMethodDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -41409,7 +41825,7 @@ var ts; context.enableSubstitution(179); context.enableSubstitution(177); context.enableSubstitution(178); - context.enableEmitNotification(226); + context.enableEmitNotification(227); context.enableEmitNotification(149); context.enableEmitNotification(151); context.enableEmitNotification(152); @@ -41465,7 +41881,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 226 + return kind === 227 || kind === 150 || kind === 149 || kind === 151 @@ -41604,15 +42020,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; var convertedLoopState; var enabledSubstitutions; return transformSourceFile; @@ -41622,178 +42030,104 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; + return hierarchyFacts & 4096 + && node.kind === 217 + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); case 144: return visitParameter(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 185: return visitArrowFunction(node); case 184: return visitFunctionExpression(node); - case 223: + case 224: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 225: return visitVariableDeclarationList(node); case 219: + return visitSwitchStatement(node); + case 233: + return visitCaseBlock(node); + case 205: + return visitBlock(node, false); + case 216: + case 215: + return visitBreakOrContinueStatement(node); + case 220: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); + return visitDoOrWhileStatement(node, undefined); case 212: - return visitForInStatement(node); + return visitForStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForInStatement(node, undefined); + case 214: + return visitForOfStatement(node, undefined); + case 208: return visitExpressionStatement(node); case 176: return visitObjectLiteralExpression(node); - case 256: + case 257: return visitCatchClause(node); - case 258: + case 259: return visitShorthandPropertyAssignment(node); + case 142: + return visitComputedPropertyName(node); case 175: return visitArrayLiteralExpression(node); case 179: @@ -41818,51 +42152,80 @@ var ts; case 196: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 202: + return visitMetaProperty(node); case 149: return visitMethodDeclaration(node); - case 205: + case 151: + case 152: + return visitAccessorDeclaration(node); + case 206: return visitVariableStatement(node); + case 217: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); addCaptureThisForNodeIfNeeded(statements, node); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); + exitSubtree(ancestorFacts, 0, 0); return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -41878,13 +42241,13 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; + var jump = node.kind === 216 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 216) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -41894,7 +42257,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 216) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -41993,6 +42356,9 @@ var ts; } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); @@ -42000,6 +42366,8 @@ var ts; ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -42020,23 +42388,26 @@ var ts; addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { ts.setEmitFlags(block, 1536); @@ -42044,17 +42415,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 217) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 209) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 205) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -42062,8 +42433,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -42083,9 +42454,8 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } if (superCallExpression @@ -42100,17 +42470,17 @@ var ts; statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { @@ -42206,21 +42576,53 @@ var ts; ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 185: + return statements; + case 149: + case 151: + case 152: + newTarget = ts.createVoidZero(); + break; + case 150: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 226: + case 184: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 204: statements.push(transformSemicolonClassElementToStatement(member)); break; case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 151: case 152: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; case 150: @@ -42234,26 +42636,29 @@ var ts; function transformSemicolonClassElementToStatement(member) { return ts.createEmptyStatement(member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false), ts.getSourceMapRange(accessors.firstAccessor)); ts.setEmitFlags(statement, 1536); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -42262,7 +42667,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -42270,7 +42675,7 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); @@ -42286,35 +42691,69 @@ var ts; if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body, location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -42361,6 +42800,7 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } @@ -42374,6 +42814,21 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -42398,9 +42853,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -42417,49 +42875,54 @@ var ts; } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -42475,48 +42938,51 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels[node.label.text] = node.label.text; + } + function resetLabel(node) { + convertedLoopState.labels[node.label.text] = undefined; + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, convertForOfToFor); } - function convertForOfToFor(node, convertedLoopBodyStatements) { + function convertForOfToFor(node, outermostLabeledStatement, convertedLoopBodyStatements) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var initializer = node.initializer; var statements = []; @@ -42579,31 +43045,53 @@ var ts; ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); ts.setEmitFlags(forStatement, 256); - return forStatement; + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 210: + case 211: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 212: + return visitForStatement(node, outermostLabeledStatement); + case 213: + return visitForInStatement(node, outermostLabeledStatement); + case 214: + return visitForOfStatement(node, outermostLabeledStatement); + } } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 142) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -42627,14 +43115,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -42643,11 +43133,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: case 212: case 213: + case 214: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 225) { loopInitializer = initializer; } break; @@ -42674,7 +43164,7 @@ var ts; } } startLexicalEnvironment(); - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; @@ -42686,11 +43176,13 @@ var ts; ts.addRange(statements_4, lexicalEnvironment); loopBody = ts.createBlock(statements_4, undefined, true); } - if (!ts.isBlock(loopBody)) { + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = ts.createBlock([loopBody], undefined, true); } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -42749,19 +43241,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -42875,17 +43366,17 @@ var ts; case 152: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: - expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); + case 149: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; case 258: - expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); + expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); + case 259: + expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: ts.Debug.failBadSyntaxKind(node); @@ -42907,21 +43398,31 @@ var ts; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container), method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -42929,21 +43430,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; + } function visitShorthandPropertyAssignment(node) { return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; + } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -42955,25 +43478,27 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; @@ -43071,21 +43596,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(emitContext, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -43103,7 +43641,7 @@ var ts; context.enableEmitNotification(152); context.enableEmitNotification(185); context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(226); } } function onSubstituteNode(emitContext, node) { @@ -43129,9 +43667,9 @@ var ts; var parent = node.parent; switch (parent.kind) { case 174: - case 226: - case 229: - case 223: + case 227: + case 230: + case 224: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -43157,8 +43695,7 @@ var ts; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { + && hierarchyFacts & 16) { return ts.createIdentifier("_this", node); } return node; @@ -43175,7 +43712,7 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { return false; } var statementExpression = statement.expression; @@ -43206,7 +43743,7 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; @@ -43283,13 +43820,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 218: - return visitSwitchStatement(node); case 219: + return visitSwitchStatement(node); + case 220: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43297,24 +43834,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); case 151: case 152: return visitAccessorDeclaration(node); - case 205: + case 206: return visitVariableStatement(node); - case 211: - return visitForStatement(node); case 212: + return visitForStatement(node); + case 213: return visitForInStatement(node); - case 215: - return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitBreakStatement(node); + case 215: + return visitContinueStatement(node); + case 217: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43352,7 +43889,7 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -43539,10 +44076,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43604,7 +44141,7 @@ var ts; emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); @@ -43664,10 +44201,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -43710,35 +44247,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 205: return transformAndEmitBlock(node); - case 207: - return transformAndEmitExpressionStatement(node); case 208: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 210: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 211: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 212: + return transformAndEmitForStatement(node); + case 213: return transformAndEmitForInStatement(node); - case 214: - return transformAndEmitContinueStatement(node); case 215: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 217: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 218: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 219: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 220: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 221: + return transformAndEmitThrowStatement(node); + case 222: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -43758,7 +44295,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name_39 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_39, variable.name); + hoistVariableDeclaration(name_39); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -43788,7 +44327,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -44022,7 +44561,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 255 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -44032,7 +44571,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 254) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -44153,12 +44692,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_39) { - var clone_6 = ts.getMutableClone(name_39); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name_40 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_40) { + var clone_7 = ts.getMutableClone(name_40); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -44768,41 +45307,41 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)]), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ]), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)]), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ]), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -44827,15 +45366,40 @@ var ts; var ts; (function (ts) { function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(249); + context.enableEmitNotification(250); + context.enableEmitNotification(248); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(177); - context.enableSubstitution(257); + context.enableSubstitution(258); return transformSourceFile; function transformSourceFile(node) { return node; } + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 249: + case 250: + case 248: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } node = previousOnSubstituteNode(emitContext, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); @@ -44892,8 +45456,8 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); + context.enableSubstitution(259); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var currentSourceFile; @@ -44931,14 +45495,7 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); - } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; return ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ ts.createArrayLiteral([ @@ -44952,6 +45509,36 @@ var ts; ]))) ], node.statements)); } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], undefined, true)); + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ], node.statements)); + } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { var aliasedModuleNames = []; var unaliasedModuleNames = []; @@ -45011,23 +45598,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return visitExportDeclaration(node); - case 240: + case 241: return visitExportAssignment(node); - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return node; @@ -45225,7 +45812,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45257,10 +45844,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45368,7 +45955,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = ts.createMap(); @@ -45428,7 +46015,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -45437,8 +46024,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_40 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); + var name_41 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_41), node); } } } @@ -45502,7 +46089,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -45519,7 +46105,7 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableEmitNotification(261); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var exportFunctionsMap = ts.createMap(); @@ -45619,7 +46205,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { + if (externalImport.kind === 242 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -45642,7 +46228,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241) { + if (externalImport.kind !== 242) { continue; } var exportDecl = externalImport; @@ -45694,15 +46280,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235: + case 236: if (!entry.importClause) { break; } - case 234: + case 235: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241: + case 242: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -45724,13 +46310,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return undefined; - case 240: + case 241: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -45851,7 +46437,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 + && (enclosingBlockScopedContainer.kind === 262 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -45873,7 +46459,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -45906,10 +46492,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -46008,43 +46594,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitForStatement(node); case 213: + return visitForInStatement(node); + case 214: return visitForOfStatement(node); - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 219: + case 220: return visitLabeledStatement(node); - case 217: - return visitWithStatement(node); case 218: + return visitWithStatement(node); + case 219: return visitSwitchStatement(node); - case 232: + case 233: return visitCaseBlock(node); - case 253: - return visitCaseClause(node); case 254: + return visitCaseClause(node); + case 255: return visitDefaultClause(node); - case 221: + case 222: return visitTryStatement(node); - case 256: + case 257: return visitCatchClause(node); - case 204: + case 205: return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -46172,7 +46758,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; + return container !== undefined && container.kind === 262; } else { return false; @@ -46187,7 +46773,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46299,7 +46885,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46327,7 +46913,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); + context.enableEmitNotification(262); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46352,9 +46938,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234: + case 235: return undefined; - case 240: + case 241: return visitExportAssignment(node); } return node; @@ -46663,7 +47249,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 236); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46735,10 +47321,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 224) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46749,7 +47335,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 236) { moduleElementEmitInfo.isVisible = true; } else { @@ -46757,12 +47343,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46933,7 +47519,7 @@ var ts; } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); @@ -47050,9 +47636,9 @@ var ts; var count = 0; while (true) { count++; - var name_41 = baseName + "_" + count; - if (!(name_41 in currentIdentifiers)) { - return name_41; + var name_42 = baseName + "_" + count; + if (!(name_42 in currentIdentifiers)) { + return name_42; } } } @@ -47096,10 +47682,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 235 || + (node.parent.kind === 262 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -47108,7 +47694,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 236) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -47126,30 +47712,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: - return writeFunctionDeclaration(node); - case 205: - return writeVariableStatement(node); - case 227: - return writeInterfaceDeclaration(node); case 226: - return writeClassDeclaration(node); + return writeFunctionDeclaration(node); + case 206: + return writeVariableStatement(node); case 228: - return writeTypeAliasDeclaration(node); + return writeInterfaceDeclaration(node); + case 227: + return writeClassDeclaration(node); case 229: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 230: + return writeEnumDeclaration(node); + case 231: return writeModuleDeclaration(node); - case 234: - return writeImportEqualsDeclaration(node); case 235: + return writeImportEqualsDeclaration(node); + case 236: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 262) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -47157,7 +47743,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 228 && !noDeclare) { write("declare "); } } @@ -47207,7 +47793,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 238) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47230,7 +47816,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 238) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47247,13 +47833,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 235) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 231) { moduleSpecifier = parent.name; } else { @@ -47321,7 +47907,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 232) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47419,10 +48005,10 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 154: @@ -47436,17 +48022,17 @@ var ts; if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 227) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 226: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47483,7 +48069,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 227) { 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; @@ -47566,7 +48152,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -47589,7 +48175,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 224) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47604,7 +48190,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47764,13 +48350,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 226) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 149 || node.kind === 150) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 226) { write("function "); writeTextOfNode(currentText, node.name); } @@ -47864,7 +48450,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47877,7 +48463,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 226: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47954,7 +48540,7 @@ var ts; 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 === 226) { + else if (node.parent.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47966,7 +48552,7 @@ var ts; 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; } - case 225: + case 226: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -48018,19 +48604,19 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: - case 227: case 226: - case 228: - case 229: - return emitModuleElement(node, isModuleElementVisible(node)); - case 205: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 231: case 235: + case 228: + case 227: + case 229: + case 230: + return emitModuleElement(node, isModuleElementVisible(node)); + case 206: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 236: return emitModuleElement(node, !node.importClause); - case 241: + case 242: return emitExportDeclaration(node); case 150: case 149: @@ -48046,11 +48632,11 @@ var ts; case 147: case 146: return emitPropertyDeclaration(node); - case 260: - return emitEnumMemberDeclaration(node); - case 240: - return emitExportAssignment(node); case 261: + return emitEnumMemberDeclaration(node); + case 241: + return emitExportAssignment(node); + case 262: return emitSourceFile(node); } } @@ -48267,7 +48853,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -48280,7 +48866,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48424,7 +49010,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48438,7 +49024,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 225) { declarationListContainerEnd = end; } } @@ -48794,7 +49380,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 261: + case 262: return emitSourceFile(node); } } @@ -48917,119 +49503,119 @@ var ts; return emitArrayBindingPattern(node); case 174: return emitBindingElement(node); - case 202: - return emitTemplateSpan(node); case 203: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 204: - return emitBlock(node); + return emitSemicolonClassElement(); case 205: - return emitVariableStatement(node); + return emitBlock(node); case 206: - return emitEmptyStatement(); + return emitVariableStatement(node); case 207: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 208: - return emitIfStatement(node); + return emitExpressionStatement(node); case 209: - return emitDoStatement(node); + return emitIfStatement(node); case 210: - return emitWhileStatement(node); + return emitDoStatement(node); case 211: - return emitForStatement(node); + return emitWhileStatement(node); case 212: - return emitForInStatement(node); + return emitForStatement(node); case 213: - return emitForOfStatement(node); + return emitForInStatement(node); case 214: - return emitContinueStatement(node); + return emitForOfStatement(node); case 215: - return emitBreakStatement(node); + return emitContinueStatement(node); case 216: - return emitReturnStatement(node); + return emitBreakStatement(node); case 217: - return emitWithStatement(node); + return emitReturnStatement(node); case 218: - return emitSwitchStatement(node); + return emitWithStatement(node); case 219: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 220: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 221: - return emitTryStatement(node); + return emitThrowStatement(node); case 222: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 223: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 224: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 225: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 226: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 227: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 228: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 229: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 230: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 231: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 232: + return emitModuleBlock(node); + case 233: return emitCaseBlock(node); - case 234: - return emitImportEqualsDeclaration(node); case 235: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 236: - return emitImportClause(node); + return emitImportDeclaration(node); case 237: - return emitNamespaceImport(node); + return emitImportClause(node); case 238: - return emitNamedImports(node); + return emitNamespaceImport(node); case 239: - return emitImportSpecifier(node); + return emitNamedImports(node); case 240: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 241: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 242: - return emitNamedExports(node); + return emitExportDeclaration(node); case 243: - return emitExportSpecifier(node); + return emitNamedExports(node); case 244: - return; + return emitExportSpecifier(node); case 245: + return; + case 246: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: - return emitJsxOpeningElement(node); case 249: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 250: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 251: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 252: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 253: - return emitCaseClause(node); + return emitJsxExpression(node); case 254: - return emitDefaultClause(node); + return emitCaseClause(node); case 255: - return emitHeritageClause(node); + return emitDefaultClause(node); case 256: - return emitCatchClause(node); + return emitHeritageClause(node); case 257: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 258: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 259: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 260: + return emitSpreadAssignment(node); + case 261: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -49106,14 +49692,14 @@ var ts; return emitAsExpression(node); case 201: return emitNonNullExpression(node); - case 246: - return emitJsxElement(node); + case 202: + return emitMetaProperty(node); case 247: + return emitJsxElement(node); + case 248: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -49558,6 +50144,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -49600,27 +50191,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 209) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -49630,7 +50221,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49642,7 +50233,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49652,7 +50243,7 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49662,11 +50253,11 @@ var ts; write(" of "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224) { + if (node.kind === 225) { emit(node); } else { @@ -49693,7 +50284,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97, node.pos); @@ -49717,9 +50308,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -49895,7 +50489,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230) { + while (body.kind === 231) { write("."); emit(body.name); body = body.body; @@ -50046,6 +50640,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -50245,8 +50842,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { write(" "); emit(node); } @@ -50375,6 +50972,14 @@ var ts; write(getClosingBracket(format)); } } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } + else { + writeLine(); + } + } function writeIfAny(nodes, text) { if (nodes && nodes.length > 0) { write(text); @@ -50555,21 +51160,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_42 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_42)) { + var name_43 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_43)) { tempFlags |= flags; - return name_42; + return name_43; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_43 = count < 26 + var name_44 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_43)) { - return name_43; + if (isUniqueName(name_44)) { + return name_44; } } } @@ -50603,22 +51208,32 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(0); + } function generateNameForNode(node) { switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 231: case 230: - case 229: return generateNameForModuleOrEnum(node); - case 235: - case 241: + case 236: + case 242: return generateNameForImportOrExportDeclaration(node); - case 225: case 226: - case 240: + case 227: + case 241: return generateNameForExportDefault(); case 197: return generateNameForClassExpression(); + case 149: + case 151: + case 152: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); } @@ -50649,11 +51264,14 @@ var ts; } return node; } + function generateNameForNodeCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } function getGeneratedIdentifier(name) { if (name.autoGenerateKind === 4) { var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { var autoGenerateId = name.autoGenerateId; @@ -50722,7 +51340,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { return true; @@ -50905,10 +51524,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_44 = names_1[_i]; - var result = name_44 in cache - ? cache[name_44] - : cache[name_44] = loader(name_44, containingFile); + var name_45 = names_1[_i]; + var result = name_45 in cache + ? cache[name_45] + : cache[name_45] = loader(name_45, containingFile); resolutions.push(result); } return resolutions; @@ -50933,6 +51552,7 @@ var ts; var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -50945,7 +51565,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -50981,6 +51602,7 @@ var ts; } } } + moduleResolutionCache = undefined; oldProgram = undefined; program = { getRootFileNames: function () { return rootNames; }, @@ -51187,7 +51809,7 @@ var ts; newSourceFile.resolvedModules = oldSourceFile.resolvedModules; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -51345,42 +51967,42 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: - case 223: + case 226: + case 224: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 234: + case 235: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240: + case 241: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255: + case 256: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227: + case 228: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case 182: @@ -51398,23 +52020,23 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226: + case 227: case 149: case 148: case 150: case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: + case 226: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 205: + case 206: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); + return checkModifiers(nodes, parent.kind === 206); } break; case 147: @@ -51526,7 +52148,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); + var importDecl = ts.createSynthesizedNode(236); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -51544,9 +52166,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 236: case 235: - case 234: - case 241: + case 242: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -51558,7 +52180,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230: + case 231: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -52182,32 +52804,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 144: - case 223: + case 224: case 174: case 147: case 146: - case 257: case 258: - case 260: + case 259: + case 261: case 149: case 148: case 150: case 151: case 152: - case 225: + case 226: case 184: case 185: - case 256: + case 257: return 1; case 143: - case 227: case 228: + case 229: case 161: return 2; - case 226: - case 229: - return 1 | 2; + case 227: case 230: + return 1 | 2; + case 231: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52217,21 +52839,21 @@ var ts; else { return 4; } - case 238: case 239: - case 234: - case 235: case 240: + case 235: + case 236: case 241: + case 242: return 1 | 2 | 4; - case 261: + case 262: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240) { + if (node.parent.kind === 241) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52255,7 +52877,7 @@ var ts; ts.Debug.assert(node.kind === 70); if (node.parent.kind === 141 && node.parent.right === node && - node.parent.parent.kind === 234) { + node.parent.parent.kind === 235) { return 1 | 2 | 4; } return 4; @@ -52289,10 +52911,10 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 255) { + if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 256) { var decl = root.parent.parent.parent; - return (decl.kind === 226 && root.parent.parent.token === 107) || - (decl.kind === 227 && root.parent.parent.token === 84); + return (decl.kind === 227 && root.parent.parent.token === 107) || + (decl.kind === 228 && root.parent.parent.token === 84); } return false; } @@ -52323,7 +52945,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 220 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52333,13 +52955,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 215 || node.parent.kind === 214) && + (node.parent.kind === 216 || node.parent.kind === 215) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 219 && + node.parent.kind === 220 && node.parent.label === node; } function isLabelName(node) { @@ -52355,7 +52977,7 @@ var ts; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 && node.parent.name === node; + return node.parent.kind === 231 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52368,13 +52990,13 @@ var ts; switch (node.parent.kind) { case 147: case 146: - case 257: - case 260: + case 258: + case 261: case 149: case 148: case 151: case 152: - case 230: + case 231: return node.parent.name === node; case 178: return node.parent.argumentExpression === node; @@ -52422,17 +53044,17 @@ var ts; return undefined; } switch (node.kind) { - case 261: + case 262: case 149: case 148: - case 225: + case 226: case 184: case 151: case 152: - case 226: case 227: - case 229: + case 228: case 230: + case 231: return node; } } @@ -52440,22 +53062,22 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261: + case 262: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230: + case 231: return ts.ScriptElementKind.moduleElement; - case 226: + case 227: case 197: return ts.ScriptElementKind.classElement; - case 227: return ts.ScriptElementKind.interfaceElement; - case 228: return ts.ScriptElementKind.typeElement; - case 229: return ts.ScriptElementKind.enumElement; - case 223: + case 228: return ts.ScriptElementKind.interfaceElement; + case 229: return ts.ScriptElementKind.typeElement; + case 230: return ts.ScriptElementKind.enumElement; + case 224: return getKindOfVariableDeclaration(node); case 174: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); case 185: - case 225: + case 226: case 184: return ts.ScriptElementKind.functionElement; case 151: return ts.ScriptElementKind.memberGetAccessorElement; @@ -52471,15 +53093,15 @@ var ts; case 153: return ts.ScriptElementKind.callSignatureElement; case 150: return ts.ScriptElementKind.constructorImplementationElement; case 143: return ts.ScriptElementKind.typeParameterElement; - case 260: return ts.ScriptElementKind.enumMemberElement; + case 261: return ts.ScriptElementKind.enumMemberElement; case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234: - case 239: - case 236: - case 243: + case 235: + case 240: case 237: + case 244: + case 238: return ts.ScriptElementKind.alias; - case 285: + case 286: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52551,19 +53173,19 @@ var ts; return false; } switch (n.kind) { - case 226: case 227: - case 229: + case 228: + case 230: case 176: case 172: case 161: - case 204: - case 231: + case 205: case 232: - case 238: - case 242: + case 233: + case 239: + case 243: return nodeEndsWith(n, 17, sourceFile); - case 256: + case 257: return isCompletedNode(n.block, sourceFile); case 180: if (!n.arguments) { @@ -52579,7 +53201,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: case 149: case 148: @@ -52593,14 +53215,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 230: + case 231: return n.body && isCompletedNode(n.body, sourceFile); - case 208: + case 209: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 207: + case 208: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24); case 175: @@ -52614,15 +53236,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21, sourceFile); - case 253: case 254: + case 255: return false; - case 211: case 212: case 213: - case 210: + case 214: + case 211: return isCompletedNode(n.statement, sourceFile); - case 209: + case 210: var hasWhileKeyword = findChildOfKind(n, 105, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19, sourceFile); @@ -52642,10 +53264,10 @@ var ts; case 194: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 202: + case 203: return ts.nodeIsPresent(n.literal); - case 241: - case 235: + case 242: + case 236: return ts.nodeIsPresent(n.moduleSpecifier); case 190: return isCompletedNode(n.operand, sourceFile); @@ -52694,7 +53316,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52749,8 +53371,8 @@ var ts; } } } - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; if (ts.isJSDocNode(child)) { continue; } @@ -52814,7 +53436,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) { var start = child.getStart(sourceFile); @@ -52829,7 +53451,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261); + ts.Debug.assert(startNode !== undefined || n.kind === 262); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -52874,13 +53496,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 252) { + if (token.kind === 26 && token.parent.kind === 253) { return true; } - if (token && token.kind === 17 && token.parent.kind === 252) { + if (token && token.kind === 17 && token.parent.kind === 253) { return true; } - if (token.kind === 26 && token.parent.kind === 249) { + if (token.kind === 26 && token.parent.kind === 250) { return true; } return false; @@ -52974,7 +53596,7 @@ var ts; if (node.kind === 157 || node.kind === 179) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 || node.kind === 227) { + if (ts.isFunctionLike(node) || node.kind === 227 || node.kind === 228) { return node.typeParameters; } return undefined; @@ -53047,11 +53669,11 @@ var ts; node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 213 && + if (node.parent.kind === 214 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 ? node.parent.parent : node.parent)) { return true; } } @@ -53268,7 +53890,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 || location.parent.kind === 243) && + (location.parent.kind === 240 || location.parent.kind === 244) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53325,6 +53947,10 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getOpenBraceEnd(constructor, sourceFile) { + return constructor.body.getFirstToken(sourceFile).getEnd(); + } + ts.getOpenBraceEnd = getOpenBraceEnd; })(ts || (ts = {})); var ts; (function (ts) { @@ -53373,15 +53999,15 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205: + case 206: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223: + case 224: case 147: case 146: return spanInVariableDeclaration(node); case 144: return spanInParameterDeclaration(node); - case 225: + case 226: case 149: case 148: case 151: @@ -53390,72 +54016,72 @@ var ts; case 184: case 185: return spanInFunctionDeclaration(node); - case 204: + case 205: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 231: + case 232: return spanInBlock(node); - case 256: + case 257: return spanInBlock(node.block); - case 207: - return textSpan(node.expression); - case 216: - return textSpan(node.getChildAt(0), node.expression); - case 210: - return textSpanEndingAtNextToken(node, node.expression); - case 209: - return spanInNode(node.statement); - case 222: - return textSpan(node.getChildAt(0)); case 208: - return textSpanEndingAtNextToken(node, node.expression); - case 219: - return spanInNode(node.statement); - case 215: - case 214: - return textSpan(node.getChildAt(0), node.label); + return textSpan(node.expression); + case 217: + return textSpan(node.getChildAt(0), node.expression); case 211: - return spanInForStatement(node); - case 212: return textSpanEndingAtNextToken(node, node.expression); - case 213: - return spanInInitializerOfForLike(node); - case 218: + case 210: + return spanInNode(node.statement); + case 223: + return textSpan(node.getChildAt(0)); + case 209: return textSpanEndingAtNextToken(node, node.expression); - case 253: - case 254: - return spanInNode(node.statements[0]); - case 221: - return spanInBlock(node.tryBlock); case 220: + return spanInNode(node.statement); + case 216: + case 215: + return textSpan(node.getChildAt(0), node.label); + case 212: + return spanInForStatement(node); + case 213: + return textSpanEndingAtNextToken(node, node.expression); + case 214: + return spanInInitializerOfForLike(node); + case 219: + return textSpanEndingAtNextToken(node, node.expression); + case 254: + case 255: + return spanInNode(node.statements[0]); + case 222: + return spanInBlock(node.tryBlock); + case 221: return textSpan(node, node.expression); - case 240: - return textSpan(node, node.expression); - case 234: - return textSpan(node, node.moduleReference); - case 235: - return textSpan(node, node.moduleSpecifier); case 241: + return textSpan(node, node.expression); + case 235: + return textSpan(node, node.moduleReference); + case 236: return textSpan(node, node.moduleSpecifier); - case 230: + case 242: + return textSpan(node, node.moduleSpecifier); + case 231: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 226: - case 229: - case 260: + case 227: + case 230: + case 261: case 174: return textSpan(node); - case 217: + case 218: return spanInNode(node.statement); case 145: return spanInNodeArray(node.parent.decorators); case 172: case 173: return spanInBindingPattern(node); - case 227: case 228: + case 229: return undefined; case 24: case 1: @@ -53491,8 +54117,8 @@ var ts; } if ((node.kind === 70 || node.kind == 196 || - node.kind === 257 || - node.kind === 258) && + node.kind === 258 || + node.kind === 259) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -53511,12 +54137,12 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209: + case 210: return spanInPreviousNode(node); case 145: return spanInNode(node.parent); - case 211: - case 213: + case 212: + case 214: return textSpan(node); case 192: if (node.parent.operatorToken.kind === 25) { @@ -53530,7 +54156,7 @@ var ts; break; } } - if (node.parent.kind === 257 && + if (node.parent.kind === 258 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -53541,7 +54167,7 @@ var ts; if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 223 || + if ((node.parent.kind === 224 || node.parent.kind === 144)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || @@ -53571,7 +54197,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 212) { + if (variableDeclaration.parent.parent.kind === 213) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -53579,7 +54205,7 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 213) { + variableDeclaration.parent.parent.kind === 214) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -53611,7 +54237,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 226 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 227 && functionDeclaration.kind !== 150); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -53631,22 +54257,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230: + case 231: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 210: - case 208: - case 212: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 211: + case 209: case 213: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 212: + case 214: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224) { + if (forLikeStatement.initializer.kind === 225) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -53690,33 +54316,33 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229: + case 230: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226: + case 227: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232: + case 233: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231: + case 232: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 229: - case 226: + case 230: + case 227: return textSpan(node); - case 204: + case 205: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 256: + case 257: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232: + case 233: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { @@ -53748,7 +54374,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 || + if (node.parent.kind === 210 || node.parent.kind === 179 || node.parent.kind === 180) { return spanInPreviousNode(node); @@ -53761,17 +54387,17 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 184: - case 225: + case 226: case 185: case 149: case 148: case 151: case 152: case 150: - case 210: - case 209: case 211: - case 213: + case 210: + case 212: + case 214: case 179: case 180: case 183: @@ -53782,7 +54408,7 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 || + node.parent.kind === 258 || node.parent.kind === 144) { return spanInPreviousNode(node); } @@ -53795,13 +54421,13 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209) { + if (node.parent.kind === 210) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213) { + if (node.parent.kind === 214) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -53845,7 +54471,7 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; var length_4 = dense[i + 1]; var type = dense[i + 2]; @@ -54152,10 +54778,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 230: - case 226: + case 231: case 227: - case 225: + case 228: + case 226: cancellationToken.throwIfCancellationRequested(); } } @@ -54199,7 +54825,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 && + return declaration.kind === 231 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54256,7 +54882,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -54340,16 +54966,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 281: + case 282: processJSDocParameterTag(tag); break; - case 284: + case 285: processJSDocTemplateTag(tag); break; - case 283: + case 284: processElement(tag.typeExpression); break; - case 282: + case 283: processElement(tag.typeExpression); break; } @@ -54430,22 +55056,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248: + case 249: if (token.parent.tagName === token) { return 19; } break; - case 249: + case 250: if (token.parent.tagName === token) { return 20; } break; - case 247: + case 248: if (token.parent.tagName === token) { return 21; } break; - case 250: + case 251: if (token.parent.name === token) { return 22; } @@ -54465,10 +55091,10 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 223 || + if (token.parent.kind === 224 || token.parent.kind === 147 || token.parent.kind === 144 || - token.parent.kind === 250) { + token.parent.kind === 251) { return 5; } } @@ -54485,7 +55111,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 250 ? 24 : 6; + return token.parent.kind === 251 ? 24 : 6; } else if (tokenKind === 11) { return 6; @@ -54499,7 +55125,7 @@ var ts; else if (tokenKind === 70) { if (token) { switch (token.parent.kind) { - case 226: + case 227: if (token.parent.name === token) { return 11; } @@ -54509,17 +55135,17 @@ var ts; return 15; } return; - case 227: + case 228: if (token.parent.name === token) { return 13; } return; - case 229: + case 230: if (token.parent.name === token) { return 12; } return; - case 230: + case 231: if (token.parent.name === token) { return 14; } @@ -54540,9 +55166,8 @@ var ts; } if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { processElement(child); } @@ -54579,7 +55204,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 249) { + location.parent && location.parent.kind === 250) { var tagName = location.parent.parent.openingElement.tagName; entries.push({ name: tagName.text, @@ -54601,13 +55226,13 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_45 in nameTable) { - if (nameTable[name_45] === position) { + for (var name_46 in nameTable) { + if (nameTable[name_46] === position) { continue; } - if (!uniqueNames[name_45]) { - uniqueNames[name_45] = name_45; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); + if (!uniqueNames[name_46]) { + uniqueNames[name_46] = name_46; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, true); if (displayName) { var entry = { name: displayName, @@ -54657,7 +55282,7 @@ var ts; if (!node || node.kind !== 9) { return undefined; } - if (node.parent.kind === 257 && + if (node.parent.kind === 258 && node.parent.parent.kind === 176 && node.parent.name === node) { return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); @@ -54665,7 +55290,7 @@ var ts; else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { return getStringLiteralCompletionEntriesFromElementAccess(node.parent); } - else if (node.parent.kind === 235 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + else if (node.parent.kind === 236 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { return getStringLiteralCompletionEntriesFromModuleNames(node); } else { @@ -54725,6 +55350,9 @@ var ts; return undefined; } function addStringLiteralCompletionsFromType(type, result) { + if (type && type.flags & 16384) { + type = typeChecker.getApparentType(type); + } if (!type) { return; } @@ -55029,11 +55657,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent_14 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_14) { break; } - currentDir = parent_13; + currentDir = parent_14; } else { break; @@ -55165,9 +55793,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 283: - case 281: + case 284: case 282: + case 283: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -55202,13 +55830,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; + var parent_15 = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_14.kind === 177) { + if (parent_15.kind === 177) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141) { + else if (parent_15.kind === 141) { node = contextToken.parent.left; isRightOfDot = true; } @@ -55221,7 +55849,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 && contextToken.parent.kind === 249) { + else if (kind === 40 && contextToken.parent.kind === 250) { isStartingCloseTag = true; location = contextToken; } @@ -55312,7 +55940,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247) || (jsxContainer.kind === 248)) { + if ((jsxContainer.kind === 248) || (jsxContainer.kind === 249)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -55333,9 +55961,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 || + scopeNode.kind === 262 || scopeNode.kind === 194 || - scopeNode.kind === 252 || + scopeNode.kind === 253 || ts.isStatement(scopeNode); } var symbolMeanings = 793064 | 107455 | 1920 | 8388608; @@ -55363,11 +55991,11 @@ var ts; return true; } if (contextToken.kind === 28 && contextToken.parent) { - if (contextToken.parent.kind === 248) { + if (contextToken.parent.kind === 249) { return true; } - if (contextToken.parent.kind === 249 || contextToken.parent.kind === 247) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246; + if (contextToken.parent.kind === 250 || contextToken.parent.kind === 248) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 247; } } return false; @@ -55397,16 +56025,16 @@ var ts; case 128: return true; case 22: - return containingNodeKind === 230; + return containingNodeKind === 231; case 16: - return containingNodeKind === 226; + return containingNodeKind === 227; case 57: - return containingNodeKind === 223 + return containingNodeKind === 224 || containingNodeKind === 192; case 13: return containingNodeKind === 194; case 14: - return containingNodeKind === 202; + return containingNodeKind === 203; case 113: case 111: case 112: @@ -55482,9 +56110,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 ? - 235 : - 241; + var declarationKind = namedImportsOrExports.kind === 239 ? + 236 : + 242; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -55505,9 +56133,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) { - return parent_15; + var parent_16 = contextToken.parent; + if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { + return parent_16; } break; } @@ -55520,8 +56148,8 @@ var ts; case 16: case 25: switch (contextToken.parent.kind) { - case 238: - case 242: + case 239: + case 243: return contextToken.parent; } } @@ -55530,34 +56158,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent_17 = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: - case 250: case 251: - if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) { - return parent_16; + case 252: + if (parent_17 && (parent_17.kind === 248 || parent_17.kind === 249)) { + return parent_17; } - else if (parent_16.kind === 250) { - return parent_16.parent; + else if (parent_17.kind === 251) { + return parent_17.parent; } break; case 9: - if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) { - return parent_16.parent; + if (parent_17 && ((parent_17.kind === 251) || (parent_17.kind === 252))) { + return parent_17.parent; } break; case 17: - if (parent_16 && - parent_16.kind === 252 && - parent_16.parent && - (parent_16.parent.kind === 250)) { - return parent_16.parent.parent; + if (parent_17 && + parent_17.kind === 253 && + parent_17.parent && + (parent_17.parent.kind === 251)) { + return parent_17.parent.parent; } - if (parent_16 && parent_16.kind === 251) { - return parent_16.parent; + if (parent_17 && parent_17.kind === 252) { + return parent_17.parent; } break; } @@ -55568,7 +56196,7 @@ var ts; switch (kind) { case 184: case 185: - case 225: + case 226: case 149: case 148: case 151: @@ -55584,16 +56212,16 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25: - return containingNodeKind === 223 || - containingNodeKind === 224 || - containingNodeKind === 205 || - containingNodeKind === 229 || + return containingNodeKind === 224 || + containingNodeKind === 225 || + containingNodeKind === 206 || + containingNodeKind === 230 || isFunction(containingNodeKind) || - containingNodeKind === 226 || - containingNodeKind === 197 || containingNodeKind === 227 || + containingNodeKind === 197 || + containingNodeKind === 228 || containingNodeKind === 173 || - containingNodeKind === 228; + containingNodeKind === 229; case 22: return containingNodeKind === 173; case 55: @@ -55601,22 +56229,22 @@ var ts; case 20: return containingNodeKind === 173; case 18: - return containingNodeKind === 256 || + return containingNodeKind === 257 || isFunction(containingNodeKind); case 16: - return containingNodeKind === 229 || - containingNodeKind === 227 || + return containingNodeKind === 230 || + containingNodeKind === 228 || containingNodeKind === 161; case 24: return containingNodeKind === 146 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 || + (contextToken.parent.parent.kind === 228 || contextToken.parent.parent.kind === 161); case 26: - return containingNodeKind === 226 || + return containingNodeKind === 227 || containingNodeKind === 197 || - containingNodeKind === 227 || containingNodeKind === 228 || + containingNodeKind === 229 || isFunction(containingNodeKind); case 114: return containingNodeKind === 147; @@ -55629,9 +56257,9 @@ var ts; case 112: return containingNodeKind === 144; case 117: - return containingNodeKind === 239 || - containingNodeKind === 243 || - containingNodeKind === 237; + return containingNodeKind === 240 || + containingNodeKind === 244 || + containingNodeKind === 238; case 74: case 82: case 108: @@ -55680,8 +56308,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_46 = element.propertyName || element.name; - existingImportsOrExports[name_46.text] = true; + var name_47 = element.propertyName || element.name; + existingImportsOrExports[name_47.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -55695,8 +56323,8 @@ var ts; var existingMemberNames = ts.createMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 257 && - m.kind !== 258 && + if (m.kind !== 258 && + m.kind !== 259 && m.kind !== 174 && m.kind !== 149 && m.kind !== 151 && @@ -55726,7 +56354,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250) { + if (attr.kind === 251) { seenNames[attr.name.text] = true; } } @@ -55875,58 +56503,58 @@ var ts; switch (node.kind) { case 89: case 81: - if (hasKind(node.parent, 208)) { + if (hasKind(node.parent, 209)) { return getIfElseOccurrences(node.parent); } break; case 95: - if (hasKind(node.parent, 216)) { + if (hasKind(node.parent, 217)) { return getReturnOccurrences(node.parent); } break; case 99: - if (hasKind(node.parent, 220)) { + if (hasKind(node.parent, 221)) { return getThrowOccurrences(node.parent); } break; case 73: - if (hasKind(parent(parent(node)), 221)) { + if (hasKind(parent(parent(node)), 222)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 101: case 86: - if (hasKind(parent(node), 221)) { + if (hasKind(parent(node), 222)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 97: - if (hasKind(node.parent, 218)) { + if (hasKind(node.parent, 219)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 72: case 78: - if (hasKind(parent(parent(parent(node))), 218)) { + if (hasKind(parent(parent(parent(node))), 219)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 71: case 76: - if (hasKind(node.parent, 215) || hasKind(node.parent, 214)) { + if (hasKind(node.parent, 216) || hasKind(node.parent, 215)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 87: - if (hasKind(node.parent, 211) || - hasKind(node.parent, 212) || - hasKind(node.parent, 213)) { + if (hasKind(node.parent, 212) || + hasKind(node.parent, 213) || + hasKind(node.parent, 214)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 105: case 80: - if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) { + if (hasKind(node.parent, 211) || hasKind(node.parent, 210)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -55943,7 +56571,7 @@ var ts; break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 205)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 206)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -55955,10 +56583,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 220) { + if (node.kind === 221) { statementAccumulator.push(node); } - else if (node.kind === 221) { + else if (node.kind === 222) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -55978,17 +56606,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_17 = child.parent; - if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) { - return parent_17; + var parent_18 = child.parent; + if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262) { + return parent_18; } - if (parent_17.kind === 221) { - var tryStatement = parent_17; + if (parent_18.kind === 222) { + var tryStatement = parent_18; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_17; + child = parent_18; } return undefined; } @@ -55997,7 +56625,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 215 || node.kind === 214) { + if (node.kind === 216 || node.kind === 215) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -56010,23 +56638,23 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218: - if (statement.kind === 214) { + for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { + switch (node_2.kind) { + case 219: + if (statement.kind === 215) { continue; } - case 211: case 212: case 213: + case 214: + case 211: case 210: - case 209: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + if (!statement.label || isLabeledBy(node_2, statement.label.text)) { + return node_2; } break; default: - if (ts.isFunctionLike(node_1)) { + if (ts.isFunctionLike(node_2)) { return undefined; } break; @@ -56037,24 +56665,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 || + if (!(container.kind === 227 || container.kind === 197 || (declaration.kind === 144 && hasKind(container, 150)))) { return undefined; } } else if (modifier === 114) { - if (!(container.kind === 226 || container.kind === 197)) { + if (!(container.kind === 227 || container.kind === 197)) { return undefined; } } else if (modifier === 83 || modifier === 123) { - if (!(container.kind === 231 || container.kind === 261)) { + if (!(container.kind === 232 || container.kind === 262)) { return undefined; } } else if (modifier === 116) { - if (!(container.kind === 226 || declaration.kind === 226)) { + if (!(container.kind === 227 || declaration.kind === 227)) { return undefined; } } @@ -56065,8 +56693,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 231: - case 261: + case 232: + case 262: if (modifierFlag & 128) { nodes = declaration.members.concat(declaration); } @@ -56077,7 +56705,7 @@ var ts; case 150: nodes = container.parameters.concat(container.parent.members); break; - case 226: + case 227: case 197: nodes = container.members; if (modifierFlag & 28) { @@ -56158,7 +56786,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { - if (loopNode.kind === 209) { + if (loopNode.kind === 210) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 105)) { @@ -56179,13 +56807,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 211: case 212: case 213: - case 209: + case 214: case 210: + case 211: return getLoopBreakContinueOccurrences(owner); - case 218: + case 219: return getSwitchCaseDefaultOccurrences(owner); } } @@ -56235,7 +56863,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 204))) { + if (!(func && hasKind(func.body, 205))) { return undefined; } var keywords = []; @@ -56249,7 +56877,7 @@ var ts; } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 208) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 209) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -56260,7 +56888,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 208)) { + if (!hasKind(ifStatement.elseStatement, 209)) { break; } ifStatement = ifStatement.elseStatement; @@ -56295,7 +56923,7 @@ var ts; } DocumentHighlights.getDocumentHighlights = getDocumentHighlights; function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 220; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -56499,16 +57127,16 @@ var ts; } function getAliasSymbolForPropertyNameSymbol(symbol, location) { if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 236); + var defaultImport = ts.getDeclarationOfKind(symbol, 237); if (defaultImport) { return typeChecker.getAliasedSymbol(symbol); } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 || - declaration.kind === 243) ? declaration : undefined; }); + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 || + declaration.kind === 244) ? declaration : undefined; }); if (importOrExportSpecifier && (!importOrExportSpecifier.propertyName || importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 239 ? + return importOrExportSpecifier.kind === 240 ? typeChecker.getAliasedSymbol(symbol) : typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } @@ -56552,7 +57180,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226); + return ts.getAncestor(privateDeclaration, 227); } } if (symbol.flags & 8388608) { @@ -56576,7 +57204,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 261 && !ts.isExternalModule(container)) { + if (container.kind === 262 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -56813,7 +57441,7 @@ var ts; result.push(getReferenceEntryFromNode(refNode.parent)); } else if (refNode.kind === 70) { - if (refNode.parent.kind === 258) { + if (refNode.parent.kind === 259) { getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } var containingClass = getContainingClassIfInHeritageClause(refNode); @@ -56823,24 +57451,24 @@ var ts; } var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); + var parent_19 = containingTypeReference.parent; + if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { + if (parent_19.body.kind === 205) { + ts.forEachReturnStatement(parent_19.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); + else if (isImplementationExpression(parent_19.body)) { + maybeAdd(getReferenceEntryFromNode(parent_19.body)); } } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_19.expression)); } } } @@ -56876,7 +57504,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 199 - && node.parent.kind === 255 + && node.parent.kind === 256 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -56923,7 +57551,7 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227) { + else if (declaration.kind === 228) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } @@ -56997,11 +57625,11 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 261: + case 262: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 225: + case 226: case 184: break; default: @@ -57009,7 +57637,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261) { + if (searchSpaceNode.kind === 262) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -57044,7 +57672,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 184: - case 225: + case 226: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -57056,13 +57684,13 @@ var ts; } break; case 197: - case 226: + case 227: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 261: - if (container.kind === 261 && !ts.isExternalModule(container)) { + case 262: + if (container.kind === 262 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -57097,13 +57725,13 @@ var ts; for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { var position = possiblePositions_1[_i]; cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9) { + var node_3 = ts.getTouchingWord(sourceFile, position); + if (!node_3 || node_3.kind !== 9) { return; } - var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + references.push(getReferenceEntryFromNode(node_3)); } } } @@ -57111,7 +57739,7 @@ var ts; function populateSearchSymbolSet(symbol, location) { var result = [symbol]; var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258) { + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); if (propertySymbol) { result.push(propertySymbol); @@ -57161,7 +57789,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227) { + else if (declaration.kind === 228) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -57293,7 +57921,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 223) { + else if (node.kind === 224) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2); } @@ -57303,18 +57931,18 @@ var ts; } else { switch (node.kind) { - case 226: + case 227: case 197: - case 229: case 230: + case 231: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205) { - ts.Debug.assert(node.parent.kind === 224); + if (node.parent && node.parent.parent && node.parent.parent.kind === 206) { + ts.Debug.assert(node.parent.kind === 225); return node.parent.parent; } } @@ -57384,8 +58012,8 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 257: case 258: + case 259: case 149: case 151: case 152: @@ -57447,11 +58075,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 239 && declaration.parent && declaration.parent.kind === 238))) { + (declaration.kind === 240 && declaration.parent && declaration.parent.kind === 239))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 258) { + if (node.parent.kind === 259) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57529,7 +58157,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 225 || d.kind === 149 || d.kind === 148))) { + (!selectConstructors && (d.kind === 226 || d.kind === 149 || d.kind === 148))) { declarations.push(d); if (d.body) definition = d; @@ -57605,7 +58233,7 @@ var ts; var GoToImplementation; (function (GoToImplementation) { function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 258) { + if (node.parent.kind === 259) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -57697,7 +58325,7 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -57731,16 +58359,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225: + case 226: case 149: case 150: - case 226: - case 205: + case 227: + case 206: break findOwner; - case 261: + case 262: return undefined; - case 230: - if (commentOwner.parent.kind === 230) { + case 231: + if (commentOwner.parent.kind === 231) { return undefined; } break findOwner; @@ -57755,7 +58383,7 @@ var ts; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : @@ -57780,7 +58408,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205) { + if (commentOwner.kind === 206) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -57823,10 +58451,10 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_47 in nameToDeclarations) { - var declarations = nameToDeclarations[name_47]; + for (var name_48 in nameToDeclarations) { + var declarations = nameToDeclarations[name_48]; if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); if (!matches) { continue; } @@ -57837,21 +58465,21 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_47); + matches = patternMatcher.getMatches(containers, name_48); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } }); rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 || decl.kind === 239 || decl.kind === 234) { + if (decl.kind === 237 || decl.kind === 240 || decl.kind === 235) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -58076,14 +58704,14 @@ var ts; addLeafNode(node); } break; - case 236: + case 237: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 238) { addLeafNode(namedBindings); } else { @@ -58095,11 +58723,11 @@ var ts; } break; case 174: - case 223: + case 224: var decl = node; - var name_48 = decl.name; - if (ts.isBindingPattern(name_48)) { - addChildrenRecursively(name_48); + var name_49 = decl.name; + if (ts.isBindingPattern(name_49)) { + addChildrenRecursively(name_49); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -58109,11 +58737,11 @@ var ts; } break; case 185: - case 225: + case 226: case 184: addNodeWithRecursiveChild(node, node.body); break; - case 229: + case 230: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -58123,9 +58751,9 @@ var ts; } endNode(); break; - case 226: - case 197: case 227: + case 197: + case 228: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -58133,21 +58761,21 @@ var ts; } endNode(); break; - case 230: + case 231: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243: - case 234: + case 244: + case 235: case 155: case 153: case 154: - case 228: + case 229: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285) { + if (tag.kind === 286) { addLeafNode(tag); } }); @@ -58195,12 +58823,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 231 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230) { + if (a.body.kind !== 231) { return true; } return areSameModule(a.body, b.body); @@ -58251,7 +58879,7 @@ var ts; return a.length - b.length; }; function tryGetName(node) { - if (node.kind === 230) { + if (node.kind === 231) { return getModuleName(node); } var decl = node; @@ -58263,14 +58891,14 @@ var ts; case 185: case 197: return getFunctionOrClassName(node); - case 285: + case 286: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230) { + if (node.kind === 231) { return getModuleName(node); } var name = node.name; @@ -58281,15 +58909,15 @@ var ts; } } switch (node.kind) { - case 261: + case 262: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; case 185: - case 225: - case 184: case 226: + case 184: + case 227: case 197: if (ts.getModifierFlags(node) & 512) { return "default"; @@ -58303,7 +58931,7 @@ var ts; return "()"; case 155: return "[]"; - case 285: + case 286: return getJSDocTypedefTagName(node); default: return ""; @@ -58315,7 +58943,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 206) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58343,23 +58971,23 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226: - case 197: - case 229: case 227: + case 197: case 230: - case 261: case 228: - case 285: + case 231: + case 262: + case 229: + case 286: return true; case 150: case 149: case 151: case 152: - case 223: + case 224: return hasSomeImportantChild(item); case 185: - case 225: + case 226: case 184: return isTopLevelFunctionDeclaration(item); default: @@ -58370,8 +58998,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231: - case 261: + case 232: + case 262: case 149: case 150: return true; @@ -58382,7 +59010,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 && childKind !== 174; + return childKind !== 224 && childKind !== 174; }); } } @@ -58437,20 +59065,20 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 231) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 230 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 231 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 142; } function getNodeSpan(node) { - return node.kind === 261 + return node.kind === 262 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); } @@ -58458,14 +59086,14 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223) { + else if (node.parent.kind === 224) { return ts.declarationNameToString(node.parent.name); } else if (node.parent.kind === 192 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 && node.parent.name) { + else if (node.parent.kind === 258 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58561,26 +59189,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204: + case 205: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent_20 = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_19.kind === 209 || - parent_19.kind === 212 || - parent_19.kind === 213 || - parent_19.kind === 211 || - parent_19.kind === 208 || - parent_19.kind === 210 || - parent_19.kind === 217 || - parent_19.kind === 256) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent_20.kind === 210 || + parent_20.kind === 213 || + parent_20.kind === 214 || + parent_20.kind === 212 || + parent_20.kind === 209 || + parent_20.kind === 211 || + parent_20.kind === 218 || + parent_20.kind === 257) { + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221) { - var tryStatement = parent_19; + if (parent_20.kind === 222) { + var tryStatement = parent_20; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -58600,17 +59228,17 @@ var ts; }); break; } - case 231: { + case 232: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226: case 227: - case 229: + case 228: + case 230: case 176: - case 232: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -58878,7 +59506,8 @@ var ts; return str === str.toLowerCase(); } function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -58886,7 +59515,7 @@ var ts; return -1; } function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -58954,7 +59583,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -59527,7 +60156,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 203 && node.parent.parent.parent.kind === 181) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -59604,7 +60233,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261; n = n.parent) { + for (var n = node; n.kind !== 262; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -59966,7 +60595,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230); + var declaration = ts.getDeclarationOfKind(symbol, 231); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -60001,7 +60630,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 228) { + else if (declaration.kind === 229) { addInPrefix(); displayParts.push(ts.keywordPart(136)); displayParts.push(ts.spacePart()); @@ -60014,7 +60643,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260) { + if (declaration.kind === 261) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -60026,7 +60655,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233) { + if (symbol.declarations[0].kind === 234) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -60037,7 +60666,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234) { + if (declaration.kind === 235) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -60105,7 +60734,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 192) { @@ -60191,11 +60820,11 @@ var ts; if (declaration.kind === 184) { return true; } - if (declaration.kind !== 223 && declaration.kind !== 225) { + if (declaration.kind !== 224 && declaration.kind !== 226) { return false; } - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { - if (parent_20.kind === 261 || parent_20.kind === 231) { + for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + if (parent_21.kind === 262 || parent_21.kind === 232) { return false; } } @@ -60386,10 +61015,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 251: + case 249: case 250: case 248: - case 249: - case 247: return node.kind === 70; } } @@ -60722,10 +61351,10 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 140, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60736,10 +61365,10 @@ var ts; this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, 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, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); @@ -60759,6 +61388,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60767,9 +61397,10 @@ var ts; this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 133, 114, 136, 138]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 133, 114, 136, 138, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -60797,6 +61428,7 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, @@ -60825,7 +61457,7 @@ var ts; this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -60840,6 +61472,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, @@ -60848,7 +61481,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2)); @@ -60889,15 +61521,15 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_49 in o) { - if (o[name_49] === rule) { - return name_49; + for (var name_50 in o) { + if (o[name_50] === rule) { + return name_50; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 211; + return context.contextNode.kind === 212; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -60907,24 +61539,25 @@ var ts; case 192: case 193: case 200: - case 243: - case 239: + case 244: + case 240: case 156: case 164: case 165: return true; case 174: - case 228: - case 234: - case 223: + case 229: + case 235: + case 224: case 144: - case 260: + case 261: case 147: case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 212: - return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; case 213: + case 143: + return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; + case 214: return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; } return false; @@ -60938,6 +61571,9 @@ var ts; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 172 || Rules.IsSingleLineBlockContext(context); + }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); }; @@ -60958,17 +61594,17 @@ var ts; return true; } switch (node.kind) { - case 204: - case 232: + case 205: + case 233: case 176: - case 231: + case 232: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225: + case 226: case 149: case 148: case 151: @@ -60977,58 +61613,64 @@ var ts; case 184: case 150: case 185: - case 227: + case 228: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 || context.contextNode.kind === 184; + return context.contextNode.kind === 226 || context.contextNode.kind === 184; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226: - case 197: case 227: - case 229: - case 161: + case 197: + case 228: case 230: - case 241: + case 161: + case 231: case 242: - case 235: - case 238: + case 243: + case 236: + case 239: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226: - case 230: - case 229: - case 204: - case 256: + case 227: case 231: - case 218: + case 230: + case 257: + case 232: + case 219: return true; + case 205: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 185 && + blockParent.kind !== 184) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208: - case 218: - case 211: + case 209: + case 219: case 212: case 213: + case 214: + case 211: + case 222: case 210: - case 221: - case 209: - case 217: - case 256: + case 218: + case 257: return true; default: return false; @@ -61059,19 +61701,19 @@ var ts; return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246; + return context.contextNode.kind !== 247; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252; + return context.contextNode.kind === 253; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250; + return context.nextTokenParent.kind === 251; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250; + return context.contextNode.kind === 251; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247; + return context.contextNode.kind === 248; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -61089,14 +61731,14 @@ var ts; return node.kind === 145; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 && + return context.currentTokenParent.kind === 225 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230; + return context.contextNode.kind === 231; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 161; @@ -61108,10 +61750,11 @@ var ts; switch (parent.kind) { case 157: case 182: - case 226: - case 197: + case 229: case 227: - case 225: + case 197: + case 228: + case 226: case 184: case 185: case 149: @@ -61139,6 +61782,9 @@ var ts; Rules.IsYieldOrYieldStarWithOperand = function (context) { return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 201; + }; return Rules; }()); formatting.Rules = Rules; @@ -61423,6 +62069,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -61501,6 +62153,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -61598,17 +62256,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 226: case 227: + case 228: return ts.rangeContainsRange(parent.members, node); - case 230: - var body = parent.body; - return body && body.kind === 231 && ts.rangeContainsRange(body.statements, node); - case 261: - case 204: case 231: + var body = parent.body; + return body && body.kind === 232 && ts.rangeContainsRange(body.statements, node); + case 262: + case 205: + case 232: return ts.rangeContainsRange(parent.statements, node); - case 256: + case 257: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -61764,10 +62422,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226: return 74; - case 227: return 108; - case 225: return 88; - case 229: return 229; + case 227: return 74; + case 228: return 108; + case 226: return 88; + case 230: return 230; case 151: return 124; case 152: return 133; case 149: @@ -61799,17 +62457,30 @@ var ts; switch (kind) { case 16: case 17: - case 20: - case 21: case 18: case 19: case 81: case 105: case 56: return indentation; - default: - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40: + case 28: { + if (container.kind === 249 || + container.kind === 250 || + container.kind === 248) { + return indentation; + } + break; + } + case 20: + case 21: { + if (container.kind !== 170) { + return indentation; + } + break; + } } + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -61850,7 +62521,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -61880,7 +62551,7 @@ var ts; if (tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -61915,10 +62586,10 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -61931,7 +62602,7 @@ var ts; if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -62121,7 +62792,7 @@ var ts; startLine++; } var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -62212,7 +62883,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 150: - case 225: + case 226: case 184: case 149: case 148: @@ -62436,7 +63107,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 || !parentAndChildShareLine); + (parent.kind === 262 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -62460,7 +63131,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 && parent.elseStatement === child) { + if (parent.kind === 209 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62482,7 +63153,7 @@ var ts; return node.parent.properties; case 175: return node.parent.elements; - case 225: + case 226: case 184: case 185: case 149: @@ -62604,35 +63275,36 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207: - case 226: - case 197: + case 208: case 227: - case 229: + case 197: case 228: + case 230: + case 229: case 175: - case 204: - case 231: + case 205: + case 232: case 176: case 161: + case 170: case 163: - case 232: + case 233: + case 255: case 254: - case 253: case 183: case 177: case 179: case 180: - case 205: - case 223: - case 240: - case 216: + case 206: + case 224: + case 241: + case 217: case 193: case 173: case 172: + case 249: case 248: - case 247: - case 252: + case 253: case 148: case 153: case 154: @@ -62642,10 +63314,10 @@ var ts; case 166: case 181: case 189: - case 242: - case 238: case 243: case 239: + case 244: + case 240: return true; } return false; @@ -62653,27 +63325,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 209: case 210: - case 212: - case 213: case 211: - case 208: - case 225: + case 213: + case 214: + case 212: + case 209: + case 226: case 184: case 149: case 185: case 150: case 151: case 152: - return childKind !== 204; - case 241: - return childKind !== 242; - case 235: - return childKind !== 236 || - (child.namedBindings && child.namedBindings.kind !== 238); - case 246: - return childKind !== 249; + return childKind !== 205; + case 242: + return childKind !== 243; + case 236: + return childKind !== 237 || + (child.namedBindings && child.namedBindings.kind !== 239); + case 247: + return childKind !== 250; } return indentByDefault; } @@ -62723,24 +63395,120 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - return constructor.body.getFirstToken(sourceFile).getEnd(); - } codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122) { - return undefined; - } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] - }]; - } + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDecl = ts.getContainingClass(token); + if (!classDecl) { + return undefined; + } + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDecl); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeFromTypeNode(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8); }); + var insertion = getMissingIndexSignatureInsertion(implementedType, 1, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, 0, classDecl, hasStringIndexSignature); + insertion += codefix.getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); + } + } + return result; + function getMissingIndexSignatureInsertion(type, kind, enclosingDeclaration, hasIndexSigOfKind) { + if (!hasIndexSigOfKind) { + var IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + var writer = ts.getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + var result_7 = writer.string(); + ts.releaseStringWriter(writer); + return result_7; + } + } + return ""; + } + function pushAction(result, insertion, description) { + var newAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }; + result.push(newAction); + } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDecl = token.parent; + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var instantiatedExtendsType = checker.getBaseTypes(classType)[0]; + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var insertion = codefix.getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + if (insertion.length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8) && !!(flags & 128); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -62762,7 +63530,7 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); + var newPosition = ts.getOpenBraceEnd(constructor, sourceFile); var changes = [{ fileName: sourceFile.fileName, textChanges: [{ newText: superCall.getText(sourceFile), @@ -62778,7 +63546,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 207 && ts.isSuperCall(n.expression)) { + if (n.kind === 208 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -62791,6 +63559,216 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122) { + return undefined; + } + var newPosition = ts.getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84)) { + return undefined; + } + var changeStart = extendsToken.getStart(sourceFile); + var changeEnd = extendsToken.getEnd(); + var textChanges = [{ newText: " implements", span: { start: changeStart, length: changeEnd - changeStart } }]; + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeStart = keywordToken.getStart(sourceFile); + changeEnd = keywordToken.getEnd(); + textChanges.push({ newText: ",", span: { start: changeStart, length: changeEnd - changeStart } }); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 224: + switch (token.parent.parent.parent.kind) { + case 212: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 214: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 225) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 213: + return undefined; + case 257: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + case 235: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 240: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + case 237: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 238: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 238: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 236 && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -62876,7 +63854,10 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -62887,6 +63868,11 @@ var ts; var symbolIdActionMap = new ImportCodeActionMap(); var cachedImportDeclarations = ts.createMap(); var cachedNewImportInsertPosition; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, false, true); + } var allPotentialModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; @@ -62894,7 +63880,6 @@ var ts; allPotentialModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { var moduleSymbol = allPotentialModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); @@ -62931,10 +63916,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } - if (node.kind === 234) { + if (node.kind === 235) { return node; } node = node.parent; @@ -62952,7 +63937,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { return getCodeActionsForExistingImport(existingDeclarations); @@ -62967,9 +63952,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 235) { + if (declaration.kind === 236) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237) { + if (namedBindings && namedBindings.kind === 238) { namespaceImportDeclaration = declaration; } else { @@ -62985,7 +63970,7 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); @@ -62996,7 +63981,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + if (declaration.moduleReference && declaration.moduleReference.kind === 246) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -63029,7 +64014,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235) { + if (declaration.kind === 236) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -63055,7 +64040,9 @@ var ts; var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); var importStatementText = isDefault ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + : isNamespaceImport + ? "import * as " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; var newText = cachedNewImportInsertPosition === sourceFile.getStart() ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter : "" + context.newLineCharacter + importStatementText + ";"; @@ -63072,7 +64059,7 @@ var ts; tryGetModuleNameAsNodeModule() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261) { + if (moduleSymbol.valueDeclaration.kind !== 262) { return moduleSymbol.name; } } @@ -63085,6 +64072,7 @@ var ts; if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -63104,7 +64092,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -63223,144 +64211,120 @@ var ts; (function (ts) { var codefix; (function (codefix) { - codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - if (token.kind === 20) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70: - switch (token.parent.kind) { - case 223: - switch (token.parent.parent.parent.kind) { - case 211: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212: - return undefined; - case 256: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - case 234: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - case 236: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 && importDecl.parent) { - importDecl = importDecl.parent; + function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var insertion = ""; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); + } + return insertion; + } + codefix.getMissingMembersInsertion = getMissingMembersInsertion; + function getInsertionForMemberSymbol(symbol, enclosingDeclaration, checker, newlineChar) { + var type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return ""; + } + var declaration = declarations[0]; + var name = declaration.name ? declaration.name.getText() : undefined; + var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); + switch (declaration.kind) { + case 151: + case 152: + case 146: + case 147: + var typeString = checker.typeToString(type, enclosingDeclaration, 0); + return "" + visibility + name + ": " + typeString + ";" + newlineChar; + case 148: + case 149: + var signatures = checker.getSignaturesOfType(type, 0); + if (!(signatures && signatures.length > 0)) { + return ""; } - return importDecl; - } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] - }] - }]; - } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048, 0); + return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar); + } + var result = ""; + for (var i = 0; i < signatures.length; i++) { + var sigString_2 = checker.signatureToString(signatures[i], enclosingDeclaration, 2048, 0); + result += "" + visibility + name + sigString_2 + ";" + newlineChar; + } + var bodySig = undefined; + if (declarations.length > signatures.length) { + bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } + var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048, 0); + result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar); + return result; + default: + return ""; + } + } + function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { + var newSignatureDeclaration = ts.createNode(153); + newSignatureDeclaration.parent = enclosingDeclaration; + newSignatureDeclaration.name = signatures[0].getDeclaration().name; + var maxNonRestArgs = -1; + var maxArgsIndex = 0; + var minArgumentCount = signatures[0].minArgumentCount; + var hasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + hasRestParameter = hasRestParameter || sig.hasRestParameter; + var nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); + if (nonRestLength > maxNonRestArgs) { + maxNonRestArgs = nonRestLength; + maxArgsIndex = i; } } - }); + var maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(function (symbol) { return symbol.getName(); }); + var optionalToken = ts.createToken(54); + newSignatureDeclaration.parameters = ts.createNodeArray(); + for (var i = 0; i < maxNonRestArgs; i++) { + var newParameter = createParameterDeclarationWithoutType(i, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + if (hasRestParameter) { + var restParameter = createParameterDeclarationWithoutType(maxNonRestArgs, minArgumentCount, newSignatureDeclaration); + restParameter.dotDotDotToken = ts.createToken(23); + newSignatureDeclaration.parameters.push(restParameter); + } + return checker.getSignatureFromDeclaration(newSignatureDeclaration); + function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { + var newParameter = ts.createNode(144); + newParameter.symbol = new SymbolConstructor(1, maxArgsParameterSymbolNames[index] || "rest"); + newParameter.symbol.valueDeclaration = newParameter; + newParameter.symbol.declarations = [newParameter]; + newParameter.parent = enclosingSignatureDeclaration; + if (index >= minArgCount) { + newParameter.questionToken = optionalToken; + } + return newParameter; + } + } + function getMethodBodyStub(newLineChar) { + return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar; + } + function getVisibilityPrefix(flags) { + if (flags & 4) { + return "public "; + } + else if (flags & 16) { + return "protected "; + } + return ""; + } + var SymbolConstructor = ts.objectAllocator.getSymbolConstructor(); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; @@ -63425,7 +64389,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292, nodes.pos, nodes.end, this); + var list = createNode(293, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -63448,7 +64412,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; + var useJSDocScanner_1 = this.kind >= 279 && this.kind <= 292; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -63721,9 +64685,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_7 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_7 !== undefined) { - return result_7; + var result_8 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_8 !== undefined) { + return result_8; } if (declaration.name.kind === 142) { var expr = declaration.name.expression; @@ -63747,7 +64711,7 @@ var ts; } function visit(node) { switch (node.kind) { - case 225: + case 226: case 184: case 149: case 148: @@ -63767,18 +64731,18 @@ var ts; } ts.forEachChild(node, visit); break; - case 226: - case 197: case 227: + case 197: case 228: case 229: case 230: - case 234: - case 243: - case 239: - case 234: - case 236: + case 231: + case 235: + case 244: + case 240: + case 235: case 237: + case 238: case 151: case 152: case 161: @@ -63789,7 +64753,7 @@ var ts; if (!ts.hasModifier(node, 92)) { break; } - case 223: + case 224: case 174: { var decl = node; if (ts.isBindingPattern(decl.name)) { @@ -63799,24 +64763,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260: + case 261: case 147: case 146: addDeclaration(node); break; - case 241: + case 242: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235: + case 236: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 238) { addDeclaration(importClause.namedBindings); } else { @@ -64411,7 +65375,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 230 && + if (nodeForStartPos.parent.parent.kind === 231 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -64600,7 +65564,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -64709,7 +65673,7 @@ var ts; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 245 || + node.parent.kind === 246 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; @@ -65075,15 +66039,15 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_50 = names_2[_i]; - var resolution = newResolutions[name_50]; + var name_51 = names_2[_i]; + var resolution = newResolutions[name_51]; if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_50]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_51]; if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_50] = resolution = loader(name_50, containingFile, compilerOptions, this); + newResolutions[name_51] = resolution = loader(name_51, containingFile, compilerOptions, this); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -65123,6 +66087,9 @@ var ts; return resolution.failedLookupLocations.length === 0; } }; + LSHost.prototype.getNewLine = function () { + return this.host.newLine; + }; LSHost.prototype.getProjectVersion = function () { return this.project.getProjectVersion(); }; @@ -65328,7 +66295,7 @@ var ts; BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; - if (statement.kind !== 230 || statement.name.kind !== 9) { + if (statement.kind !== 231 || statement.name.kind !== 9) { return false; } } @@ -65439,7 +66406,7 @@ var ts; var ModuleBuilderFileInfo = (function (_super) { __extends(ModuleBuilderFileInfo, _super); function ModuleBuilderFileInfo() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.references = []; _this.referencedBy = []; return _this; @@ -65802,7 +66769,7 @@ var ts; info.detachFromProject(this); } } - else { + if (!this.program || !this.languageServiceEnabled) { for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) { var root = _c[_b]; root.detachFromProject(this); @@ -65948,9 +66915,9 @@ var ts; } var unresolvedImports; if (file.resolvedModules) { - for (var name_51 in file.resolvedModules) { - if (!file.resolvedModules[name_51] && !ts.isExternalModuleNameRelative(name_51)) { - var trimmed = name_51.trim(); + for (var name_52 in file.resolvedModules) { + if (!file.resolvedModules[name_52] && !ts.isExternalModuleNameRelative(name_52)) { + var trimmed = name_52.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -68539,9 +69506,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_52 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name_53 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_52, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name_53, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -69022,7 +69989,7 @@ var ts; if (len > 1) { var insertedNodes = new Array(len - 1); var startNode = leafNode; - for (var i = 1, len_1 = lines.length; i < len_1; i++) { + for (var i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } var pathIndex = this.startPath.length - 2; @@ -69219,8 +70186,8 @@ var ts; var snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { var snapIndex = snap.index; - for (var i = 0, len = this.changes.length; i < len; i++) { - var change = this.changes[i]; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } snap = new LineIndexSnapshot(this.currentVersion + 1, this); @@ -69241,8 +70208,8 @@ var ts; var textChangeRanges = []; for (var i = oldVersion + 1; i <= newVersion; i++) { var snap = this.versions[this.versionToIndex(i)]; - for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - var textChange = snap.changesSincePreviousVersion[j]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); } } @@ -69342,7 +70309,7 @@ var ts; LineIndex.prototype.load = function (lines) { if (lines.length > 0) { var leaves = []; - for (var i = 0, len = lines.length; i < len; i++) { + for (var i = 0; i < lines.length; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); @@ -69502,8 +70469,8 @@ var ts; LineNode.prototype.updateCounts = function () { this.totalChars = 0; this.totalLines = 0; - for (var i = 0, len = this.children.length; i < len; i++) { - var child = this.children[i]; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; this.totalChars += child.charCount(); this.totalLines += child.lineCount(); } @@ -70044,7 +71011,7 @@ var ts; var IOSession = (function (_super) { __extends(IOSession, _super); function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, telemetryEnabled, logger) { - var _this; + var _this = this; var typingsInstaller = disableAutomaticTypingAcquisition ? undefined : new NodeTypingsInstaller(telemetryEnabled, logger, host, installerEventPort, globalTypingsCacheLocation, host.newLine); @@ -70074,7 +71041,8 @@ var ts; function parseLoggingEnvironmentString(logEnvStr) { var logEnv = { logToFile: true }; var args = logEnvStr.split(" "); - for (var i = 0, len = args.length; i < (len - 1); i += 2) { + var len = args.length - 1; + for (var i = 0; i < len; i += 2) { var option = args[i]; var value = args[i + 1]; if (option && value) { @@ -70928,7 +71896,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index e01f4393032..25ed333b299 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -764,12 +764,14 @@ declare namespace ts.server.protocol { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } @@ -1094,102 +1096,102 @@ declare namespace ts { ExpressionWithTypeArguments = 199, AsExpression = 200, NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, + MetaProperty = 202, + TemplateSpan = 203, + SemicolonClassElement = 204, + Block = 205, + VariableStatement = 206, + EmptyStatement = 207, + ExpressionStatement = 208, + IfStatement = 209, + DoStatement = 210, + WhileStatement = 211, + ForStatement = 212, + ForInStatement = 213, + ForOfStatement = 214, + ContinueStatement = 215, + BreakStatement = 216, + ReturnStatement = 217, + WithStatement = 218, + SwitchStatement = 219, + LabeledStatement = 220, + ThrowStatement = 221, + TryStatement = 222, + DebuggerStatement = 223, + VariableDeclaration = 224, + VariableDeclarationList = 225, + FunctionDeclaration = 226, + ClassDeclaration = 227, + InterfaceDeclaration = 228, + TypeAliasDeclaration = 229, + EnumDeclaration = 230, + ModuleDeclaration = 231, + ModuleBlock = 232, + CaseBlock = 233, + NamespaceExportDeclaration = 234, + ImportEqualsDeclaration = 235, + ImportDeclaration = 236, + ImportClause = 237, + NamespaceImport = 238, + NamedImports = 239, + ImportSpecifier = 240, + ExportAssignment = 241, + ExportDeclaration = 242, + NamedExports = 243, + ExportSpecifier = 244, + MissingDeclaration = 245, + ExternalModuleReference = 246, + JsxElement = 247, + JsxSelfClosingElement = 248, + JsxOpeningElement = 249, + JsxClosingElement = 250, + JsxAttribute = 251, + JsxSpreadAttribute = 252, + JsxExpression = 253, + CaseClause = 254, + DefaultClause = 255, + HeritageClause = 256, + CatchClause = 257, + PropertyAssignment = 258, + ShorthandPropertyAssignment = 259, + SpreadAssignment = 260, + EnumMember = 261, + SourceFile = 262, + JSDocTypeExpression = 263, + JSDocAllType = 264, + JSDocUnknownType = 265, + JSDocArrayType = 266, + JSDocUnionType = 267, + JSDocTupleType = 268, + JSDocNullableType = 269, + JSDocNonNullableType = 270, + JSDocRecordType = 271, + JSDocRecordMember = 272, + JSDocTypeReference = 273, + JSDocOptionalType = 274, + JSDocFunctionType = 275, + JSDocVariadicType = 276, + JSDocConstructorType = 277, + JSDocThisType = 278, + JSDocComment = 279, + JSDocTag = 280, + JSDocAugmentsTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + JSDocLiteralType = 289, + JSDocNullKeyword = 290, + JSDocUndefinedKeyword = 291, + JSDocNeverKeyword = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, Count = 298, FirstAssignment = 57, LastAssignment = 69, @@ -1216,10 +1218,10 @@ declare namespace ts { FirstBinaryOperator = 26, LastBinaryOperator = 69, FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + FirstJSDocNode = 263, + LastJSDocNode = 289, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 292, } const enum NodeFlags { None = 0, @@ -1846,6 +1848,11 @@ declare namespace ts { kind: SyntaxKind.NonNullExpression; expression: Expression; } + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; @@ -1880,6 +1887,7 @@ declare namespace ts { } interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + dotDotDotToken?: Token; expression?: Expression; } interface JsxText extends Node { @@ -1895,10 +1903,6 @@ declare namespace ts { interface EndOfDeclarationMarker extends Statement { kind: SyntaxKind.EndOfDeclarationMarker; } - interface RawExpression extends PrimaryExpression { - kind: SyntaxKind.RawExpression; - text: string; - } interface MergeDeclarationMarker extends Statement { kind: SyntaxKind.MergeDeclarationMarker; } @@ -1912,7 +1916,7 @@ declare namespace ts { kind: SyntaxKind.MissingDeclaration; name?: Identifier; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; @@ -2458,6 +2462,7 @@ declare namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; @@ -2470,6 +2475,8 @@ declare namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -2492,6 +2499,7 @@ declare namespace ts { isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; @@ -2505,6 +2513,7 @@ declare namespace ts { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -2542,6 +2551,7 @@ declare namespace ts { InFirstTypeArgument = 256, InTypeAlias = 512, UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, } const enum SymbolFormatFlags { None = 0, @@ -2751,6 +2761,7 @@ declare namespace ts { TypeChecked = 1, LexicalThis = 2, CaptureThis = 4, + CaptureNewTarget = 8, SuperInstance = 256, SuperStatic = 512, ContextChecked = 1024, @@ -3671,6 +3682,9 @@ declare namespace ts { function memoize(callback: () => T): () => T; function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; function compose(...args: ((t: T) => T)[]): (t: T) => T; + function formatStringFromArgs(text: string, args: { + [index: number]: string; + }, baseIndex?: number): string; let localizedDiagnosticMessages: Map; function getLocaleSpecificMessage(message: DiagnosticMessage): string; function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; @@ -4178,7 +4192,7 @@ declare namespace ts { key: string; message: string; }; - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: number; category: DiagnosticCategory; key: string; @@ -5120,6 +5134,12 @@ declare namespace ts { key: string; message: string; }; + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Duplicate_identifier_0: { code: number; category: DiagnosticCategory; @@ -6494,6 +6514,18 @@ declare namespace ts { key: string; message: string; }; + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; JSX_element_attributes_type_0_may_not_be_a_union_type: { code: number; category: DiagnosticCategory; @@ -6548,6 +6580,12 @@ declare namespace ts { key: string; message: string; }; + JSX_spread_child_must_be_an_array_type: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Cannot_emit_namespaced_JSX_elements_in_React: { code: number; category: DiagnosticCategory; @@ -6854,6 +6892,18 @@ declare namespace ts { key: string; message: string; }; + The_operand_of_a_delete_operator_must_be_a_property_reference: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Import_declaration_0_is_using_private_name_1: { code: number; category: DiagnosticCategory; @@ -7862,6 +7912,12 @@ declare namespace ts { key: string; message: string; }; + File_0_has_an_unsupported_extension_so_skipping_it: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Only_amd_and_system_modules_are_supported_alongside_0: { code: number; category: DiagnosticCategory; @@ -7940,7 +7996,7 @@ declare namespace ts { key: string; message: string; }; - Loading_module_as_file_Slash_folder_candidate_module_location_0: { + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: number; category: DiagnosticCategory; key: string; @@ -7958,7 +8014,7 @@ declare namespace ts { key: string; message: string; }; - Loading_module_0_from_node_modules_folder: { + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: number; category: DiagnosticCategory; key: string; @@ -8252,6 +8308,18 @@ declare namespace ts { key: string; message: string; }; + Resolution_for_module_0_was_found_in_cache: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Directory_0_does_not_exist_skipping_all_lookups_in_it: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Variable_0_implicitly_has_an_1_type: { code: number; category: DiagnosticCategory; @@ -8588,6 +8656,18 @@ declare namespace ts { key: string; message: string; }; + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; Circularity_detected_while_resolving_configuration_Colon_0: { code: number; category: DiagnosticCategory; @@ -8636,13 +8716,7 @@ declare namespace ts { key: string; message: string; }; - Implement_interface_on_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_interface_on_class: { + Implement_interface_0: { code: number; category: DiagnosticCategory; key: string; @@ -8684,6 +8758,18 @@ declare namespace ts { key: string; message: string; }; + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { + code: number; + category: DiagnosticCategory; + key: string; + message: string; + }; }; } declare namespace ts { @@ -8904,12 +8990,23 @@ declare namespace ts { }): string[] | undefined; function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; function directoryProbablyExists(directoryName: string, host: { directoryExists?: (directoryName: string) => boolean; }): boolean; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; function loadModuleFromGlobalCache(moduleName: string, projectName: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, globalCache: string): ResolvedModuleWithFailedLookupLocations; } declare namespace ts { @@ -8988,6 +9085,8 @@ declare namespace ts { let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; let fullTripleSlashAMDReferencePathRegEx: RegExp; function isPartOfTypeNode(node: Node): boolean; + function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean; + function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression; function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; function getRestParameterElementType(node: TypeNode): TypeNode; @@ -8998,6 +9097,7 @@ declare namespace ts { function isFunctionLikeKind(kind: SyntaxKind): boolean; function introducesArgumentsExoticObject(node: Node): boolean; function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement; + function unwrapInnermostStatmentOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void): Statement; function isFunctionBlock(node: Node): boolean; function isObjectLiteralMethod(node: Node): node is MethodDeclaration; function isObjectLiteralOrClassExpressionMethod(node: Node): node is MethodDeclaration; @@ -9006,6 +9106,7 @@ declare namespace ts { function getContainingFunction(node: Node): FunctionLikeDeclaration; function getContainingClass(node: Node): ClassLikeDeclaration; function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; + function getNewTargetContainer(node: Node): Node; function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression; function isSuperProperty(node: Node): node is SuperProperty; @@ -9050,6 +9151,7 @@ declare namespace ts { } function getAssignmentTargetKind(node: Node): AssignmentKind; function isAssignmentTarget(node: Node): boolean; + function isDeleteTarget(node: Node): boolean; function isNodeDescendantOf(node: Node, ancestor: Node): boolean; function isInAmbientContext(node: Node): boolean; function isDeclarationName(name: Node): boolean; @@ -9062,7 +9164,7 @@ declare namespace ts { function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; - function getAncestor(node: Node, kind: SyntaxKind): Node; + function getAncestor(node: Node | undefined, kind: SyntaxKind): Node; function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; @@ -9094,7 +9196,7 @@ declare namespace ts { function getExpressionAssociativity(expression: Expression): Associativity; function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.RawExpression | SyntaxKind.Count; + function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.MetaProperty | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count; function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; function createDiagnosticCollection(): DiagnosticCollection; function escapeString(s: string): string; @@ -9210,6 +9312,7 @@ declare namespace ts { function isTemplateHead(node: Node): node is TemplateHead; function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail; function isIdentifier(node: Node): node is Identifier; + function isVoidExpression(node: Node): node is VoidExpression; function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier; function isModifier(node: Node): node is Modifier; function isQualifiedName(node: Node): node is QualifiedName; @@ -9488,7 +9591,7 @@ declare namespace ts { function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; function createJsxSpreadAttribute(expression: Expression, location?: TextRange): JsxSpreadAttribute; function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; - function createJsxExpression(expression: Expression, location?: TextRange): JsxExpression; + function createJsxExpression(expression: Expression, dotDotDotToken: Token, location?: TextRange): JsxExpression; function updateJsxExpression(node: JsxExpression, expression: Expression): JsxExpression; function createHeritageClause(token: SyntaxKind, types: ExpressionWithTypeArguments[], location?: TextRange): HeritageClause; function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; @@ -9510,7 +9613,6 @@ declare namespace ts { function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression; function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; - function createRawExpression(text: string): RawExpression; function createComma(left: Expression, right: Expression): Expression; function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression; function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression, location?: TextRange): DestructuringAssignment; @@ -9539,6 +9641,7 @@ declare namespace ts { function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; function getHelperName(name: string): Identifier; + function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement; interface CallBinding { target: LeftHandSideExpression; thisArg: Expression; @@ -10043,6 +10146,7 @@ declare namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -10051,6 +10155,7 @@ declare namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -10058,6 +10163,7 @@ declare namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; @@ -10066,6 +10172,7 @@ declare namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } @@ -10416,6 +10523,7 @@ declare namespace ts { configJsonObject: any; diagnostics: Diagnostic[]; }; + function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile): number; } declare namespace ts.BreakpointResolver { function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; @@ -10695,6 +10803,7 @@ declare namespace ts.formatting { SpaceAfterLetConstInVariableDeclaration: Rule; NoSpaceBeforeOpenParenInFuncCall: Rule; SpaceAfterFunctionInFuncDecl: Rule; + SpaceBeforeOpenParenInFuncDecl: Rule; NoSpaceBeforeOpenParenInFuncDecl: Rule; SpaceAfterVoidOperator: Rule; NoSpaceBetweenReturnAndSemicolon: Rule; @@ -10703,6 +10812,7 @@ declare namespace ts.formatting { SpaceAfterGetSetInMember: Rule; SpaceBeforeBinaryKeywordOperator: Rule; SpaceAfterBinaryKeywordOperator: Rule; + SpaceAfterConstructor: Rule; NoSpaceAfterConstructor: Rule; NoSpaceAfterModuleImport: Rule; SpaceAfterCertainTypeScriptKeywords: Rule; @@ -10776,6 +10886,7 @@ declare namespace ts.formatting { NoSpaceAfterEqualInJsxAttribute: Rule; NoSpaceAfterTypeAssertion: Rule; SpaceAfterTypeAssertion: Rule; + NoSpaceBeforeNonNullAssertionOperator: Rule; constructor(); static IsForContext(context: FormattingContext): boolean; static IsNotForContext(context: FormattingContext): boolean; @@ -10783,6 +10894,7 @@ declare namespace ts.formatting { static IsNotBinaryOpContext(context: FormattingContext): boolean; static IsConditionalOperatorContext(context: FormattingContext): boolean; static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean; + static IsBraceWrappedContext(context: FormattingContext): boolean; static IsBeforeMultilineBlockContext(context: FormattingContext): boolean; static IsMultilineBlockContext(context: FormattingContext): boolean; static IsSingleLineBlockContext(context: FormattingContext): boolean; @@ -10820,6 +10932,7 @@ declare namespace ts.formatting { static IsTypeAssertionContext(context: FormattingContext): boolean; static IsVoidOpContext(context: FormattingContext): boolean; static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean; + static IsNonNullAssertionContext(context: FormattingContext): boolean; } } declare namespace ts.formatting { @@ -10981,6 +11094,17 @@ declare namespace ts.codefix { } declare namespace ts.codefix { } +declare namespace ts.codefix { +} +declare namespace ts.codefix { +} +declare namespace ts.codefix { +} +declare namespace ts.codefix { +} +declare namespace ts.codefix { + function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string; +} declare namespace ts { const servicesVersion = "0.5"; interface DisplayPartsSymbolWriter extends SymbolWriter { @@ -11082,6 +11206,7 @@ declare namespace ts.server { startRecordingFilesWithChangedResolutions(): void; finishRecordingFilesWithChangedResolutions(): Path[]; private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); + getNewLine(): string; getProjectVersion(): string; getCompilationSettings(): CompilerOptions; useCaseSensitiveFileNames(): boolean; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 842c5458a89..459706962fb 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { var OperationCanceledException = (function () { @@ -206,7 +211,7 @@ var ts; ts.toPath = toPath; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -225,7 +230,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +240,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -245,7 +250,7 @@ var ts; } ts.find = find; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +273,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +283,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -981,6 +986,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2475,7 +2481,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2632,6 +2638,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2861,6 +2868,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2870,6 +2879,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2921,6 +2931,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3089,6 +3101,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -3102,10 +3115,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -3154,6 +3167,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3210,22 +3225,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); var ts; @@ -3606,7 +3624,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3792,7 +3810,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -5539,6 +5557,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -6156,6 +6175,7 @@ var ts; newLineCharacter: host.newLine || "\n", convertTabsToSpaces: true, indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, insertSpaceAfterCommaDelimiter: true, insertSpaceAfterSemicolonInForStatements: true, insertSpaceBeforeAndAfterBinaryOperators: true, @@ -6163,8 +6183,10 @@ var ts; insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, placeOpenBraceOnNewLineForFunctions: false, placeOpenBraceOnNewLineForControlBlocks: false, }; @@ -6293,6 +6315,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -6300,9 +6328,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -6314,13 +6339,13 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2: - case 0: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -6382,6 +6407,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -6436,7 +6462,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -6452,7 +6482,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -6493,31 +6524,115 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_1 = ts.getDirectoryPath(current); + if (parent_1 === current || directoryPathMap.contains(parent_1)) { + break; + } + directoryPathMap.set(parent_1, result); + current = parent_1; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -6642,33 +6757,33 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -6685,10 +6800,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -6716,11 +6854,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -6729,19 +6867,21 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -6750,16 +6890,22 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -6769,73 +6915,117 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -6847,10 +7037,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); @@ -6981,7 +7174,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261) { + while (node && node.kind !== 262) { node = node.parent; } return node; @@ -6989,11 +7182,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: return true; } return false; @@ -7058,18 +7251,18 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 292 && node._children.length > 0) { + if (node.kind === 293 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 && node.kind <= 288; + return node.kind >= 263 && node.kind <= 289; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 && node.kind <= 291; + return node.kind >= 279 && node.kind <= 292; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -7163,11 +7356,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 && node.parent.kind === 256; + return node.kind === 224 && node.parent.kind === 257; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 && + return node && node.kind === 231 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -7176,11 +7369,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return node.kind === 230 && (!node.body); + return node.kind === 231 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 || - node.kind === 230 || + return node.kind === 262 || + node.kind === 231 || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -7193,9 +7386,9 @@ var ts; return false; } switch (node.parent.kind) { - case 261: + case 262: return ts.isExternalModule(node.parent); - case 231: + case 232: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -7207,22 +7400,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261: - case 232: - case 256: - case 230: - case 211: + case 262: + case 233: + case 257: + case 231: case 212: case 213: + case 214: case 150: case 149: case 151: case 152: - case 225: + case 226: case 184: case 185: return true; - case 204: + case 205: return parentNode && !isFunctionLike(parentNode); } return false; @@ -7300,7 +7493,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204) { + if (node.body && node.body.kind === 205) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -7312,26 +7505,26 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261: + case 262: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 223: + case 224: case 174: - case 226: - case 197: case 227: + case 197: + case 228: + case 231: case 230: - case 229: - case 260: - case 225: + case 261: + case 226: case 184: case 149: case 151: case 152: - case 228: + case 229: errorNode = node.name; break; case 185: @@ -7355,7 +7548,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 && isConst(node); + return node.kind === 230 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -7372,7 +7565,7 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 + return node.kind === 208 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; @@ -7429,24 +7622,24 @@ var ts; case 141: case 177: case 98: - var parent_1 = node.parent; - if (parent_1.kind === 160) { + var parent_2 = node.parent; + if (parent_2.kind === 160) { return false; } - if (156 <= parent_1.kind && parent_1.kind <= 171) { + if (156 <= parent_2.kind && parent_2.kind <= 171) { return true; } - switch (parent_1.kind) { + switch (parent_2.kind) { case 199: - return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); + return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); case 143: - return node === parent_1.constraint; + return node === parent_2.constraint; case 147: case 146: case 144: - case 223: - return node === parent_1.type; - case 225: + case 224: + return node === parent_2.type; + case 226: case 184: case 185: case 150: @@ -7454,16 +7647,16 @@ var ts; case 148: case 151: case 152: - return node === parent_1.type; + return node === parent_2.type; case 153: case 154: case 155: - return node === parent_1.type; + return node === parent_2.type; case 182: - return node === parent_1.type; + return node === parent_2.type; case 179: case 180: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + return parent_2.typeArguments && ts.indexOf(parent_2.typeArguments, node) >= 0; case 181: return false; } @@ -7471,27 +7664,41 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 190; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216: + case 217: return visitor(node); - case 232: - case 204: - case 208: + case 233: + case 205: case 209: case 210: case 211: case 212: case 213: - case 217: + case 214: case 218: - case 253: - case 254: case 219: - case 221: - case 256: + case 254: + case 255: + case 220: + case 222: + case 257: return ts.forEachChild(node, traverse); } } @@ -7507,11 +7714,11 @@ var ts; if (operand) { traverse(operand); } - case 229: - case 227: case 230: case 228: - case 226: + case 231: + case 229: + case 227: case 197: return; default: @@ -7545,13 +7752,13 @@ var ts; if (node) { switch (node.kind) { case 174: - case 260: + case 261: case 144: - case 257: + case 258: case 147: case 146: - case 258: - case 223: + case 259: + case 224: return true; } } @@ -7563,7 +7770,7 @@ var ts; } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 || node.kind === 197); + return node && (node.kind === 227 || node.kind === 197); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7574,7 +7781,7 @@ var ts; switch (kind) { case 150: case 184: - case 225: + case 226: case 185: case 149: case 148: @@ -7597,7 +7804,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: return true; } @@ -7606,20 +7813,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211: case 212: case 213: - case 209: + case 214: case 210: + case 211: return true; - case 219: + case 220: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatmentOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 220) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 && isFunctionLike(node.parent); + return node && node.kind === 205 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -7683,9 +7902,9 @@ var ts; if (!includeArrowFunctions) { continue; } - case 225: + case 226: case 184: - case 230: + case 231: case 147: case 146: case 149: @@ -7696,13 +7915,26 @@ var ts; case 153: case 154: case 155: - case 229: - case 261: + case 230: + case 262: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, false); + if (container) { + switch (container.kind) { + case 150: + case 226: + case 184: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; function getSuperContainer(node, stopOnFunctions) { while (true) { node = node.parent; @@ -7713,7 +7945,7 @@ var ts; case 142: node = node.parent; break; - case 225: + case 226: case 184: case 185: if (!stopOnFunctions) { @@ -7742,13 +7974,13 @@ var ts; function getImmediatelyInvokedFunctionExpression(func) { if (func.kind === 184 || func.kind === 185) { var prev = func; - var parent_2 = func.parent; - while (parent_2.kind === 183) { - prev = parent_2; - parent_2 = parent_2.parent; + var parent_3 = func.parent; + while (parent_3.kind === 183) { + prev = parent_3; + parent_3 = parent_3.parent; } - if (parent_2.kind === 179 && parent_2.expression === prev) { - return parent_2; + if (parent_3.kind === 179 && parent_3.expression === prev) { + return parent_3; } } } @@ -7762,7 +7994,7 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 157: - case 272: + case 273: return node.typeName; case 199: return isEntityNameExpression(node.expression) @@ -7796,21 +8028,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226: + case 227: return true; case 147: - return node.parent.kind === 226; + return node.parent.kind === 227; case 151: case 152: case 149: return node.body !== undefined - && node.parent.kind === 226; + && node.parent.kind === 227; case 144: return node.parent.body !== undefined && (node.parent.kind === 150 || node.parent.kind === 149 || node.parent.kind === 152) - && node.parent.parent.kind === 226; + && node.parent.parent.kind === 227; } return false; } @@ -7826,7 +8058,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226: + case 227: return ts.forEach(node.members, nodeOrChildIsDecorated); case 149: case 152: @@ -7836,9 +8068,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 || - parent.kind === 247 || - parent.kind === 249) { + if (parent.kind === 249 || + parent.kind === 248 || + parent.kind === 250) { return parent.tagName === node; } return false; @@ -7877,10 +8109,11 @@ var ts; case 194: case 12: case 198: - case 246: case 247: + case 248: case 195: case 189: + case 202: return true; case 141: while (node.parent.kind === 141) { @@ -7894,53 +8127,53 @@ var ts; case 8: case 9: case 98: - var parent_3 = node.parent; - switch (parent_3.kind) { - case 223: + var parent_4 = node.parent; + switch (parent_4.kind) { + case 224: case 144: case 147: case 146: - case 260: - case 257: + case 261: + case 258: case 174: - return parent_3.initializer === node; - case 207: + return parent_4.initializer === node; case 208: case 209: case 210: - case 216: + case 211: case 217: case 218: - case 253: - case 220: - case 218: - return parent_3.expression === node; - case 211: - var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224) || + case 219: + case 254: + case 221: + case 219: + return parent_4.expression === node; + case 212: + var forStatement = parent_4; + return (forStatement.initializer === node && forStatement.initializer.kind !== 225) || forStatement.condition === node || forStatement.incrementor === node; - case 212: case 213: - var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224) || + case 214: + var forInStatement = parent_4; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225) || forInStatement.expression === node; case 182: case 200: - return node === parent_3.expression; - case 202: - return node === parent_3.expression; + return node === parent_4.expression; + case 203: + return node === parent_4.expression; case 142: - return node === parent_3.expression; + return node === parent_4.expression; case 145: + case 253: case 252: - case 251: - case 259: + case 260: return true; case 199: - return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); + return parent_4.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_4); default: - if (isPartOfExpression(parent_3)) { + if (isPartOfExpression(parent_4)) { return true; } } @@ -7955,7 +8188,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind === 245; + return node.kind === 235 && node.moduleReference.kind === 246; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7964,7 +8197,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 && node.moduleReference.kind !== 245; + return node.kind === 235 && node.moduleReference.kind !== 246; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7988,7 +8221,7 @@ var ts; } ts.isSingleOrDoubleQuote = isSingleOrDoubleQuote; function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223) { + if (s.valueDeclaration && s.valueDeclaration.kind === 224) { var declaration = s.valueDeclaration; return declaration.initializer && declaration.initializer.kind === 184; } @@ -8035,35 +8268,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235) { + if (node.kind === 236) { return node.moduleSpecifier; } - if (node.kind === 234) { + if (node.kind === 235) { var reference = node.moduleReference; - if (reference.kind === 245) { + if (reference.kind === 246) { return reference.expression; } } - if (node.kind === 241) { + if (node.kind === 242) { return node.moduleSpecifier; } - if (node.kind === 230 && node.name.kind === 9) { + if (node.kind === 231 && node.name.kind === 9) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 + return node.kind === 236 && node.importClause && !!node.importClause.name; } @@ -8074,8 +8307,8 @@ var ts; case 144: case 149: case 148: + case 259: case 258: - case 257: case 147: case 146: return node.questionToken !== undefined; @@ -8085,9 +8318,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 && + return node.kind === 275 && node.parameters.length > 0 && - node.parameters[0].type.kind === 276; + node.parameters[0].type.kind === 277; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -8100,7 +8333,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281) { + if (doc.kind === 282) { if (doc.kind === kind) { result.push(doc); } @@ -8126,9 +8359,9 @@ var ts; var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205; + parent.parent.parent.kind === 206; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205; + parent.parent.kind === 206; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -8138,13 +8371,13 @@ var ts; var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 192 && parent.operatorToken.kind === 57 && - parent.parent.kind === 207; + parent.parent.kind === 208; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 && - parent && parent.kind === 230; - var isPropertyAssignmentExpression = parent && parent.kind === 257; + var isModuleDeclaration = node.kind === 231 && + parent && parent.kind === 231; + var isPropertyAssignmentExpression = parent && parent.kind === 258; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } @@ -8162,17 +8395,17 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281); + var tags = getJSDocTags(func, 282); if (!param.name) { var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70) { var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 && tag.parameterName.text === name_8; }); + return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_8; }); } else { return undefined; @@ -8180,7 +8413,7 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283); + var tag = getFirstJSDocTag(node, 284); if (!tag && node.kind === 144) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -8191,15 +8424,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280); + return getFirstJSDocTag(node, 281); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282); + return getFirstJSDocTag(node, 283); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284); + return getFirstJSDocTag(node, 285); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -8212,8 +8445,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 275 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275; })) { + if (node.type && node.type.kind === 276 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276; })) { return true; } } @@ -8237,19 +8470,19 @@ var ts; case 191: var unaryOperator = parent.operator; return unaryOperator === 42 || unaryOperator === 43 ? 2 : 0; - case 212: case 213: + case 214: return parent.initializer === node ? 1 : 0; case 183: case 175: case 196: node = parent; break; - case 258: + case 259: if (parent.name !== node) { return 0; } - case 257: + case 258: node = parent.parent; break; default: @@ -8263,6 +8496,17 @@ var ts; return getAssignmentTargetKind(node) !== 0; } ts.isAssignmentTarget = isAssignmentTarget; + function isDeleteTarget(node) { + if (node.kind !== 177 && node.kind !== 178) { + return false; + } + node = node.parent; + while (node && node.kind === 183) { + node = node.parent; + } + return node && node.kind === 186; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -8274,7 +8518,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2) || (node.kind === 261 && node.isDeclarationFile)) { + if (hasModifier(node, 2) || (node.kind === 262 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -8287,7 +8531,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 || parent.kind === 243) { + if (parent.kind === 240 || parent.kind === 244) { if (parent.propertyName) { return true; } @@ -8313,8 +8557,8 @@ var ts; case 148: case 151: case 152: - case 260: - case 257: + case 261: + case 258: case 177: return parent.name === node; case 141: @@ -8326,22 +8570,22 @@ var ts; } return false; case 174: - case 239: + case 240: return parent.propertyName === node; - case 243: + case 244: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 234 || - node.kind === 233 || - node.kind === 236 && !!node.name || - node.kind === 237 || - node.kind === 239 || - node.kind === 243 || - node.kind === 240 && exportAssignmentIsAlias(node); + return node.kind === 235 || + node.kind === 234 || + node.kind === 237 && !!node.name || + node.kind === 238 || + node.kind === 240 || + node.kind === 244 || + node.kind === 241 && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8521,13 +8765,13 @@ var ts; var kind = node.kind; return kind === 150 || kind === 184 - || kind === 225 + || kind === 226 || kind === 185 || kind === 149 || kind === 151 || kind === 152 - || kind === 230 - || kind === 261; + || kind === 231 + || kind === 262; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8649,14 +8893,13 @@ var ts; case 184: case 185: case 197: - case 246: case 247: + case 248: case 11: case 12: case 194: case 183: case 198: - case 297: return 19; case 181: case 177: @@ -8830,13 +9073,12 @@ var ts; "\u0085": "\\u0085" }); function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -9712,8 +9954,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229: case 230: + case 231: return parseNode === parseNode.parent.name; } } @@ -9731,7 +9973,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 && declaration !== node) { + if (declaration.kind === 227 && declaration !== node) { return true; } } @@ -9782,6 +10024,10 @@ var ts; return node.kind === 70; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { return isIdentifier(node) && node.autoGenerateKind > 0; } @@ -9849,18 +10095,18 @@ var ts; || kind === 151 || kind === 152 || kind === 155 - || kind === 203; + || kind === 204; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 - || kind === 258 + return kind === 258 || kind === 259 + || kind === 260 || kind === 149 || kind === 151 || kind === 152 - || kind === 244; + || kind === 245; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNodeKind(kind) { @@ -9913,7 +10159,7 @@ var ts; ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223: + case 224: case 144: case 174: return true; @@ -9991,8 +10237,8 @@ var ts; || kind === 178 || kind === 180 || kind === 179 - || kind === 246 || kind === 247 + || kind === 248 || kind === 181 || kind === 175 || kind === 183 @@ -10011,7 +10257,7 @@ var ts; || kind === 100 || kind === 96 || kind === 201 - || kind === 297; + || kind === 202; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10039,7 +10285,6 @@ var ts; || kind === 196 || kind === 200 || kind === 198 - || kind === 297 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10053,11 +10298,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294; + return node.kind === 295; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293; + return node.kind === 294; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10070,11 +10315,11 @@ var ts; } ts.isOmittedExpression = isOmittedExpression; function isTemplateSpan(node) { - return node.kind === 202; + return node.kind === 203; } ts.isTemplateSpan = isTemplateSpan; function isBlock(node) { - return node.kind === 204; + return node.kind === 205; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10092,121 +10337,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223; + return node.kind === 224; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224; + return node.kind === 225; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232; + return node.kind === 233; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 - || kind === 230; + return kind === 232 + || kind === 231; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 234; + return node.kind === 235; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236; + return node.kind === 237; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 - || kind === 237; + return kind === 239 + || kind === 238; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239; + return node.kind === 240; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242; + return node.kind === 243; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243; + return node.kind === 244; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 || node.kind === 229; + return node.kind === 231 || node.kind === 230; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { return kind === 185 || kind === 174 - || kind === 226 + || kind === 227 || kind === 197 || kind === 150 - || kind === 229 - || kind === 260 - || kind === 243 - || kind === 225 + || kind === 230 + || kind === 261 + || kind === 244 + || kind === 226 || kind === 184 || kind === 151 - || kind === 236 - || kind === 234 - || kind === 239 - || kind === 227 + || kind === 237 + || kind === 235 + || kind === 240 + || kind === 228 || kind === 149 || kind === 148 - || kind === 230 - || kind === 233 - || kind === 237 + || kind === 231 + || kind === 234 + || kind === 238 || kind === 144 - || kind === 257 + || kind === 258 || kind === 147 || kind === 146 || kind === 152 - || kind === 258 - || kind === 228 + || kind === 259 + || kind === 229 || kind === 143 - || kind === 223 - || kind === 285; + || kind === 224 + || kind === 286; } function isDeclarationStatementKind(kind) { - return kind === 225 - || kind === 244 - || kind === 226 + return kind === 226 + || kind === 245 || kind === 227 || kind === 228 || kind === 229 || kind === 230 + || kind === 231 + || kind === 236 || kind === 235 - || kind === 234 + || kind === 242 || kind === 241 - || kind === 240 - || kind === 233; + || kind === 234; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 - || kind === 214 - || kind === 222 - || kind === 209 - || kind === 207 - || kind === 206 - || kind === 212 - || kind === 213 - || kind === 211 - || kind === 208 - || kind === 219 - || kind === 216 - || kind === 218 - || kind === 220 - || kind === 221 - || kind === 205 + return kind === 216 + || kind === 215 + || kind === 223 || kind === 210 + || kind === 208 + || kind === 207 + || kind === 213 + || kind === 214 + || kind === 212 + || kind === 209 + || kind === 220 || kind === 217 - || kind === 293 - || kind === 296 - || kind === 295; + || kind === 219 + || kind === 221 + || kind === 222 + || kind === 206 + || kind === 211 + || kind === 218 + || kind === 294 + || kind === 297 + || kind === 296; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10224,22 +10469,22 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204; + || kind === 205; } ts.isStatement = isStatement; function isModuleReference(node) { var kind = node.kind; - return kind === 245 + return kind === 246 || kind === 141 || kind === 70; } ts.isModuleReference = isModuleReference; function isJsxOpeningElement(node) { - return node.kind === 248; + return node.kind === 249; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249; + return node.kind === 250; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { @@ -10251,60 +10496,60 @@ var ts; ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 - || kind === 252 - || kind === 247 + return kind === 247 + || kind === 253 + || kind === 248 || kind === 10; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 - || kind === 251; + return kind === 251 + || kind === 252; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251; + return node.kind === 252; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250; + return node.kind === 251; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 - || kind === 252; + || kind === 253; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 - || kind === 254; + return kind === 254 + || kind === 255; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255; + return node.kind === 256; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256; + return node.kind === 257; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 257; + return node.kind === 258; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258; + return node.kind === 259; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } ts.isEnumMember = isEnumMember; function isSourceFile(node) { - return node.kind === 261; + return node.kind === 262; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10445,7 +10690,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 143) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228) { return current; } } @@ -10465,14 +10710,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= ts.getModifierFlags(node); } return flags; @@ -10481,14 +10726,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223) { + if (node.kind === 224) { node = node.parent; } - if (node && node.kind === 224) { + if (node && node.kind === 225) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205) { + if (node && node.kind === 206) { flags |= node.flags; } return flags; @@ -10547,7 +10792,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 + var ConstructorForKind = kind === 262 ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -11243,7 +11488,7 @@ var ts; } ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; function createTemplateSpan(expression, literal, location) { - var node = createNode(202, location); + var node = createNode(203, location); node.expression = expression; node.literal = literal; return node; @@ -11257,7 +11502,7 @@ var ts; } ts.updateTemplateSpan = updateTemplateSpan; function createBlock(statements, location, multiLine, flags) { - var block = createNode(204, location, flags); + var block = createNode(205, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11273,7 +11518,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205, location, flags); + var node = createNode(206, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11288,7 +11533,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224, location, flags); + var node = createNode(225, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11301,7 +11546,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223, location, flags); + var node = createNode(224, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11316,11 +11561,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(206, location); + return createNode(207, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(207, location, flags); + var node = createNode(208, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11333,7 +11578,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208, location); + var node = createNode(209, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11348,7 +11593,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(209, location); + var node = createNode(210, location); node.statement = statement; node.expression = expression; return node; @@ -11362,7 +11607,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(210, location); + var node = createNode(211, location); node.expression = expression; node.statement = statement; return node; @@ -11376,7 +11621,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211, location, undefined); + var node = createNode(212, location, undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11392,7 +11637,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(212, location); + var node = createNode(213, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11407,7 +11652,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(213, location); + var node = createNode(214, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11422,7 +11667,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(214, location); + var node = createNode(215, location); if (label) { node.label = label; } @@ -11437,7 +11682,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(215, location); + var node = createNode(216, location); if (label) { node.label = label; } @@ -11452,7 +11697,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(216, location); + var node = createNode(217, location); node.expression = expression; return node; } @@ -11465,7 +11710,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(217, location); + var node = createNode(218, location); node.expression = expression; node.statement = statement; return node; @@ -11479,7 +11724,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(218, location); + var node = createNode(219, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11493,7 +11738,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(219, location); + var node = createNode(220, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11507,7 +11752,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(220, location); + var node = createNode(221, location); node.expression = expression; return node; } @@ -11520,7 +11765,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221, location); + var node = createNode(222, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11535,7 +11780,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(232, location); + var node = createNode(233, location); node.clauses = createNodeArray(clauses); return node; } @@ -11548,7 +11793,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225, location, flags); + var node = createNode(226, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11568,7 +11813,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226, location); + var node = createNode(227, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11586,7 +11831,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235, location); + var node = createNode(236, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11602,7 +11847,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(236, location); + var node = createNode(237, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11616,7 +11861,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(237, location); + var node = createNode(238, location); node.name = name; return node; } @@ -11629,7 +11874,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(238, location); + var node = createNode(239, location); node.elements = createNodeArray(elements); return node; } @@ -11642,7 +11887,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(239, location); + var node = createNode(240, location); node.propertyName = propertyName; node.name = name; return node; @@ -11656,7 +11901,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240, location); + var node = createNode(241, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11672,7 +11917,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241, location); + var node = createNode(242, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11688,7 +11933,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(242, location); + var node = createNode(243, location); node.elements = createNodeArray(elements); return node; } @@ -11701,7 +11946,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(243, location); + var node = createNode(244, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11715,7 +11960,7 @@ var ts; } ts.updateExportSpecifier = updateExportSpecifier; function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246, location); + var node = createNode(247, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11730,7 +11975,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247, location); + var node = createNode(248, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11744,7 +11989,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248, location); + var node = createNode(249, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11758,7 +12003,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(249, location); + var node = createNode(250, location); node.tagName = tagName; return node; } @@ -11771,7 +12016,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(250, location); + var node = createNode(251, location); node.name = name; node.initializer = initializer; return node; @@ -11785,7 +12030,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(251, location); + var node = createNode(252, location); node.expression = expression; return node; } @@ -11797,21 +12042,22 @@ var ts; return node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252, location); + function createJsxExpression(expression, dotDotDotToken, location) { + var node = createNode(253, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } ts.updateJsxExpression = updateJsxExpression; function createHeritageClause(token, types, location) { - var node = createNode(255, location); + var node = createNode(256, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11825,7 +12071,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(253, location); + var node = createNode(254, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11839,7 +12085,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(254, location); + var node = createNode(255, location); node.statements = createNodeArray(statements); return node; } @@ -11852,7 +12098,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256, location); + var node = createNode(257, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11866,7 +12112,7 @@ var ts; } ts.updateCatchClause = updateCatchClause; function createPropertyAssignment(name, initializer, location) { - var node = createNode(257, location); + var node = createNode(258, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11881,14 +12127,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258, location); + var node = createNode(259, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(259, location); + var node = createNode(260, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -11909,7 +12155,7 @@ var ts; ts.updateSpreadAssignment = updateSpreadAssignment; function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261, node, node.flags); + var updated = createNode(262, node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -11969,27 +12215,27 @@ var ts; } ts.updateSourceFileNode = updateSourceFileNode; function createNotEmittedStatement(original) { - var node = createNode(293, original); + var node = createNode(294, original); node.original = original; return node; } ts.createNotEmittedStatement = createNotEmittedStatement; function createEndOfDeclarationMarker(original) { - var node = createNode(296); + var node = createNode(297); node.emitNode = {}; node.original = original; return node; } ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; function createMergeDeclarationMarker(original) { - var node = createNode(295); + var node = createNode(296); node.emitNode = {}; node.original = original; return node; } ts.createMergeDeclarationMarker = createMergeDeclarationMarker; function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294, location || original); + var node = createNode(295, location || original); node.expression = expression; node.original = original; return node; @@ -12002,12 +12248,6 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function createRawExpression(text) { - var node = createNode(297); - node.text = text; - return node; - } - ts.createRawExpression = createRawExpression; function createComma(left, right) { return createBinary(left, 25, right); } @@ -12171,6 +12411,19 @@ var ts; return setEmitFlags(createIdentifier(name), 4096 | 2); } ts.getHelperName = getHelperName; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12270,9 +12523,9 @@ var ts; case 151: case 152: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257: - return createExpressionForPropertyAssignment(property, receiver); case 258: + return createExpressionForPropertyAssignment(property, receiver); + case 259: return createExpressionForShorthandPropertyAssignment(property, receiver); case 149: return createExpressionForMethodDeclaration(property, receiver); @@ -12630,7 +12883,7 @@ var ts; case 177: node = node.expression; continue; - case 294: + case 295: node = node.expression; continue; } @@ -12678,7 +12931,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294) { + while (node.kind === 295) { node = node.expression; } return node; @@ -12738,7 +12991,7 @@ var ts; function getOrCreateEmitNode(node) { if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 261) { + if (node.kind === 262) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -12929,10 +13182,10 @@ var ts; var name_11 = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 && node.importClause) { + if (node.kind === 236 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 241 && node.moduleSpecifier) { + if (node.kind === 242 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -12996,11 +13249,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 258: - return bindingElement.name; + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); case 259: + return bindingElement.name; + case 260: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -13020,7 +13273,7 @@ var ts; case 174: return bindingElement.dotDotDotToken; case 196: - case 259: + case 260: return bindingElement; } return undefined; @@ -13036,7 +13289,7 @@ var ts; : propertyName; } break; - case 257: + case 258: if (bindingElement.name) { var propertyName = bindingElement.name; return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) @@ -13044,7 +13297,7 @@ var ts; : propertyName; } break; - case 259: + case 260: return bindingElement.name; } var target = getTargetOfBindingOrAssignmentElement(bindingElement); @@ -13149,15 +13402,15 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235: + case 236: externalImports.push(node); break; - case 234: - if (node.moduleReference.kind === 245) { + case 235: + if (node.moduleReference.kind === 246) { externalImports.push(node); } break; - case 241: + case 242: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -13184,12 +13437,12 @@ var ts; } } break; - case 240: + case 241: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 205: + case 206: if (ts.hasModifier(node, 1)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13197,7 +13450,7 @@ var ts; } } break; - case 225: + case 226: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -13215,7 +13468,7 @@ var ts; } } break; - case 226: + case 227: if (ts.hasModifier(node, 1)) { if (ts.hasModifier(node, 512)) { if (!hasExportDefault) { @@ -13263,7 +13516,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261) { + if (kind === 262) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70) { @@ -13312,20 +13565,20 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 258: + case 259: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259: + case 260: return visitNode(cbNode, node.expression); case 144: case 147: case 146: - case 257: - case 223: + case 258: + case 224: case 174: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13351,7 +13604,7 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13443,6 +13696,8 @@ var ts; visitNode(cbNode, node.type); case 201: return visitNode(cbNode, node.expression); + case 202: + return visitNode(cbNode, node.name); case 193: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || @@ -13451,84 +13706,77 @@ var ts; visitNode(cbNode, node.whenFalse); case 196: return visitNode(cbNode, node.expression); - case 204: - case 231: + case 205: + case 232: return visitNodes(cbNodes, node.statements); - case 261: + case 262: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205: + case 206: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224: + case 225: return visitNodes(cbNodes, node.declarations); - case 207: - return visitNode(cbNode, node.expression); case 208: + return visitNode(cbNode, node.expression); + case 209: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209: + case 210: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 211: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 212: return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 213: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 214: - case 215: - return visitNode(cbNode, node.label); - case 216: - return visitNode(cbNode, node.expression); - case 217: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 215: + case 216: + return visitNode(cbNode, node.label); + case 217: + return visitNode(cbNode, node.expression); case 218: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 219: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232: + case 233: return visitNodes(cbNodes, node.clauses); - case 253: + case 254: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254: + case 255: return visitNodes(cbNodes, node.statements); - case 219: + case 220: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220: - return visitNode(cbNode, node.expression); case 221: + return visitNode(cbNode, node.expression); + case 222: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256: + case 257: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 145: return visitNode(cbNode, node.expression); - case 226: - case 197: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 227: + case 197: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -13540,143 +13788,151 @@ var ts; visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 260: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); case 230: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 261: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 231: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234: + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235: + case 236: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236: + case 237: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233: - return visitNode(cbNode, node.name); - case 237: + case 234: return visitNode(cbNode, node.name); case 238: - case 242: + return visitNode(cbNode, node.name); + case 239: + case 243: return visitNodes(cbNodes, node.elements); - case 241: + case 242: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239: - case 243: + case 240: + case 244: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240: + case 241: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 194: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202: + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 142: return visitNode(cbNode, node.expression); - case 255: + case 256: return visitNodes(cbNodes, node.types); case 199: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245: - return visitNode(cbNode, node.expression); - case 244: - return visitNodes(cbNodes, node.decorators); case 246: + return visitNode(cbNode, node.expression); + case 245: + return visitNodes(cbNodes, node.decorators); + case 247: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247: case 248: + case 249: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 250: + case 251: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251: - return visitNode(cbNode, node.expression); case 252: return visitNode(cbNode, node.expression); - case 249: + case 253: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 250: return visitNode(cbNode, node.tagName); - case 262: + case 263: return visitNode(cbNode, node.type); - case 266: - return visitNodes(cbNodes, node.types); case 267: return visitNodes(cbNodes, node.types); - case 265: + case 268: + return visitNodes(cbNodes, node.types); + case 266: return visitNode(cbNode, node.elementType); + case 270: + return visitNode(cbNode, node.type); case 269: return visitNode(cbNode, node.type); - case 268: - return visitNode(cbNode, node.type); - case 270: + case 271: return visitNode(cbNode, node.literal); - case 272: + case 273: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273: - return visitNode(cbNode, node.type); case 274: + return visitNode(cbNode, node.type); + case 275: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275: - return visitNode(cbNode, node.type); case 276: return visitNode(cbNode, node.type); case 277: return visitNode(cbNode, node.type); - case 271: + case 278: + return visitNode(cbNode, node.type); + case 272: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278: + case 279: return visitNodes(cbNodes, node.tags); - case 281: + case 282: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282: - return visitNode(cbNode, node.typeExpression); case 283: return visitNode(cbNode, node.typeExpression); - case 280: - return visitNode(cbNode, node.typeExpression); case 284: - return visitNodes(cbNodes, node.typeParameters); + return visitNode(cbNode, node.typeExpression); + case 281: + return visitNode(cbNode, node.typeExpression); case 285: + return visitNodes(cbNodes, node.typeParameters); + case 286: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287: + case 288: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286: + case 287: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294: + case 295: return visitNode(cbNode, node.expression); - case 288: + case 289: return visitNode(cbNode, node.literal); } } @@ -13840,7 +14096,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(261, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(262, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -14459,7 +14715,7 @@ var ts; case 151: case 152: case 147: - case 203: + case 204: return true; case 149: var methodDeclaration = node; @@ -14473,8 +14729,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253: case 254: + case 255: return true; } } @@ -14483,42 +14739,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225: + case 226: + case 206: case 205: - case 204: + case 209: case 208: - case 207: - case 220: + case 221: + case 217: + case 219: case 216: - case 218: case 215: + case 213: case 214: case 212: - case 213: case 211: - case 210: - case 217: - case 206: - case 221: - case 219: - case 209: + case 218: + case 207: case 222: + case 220: + case 210: + case 223: + case 236: case 235: - case 234: + case 242: case 241: - case 240: - case 230: - case 226: + case 231: case 227: - case 229: case 228: + case 230: + case 229: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260; + return node.kind === 261; } function isReusableTypeMember(node) { if (node) { @@ -14534,7 +14790,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223) { + if (node.kind !== 224) { return false; } var variableDeclarator = node; @@ -14666,7 +14922,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202); + var span = createNode(203); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17) { @@ -15791,8 +16047,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248) { - var node = createNode(246, opening.pos); + if (opening.kind === 249) { + var node = createNode(247, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -15802,7 +16058,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247); + ts.Debug.assert(opening.kind === 248); result = opening; } if (inExpressionContext && token() === 26) { @@ -15862,7 +16118,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token() === 28) { - node = createNode(248, fullStart); + node = createNode(249, fullStart); scanJsxText(); } else { @@ -15874,7 +16130,7 @@ var ts; parseExpected(28, undefined, false); scanJsxText(); } - node = createNode(247, fullStart); + node = createNode(248, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -15893,9 +16149,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252); + var node = createNode(253); parseExpected(16); if (token() !== 17) { + node.dotDotDotToken = parseOptionalToken(23); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -15912,7 +16169,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250); + var node = createNode(251); node.name = parseIdentifierName(); if (token() === 57) { switch (scanJsxAttributeValue()) { @@ -15927,7 +16184,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251); + var node = createNode(252); parseExpected(16); parseExpected(23); node.expression = parseExpression(); @@ -15935,7 +16192,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249); + var node = createNode(250); parseExpected(27); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -16152,7 +16409,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23); if (dotDotDotToken) { - var spreadElement = createNode(259, fullStart); + var spreadElement = createNode(260, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -16171,7 +16428,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 || token() === 17 || token() === 57); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258, fullStart); + var shorthandDeclaration = createNode(259, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57); @@ -16182,7 +16439,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257, fullStart); + var propertyAssignment = createNode(258, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -16228,8 +16485,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180); + var fullStart = scanner.getStartPos(); parseExpected(93); + if (parseOptional(22)) { + var node_1 = createNode(202, fullStart); + node_1.keywordToken = 93; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(180, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18) { @@ -16238,7 +16502,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204); + var node = createNode(205); if (parseExpected(16, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -16269,12 +16533,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206); + var node = createNode(207); parseExpected(24); return finishNode(node); } function parseIfStatement() { - var node = createNode(208); + var node = createNode(209); parseExpected(89); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16284,7 +16548,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209); + var node = createNode(210); parseExpected(80); node.statement = parseStatement(); parseExpected(105); @@ -16295,7 +16559,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210); + var node = createNode(211); parseExpected(105); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16318,21 +16582,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91)) { - var forInStatement = createNode(212, pos); + var forInStatement = createNode(213, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(140)) { - var forOfStatement = createNode(213, pos); + var forOfStatement = createNode(214, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(211, pos); + var forStatement = createNode(212, pos); forStatement.initializer = initializer; parseExpected(24); if (token() !== 24 && token() !== 19) { @@ -16350,7 +16614,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 ? 71 : 76); + parseExpected(kind === 216 ? 71 : 76); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -16358,7 +16622,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216); + var node = createNode(217); parseExpected(95); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -16367,7 +16631,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217); + var node = createNode(218); parseExpected(106); parseExpected(18); node.expression = allowInAnd(parseExpression); @@ -16376,7 +16640,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253); + var node = createNode(254); parseExpected(72); node.expression = allowInAnd(parseExpression); parseExpected(55); @@ -16384,7 +16648,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254); + var node = createNode(255); parseExpected(78); parseExpected(55); node.statements = parseList(3, parseStatement); @@ -16394,12 +16658,12 @@ var ts; return token() === 72 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218); + var node = createNode(219); parseExpected(97); parseExpected(18); node.expression = allowInAnd(parseExpression); parseExpected(19); - var caseBlock = createNode(232, scanner.getStartPos()); + var caseBlock = createNode(233, scanner.getStartPos()); parseExpected(16); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(17); @@ -16407,14 +16671,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(220); + var node = createNode(221); parseExpected(99); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(221); + var node = createNode(222); parseExpected(101); node.tryBlock = parseBlock(false); node.catchClause = token() === 73 ? parseCatchClause() : undefined; @@ -16425,7 +16689,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256); + var result = createNode(257); parseExpected(73); if (parseExpected(18)) { result.variableDeclaration = parseVariableDeclaration(); @@ -16435,7 +16699,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222); + var node = createNode(223); parseExpected(77); parseSemicolon(); return finishNode(node); @@ -16444,13 +16708,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 && parseOptional(55)) { - var labeledStatement = createNode(219, fullStart); + var labeledStatement = createNode(220, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207, fullStart); + var expressionStatement = createNode(208, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -16602,9 +16866,9 @@ var ts; case 87: return parseForOrForInOrForOfStatement(); case 76: - return parseBreakOrContinueStatement(214); - case 71: return parseBreakOrContinueStatement(215); + case 71: + return parseBreakOrContinueStatement(216); case 95: return parseReturnStatement(); case 106: @@ -16683,7 +16947,7 @@ var ts; } default: if (decorators || modifiers) { - var node = createMissingNode(244, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(245, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -16755,7 +17019,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223); + var node = createNode(224); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -16764,7 +17028,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224); + var node = createNode(225); switch (token()) { case 103: break; @@ -16793,7 +17057,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(206, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(false); @@ -16801,7 +17065,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(226, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88); @@ -16986,7 +17250,7 @@ var ts; } function parseClassElement() { if (token() === 24) { - var result = createNode(203); + var result = createNode(204); nextToken(); return finishNode(result); } @@ -17020,7 +17284,7 @@ var ts; return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 197); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -17055,7 +17319,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 || token() === 107) { - var node = createNode(255); + var node = createNode(256); node.token = token(); nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -17078,7 +17342,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227, fullStart); + var node = createNode(228, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108); @@ -17089,7 +17353,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228, fullStart); + var node = createNode(229, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(136); @@ -17101,13 +17365,13 @@ var ts; return addJSDocComment(finishNode(node)); } function parseEnumMember() { - var node = createNode(260, scanner.getStartPos()); + var node = createNode(261, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229, fullStart); + var node = createNode(230, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82); @@ -17122,7 +17386,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231, scanner.getStartPos()); + var node = createNode(232, scanner.getStartPos()); if (parseExpected(16)) { node.statements = parseList(1, parseStatement); parseExpected(17); @@ -17133,7 +17397,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); var namespaceFlag = flags & 16; node.decorators = decorators; node.modifiers = modifiers; @@ -17145,7 +17409,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230, fullStart); + var node = createNode(231, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (token() === 139) { @@ -17190,7 +17454,7 @@ var ts; return nextToken() === 40; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233, fullStart); + var exportDeclaration = createNode(234, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117); @@ -17206,7 +17470,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token() !== 25 && token() !== 138) { - var importEqualsDeclaration = createNode(234, fullStart); + var importEqualsDeclaration = createNode(235, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -17216,7 +17480,7 @@ var ts; return addJSDocComment(finishNode(importEqualsDeclaration)); } } - var importDeclaration = createNode(235, fullStart); + var importDeclaration = createNode(236, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; if (identifier || @@ -17230,13 +17494,13 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(236, fullStart); + var importClause = createNode(237, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(25)) { - importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(238); + importClause.namedBindings = token() === 38 ? parseNamespaceImport() : parseNamedImportsOrExports(239); } return finishNode(importClause); } @@ -17246,7 +17510,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(245); + var node = createNode(246); parseExpected(131); parseExpected(18); node.expression = parseModuleSpecifier(); @@ -17264,7 +17528,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(237); + var namespaceImport = createNode(238); parseExpected(38); parseExpected(117); namespaceImport.name = parseIdentifier(); @@ -17272,14 +17536,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(22, kind === 238 ? parseImportSpecifier : parseExportSpecifier, 16, 17); + node.elements = parseBracketedList(22, kind === 239 ? parseImportSpecifier : parseExportSpecifier, 16, 17); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243); + return parseImportOrExportSpecifier(244); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239); + return parseImportOrExportSpecifier(240); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -17298,13 +17562,13 @@ var ts; else { node.name = identifierName; } - if (kind === 239 && checkIdentifierIsKeyword) { + if (kind === 240 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241, fullStart); + var node = createNode(242, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38)) { @@ -17312,7 +17576,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242); + node.exportClause = parseNamedImportsOrExports(243); if (token() === 138 || (token() === 9 && !scanner.hasPrecedingLineBreak())) { parseExpected(138); node.moduleSpecifier = parseModuleSpecifier(); @@ -17322,7 +17586,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240, fullStart); + var node = createNode(241, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57)) { @@ -17401,10 +17665,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1) - || node.kind === 234 && node.moduleReference.kind === 245 - || node.kind === 235 - || node.kind === 240 + || node.kind === 235 && node.moduleReference.kind === 246 + || node.kind === 236 || node.kind === 241 + || node.kind === 242 ? node : undefined; }); @@ -17440,7 +17704,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(262, scanner.getTokenPos()); + var result = createNode(263, scanner.getTokenPos()); parseExpected(16); result.type = parseJSDocTopLevelType(); parseExpected(17); @@ -17451,12 +17715,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48) { - var unionType = createNode(266, type.pos); + var unionType = createNode(267, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57) { - var optionalType = createNode(273, type.pos); + var optionalType = createNode(274, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -17467,20 +17731,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20) { - var arrayType = createNode(265, type.pos); + var arrayType = createNode(266, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21); type = finishNode(arrayType); } else if (token() === 54) { - var nullableType = createNode(268, type.pos); + var nullableType = createNode(269, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50) { - var nonNullableType = createNode(269, type.pos); + var nonNullableType = createNode(270, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -17532,27 +17796,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277); + var result = createNode(278); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276); + var result = createNode(277); nextToken(); parseExpected(55); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275); + var result = createNode(276); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274); + var result = createNode(275); nextToken(); parseExpected(18); result.parameters = parseDelimitedList(23, parseJSDocParameter); @@ -17573,7 +17837,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272); + var result = createNode(273); result.name = parseSimplePropertyName(); if (token() === 26) { result.typeArguments = parseTypeArguments(); @@ -17613,18 +17877,18 @@ var ts; return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270); + var result = createNode(271); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269); + var result = createNode(270); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267); + var result = createNode(268); nextToken(); result.types = parseDelimitedList(26, parseJSDocType); checkForTrailingComma(result.types); @@ -17638,7 +17902,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266); + var result = createNode(267); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19); @@ -17654,12 +17918,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263); + var result = createNode(264); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288); + var result = createNode(289); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -17672,11 +17936,11 @@ var ts; token() === 28 || token() === 57 || token() === 48) { - var result = createNode(264, pos); + var result = createNode(265, pos); return finishNode(result); } else { - var result = createNode(268, pos); + var result = createNode(269, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -17820,7 +18084,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(278, start); + var result = createNode(279, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -17930,7 +18194,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -17985,7 +18249,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -17996,20 +18260,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282, atToken.pos); + var result = createNode(283, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283, atToken.pos); + var result = createNode(284, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -18024,7 +18288,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286, atToken.pos); + var result = createNode(287, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -18033,7 +18297,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -18042,7 +18306,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285, atToken.pos); + var typedefTag = createNode(286, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -18056,7 +18320,7 @@ var ts; typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272) { + if (typeExpression.type.kind === 273) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { var name_16 = jsDocTypeReference.name; @@ -18074,7 +18338,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(288, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -18115,7 +18379,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22)) { - var jsDocNamespaceNode = createNode(230, pos); + var jsDocNamespaceNode = createNode(231, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4); @@ -18159,7 +18423,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = createNodeArray(); @@ -18182,7 +18446,7 @@ var ts; break; } } - var result = createNode(284, atToken.pos); + var result = createNode(285, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -18474,7 +18738,7 @@ var ts; } function visitArray(array) { if (position >= array.pos && position < array.end) { - for (var i = 0, n = array.length; i < n; i++) { + for (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -18501,16 +18765,16 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 227 || node.kind === 228) { + if (node.kind === 228 || node.kind === 229) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 235 || node.kind === 234) && !(ts.hasModifier(node, 1))) { + else if ((node.kind === 236 || node.kind === 235) && !(ts.hasModifier(node, 1))) { return 0; } - else if (node.kind === 231) { + else if (node.kind === 232) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -18526,7 +18790,7 @@ var ts; }); return state_1; } - else if (node.kind === 230) { + else if (node.kind === 231) { var body = node.body; return body ? getModuleInstanceState(body) : 1; } @@ -18635,7 +18899,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231)) { symbol.valueDeclaration = node; } } @@ -18666,9 +18930,9 @@ var ts; return "__new"; case 155: return "__index"; - case 241: + case 242: return "__export"; - case 240: + case 241: return node.isExportEquals ? "export=" : "default"; case 192: switch (ts.getSpecialPropertyAssignmentKind(node)) { @@ -18682,20 +18946,20 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225: case 226: + case 227: return ts.hasModifier(node, 512) ? "default" : undefined; - case 274: + case 275: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 144: - ts.Debug.assert(node.parent.kind === 274); + ts.Debug.assert(node.parent.kind === 275); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285: + case 286: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 206) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -18739,7 +19003,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 241 && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -18759,7 +19023,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 243 || (node.kind === 234 && hasExportModifier)) { + if (node.kind === 244 || (node.kind === 235 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -18767,7 +19031,7 @@ var ts; } } else { - var isJSDocTypedefInJSDocNamespace = node.kind === 285 && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 && node.name && node.name.kind === 70 && node.name.isInJSDocNamespace; @@ -18828,7 +19092,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256; } - if (node.kind === 261) { + if (node.kind === 262) { node.flags |= emitFlags; } if (isIIFE) { @@ -18904,43 +19168,43 @@ var ts; return; } switch (node.kind) { - case 210: + case 211: bindWhileStatement(node); break; - case 209: + case 210: bindDoStatement(node); break; - case 211: + case 212: bindForStatement(node); break; - case 212: case 213: + case 214: bindForInOrForOfStatement(node); break; - case 208: + case 209: bindIfStatement(node); break; - case 216: - case 220: + case 217: + case 221: bindReturnOrThrow(node); break; + case 216: case 215: - case 214: bindBreakOrContinueStatement(node); break; - case 221: + case 222: bindTryStatement(node); break; - case 218: + case 219: bindSwitchStatement(node); break; - case 232: + case 233: bindCaseBlock(node); break; - case 253: + case 254: bindCaseClause(node); break; - case 219: + case 220: bindLabeledStatement(node); break; case 190: @@ -18958,7 +19222,7 @@ var ts; case 193: bindConditionalExpressionFlow(node); break; - case 223: + case 224: bindVariableDeclarationFlow(node); break; case 179: @@ -19124,11 +19388,11 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208: - case 210: case 209: - return parent.expression === node; case 211: + case 210: + return parent.expression === node; + case 212: case 193: return parent.condition === node; } @@ -19192,7 +19456,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 + var enclosingLabeledStatement = node.parent.kind === 220 ? ts.lastOrUndefined(activeLabels) : undefined; var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); @@ -19227,7 +19491,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224) { + if (node.initializer.kind !== 225) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -19249,7 +19513,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216) { + if (node.kind === 217) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -19269,7 +19533,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 ? breakTarget : continueTarget; + var flowLabel = node.kind === 216 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -19326,7 +19590,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -19391,7 +19655,7 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209) { + if (!node.statement || node.statement.kind !== 210) { addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); } @@ -19422,13 +19686,13 @@ var ts; else if (node.kind === 176) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257) { + if (p.kind === 258) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258) { + else if (p.kind === 259) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259) { + else if (p.kind === 260) { bindAssignmentTargetFlow(p.expression); } } @@ -19528,7 +19792,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 || node.parent.parent.kind === 213) { + if (node.initializer || node.parent.parent.kind === 213 || node.parent.parent.kind === 214) { bindInitializedVariableFlow(node); } } @@ -19555,28 +19819,28 @@ var ts; function getContainerFlags(node) { switch (node.kind) { case 197: - case 226: - case 229: + case 227: + case 230: case 176: case 161: - case 287: - case 270: + case 288: + case 271: return 1; - case 227: - return 1 | 64; - case 274: - case 230: case 228: + return 1 | 64; + case 275: + case 231: + case 229: case 170: return 1 | 32; - case 261: + case 262: return 1 | 4 | 32; case 149: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 | 4 | 32 | 8 | 128; } case 150: - case 225: + case 226: case 148: case 151: case 152: @@ -19589,17 +19853,17 @@ var ts; case 184: case 185: return 1 | 4 | 32 | 8 | 16; - case 231: + case 232: return 4; case 147: return node.initializer ? 4 : 0; - case 256: - case 211: + case 257: case 212: case 213: - case 232: + case 214: + case 233: return 2; - case 204: + case 205: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -19615,20 +19879,20 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 230: + case 231: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261: + case 262: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 197: - case 226: + case 227: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229: + case 230: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 161: case 176: - case 227: - case 270: - case 287: + case 228: + case 271: + case 288: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 158: case 159: @@ -19640,11 +19904,11 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: case 185: - case 274: - case 228: + case 275: + case 229: case 170: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } @@ -19660,11 +19924,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 ? node : node.body; - if (body && (body.kind === 261 || body.kind === 231)) { + var body = node.kind === 262 ? node : node.body; + if (body && (body.kind === 262 || body.kind === 232)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 || stat.kind === 240) { + if (stat.kind === 242 || stat.kind === 241) { return true; } } @@ -19740,11 +20004,11 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 || prop.name.kind !== 70) { + if (prop.kind === 260 || prop.name.kind !== 70) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 257 || prop.kind === 258 || prop.kind === 149 + var currentKind = prop.kind === 258 || prop.kind === 259 || prop.kind === 149 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -19766,10 +20030,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230: + case 231: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261: + case 262: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -19859,8 +20123,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 261 && - blockScopeContainer.kind !== 230 && + if (blockScopeContainer.kind !== 262 && + blockScopeContainer.kind !== 231 && !ts.isFunctionLike(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -19943,14 +20207,14 @@ var ts; case 70: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285) { + while (parentNode && parentNode.kind !== 286) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); break; } case 98: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 259)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -19982,7 +20246,7 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 256: + case 257: return checkStrictModeCatchClause(node); case 186: return checkStrictModeDeleteExpression(node); @@ -19992,7 +20256,7 @@ var ts; return checkStrictModePostfixUnaryExpression(node); case 190: return checkStrictModePrefixUnaryExpression(node); - case 217: + case 218: return checkStrictModeWithStatement(node); case 167: seenThisKeyword = true; @@ -20003,22 +20267,22 @@ var ts; return declareSymbolAndAddToSymbolTable(node, 262144, 530920); case 144: return bindParameter(node); - case 223: + case 224: case 174: return bindVariableDeclarationOrBindingElement(node); case 147: case 146: - case 271: + case 272: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 0); - case 286: + case 287: return bindJSDocProperty(node); - case 257: case 258: - return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 260: - return bindPropertyOrMethodOrAccessor(node, 8, 900095); case 259: - case 251: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 261: + return bindPropertyOrMethodOrAccessor(node, 8, 900095); + case 260: + case 252: var root = container; var hasRest = false; while (root.parent) { @@ -20039,7 +20303,7 @@ var ts; case 149: case 148: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); - case 225: + case 226: return bindFunctionDeclaration(node); case 150: return declareSymbolAndAddToSymbolTable(node, 16384, 0); @@ -20049,12 +20313,12 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 158: case 159: - case 274: + case 275: return bindFunctionOrConstructorType(node); case 161: case 170: - case 287: - case 270: + case 288: + case 271: return bindAnonymousDeclaration(node, 2048, "__type"); case 176: return bindObjectLiteralExpression(node); @@ -20067,43 +20331,43 @@ var ts; } break; case 197: - case 226: + case 227: inStrictMode = true; return bindClassLikeDeclaration(node); - case 227: + case 228: return bindBlockScopedDeclaration(node, 64, 792968); - case 285: + case 286: if (!node.fullName || node.fullName.kind === 70) { return bindBlockScopedDeclaration(node, 524288, 793064); } break; - case 228: - return bindBlockScopedDeclaration(node, 524288, 793064); case 229: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793064); case 230: + return bindEnumDeclaration(node); + case 231: return bindModuleDeclaration(node); - case 234: - case 237: - case 239: - case 243: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 233: - return bindNamespaceExportDeclaration(node); - case 236: - return bindImportClause(node); - case 241: - return bindExportDeclaration(node); + case 235: + case 238: case 240: + case 244: + return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + case 234: + return bindNamespaceExportDeclaration(node); + case 237: + return bindImportClause(node); + case 242: + return bindExportDeclaration(node); + case 241: return bindExportAssignment(node); - case 261: + case 262: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204: + case 205: if (!ts.isFunctionLike(node.parent)) { return; } - case 231: + case 232: return updateStrictModeStatementList(node.statements); } } @@ -20131,7 +20395,7 @@ var ts; bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else { - var flags = node.kind === 240 && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 241 && ts.exportAssignmentIsAlias(node) ? 8388608 : 4; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); @@ -20141,17 +20405,17 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261) { + if (node.parent.kind !== 262) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_4 = node.parent; - if (!ts.isExternalModule(parent_4)) { + var parent_5 = node.parent; + if (!ts.isExternalModule(parent_5)) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_module_files)); return; } - if (!parent_4.isDeclarationFile) { + if (!parent_5.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -20190,7 +20454,7 @@ var ts; } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); - if (container.kind === 225 || container.kind === 184) { + if (container.kind === 226 || container.kind === 184) { container.symbol.members = container.symbol.members || ts.createMap(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); } @@ -20226,7 +20490,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 226) { + if (node.kind === 227) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -20336,15 +20600,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 206) || - node.kind === 226 || - (node.kind === 230 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 229 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 207) || + node.kind === 227 || + (node.kind === 231 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 230 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 || + (node.kind !== 206 || ts.getCombinedNodeFlags(node.declarationList) & 3 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -20362,13 +20626,13 @@ var ts; return computeCallExpression(node, subtreeFlags); case 180: return computeNewExpression(node, subtreeFlags); - case 230: + case 231: return computeModuleDeclaration(node, subtreeFlags); case 183: return computeParenthesizedExpression(node, subtreeFlags); case 192: return computeBinaryExpression(node, subtreeFlags); - case 207: + case 208: return computeExpressionStatement(node, subtreeFlags); case 144: return computeParameter(node, subtreeFlags); @@ -20376,23 +20640,23 @@ var ts; return computeArrowFunction(node, subtreeFlags); case 184: return computeFunctionExpression(node, subtreeFlags); - case 225: - return computeFunctionDeclaration(node, subtreeFlags); - case 223: - return computeVariableDeclaration(node, subtreeFlags); - case 224: - return computeVariableDeclarationList(node, subtreeFlags); - case 205: - return computeVariableStatement(node, subtreeFlags); - case 219: - return computeLabeledStatement(node, subtreeFlags); case 226: + return computeFunctionDeclaration(node, subtreeFlags); + case 224: + return computeVariableDeclaration(node, subtreeFlags); + case 225: + return computeVariableDeclarationList(node, subtreeFlags); + case 206: + return computeVariableStatement(node, subtreeFlags); + case 220: + return computeLabeledStatement(node, subtreeFlags); + case 227: return computeClassDeclaration(node, subtreeFlags); case 197: return computeClassExpression(node, subtreeFlags); - case 255: - return computeHeritageClause(node, subtreeFlags); case 256: + return computeHeritageClause(node, subtreeFlags); + case 257: return computeCatchClause(node, subtreeFlags); case 199: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -20405,7 +20669,7 @@ var ts; case 151: case 152: return computeAccessor(node, subtreeFlags); - case 234: + case 235: return computeImportEquals(node, subtreeFlags); case 177: return computePropertyAccess(node, subtreeFlags); @@ -20793,25 +21057,25 @@ var ts; case 116: case 123: case 75: - case 229: - case 260: + case 230: + case 261: case 182: case 200: case 201: case 130: transformFlags |= 3; break; - case 246: case 247: case 248: - case 10: case 249: + case 10: case 250: case 251: case 252: + case 253: transformFlags |= 4; break; - case 213: + case 214: transformFlags |= 8; case 12: case 13: @@ -20819,8 +21083,9 @@ var ts; case 15: case 194: case 181: - case 258: + case 259: case 114: + case 202: transformFlags |= 192; break; case 195: @@ -20850,8 +21115,8 @@ var ts; case 164: case 165: case 166: - case 227: case 228: + case 229: case 167: case 168: case 169: @@ -20869,7 +21134,7 @@ var ts; case 196: transformFlags |= 192 | 524288; break; - case 259: + case 260: transformFlags |= 8 | 1048576; break; case 96: @@ -20917,22 +21182,22 @@ var ts; transformFlags |= 192; } break; - case 209: case 210: case 211: case 212: + case 213: if (subtreeFlags & 4194304) { transformFlags |= 192; } break; - case 261: + case 262: if (subtreeFlags & 32768) { transformFlags |= 192; } break; - case 216: - case 214: + case 217: case 215: + case 216: transformFlags |= 33554432; break; } @@ -20948,18 +21213,18 @@ var ts; case 180: case 175: return 537396545; - case 230: + case 231: return 574674241; case 144: return 536872257; case 185: return 601249089; case 184: - case 225: - return 601281857; - case 224: - return 546309441; case 226: + return 601281857; + case 225: + return 546309441; + case 227: case 197: return 539358529; case 150: @@ -20981,12 +21246,12 @@ var ts; case 153: case 154: case 155: - case 227: case 228: + case 229: return -3; case 176: return 540087617; - case 256: + case 257: return 537920833; case 172: case 173: @@ -21056,9 +21321,11 @@ var ts; getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getTypeFromTypeNode: getTypeFromTypeNode, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -21067,6 +21334,7 @@ var ts; getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + signatureToString: signatureToString, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -21089,7 +21357,8 @@ var ts; tryGetMemberInModuleExports: tryGetMemberInModuleExports, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -21183,6 +21452,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var typeofEQFacts = ts.createMap({ @@ -21328,7 +21598,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 && source.valueDeclaration.kind !== 230))) { + (target.valueDeclaration.kind === 231 && source.valueDeclaration.kind !== 231))) { target.valueDeclaration = source.valueDeclaration; } ts.addRange(target.declarations, source.declarations); @@ -21423,7 +21693,7 @@ var ts; return type.flags & 32768 ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 261 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 262 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -21467,25 +21737,35 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 223 || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174) { + var errorBindingElement = ts.getAncestor(usage, 174); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224), usage); + } + else if (declaration.kind === 224) { + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); return isUsedInFunctionOrNonStaticProperty(usage, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205: - case 211: - case 213: + case 206: + case 212: + case 214: if (isSameScopeDescendentOf(usage, declaration, container)) { return true; } break; } switch (declaration.parent.parent.kind) { - case 212: case 213: + case 214: if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; } @@ -21512,6 +21792,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { var result; @@ -21525,7 +21814,7 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 278) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 279) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 144 || @@ -21548,13 +21837,13 @@ var ts; } } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230: + case 231: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 || ts.isAmbientModule(location)) { + if (location.kind === 262 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -21564,7 +21853,7 @@ var ts; } if (moduleExports[name] && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 243)) { + ts.getDeclarationOfKind(moduleExports[name], 244)) { break; } } @@ -21572,7 +21861,7 @@ var ts; break loop; } break; - case 229: + case 230: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } @@ -21588,9 +21877,9 @@ var ts; } } break; - case 226: - case 197: case 227: + case 197: + case 228: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -21608,7 +21897,7 @@ var ts; break; case 142: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227) { + if (ts.isClassLike(grandparent) || grandparent.kind === 228) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; @@ -21620,7 +21909,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 185: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; @@ -21684,7 +21973,7 @@ var ts; } if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233) { + if (decls && decls.length === 1 && decls[0].kind === 234) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -21764,7 +22053,7 @@ var ts; 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"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -21781,10 +22070,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234) { + if (node.kind === 235) { return node; } - while (node && node.kind !== 235) { + while (node && node.kind !== 236) { node = node.parent; } return node; @@ -21794,7 +22083,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245) { + if (node.moduleReference.kind === 246) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -21898,19 +22187,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 234: + case 235: return getTargetOfImportEqualsDeclaration(node); - case 236: - return getTargetOfImportClause(node); case 237: + return getTargetOfImportClause(node); + case 238: return getTargetOfNamespaceImport(node); - case 239: - return getTargetOfImportSpecifier(node); - case 243: - return getTargetOfExportSpecifier(node); case 240: + return getTargetOfImportSpecifier(node); + case 244: + return getTargetOfExportSpecifier(node); + case 241: return getTargetOfExportAssignment(node); - case 233: + case 234: return getTargetOfNamespaceExportDeclaration(node); } } @@ -21954,10 +22243,10 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240) { + if (node.kind === 241) { checkExpressionCached(node.expression); } - else if (node.kind === 243) { + else if (node.kind === 244) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -21973,7 +22262,7 @@ var ts; return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 234); + ts.Debug.assert(entityName.parent.kind === 235); return resolveEntityName(entityName, 107455 | 793064 | 1920, false, dontResolveAlias); } } @@ -22270,11 +22559,11 @@ var ts; } } switch (location_1.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 230: + case 231: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -22318,7 +22607,7 @@ var ts; return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -22350,7 +22639,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -22423,7 +22712,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 262 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -22461,7 +22750,7 @@ var ts; meaning = 107455 | 1048576; } else if (entityName.kind === 141 || entityName.kind === 177 || - entityName.parent.kind === 234) { + entityName.parent.kind === 235) { meaning = 1920; } else { @@ -22556,7 +22845,7 @@ var ts; while (node.kind === 166) { node = node.parent; } - if (node.kind === 228) { + if (node.kind === 229) { return getSymbolOfNode(node); } } @@ -22564,7 +22853,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 && + node.parent.kind === 232 && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { @@ -22633,9 +22922,9 @@ var ts; var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), false); + var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_6) { + walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), false); } } if (accessibleSymbolChain) { @@ -22768,12 +23057,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); writePunctuation(writer, 22); } } @@ -22832,7 +23121,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 || declaration.parent.kind === 231; + return declaration.parent.kind === 262 || declaration.parent.kind === 232; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -22845,25 +23134,6 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130); - writeSpace(writer); - } - writePunctuation(writer, 20); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21); - writePunctuation(writer, 55); - writeSpace(writer); - writeType(info.type, 0); - writePunctuation(writer, 24); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130); @@ -22946,8 +23216,8 @@ var ts; writePunctuation(writer, 24); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134); - writeIndexSignature(resolved.numberIndexInfo, 132); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -23126,6 +23396,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 && isTypeAny(returnType)) { + return; + } if (flags & 8) { writeSpace(writer); writePunctuation(writer, 35); @@ -23138,7 +23412,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -23156,6 +23429,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130); + writeSpace(writer); + } + writePunctuation(writer, 20); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55); + writeSpace(writer); + switch (kind) { + case 1: + writeKeyword(writer, 132); + break; + case 0: + writeKeyword(writer, 134); + break; + } + writePunctuation(writer, 21); + writePunctuation(writer, 55); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -23166,6 +23465,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -23182,27 +23482,27 @@ var ts; switch (node.kind) { case 174: return isDeclarationVisible(node.parent.parent); - case 223: + case 224: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 230: - case 226: + case 231: case 227: case 228: - case 225: case 229: - case 234: + case 226: + case 230: + case 235: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent_8 = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 234 && parent_7.kind !== 261 && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 235 && parent_8.kind !== 262 && ts.isInAmbientContext(parent_8))) { + return isGlobalSourceFile(parent_8); } - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent_8); case 147: case 146: case 151: @@ -23217,7 +23517,7 @@ var ts; case 153: case 155: case 144: - case 231: + case 232: case 158: case 159: case 161: @@ -23228,15 +23528,15 @@ var ts; case 165: case 166: return isDeclarationVisible(node.parent); - case 236: case 237: - case 239: + case 238: + case 240: return false; case 143: - case 261: - case 233: + case 262: + case 234: return true; - case 240: + case 241: return false; default: return false; @@ -23245,10 +23545,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240) { + if (node.parent && node.parent.kind === 241) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243) { + else if (node.parent.kind === 244) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -23326,12 +23626,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 223: case 224: + case 225: + case 240: case 239: case 238: case 237: - case 236: node = node.parent; break; default: @@ -23350,9 +23650,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192) !== 0; - } function getTypeForBindingElementParent(node) { var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false); @@ -23487,11 +23784,11 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 212) { + if (declaration.parent.parent.kind === 213) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 | 262144) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213) { + if (declaration.parent.parent.kind === 214) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -23501,7 +23798,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536) && - declaration.kind === 223 && !ts.isBindingPattern(declaration.name) && + declaration.kind === 224 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { return autoType; @@ -23539,7 +23836,7 @@ var ts; var type = checkDeclarationInitializer(declaration); return addOptionality(type, declaration.questionToken && includeOptionality); } - if (declaration.kind === 258) { + if (declaration.kind === 259) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -23614,7 +23911,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 257) { + if (declaration.kind === 258) { return type; } return getWidenedType(type); @@ -23642,10 +23939,10 @@ var ts; if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } - if (declaration.kind === 240) { + if (declaration.kind === 241) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 286 && declaration.typeExpression) { + if (declaration.flags & 65536 && declaration.kind === 287 && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -23852,8 +24149,8 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 || node.kind === 197 || - node.kind === 225 || node.kind === 184 || + if (node.kind === 227 || node.kind === 197 || + node.kind === 226 || node.kind === 184 || node.kind === 149 || node.kind === 185) { var declarations = node.typeParameters; if (declarations) { @@ -23863,15 +24160,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 || node.kind === 226 || - node.kind === 197 || node.kind === 228) { + if (node.kind === 228 || node.kind === 227 || + node.kind === 197 || node.kind === 229) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -24004,7 +24301,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 228 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -24033,7 +24330,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227) { + if (declaration.kind === 228) { if (declaration.flags & 64) { return false; } @@ -24083,7 +24380,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285); + var declaration = ts.getDeclarationOfKind(symbol, 286); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -24094,7 +24391,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228); + declaration = ts.getDeclarationOfKind(symbol, 229); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -24126,7 +24423,7 @@ var ts; function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -24154,7 +24451,7 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229) { + if (declaration.kind === 230) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -24629,8 +24926,8 @@ var ts; else { var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); - var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + var extendedConstraint = constraint && constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; @@ -24901,7 +25198,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (node.flags & 65536) { - if (node.type && node.type.kind === 273) { + if (node.type && node.type.kind === 274) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -24912,7 +25209,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273; + return paramTag.typeExpression.type.kind === 274; } } } @@ -24964,7 +25261,7 @@ var ts; var thisParameter = undefined; var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { @@ -25047,12 +25344,12 @@ var ts; if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -25063,7 +25360,7 @@ var ts; case 152: case 184: case 185: - case 274: + case 275: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -25335,7 +25632,7 @@ var ts; switch (node.kind) { case 157: return node.typeName; - case 272: + case 273: return node.name; case 199: var expr = node.expression; @@ -25361,7 +25658,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 272) { + if (symbol.flags & 107455 && node.kind === 273) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -25371,7 +25668,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272) { + if (node.kind === 273) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -25406,9 +25703,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 226: case 227: - case 229: + case 228: + case 230: return declaration; } } @@ -25582,8 +25879,9 @@ var ts; return false; } 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, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -25693,8 +25991,8 @@ var ts; } } function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; addTypeToIntersection(typeSet, type); } } @@ -25812,7 +26110,7 @@ var ts; getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -25924,7 +26222,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 229 ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -26047,7 +26345,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 228)) { if (!(ts.getModifierFlags(container) & 32) && (container.kind !== 150 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -26066,8 +26364,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118: - case 263: case 264: + case 265: return anyType; case 134: return stringType; @@ -26085,21 +26383,21 @@ var ts; return nullType; case 129: return neverType; - case 289: - return nullType; case 290: - return undefinedType; + return nullType; case 291: + return undefinedType; + case 292: return neverType; case 167: case 98: return getTypeFromThisTypeNode(node); case 171: return getTypeFromLiteralTypeNode(node); - case 288: + case 289: return getTypeFromLiteralTypeNode(node.literal); case 157: - case 272: + case 273: return getTypeFromTypeReference(node); case 156: return booleanType; @@ -26108,29 +26406,29 @@ var ts; case 160: return getTypeFromTypeQueryNode(node); case 162: - case 265: + case 266: return getTypeFromArrayTypeNode(node); case 163: return getTypeFromTupleTypeNode(node); case 164: - case 266: + case 267: return getTypeFromUnionTypeNode(node); case 165: return getTypeFromIntersectionTypeNode(node); case 166: - case 268: case 269: - case 276: - case 277: - case 273: - return getTypeFromTypeNode(node.type); case 270: + case 277: + case 278: + case 274: + return getTypeFromTypeNode(node.type); + case 271: return getTypeFromTypeNode(node.literal); case 158: case 159: case 161: - case 287: - case 274: + case 288: + case 275: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168: return getTypeFromTypeOperatorNode(node); @@ -26142,9 +26440,9 @@ var ts; case 141: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267: + case 268: return getTypeFromJSDocTupleType(node); - case 275: + case 276: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -26293,17 +26591,19 @@ var ts; var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144) { var typeVariable_1 = constraintType.type; - var mappedTypeVariable = instantiateType(typeVariable_1, mapper); - if (typeVariable_1 !== mappedTypeVariable) { - return mapType(mappedTypeVariable, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable_1.flags & 16384) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -26324,12 +26624,12 @@ var ts; return false; } var mappedTypes = mapper.mappedTypes; - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { case 158: case 159: - case 225: + case 226: case 149: case 148: case 150: @@ -26340,10 +26640,10 @@ var ts; case 152: case 184: case 185: - case 226: - case 197: case 227: + case 197: case 228: + case 229: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -26353,15 +26653,24 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227) { + if (ts.isClassLike(node) || node.kind === 228) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230: - case 261: + case 275: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 231: + case 262: return false; } node = node.parent; @@ -26371,7 +26680,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 || parentKind === 231; + return parentKind === 262 || parentKind === 232; } return false; } @@ -26438,7 +26747,7 @@ var ts; case 192: return node.operatorToken.kind === 53 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257: + case 258: return isContextSensitive(node.initializer); case 149: case 148: @@ -26494,7 +26803,7 @@ var ts; return isTypeRelatedTo(source, target, assignableRelation); } function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -27196,8 +27505,11 @@ var ts; } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { + return -1; + } } return 0; } @@ -27348,7 +27660,7 @@ var ts; return 0; } var result = -1; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; @@ -27557,8 +27869,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -27566,8 +27878,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -27658,8 +27970,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; result |= getFalsyFlags(t); } return result; @@ -27818,7 +28130,7 @@ var ts; case 174: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225: + case 226: case 149: case 148: case 151: @@ -28159,8 +28471,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -28276,7 +28588,7 @@ var ts; switch (source.kind) { case 70: return target.kind === 70 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 || target.kind === 174) && + (target.kind === 224 || target.kind === 174) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98: return target.kind === 98; @@ -28374,8 +28686,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getTypeFacts(t); } return result; @@ -28461,7 +28773,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, undefined, false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 || node.parent.kind === 257 ? + return node.parent.kind === 175 || node.parent.kind === 258 ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -28480,9 +28792,9 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212: - return stringType; case 213: + return stringType; + case 214: return checkRightHandSideOfForOf(parent.expression) || unknownType; case 192: return getAssignedTypeOfBinaryExpression(parent); @@ -28492,9 +28804,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 196: return getAssignedTypeOfSpreadExpression(parent); - case 257: - return getAssignedTypeOfPropertyAssignment(parent); case 258: + return getAssignedTypeOfPropertyAssignment(parent); + case 259: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -28517,26 +28829,26 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212) { + if (node.parent.parent.kind === 213) { return stringType; } - if (node.parent.parent.kind === 213) { + if (node.parent.parent.kind === 214) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 ? + return node.kind === 224 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 || node.kind === 174 ? + return node.kind === 224 || node.kind === 174 ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 && node.initializer && + return node.kind === 224 && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 174 && node.parent.kind === 192 && isEmptyArrayLiteral(node.parent.right); @@ -28563,7 +28875,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253) { + if (clause.kind === 254) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -28665,8 +28977,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 8192)) { if (!(getObjectFlags(t) & 256)) { return false; @@ -29208,8 +29520,8 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 || - node.kind === 261 || + node.kind === 232 || + node.kind === 262 || node.kind === 147) { return node; } @@ -29279,7 +29591,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (localOrExportSymbol.flags & 32) { var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 226 + if (declaration_1.kind === 227 && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -29307,6 +29619,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -29334,7 +29647,7 @@ var ts; flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); if (type === autoType || type === autoArrayType) { @@ -29365,7 +29678,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 256) { + symbol.valueDeclaration.parent.kind === 257) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -29383,8 +29696,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 211 && - ts.getAncestor(symbol.valueDeclaration, 224).parent === container && + if (container.kind === 212 && + ts.getAncestor(symbol.valueDeclaration, 225).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -29474,10 +29787,10 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 230: + case 231: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 229: + case 230: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; case 150: @@ -29535,9 +29848,9 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274) { + if (jsdocType && jsdocType.kind === 275) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -29831,8 +30144,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -29902,13 +30215,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250) { + if (attribute.kind === 251) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 251) { + else if (attribute.kind === 252) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -29926,14 +30239,14 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223: + case 224: case 144: case 147: case 146: case 174: return getContextualTypeForInitializerExpression(node); case 185: - case 216: + case 217: return getContextualTypeForReturnExpression(node); case 195: return getContextualTypeForYieldOperand(parent); @@ -29945,22 +30258,22 @@ var ts; return getTypeFromTypeNode(parent.type); case 192: return getContextualTypeForBinaryOperand(node); - case 257: case 258: + case 259: return getContextualTypeForObjectLiteralElement(parent); case 175: return getContextualTypeForElementExpression(node); case 193: return getContextualTypeForConditionalOperand(node); - case 202: + case 203: ts.Debug.assert(parent.parent.kind === 194); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 183: return getContextualType(parent); - case 252: + case 253: return getContextualType(parent); - case 250: case 251: + case 252: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -30012,8 +30325,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -30156,25 +30469,25 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 || - memberDecl.kind === 258 || + if (memberDecl.kind === 258 || + memberDecl.kind === 259 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257) { + if (memberDecl.kind === 258) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 149) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 258); + ts.Debug.assert(memberDecl.kind === 259); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 257 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 258 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 259 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -30200,7 +30513,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259) { + else if (memberDecl.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(memberDecl, 2); } @@ -30300,13 +30613,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252: + case 253: checkJsxExpression(child); break; - case 246: + case 247: checkJsxElement(child); break; - case 247: + case 248: checkJsxSelfClosingElement(child); break; } @@ -30601,11 +30914,11 @@ var ts; var nameTable = ts.createMap(); var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250) { + if (node.attributes[i].kind === 251) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 251); + ts.Debug.assert(node.attributes[i].kind === 252); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -30624,7 +30937,11 @@ var ts; } function checkJsxExpression(node) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -30642,7 +30959,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 || node.kind === 223 ? + var errorNode = node.kind === 177 || node.kind === 224 ? node.name : node.right; if (left.kind === 96) { @@ -30788,7 +31105,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224) { + if (initializer.kind === 225) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -30810,7 +31127,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 && + if (node.kind === 213 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -30906,19 +31223,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent_9; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent_9; } lastSymbol = symbol; if (signature.hasLiteralTypes) { @@ -31138,7 +31455,7 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 145) { switch (node.parent.kind) { - case 226: + case 227: case 197: return 1; case 147: @@ -31159,7 +31476,7 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } @@ -31180,7 +31497,7 @@ var ts; return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -31217,7 +31534,7 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 226) { + if (node.kind === 227) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -31578,7 +31895,7 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226: + case 227: case 197: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 144: @@ -31688,9 +32005,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 225 + ? 226 : resolvedRequire.flags & 3 - ? 223 + ? 224 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -31716,6 +32033,23 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + ts.Debug.assert(node.keywordToken === 93 && node.name.text === "target", "Unrecognized meta-property."); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 150) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -31823,7 +32157,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 204) { + if (func.body.kind !== 205) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -31902,7 +32236,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 219 && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -31948,7 +32282,7 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 1024)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256; @@ -32014,6 +32348,7 @@ var ts; if (produceDiagnostics && node.kind !== 149) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } @@ -32028,7 +32363,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204) { + if (node.body.kind === 205) { checkSourceElement(node.body); } else { @@ -32081,7 +32416,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237; + return declaration && declaration.kind === 238; } } } @@ -32097,6 +32432,16 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 177 && expr.kind !== 178) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { @@ -32167,8 +32512,8 @@ var ts; } if (type.flags & 196608) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -32182,8 +32527,8 @@ var ts; } if (type.flags & 65536) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -32192,8 +32537,8 @@ var ts; } if (type.flags & 131072) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { + var t = types_18[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -32240,7 +32585,7 @@ var ts; return sourceType; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 || property.kind === 258) { + if (property.kind === 258 || property.kind === 259) { var name_22 = property.name; if (name_22.kind === 142) { checkComputedPropertyName(name_22); @@ -32255,7 +32600,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1) || getIndexTypeOfType(objectLiteralType, 0); if (type) { - if (property.kind === 258) { + if (property.kind === 259) { return checkDestructuringAssignment(property, type); } else { @@ -32266,7 +32611,7 @@ var ts; error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); } } - else if (property.kind === 259) { + else if (property.kind === 260) { if (languageVersion < 5) { checkExternalEmitHelpers(property, 4); } @@ -32334,7 +32679,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 258) { + if (exprOrAssignment.kind === 259) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -32362,7 +32707,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 ? + var error = target.parent.kind === 260 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -32391,8 +32736,8 @@ var ts; case 176: case 187: case 201: + case 248: case 247: - case 246: return true; case 193: return isSideEffectFree(node.whenTrue) && @@ -32826,6 +33171,8 @@ var ts; return checkAssertion(node); case 201: return checkNonNullAssertion(node); + case 202: + return checkMetaProperty(node); case 186: return checkDeleteExpression(node); case 188: @@ -32846,13 +33193,13 @@ var ts; return undefinedWideningType; case 195: return checkYieldExpression(node); - case 252: + case 253: return checkJsxExpression(node); - case 246: - return checkJsxElement(node); case 247: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 248: + return checkJsxSelfClosingElement(node); + case 249: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -32897,7 +33244,7 @@ var ts; return false; } return node.kind === 149 || - node.kind === 225 || + node.kind === 226 || node.kind === 184; } function getTypePredicateParameterIndex(parameterList, parameter) { @@ -32956,14 +33303,14 @@ var ts; switch (node.parent.kind) { case 185: case 153: - case 225: + case 226: case 184: case 158: case 149: case 148: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; } } } @@ -32991,7 +33338,7 @@ var ts; if (node.kind === 155) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 || node.kind === 225 || node.kind === 159 || + else if (node.kind === 158 || node.kind === 226 || node.kind === 159 || node.kind === 153 || node.kind === 150 || node.kind === 154) { checkGrammarFunctionLikeDeclaration(node); @@ -33113,7 +33460,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227) { + if (node.kind === 228) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -33195,7 +33542,7 @@ var ts; if (n.kind === 98) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 && n.kind !== 225) { + else if (n.kind !== 184 && n.kind !== 226) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -33220,7 +33567,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -33369,8 +33716,8 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 227 && - n.parent.kind !== 226 && + if (n.parent.kind !== 228 && + n.parent.kind !== 227 && n.parent.kind !== 197 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { @@ -33481,11 +33828,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 || node.parent.kind === 161 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 228 || node.parent.kind === 161 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 225 || node.kind === 149 || node.kind === 148 || node.kind === 150) { + if (node.kind === 226 || node.kind === 149 || node.kind === 148 || node.kind === 150) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -33596,16 +33943,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227: + case 228: return 2097152; - case 230: + case 231: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 226: - case 229: + case 227: + case 230: return 2097152 | 1048576; - case 234: + case 235: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -33617,7 +33964,8 @@ var ts; } function checkNonThenableType(type, location, message) { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + var apparentType = getApparentType(type); + if ((apparentType.flags & (1 | 8192)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -33752,7 +34100,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226: + case 227: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -33807,7 +34155,7 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 226: + case 227: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -33840,6 +34188,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -33890,28 +34239,28 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261: - case 230: + case 262: + case 231: checkUnusedModuleMembers(node); break; - case 226: + case 227: case 197: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227: + case 228: checkUnusedTypeParameters(node); break; - case 204: - case 232: - case 211: + case 205: + case 233: case 212: case 213: + case 214: checkUnusedLocalsAndParameters(node); break; case 150: case 184: - case 225: + case 226: case 185: case 149: case 151: @@ -33935,7 +34284,7 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + if (node.parent.kind !== 228 && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { @@ -33968,9 +34317,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 && - (declaration.parent.parent.kind === 212 || - declaration.parent.parent.kind === 213)) { + if (declaration.kind === 224 && + (declaration.parent.parent.kind === 213 || + declaration.parent.parent.kind === 214)) { return; } } @@ -34031,7 +34380,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -34039,7 +34388,7 @@ var ts; } } function checkBlock(node) { - if (node.kind === 204) { + if (node.kind === 205) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -34083,6 +34432,11 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; while (current) { @@ -34099,6 +34453,22 @@ var ts; current = current.parent; } } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 8) { + var isDeclaration_2 = node.kind !== 70; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -34108,8 +34478,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -34124,11 +34494,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34136,11 +34506,11 @@ var ts; if (languageVersion >= 4 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 230 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 231 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 261 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { + if (parent.kind === 262 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -34148,7 +34518,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 223 && !node.initializer) { + if (node.kind === 224 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -34158,15 +34528,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224); - var container = varDeclList.parent.kind === 205 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225); + var container = varDeclList.parent.kind === 206 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 204 && ts.isFunctionLike(container.parent) || + (container.kind === 205 && ts.isFunctionLike(container.parent) || + container.kind === 232 || container.kind === 231 || - container.kind === 230 || - container.kind === 261); + container.kind === 262); if (!namesShareScope) { var name_25 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); @@ -34199,7 +34569,8 @@ var ts; } var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144) { + if (symbol.valueDeclaration.kind === 144 || + symbol.valueDeclaration.kind === 174) { if (symbol.valueDeclaration.pos < node.pos) { return; } @@ -34237,19 +34608,19 @@ var ts; } } if (node.kind === 174) { - if (node.parent.kind === 172 && languageVersion < 5) { + if (node.parent.kind === 172 && languageVersion < 5 && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4); } if (node.propertyName && node.propertyName.kind === 142) { checkComputedPropertyName(node.propertyName); } - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); var name_26 = node.propertyName || node.name; var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); } } if (ts.isBindingPattern(node.name)) { @@ -34260,7 +34631,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -34269,7 +34640,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 212) { + if (node.initializer && node.parent.parent.kind !== 213) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -34289,18 +34660,19 @@ var ts; } if (node.kind !== 147 && node.kind !== 146) { checkExportsOnMergedDeclarations(node); - if (node.kind === 223 || node.kind === 174) { + if (node.kind === 224 || node.kind === 174) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 && right.kind === 223) || - (left.kind === 223 && right.kind === 144)) { + if ((left.kind === 144 && right.kind === 224) || + (left.kind === 224 && right.kind === 144)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -34346,7 +34718,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206) { + if (node.thenStatement.kind === 207) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -34363,12 +34735,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224) { + if (node.initializer && node.initializer.kind === 225) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -34386,7 +34758,7 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { checkForInOrForOfVariableDeclaration(node); } else { @@ -34411,7 +34783,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = checkNonNullExpression(node.expression); - if (node.initializer.kind === 224) { + if (node.initializer.kind === 225) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -34668,7 +35040,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 254 && !hasDuplicateDefaultClause) { + if (clause.kind === 255 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -34680,7 +35052,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253) { + if (produceDiagnostics && clause.kind === 254) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); var caseIsLiteral = isLiteralType(caseType); @@ -34706,7 +35078,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 219 && current.label.text === node.label.text) { + if (current.kind === 220 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -34829,7 +35201,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -34849,7 +35221,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 || declaration.kind === 227) { + if (declaration.kind === 227 || declaration.kind === 228) { if (!firstDecl) { firstDecl = declaration; } @@ -34882,6 +35254,7 @@ var ts; if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -34917,7 +35290,7 @@ var ts; checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226) { + baseType_1.symbol.valueDeclaration.kind === 227) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -35044,7 +35417,7 @@ var ts; if (!list1 || !list2 || list1.length !== list2.length) { return false; } - for (var i = 0, len = list1.length; i < len; i++) { + for (var i = 0; i < list1.length; i++) { var tp1 = list1[i]; var tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -35102,7 +35475,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -35233,6 +35606,7 @@ var ts; } return undefined; case 8: + checkGrammarNumericLiteral(e); return +e.text; case 183: return evalConstant(e.expression); @@ -35306,6 +35680,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -35326,7 +35701,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 229) { + if (declaration.kind !== 230) { return false; } var enumDeclaration = declaration; @@ -35349,8 +35724,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 226 || - (declaration.kind === 225 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 227 || + (declaration.kind === 226 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -35409,7 +35784,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 226); + var mergedClass = ts.getDeclarationOfKind(symbol, 227); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -35452,22 +35827,22 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205: + case 206: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240: case 241: + case 242: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234: case 235: + case 236: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 174: - case 223: + case 224: var name_27 = node.name; if (ts.isBindingPattern(name_27)) { for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { @@ -35476,12 +35851,12 @@ var ts; } break; } - case 226: - case 229: - case 225: case 227: case 230: + case 226: case 228: + case 231: + case 229: if (isGlobalAugmentation) { return; } @@ -35517,9 +35892,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 ? + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { + error(moduleName, node.kind === 242 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -35540,7 +35915,7 @@ var ts; (symbol.flags & 793064 ? 793064 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 ? + var message = node.kind === 244 ? 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)); @@ -35567,7 +35942,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 238) { checkImportBinding(importClause.namedBindings); } else { @@ -35618,8 +35993,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 232 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -35632,7 +36007,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 || node.parent.kind === 231 || node.parent.kind === 230; + var isInAppropriateContext = node.parent.kind === 262 || node.parent.kind === 232 || node.parent.kind === 231; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -35655,9 +36030,14 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 261 ? node.parent : node.parent.parent; - if (container.kind === 230 && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 262 ? node.parent : node.parent.parent; + if (container.kind === 231 && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { @@ -35723,7 +36103,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 && declaration.kind !== 149) || + return (declaration.kind !== 226 && declaration.kind !== 149) || !!declaration.body; } } @@ -35734,10 +36114,10 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 230: - case 226: + case 231: case 227: - case 225: + case 228: + case 226: cancellationToken.throwIfCancellationRequested(); } } @@ -35786,71 +36166,71 @@ var ts; return checkIndexedAccessType(node); case 170: return checkMappedType(node); - case 225: + case 226: return checkFunctionDeclaration(node); - case 204: - case 231: - return checkBlock(node); case 205: + case 232: + return checkBlock(node); + case 206: return checkVariableStatement(node); - case 207: - return checkExpressionStatement(node); case 208: - return checkIfStatement(node); + return checkExpressionStatement(node); case 209: - return checkDoStatement(node); + return checkIfStatement(node); case 210: - return checkWhileStatement(node); + return checkDoStatement(node); case 211: - return checkForStatement(node); + return checkWhileStatement(node); case 212: - return checkForInStatement(node); + return checkForStatement(node); case 213: - return checkForOfStatement(node); + return checkForInStatement(node); case 214: + return checkForOfStatement(node); case 215: - return checkBreakOrContinueStatement(node); case 216: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 217: - return checkWithStatement(node); + return checkReturnStatement(node); case 218: - return checkSwitchStatement(node); + return checkWithStatement(node); case 219: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 220: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 221: + return checkThrowStatement(node); + case 222: return checkTryStatement(node); - case 223: + case 224: return checkVariableDeclaration(node); case 174: return checkBindingElement(node); - case 226: - return checkClassDeclaration(node); case 227: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 228: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 229: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 230: + return checkEnumDeclaration(node); + case 231: return checkModuleDeclaration(node); - case 235: + case 236: return checkImportDeclaration(node); - case 234: + case 235: return checkImportEqualsDeclaration(node); - case 241: + case 242: return checkExportDeclaration(node); - case 240: + case 241: return checkExportAssignment(node); - case 206: + case 207: checkGrammarStatementInAmbientContext(node); return; - case 222: + case 223: checkGrammarStatementInAmbientContext(node); return; - case 244: + case 245: return checkMissingDeclaration(node); } } @@ -35893,6 +36273,7 @@ var ts; } checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -35912,6 +36293,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1; } } @@ -35956,7 +36341,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 && node.parent.statement === node) { + if (node.parent.kind === 218 && node.parent.statement === node) { return true; } node = node.parent; @@ -35978,14 +36363,14 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261: + case 262: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230: + case 231: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 229: + case 230: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; case 197: @@ -35993,8 +36378,8 @@ var ts; if (className) { copySymbol(location.symbol, meaning); } - case 226: case 227: + case 228: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } @@ -36039,10 +36424,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 143: - case 226: case 227: case 228: case 229: + case 230: return true; } } @@ -36051,7 +36436,7 @@ var ts; while (node.parent && node.parent.kind === 141) { node = node.parent; } - return node.parent && (node.parent.kind === 157 || node.parent.kind === 272); + return node.parent && (node.parent.kind === 157 || node.parent.kind === 273); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -36078,10 +36463,10 @@ var ts; while (nodeOnRightSide.parent.kind === 141) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234) { + if (nodeOnRightSide.parent.kind === 235) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240) { + if (nodeOnRightSide.parent.kind === 241) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -36105,11 +36490,11 @@ var ts; default: } } - if (entityName.parent.kind === 240 && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 241 && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); } if (entityName.kind !== 177 && isInRightSideOfImportOrExportAssignment(entityName)) { - var importEqualsDeclaration = ts.getAncestor(entityName, 234); + var importEqualsDeclaration = ts.getAncestor(entityName, 235); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true); } @@ -36156,10 +36541,10 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 272) ? 793064 : 1920; + var meaning = (entityName.parent.kind === 157 || entityName.parent.kind === 273) ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } - else if (entityName.parent.kind === 250) { + else if (entityName.parent.kind === 251) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 156) { @@ -36168,7 +36553,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261) { + if (node.kind === 262) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -36221,7 +36606,7 @@ var ts; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 || node.parent.kind === 241) && + ((node.parent.kind === 236 || node.parent.kind === 242) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -36243,7 +36628,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 258) { + if (location && location.kind === 259) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -36294,7 +36679,7 @@ var ts; } function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { ts.Debug.assert(expr.kind === 176 || expr.kind === 175); - if (expr.parent.kind === 213) { + if (expr.parent.kind === 214) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } @@ -36302,7 +36687,7 @@ var ts; var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } - if (expr.parent.kind === 257) { + if (expr.parent.kind === 258) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -36413,7 +36798,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 261) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 262) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -36451,7 +36836,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 204 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 205 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -36491,16 +36876,16 @@ var ts; return true; } switch (node.kind) { - case 234: - case 236: + case 235: case 237: - case 239: - case 243: + case 238: + case 240: + case 244: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241: + case 242: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240: + case 241: return node.expression && node.expression.kind === 70 ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -36510,7 +36895,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 262 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -36561,7 +36946,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 260) { + if (node.kind === 261) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -36655,9 +37040,9 @@ var ts; } var location = reference; if (startInDeclarationContainer) { - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent_12 = reference.parent; + if (ts.isDeclaration(parent_12) && reference === parent_12.name) { + location = getDeclarationContainer(parent_12); } } return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); @@ -36770,15 +37155,15 @@ var ts; } var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 262 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -36797,7 +37182,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261); + return ts.getDeclarationOfKind(moduleSymbol, 262); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -36974,7 +37359,7 @@ var ts; } switch (modifier.kind) { case 75: - if (node.kind !== 229 && node.parent.kind === 226) { + if (node.kind !== 230 && node.parent.kind === 227) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75)); } break; @@ -37000,7 +37385,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -37023,7 +37408,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 || node.parent.kind === 261) { + else if (node.parent.kind === 232 || node.parent.kind === 262) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 144) { @@ -37058,7 +37443,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 144) { @@ -37073,13 +37458,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226) { + else if (node.parent.kind === 227) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 144) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -37089,14 +37474,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226) { + if (node.kind !== 227) { if (node.kind !== 149 && node.kind !== 147 && node.kind !== 151 && node.kind !== 152) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 227 && ts.getModifierFlags(node.parent) & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -37138,7 +37523,7 @@ var ts; } return; } - else if ((node.kind === 235 || node.kind === 234) && flags & 2) { + else if ((node.kind === 236 || node.kind === 235) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 144 && (flags & 92) && ts.isBindingPattern(node.name)) { @@ -37168,29 +37553,29 @@ var ts; case 149: case 148: case 155: - case 230: + case 231: + case 236: case 235: - case 234: + case 242: case 241: - case 240: case 184: case 185: case 144: return false; default: - if (node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 232 || node.parent.kind === 262) { return false; } switch (node.kind) { - case 225: - return nodeHasAnyModifiersExcept(node, 119); case 226: - return nodeHasAnyModifiersExcept(node, 116); + return nodeHasAnyModifiersExcept(node, 119); case 227: - case 205: + return nodeHasAnyModifiersExcept(node, 116); case 228: - return true; + case 206: case 229: + return true; + case 230: return nodeHasAnyModifiersExcept(node, 75); default: ts.Debug.fail(); @@ -37204,7 +37589,7 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 149: - case 225: + case 226: case 184: case 185: if (!node.asteriskToken) { @@ -37410,7 +37795,7 @@ var ts; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 || + ts.Debug.assert(node.kind === 226 || node.kind === 184 || node.kind === 149); if (ts.isInAmbientContext(node)) { @@ -37437,14 +37822,14 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259) { + if (prop.kind === 260) { continue; } var name_30 = prop.name; if (name_30.kind === 142) { checkGrammarComputedPropertyName(name_30); } - if (prop.kind === 258 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } if (prop.modifiers) { @@ -37456,7 +37841,7 @@ var ts; } } var currentKind = void 0; - if (prop.kind === 257 || prop.kind === 258) { + if (prop.kind === 258 || prop.kind === 259) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_30.kind === 8) { checkGrammarNumericLiteral(name_30); @@ -37505,7 +37890,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251) { + if (attr.kind === 252) { continue; } var jsxAttr = attr; @@ -37517,7 +37902,7 @@ var ts; return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 && !initializer.expression) { + if (initializer && initializer.kind === 253 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -37526,7 +37911,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224) { + if (forInOrOfStatement.initializer.kind === 225) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -37534,20 +37919,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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 === 212 + var diagnostic = forInOrOfStatement.kind === 213 ? 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); @@ -37631,7 +38016,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 161) { @@ -37645,9 +38030,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219: + case 220: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 214 + var isMisplacedContinueLabel = node.kind === 215 && !ts.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); @@ -37655,8 +38040,8 @@ var ts; return false; } break; - case 218: - if (node.kind === 215 && !node.label) { + case 219: + if (node.kind === 216 && !node.label) { return false; } break; @@ -37669,13 +38054,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 + var message = node.kind === 216 ? 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 === 215 + var message = node.kind === 216 ? 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); @@ -37701,7 +38086,7 @@ var ts; expr.operand.kind === 8; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 && node.parent.parent.kind !== 213) { + if (node.parent.parent.kind !== 213 && node.parent.parent.kind !== 214) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -37758,15 +38143,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208: case 209: case 210: - case 217: case 211: + case 218: case 212: case 213: + case 214: return false; - case 219: + case 220: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -37781,6 +38166,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -37821,7 +38213,7 @@ var ts; return true; } } - else if (node.parent.kind === 227) { + else if (node.parent.kind === 228) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -37842,13 +38234,13 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 227 || - node.kind === 228 || + if (node.kind === 228 || + node.kind === 229 || + node.kind === 236 || node.kind === 235 || - node.kind === 234 || + node.kind === 242 || node.kind === 241 || - node.kind === 240 || - node.kind === 233 || + node.kind === 234 || ts.getModifierFlags(node) & (2 | 1 | 512)) { return false; } @@ -37857,7 +38249,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205) { + if (ts.isDeclaration(decl) || decl.kind === 206) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -37876,7 +38268,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 === 204 || node.parent.kind === 231 || node.parent.kind === 261) { + if (node.parent.kind === 205 || node.parent.kind === 232 || node.parent.kind === 262) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -37887,8 +38279,22 @@ var ts; } } function checkGrammarNumericLiteral(node) { - if (node.isOctalLiteral && languageVersion >= 1) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 171)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 261)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -37933,31 +38339,31 @@ var ts; _a[201] = [ { name: "expression", test: ts.isLeftHandSideExpression } ], - _a[229] = [ + _a[230] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "members", test: ts.isEnumMember } ], - _a[230] = [ + _a[231] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isModuleName }, { name: "body", test: ts.isModuleBody } ], - _a[231] = [ + _a[232] = [ { name: "statements", test: ts.isStatement } ], - _a[234] = [ + _a[235] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "moduleReference", test: ts.isModuleReference } ], - _a[245] = [ + _a[246] = [ { name: "expression", test: ts.isExpression, optional: true } ], - _a[260] = [ + _a[261] = [ { name: "name", test: ts.isPropertyName }, { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } ], @@ -37983,11 +38389,11 @@ var ts; } var result = initial; switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: - case 293: + case 223: + case 294: break; case 142: result = reduceNode(node.expression, cbNode, result); @@ -38128,72 +38534,72 @@ var ts; result = reduceNode(node.expression, cbNode, result); result = reduceNodes(node.typeArguments, cbNodes, result); break; - case 202: + case 203: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; - case 204: + case 205: result = reduceNodes(node.statements, cbNodes, result); break; - case 205: + case 206: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207: + case 208: result = reduceNode(node.expression, cbNode, result); break; - case 208: + case 209: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209: - result = reduceNode(node.statement, cbNode, result); - result = reduceNode(node.expression, cbNode, result); - break; case 210: - case 217: - result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); + result = reduceNode(node.expression, cbNode, result); break; case 211: + case 218: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 212: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212: case 213: + case 214: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216: - case 220: + case 217: + case 221: result = reduceNode(node.expression, cbNode, result); break; - case 218: + case 219: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219: + case 220: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221: + case 222: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223: + case 224: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224: + case 225: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225: + case 226: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38202,7 +38608,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226: + case 227: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -38210,92 +38616,92 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 232: + case 233: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235: + case 236: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236: + case 237: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237: - result = reduceNode(node.name, cbNode, result); - break; case 238: - case 242: - result = reduceNodes(node.elements, cbNodes, result); + result = reduceNode(node.name, cbNode, result); break; case 239: case 243: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 240: + case 244: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240: + case 241: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241: + case 242: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 246: + case 247: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247: case 248: + case 249: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 249: + case 250: result = reduceNode(node.tagName, cbNode, result); break; - case 250: + case 251: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251: - result = reduceNode(node.expression, cbNode, result); - break; case 252: result = reduceNode(node.expression, cbNode, result); break; case 253: result = reduceNode(node.expression, cbNode, result); + break; case 254: + result = reduceNode(node.expression, cbNode, result); + case 255: result = reduceNodes(node.statements, cbNodes, result); break; - case 255: + case 256: result = reduceNodes(node.types, cbNodes, result); break; - case 256: + case 257: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; - case 257: + case 258: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258: + case 259: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259: + case 260: result = reduceNode(node.expression, cbNode, result); break; - case 261: + case 262: result = reduceNodes(node.statements, cbNodes, result); break; - case 294: + case 295: result = reduceNode(node.expression, cbNode, result); break; default: @@ -38436,10 +38842,10 @@ var ts; return node; } switch (node.kind) { - case 203: - case 206: + case 204: + case 207: case 198: - case 222: + case 223: return node; case 142: return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression)); @@ -38507,101 +38913,101 @@ var ts; return ts.updateClassExpression(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); case 199: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); - case 202: + case 203: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 204: - return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); case 205: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 206: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207: - return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 208: - return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); case 209: - return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, true, liftToBlock)); case 210: - return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); case 211: - return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 212: - return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 213: - return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 214: - return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 215: - return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 216: - return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, true)); case 217: - return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, true)); case 218: - return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 219: - return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); case 220: - return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, false, liftToBlock)); case 221: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 222: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, true), visitNode(node.finallyBlock, visitor, ts.isBlock, true)); - case 223: - return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 224: - return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, true), visitNode(node.initializer, visitor, ts.isExpression, true)); case 225: - return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); case 226: + return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, true), visitFunctionBody(node.body, visitor, context)); + case 227: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232: + case 233: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235: - return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 236: - return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); case 237: - return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, true)); case 238: - return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); case 239: - return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); case 240: - return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); case 241: - return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); case 242: - return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, true)); case 243: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 244: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, true), visitNode(node.name, visitor, ts.isIdentifier)); - case 246: - return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 247: - return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); case 248: - return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 249: - return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); case 250: - return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); case 251: - return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); case 252: - return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); case 253: - return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); case 254: - return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); case 255: - return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); case 256: - return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); case 257: - return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); case 258: - return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 259: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 260: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); - case 261: + case 262: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 294: + case 295: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -38689,7 +39095,7 @@ var ts; return subtreeFlags; } function aggregateTransformFlagsForSubtree(node) { - if (ts.hasModifier(node, 2) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 199)) { return 0; } return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); @@ -39093,15 +39499,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 261: + case 262: + case 233: case 232: - case 231: - case 204: + case 205: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; + case 227: case 226: - case 225: if (ts.hasModifier(node, 2)) { break; } @@ -39126,13 +39532,13 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 240: - return visitExportAssignment(node); case 241: + return visitExportAssignment(node); + case 242: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -39142,11 +39548,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 241 || - node.kind === 235 || + if (node.kind === 242 || node.kind === 236 || - (node.kind === 234 && - node.moduleReference.kind === 245)) { + node.kind === 237 || + (node.kind === 235 && + node.moduleReference.kind === 246)) { return undefined; } else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) { @@ -39170,7 +39576,7 @@ var ts; case 152: case 149: return visitorWorker(node); - case 203: + case 204: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -39227,18 +39633,18 @@ var ts; case 171: case 155: case 145: - case 228: + case 229: case 147: return undefined; case 150: return visitConstructor(node); - case 227: + case 228: return ts.createNotEmittedStatement(node); - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); - case 255: + case 256: return visitHeritageClause(node); case 199: return visitExpressionWithTypeArguments(node); @@ -39248,7 +39654,7 @@ var ts; return visitGetAccessor(node); case 152: return visitSetAccessor(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -39267,15 +39673,15 @@ var ts; return visitNewExpression(node); case 201: return visitNonNullExpression(node); - case 229: - return visitEnumDeclaration(node); - case 205: - return visitVariableStatement(node); - case 223: - return visitVariableDeclaration(node); case 230: + return visitEnumDeclaration(node); + case 206: + return visitVariableStatement(node); + case 224: + return visitVariableDeclaration(node); + case 231: return visitModuleDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); default: ts.Debug.failBadSyntaxKind(node); @@ -39429,7 +39835,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 207 && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -39714,7 +40120,7 @@ var ts; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 226: + case 227: case 197: return ts.getFirstConstructorWithBody(node) !== undefined; case 149: @@ -39732,7 +40138,7 @@ var ts; return serializeTypeNode(node.type); case 152: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226: + case 227: case 197: case 149: return ts.createIdentifier("Function"); @@ -39789,6 +40195,9 @@ var ts; } switch (node.kind) { case 104: + case 137: + case 94: + case 129: return ts.createVoidZero(); case 166: return serializeTypeNode(node.type); @@ -39827,29 +40236,7 @@ var ts; return serializeTypeReferenceNode(node); case 165: case 164: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - if (serializedIndividual.kind !== 70) { - serializedUnion = undefined; - break; - } - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - if (serializedUnion) { - return serializedUnion; - } - } + return serializeUnionOrIntersectionType(node); case 160: case 168: case 169: @@ -39864,6 +40251,32 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + serializedUnion = serializedIndividual; + } + } + return serializedUnion; + } function serializeTypeReferenceNode(node) { switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { case ts.TypeReferenceSerializationKind.Unknown: @@ -40190,7 +40603,7 @@ var ts; ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 229) { + if (node.kind === 230) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -40250,8 +40663,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 232) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -40273,13 +40686,13 @@ var ts; currentNamespace = savedCurrentNamespace; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = ts.createBlock(ts.createNodeArray(statements, statementsLocation), blockLocation, true); - if (body.kind !== 231) { + if (body.kind !== 232) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230) { + if (moduleDeclaration.body.kind === 231) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -40299,7 +40712,7 @@ var ts; return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 237) { + if (node.kind === 238) { return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } else { @@ -40434,15 +40847,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(70); - context.enableSubstitution(258); - context.enableEmitNotification(230); + context.enableSubstitution(259); + context.enableEmitNotification(231); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230; + return ts.getOriginalNode(node).kind === 231; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229; + return ts.getOriginalNode(node).kind === 230; } function onEmitNode(emitContext, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -40515,9 +40928,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 261) { - var substitute = (applicableSubstitutions & 2 && container.kind === 230) || - (applicableSubstitutions & 8 && container.kind === 229); + if (container && container.kind !== 262) { + var substitute = (applicableSubstitutions & 2 && container.kind === 231) || + (applicableSubstitutions & 8 && container.kind === 230); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, node); } @@ -40632,11 +41045,11 @@ var ts; return visitObjectLiteralExpression(node); case 192: return visitBinaryExpression(node, noDestructuringValue); - case 223: + case 224: return visitVariableDeclaration(node); - case 213: + case 214: return visitForOfStatement(node); - case 211: + case 212: return visitForStatement(node); case 188: return visitVoidExpression(node); @@ -40648,7 +41061,7 @@ var ts; return visitGetAccessorDeclaration(node); case 152: return visitSetAccessorDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -40656,7 +41069,7 @@ var ts; return visitArrowFunction(node); case 144: return visitParameter(node); - case 207: + case 208: return visitExpressionStatement(node); case 183: return visitParenthesizedExpression(node, noDestructuringValue); @@ -40669,7 +41082,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 259) { + if (e.kind === 260) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -40681,7 +41094,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257) { + if (e.kind === 258) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -40854,11 +41267,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246: - return visitJsxElement(node, false); case 247: + return visitJsxElement(node, false); + case 248: return visitJsxSelfClosingElement(node, false); - case 252: + case 253: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -40868,11 +41281,11 @@ var ts; switch (node.kind) { case 10: return visitJsxText(node); - case 252: + case 253: return visitJsxExpression(node); - case 246: - return visitJsxElement(node, true); case 247: + return visitJsxElement(node, true); + case 248: return visitJsxSelfClosingElement(node, true); default: ts.Debug.failBadSyntaxKind(node); @@ -40926,7 +41339,10 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, node) : node; } - else if (node.kind === 252) { + else if (node.kind === 253) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } return visitJsxExpression(node); } else { @@ -40991,7 +41407,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246) { + if (node.kind === 247) { return getTagName(node.openingElement); } else { @@ -41310,7 +41726,7 @@ var ts; return visitAwaitExpression(node); case 149: return visitMethodDeclaration(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -41409,7 +41825,7 @@ var ts; context.enableSubstitution(179); context.enableSubstitution(177); context.enableSubstitution(178); - context.enableEmitNotification(226); + context.enableEmitNotification(227); context.enableEmitNotification(149); context.enableEmitNotification(151); context.enableEmitNotification(152); @@ -41465,7 +41881,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 226 + return kind === 227 || kind === 150 || kind === 149 || kind === 151 @@ -41604,15 +42020,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; var convertedLoopState; var enabledSubstitutions; return transformSourceFile; @@ -41622,178 +42030,104 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383; + return ancestorFacts; } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - switch (currentNode.kind) { - case 205: - enclosingVariableStatement = currentNode; - break; - case 224: - case 223: - case 174: - case 172: - case 173: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 && !node.expression; + return hierarchyFacts & 4096 + && node.kind === 217 + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64) !== 0 || - node.kind === 219 || - (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205: - return visitVariableStatement(node); - case 218: - return visitSwitchStatement(node); - case 215: - case 214: - return visitBreakOrContinueStatement(node); - case 98: - return visitThisKeyword(node); - case 70: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96) { + return visitSuperKeyword(true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114: return undefined; - case 226: + case 227: return visitClassDeclaration(node); case 197: return visitClassExpression(node); case 144: return visitParameter(node); - case 225: + case 226: return visitFunctionDeclaration(node); case 185: return visitArrowFunction(node); case 184: return visitFunctionExpression(node); - case 223: + case 224: return visitVariableDeclaration(node); case 70: return visitIdentifier(node); - case 224: + case 225: return visitVariableDeclarationList(node); case 219: + return visitSwitchStatement(node); + case 233: + return visitCaseBlock(node); + case 205: + return visitBlock(node, false); + case 216: + case 215: + return visitBreakOrContinueStatement(node); + case 220: return visitLabeledStatement(node); - case 209: - return visitDoStatement(node); case 210: - return visitWhileStatement(node); case 211: - return visitForStatement(node); + return visitDoOrWhileStatement(node, undefined); case 212: - return visitForInStatement(node); + return visitForStatement(node, undefined); case 213: - return visitForOfStatement(node); - case 207: + return visitForInStatement(node, undefined); + case 214: + return visitForOfStatement(node, undefined); + case 208: return visitExpressionStatement(node); case 176: return visitObjectLiteralExpression(node); - case 256: + case 257: return visitCatchClause(node); - case 258: + case 259: return visitShorthandPropertyAssignment(node); + case 142: + return visitComputedPropertyName(node); case 175: return visitArrayLiteralExpression(node); case 179: @@ -41818,51 +42152,80 @@ var ts; case 196: return visitSpreadElement(node); case 96: - return visitSuperKeyword(); - case 195: - return ts.visitEachChild(node, visitor, context); + return visitSuperKeyword(false); + case 98: + return visitThisKeyword(node); + case 202: + return visitMetaProperty(node); case 149: return visitMethodDeclaration(node); - case 205: + case 151: + case 152: + return visitAccessorDeclaration(node); + case 206: return visitVariableStatement(node); + case 217: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968, 64); var statements = []; startLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, node.statements, false, visitor); addCaptureThisForNodeIfNeeded(statements, node); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); + exitSubtree(ancestorFacts, 0, 0); return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps |= 2; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps |= 2; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032, 0); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185) { - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2) { + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -41878,13 +42241,13 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 215 ? 2 : 4; + var jump = node.kind === 216 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215) { + if (node.kind === 216) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -41894,7 +42257,7 @@ var ts; } } else { - if (node.kind === 215) { + if (node.kind === 216) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -41993,6 +42356,9 @@ var ts; } } function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278, 73); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getDeclarationName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), constructor || node); @@ -42000,6 +42366,8 @@ var ts; ts.setEmitFlags(constructorFunction, 8); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; } function transformConstructorParameters(constructor, hasSynthesizedSuper) { return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) @@ -42020,23 +42388,26 @@ var ts; addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); if (superCaptureStatus === 1 || superCaptureStatus === 2) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1) { + hierarchyFacts |= 4096; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset)); } - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, false); + } var block = ts.createBlock(ts.createNodeArray(statements, constructor ? constructor.body.statements : node.members), constructor ? constructor.body : node, true); if (!constructor) { ts.setEmitFlags(block, 1536); @@ -42044,17 +42415,17 @@ var ts; return block; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 216) { + if (statement.kind === 217) { return true; } - else if (statement.kind === 208) { + else if (statement.kind === 209) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204) { + else if (statement.kind === 205) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -42062,8 +42433,8 @@ var ts; } return false; } - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { - if (!hasExtendsClause) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -42083,9 +42454,8 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 208 && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } if (superCallExpression @@ -42100,17 +42470,17 @@ var ts; statements.push(returnStatement); return 2; } - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); if (superCallExpression) { return 1; } return 0; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } function visitParameter(node) { if (node.dotDotDotToken) { @@ -42206,21 +42576,53 @@ var ts; ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384) { + var newTarget = void 0; + switch (node.kind) { + case 185: + return statements; + case 149: + case 151: + case 152: + newTarget = ts.createVoidZero(); + break; + case 150: + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"); + break; + case 226: + case 184: + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 92, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } function addClassMembers(statements, node) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203: + case 204: statements.push(transformSemicolonClassElementToStatement(member)); break; case 149: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 151: case 152: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; case 150: @@ -42234,26 +42636,29 @@ var ts; function transformSemicolonClassElementToStatement(member) { return ts.createEmptyStatement(member); } - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0, 0); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), member.name); - var memberFunction = transformFunctionLikeToExpression(member, member, undefined); + var memberFunction = transformFunctionLikeToExpression(member, member, undefined, container); ts.setEmitFlags(memberFunction, 1536); ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), member); ts.setOriginalNode(statement, member); ts.setCommentRange(statement, commentRange); ts.setEmitFlags(statement, 48); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return statement; } - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, false), ts.getSourceMapRange(accessors.firstAccessor)); + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, false), ts.getSourceMapRange(accessors.firstAccessor)); ts.setEmitFlags(statement, 1536); return statement; } - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0, 0); var target = ts.getMutableClone(receiver); ts.setEmitFlags(target, 1536 | 32); ts.setSourceMapRange(target, firstAccessor.name); @@ -42262,7 +42667,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, undefined, undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -42270,7 +42675,7 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, undefined, undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512); var setter = ts.createPropertyAssignment("set", setterFunction); @@ -42286,35 +42691,69 @@ var ts; if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return call; } function visitArrowFunction(node) { if (node.transformFlags & 16384) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256, 66); var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node), node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8); + exitSubtree(ancestorFacts, 0, 0); + convertedLoopState = savedConvertedLoopState; return func; } function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, undefined, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var ancestorFacts = ts.getEmitFlags(node) & 131072 + ? enterSubtree(16278, 69) + : enterSubtree(16286, 65); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, undefined, name, undefined, parameters, undefined, body); } function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.transformFlags & 64 + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name, undefined, parameters, undefined, body); } - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32) + ? enterSubtree(16286, 65 | 8) + : enterSubtree(16286, 65); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 && !name && (node.kind === 226 || node.kind === 184)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, saveStateAndInvoke(node, transformFunctionBody), location), node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body, location), node); } function transformFunctionBody(node) { var multiLine = false; @@ -42361,6 +42800,7 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, false); if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; } @@ -42374,6 +42814,21 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, true), updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 + ? enterSubtree(4032, 512) + : enterSubtree(3904, 128); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0, 0); + return updated; + } function visitExpressionStatement(node) { switch (node.expression.kind) { case 183: @@ -42398,9 +42853,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3) == 0) { + var ancestorFacts = enterSubtree(0, ts.hasModifier(node, 1) ? 32 : 0); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3) === 0) { var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -42417,49 +42875,54 @@ var ts; } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); + updated = ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25, acc); }), node); } else { - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function visitVariableDeclarationList(node) { - if (node.flags & 3) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64) { + if (node.flags & 3) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } function shouldEmitExplicitInitializerForLetDeclaration(node) { var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, false)); + && (hierarchyFacts & 512) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 - && enclosingBlockScopeContainer.kind !== 213 + && (hierarchyFacts & 2048) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, false))); + && (hierarchyFacts & (1024 | 2048)) === 0)); return emitExplicitInitializer; } function visitVariableDeclarationInLetDeclarationList(node) { @@ -42475,48 +42938,51 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitVariableDeclaration(node) { + var ancestorFacts = enterSubtree(32, 0); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1); - return ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0, undefined, (ancestorFacts & 32) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0, 0); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels[node.label.text] = node.label.text; + } + function resetLabel(node) { + convertedLoopState.labels[node.label.text] = undefined; + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0, 0); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement); } - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, convertForOfToFor); } - function convertForOfToFor(node, convertedLoopBodyStatements) { + function convertForOfToFor(node, outermostLabeledStatement, convertedLoopBodyStatements) { var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var initializer = node.initializer; var statements = []; @@ -42579,31 +43045,53 @@ var ts; ts.createVariableDeclaration(rhsReference, undefined, expression, node.expression) ], node.expression), 1048576), ts.createLessThan(counter, ts.createPropertyAccess(rhsReference, "length"), node.expression), ts.createPostfixIncrement(counter, node.expression), body, node); ts.setEmitFlags(forStatement, 256); - return forStatement; + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 210: + case 211: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 212: + return visitForStatement(node, outermostLabeledStatement); + case 213: + return visitForInStatement(node, outermostLabeledStatement); + case 214: + return visitForOfStatement(node, outermostLabeledStatement); + } } function visitObjectLiteralExpression(node) { var properties = node.properties; var numProperties = properties.length; var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 - || property.name.kind === 142) { + if ((property.transformFlags & 16777216 && hierarchyFacts & 4) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 142) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - var temp = ts.createTempVariable(hoistVariableDeclaration); - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + var temp = ts.createTempVariable(hoistVariableDeclaration); + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), undefined, node.multiLine), 32768)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536) !== 0; @@ -42627,14 +43115,16 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 | 4; } - var result = convert ? convert(node, undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -42643,11 +43133,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211: case 212: case 213: + case 214: var initializer = node.initializer; - if (initializer && initializer.kind === 224) { + if (initializer && initializer.kind === 225) { loopInitializer = initializer; } break; @@ -42674,7 +43164,7 @@ var ts; } } startLexicalEnvironment(); - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, false, ts.liftToBlock); var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; @@ -42686,11 +43176,13 @@ var ts; ts.addRange(statements_4, lexicalEnvironment); loopBody = ts.createBlock(statements_4, undefined, true); } - if (!ts.isBlock(loopBody)) { + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = ts.createBlock([loopBody], undefined, true); } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072) !== 0 + var isAsyncBlockContainingAwait = hierarchyFacts & 4 && (node.statement.transformFlags & 16777216) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -42749,19 +43241,18 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); - loop.statement = undefined; - loop = ts.visitEachChild(loop, visitor, context); - loop.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + var clone_4 = ts.getMutableClone(node); + clone_4.statement = undefined; + clone_4 = ts.visitEachChild(clone_4, visitor, context); + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, undefined, true); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -42875,17 +43366,17 @@ var ts; case 152: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257: - expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); + case 149: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; case 258: - expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); + expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); + case 259: + expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: ts.Debug.failBadSyntaxKind(node); @@ -42907,21 +43398,31 @@ var ts; } return expression; } - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined), method); + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0, 0); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, method, undefined, container), method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 16384 : 0); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); - var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032, 0); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0, temp); + var list = ts.createVariableDeclarationList(vars, node.variableDeclaration, node.variableDeclaration.flags); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0, 0); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -42929,21 +43430,43 @@ var ts; } function visitMethodDeclaration(node) { ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined); + var functionExpression = transformFunctionLikeToExpression(node, ts.moveRangePos(node, -1), undefined, undefined); ts.setEmitFlags(functionExpression, 512 | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, node); } + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286, 65); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, 0); + convertedLoopState = savedConvertedLoopState; + return updated; + } function visitShorthandPropertyAssignment(node) { return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0, 8192); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152, hierarchyFacts & 49152 ? 32768 : 0); + return updated; + } function visitYieldExpression(node) { return ts.visitEachChild(node, visitor, context); } function visitArrayLiteralExpression(node) { - return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + if (node.transformFlags & 64) { + return transformAndSpreadElements(node.elements, true, node.multiLine, node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + if (node.transformFlags & 64) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, false); @@ -42955,25 +43478,27 @@ var ts; } var resultingCall; if (node.transformFlags & 524288) { - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false)); } else { - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node); } if (node.expression.kind === 96) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } function visitNewExpression(node) { - ts.Debug.assert((node.transformFlags & 524288) !== 0); - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + if (node.transformFlags & 524288) { + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), false, false, false)), undefined, []); + } + return ts.visitEachChild(node, visitor, context); } function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { var numElements = elements.length; @@ -43071,21 +43596,34 @@ var ts; } } } - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32) - && currentParent.kind !== 179 + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 && node.name.text === "target") { + if (hierarchyFacts & 8192) { + hierarchyFacts |= 32768; + } + else { + hierarchyFacts |= 16384; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) { - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8 + ? 65 | 16 + : 65); + previousOnEmitNode(emitContext, node, emitCallback); + exitSubtree(ancestorFacts, 0, 0); + return; } previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; } function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2) === 0) { @@ -43103,7 +43641,7 @@ var ts; context.enableEmitNotification(152); context.enableEmitNotification(185); context.enableEmitNotification(184); - context.enableEmitNotification(225); + context.enableEmitNotification(226); } } function onSubstituteNode(emitContext, node) { @@ -43129,9 +43667,9 @@ var ts; var parent = node.parent; switch (parent.kind) { case 174: - case 226: - case 229: - case 223: + case 227: + case 230: + case 224: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -43157,8 +43695,7 @@ var ts; } function substituteThisKeyword(node) { if (enabledSubstitutions & 1 - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8) { + && hierarchyFacts & 16) { return ts.createIdentifier("_this", node); } return node; @@ -43175,7 +43712,7 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208) { return false; } var statementExpression = statement.expression; @@ -43206,7 +43743,7 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); var ts; @@ -43283,13 +43820,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 218: - return visitSwitchStatement(node); case 219: + return visitSwitchStatement(node); + case 220: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -43297,24 +43834,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); case 151: case 152: return visitAccessorDeclaration(node); - case 205: + case 206: return visitVariableStatement(node); - case 211: - return visitForStatement(node); case 212: + return visitForStatement(node); + case 213: return visitForInStatement(node); - case 215: - return visitBreakStatement(node); - case 214: - return visitContinueStatement(node); case 216: + return visitBreakStatement(node); + case 215: + return visitContinueStatement(node); + case 217: return visitReturnStatement(node); default: if (node.transformFlags & 16777216) { @@ -43352,7 +43889,7 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 225: + case 226: return visitFunctionDeclaration(node); case 184: return visitFunctionExpression(node); @@ -43539,10 +44076,10 @@ var ts; else if (node.operatorToken.kind === 25) { return visitCommaExpression(node); } - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -43604,7 +44141,7 @@ var ts; emitYield(expression, node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(node); } function visitArrayLiteralExpression(node) { return visitElements(node.elements, undefined, undefined, node.multiLine); @@ -43664,10 +44201,10 @@ var ts; } function visitElementAccessExpression(node) { if (containsYield(node.argumentExpression)) { - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -43710,35 +44247,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204: + case 205: return transformAndEmitBlock(node); - case 207: - return transformAndEmitExpressionStatement(node); case 208: - return transformAndEmitIfStatement(node); + return transformAndEmitExpressionStatement(node); case 209: - return transformAndEmitDoStatement(node); + return transformAndEmitIfStatement(node); case 210: - return transformAndEmitWhileStatement(node); + return transformAndEmitDoStatement(node); case 211: - return transformAndEmitForStatement(node); + return transformAndEmitWhileStatement(node); case 212: + return transformAndEmitForStatement(node); + case 213: return transformAndEmitForInStatement(node); - case 214: - return transformAndEmitContinueStatement(node); case 215: - return transformAndEmitBreakStatement(node); + return transformAndEmitContinueStatement(node); case 216: - return transformAndEmitReturnStatement(node); + return transformAndEmitBreakStatement(node); case 217: - return transformAndEmitWithStatement(node); + return transformAndEmitReturnStatement(node); case 218: - return transformAndEmitSwitchStatement(node); + return transformAndEmitWithStatement(node); case 219: - return transformAndEmitLabeledStatement(node); + return transformAndEmitSwitchStatement(node); case 220: - return transformAndEmitThrowStatement(node); + return transformAndEmitLabeledStatement(node); case 221: + return transformAndEmitThrowStatement(node); + case 222: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, true)); @@ -43758,7 +44295,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name_39 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_39, variable.name); + hoistVariableDeclaration(name_39); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -43788,7 +44327,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -44022,7 +44561,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 && defaultClauseIndex === -1) { + if (clause.kind === 255 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -44032,7 +44571,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253) { + if (clause.kind === 254) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -44153,12 +44692,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_39) { - var clone_6 = ts.getMutableClone(name_39); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name_40 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_40) { + var clone_7 = ts.getMutableClone(name_40); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -44768,41 +45307,41 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2), expression] - : [createInstruction(2)]), operationLocation)); + : [createInstruction(2)]), operationLocation), 384)); } function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation)); + ]), operationLocation), 384)); } function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384)), 1)); } function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4), expression] - : [createInstruction(4)]), operationLocation)); + : [createInstruction(4)]), operationLocation), 384)); } function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(5), expression - ]), operationLocation)); + ]), operationLocation), 384)); } function writeEndfinally() { lastOperationWasAbrupt = true; @@ -44827,15 +45366,40 @@ var ts; var ts; (function (ts) { function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(249); + context.enableEmitNotification(250); + context.enableEmitNotification(248); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(177); - context.enableSubstitution(257); + context.enableSubstitution(258); return transformSourceFile; function transformSourceFile(node) { return node; } + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 249: + case 250: + case 248: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } node = previousOnSubstituteNode(emitContext, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); @@ -44892,8 +45456,8 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableSubstitution(258); - context.enableEmitNotification(261); + context.enableSubstitution(259); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var currentSourceFile; @@ -44931,14 +45495,7 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, true); - } - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, undefined, false); - } - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var _a = collectAsynchronousDependencies(node, true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; return ts.updateSourceFileNode(node, ts.createNodeArray([ ts.createStatement(ts.createCall(define, undefined, (moduleName ? [moduleName] : []).concat([ ts.createArrayLiteral([ @@ -44952,6 +45509,36 @@ var ts; ]))) ], node.statements)); } + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ts.createParameter(undefined, undefined, undefined, "factory")], undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement(undefined, [ + ts.createVariableDeclaration("v", undefined, ts.createCall(ts.createIdentifier("factory"), undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], undefined, true)); + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, undefined, [ + ts.createFunctionExpression(undefined, undefined, undefined, undefined, [ + ts.createParameter(undefined, undefined, undefined, "require"), + ts.createParameter(undefined, undefined, undefined, "exports") + ].concat(importAliasNames), undefined, transformAsynchronousModuleBody(node)) + ])) + ], node.statements)); + } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { var aliasedModuleNames = []; var unaliasedModuleNames = []; @@ -45011,23 +45598,23 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return visitExportDeclaration(node); - case 240: + case 241: return visitExportAssignment(node); - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return node; @@ -45225,7 +45812,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -45257,10 +45844,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -45368,7 +45955,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = ts.createMap(); @@ -45428,7 +46015,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -45437,8 +46024,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_40 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); + var name_41 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_41), node); } } } @@ -45502,7 +46089,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); var ts; (function (ts) { @@ -45519,7 +46105,7 @@ var ts; context.enableSubstitution(192); context.enableSubstitution(190); context.enableSubstitution(191); - context.enableEmitNotification(261); + context.enableEmitNotification(262); var moduleInfoMap = ts.createMap(); var deferredExports = ts.createMap(); var exportFunctionsMap = ts.createMap(); @@ -45619,7 +46205,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 && externalImport.exportClause) { + if (externalImport.kind === 242 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -45642,7 +46228,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241) { + if (externalImport.kind !== 242) { continue; } var exportDecl = externalImport; @@ -45694,15 +46280,15 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235: + case 236: if (!entry.importClause) { break; } - case 234: + case 235: ts.Debug.assert(importVariableName !== undefined); statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241: + case 242: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { var properties = []; @@ -45724,13 +46310,13 @@ var ts; } function sourceElementVisitor(node) { switch (node.kind) { - case 235: + case 236: return visitImportDeclaration(node); - case 234: + case 235: return visitImportEqualsDeclaration(node); - case 241: + case 242: return undefined; - case 240: + case 241: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -45851,7 +46437,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 1048576) === 0 - && (enclosingBlockScopedContainer.kind === 261 + && (enclosingBlockScopedContainer.kind === 262 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -45873,7 +46459,7 @@ var ts; : preventSubstitution(ts.createAssignment(name, value, location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -45906,10 +46492,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237: + case 238: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238: + case 239: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -46008,43 +46594,43 @@ var ts; } function nestedElementVisitor(node) { switch (node.kind) { - case 205: + case 206: return visitVariableStatement(node); - case 225: - return visitFunctionDeclaration(node); case 226: + return visitFunctionDeclaration(node); + case 227: return visitClassDeclaration(node); - case 211: - return visitForStatement(node); case 212: - return visitForInStatement(node); + return visitForStatement(node); case 213: + return visitForInStatement(node); + case 214: return visitForOfStatement(node); - case 209: - return visitDoStatement(node); case 210: + return visitDoStatement(node); + case 211: return visitWhileStatement(node); - case 219: + case 220: return visitLabeledStatement(node); - case 217: - return visitWithStatement(node); case 218: + return visitWithStatement(node); + case 219: return visitSwitchStatement(node); - case 232: + case 233: return visitCaseBlock(node); - case 253: - return visitCaseClause(node); case 254: + return visitCaseClause(node); + case 255: return visitDefaultClause(node); - case 221: + case 222: return visitTryStatement(node); - case 256: + case 257: return visitCatchClause(node); - case 204: + case 205: return visitBlock(node); - case 295: - return visitMergeDeclarationMarker(node); case 296: + return visitMergeDeclarationMarker(node); + case 297: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -46172,7 +46758,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261; + return container !== undefined && container.kind === 262; } else { return false; @@ -46187,7 +46773,7 @@ var ts; return node; } function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261) { + if (node.kind === 262) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -46299,7 +46885,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 261) { + if (exportContainer && exportContainer.kind === 262) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -46327,7 +46913,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261); + context.enableEmitNotification(262); context.enableSubstitution(70); var currentSourceFile; return transformSourceFile; @@ -46352,9 +46938,9 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234: + case 235: return undefined; - case 240: + case 241: return visitExportAssignment(node); } return node; @@ -46663,7 +47249,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235); + ts.Debug.assert(aliasEmitInfo.node.kind === 236); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -46735,10 +47321,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223) { + if (declaration.kind === 224) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 || declaration.kind === 239 || declaration.kind === 236) { + else if (declaration.kind === 239 || declaration.kind === 240 || declaration.kind === 237) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -46749,7 +47335,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235) { + if (moduleElementEmitInfo.node.kind === 236) { moduleElementEmitInfo.isVisible = true; } else { @@ -46757,12 +47343,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230) { + if (nodeToCheck.kind === 231) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -46933,7 +47519,7 @@ var ts; } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 234 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 235 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); @@ -47050,9 +47636,9 @@ var ts; var count = 0; while (true) { count++; - var name_41 = baseName + "_" + count; - if (!(name_41 in currentIdentifiers)) { - return name_41; + var name_42 = baseName + "_" + count; + if (!(name_42 in currentIdentifiers)) { + return name_42; } } } @@ -47096,10 +47682,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 || - (node.parent.kind === 261 && isCurrentFileExternalModule)) { + else if (node.kind === 235 || + (node.parent.kind === 262 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -47108,7 +47694,7 @@ var ts; }); } else { - if (node.kind === 235) { + if (node.kind === 236) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -47126,30 +47712,30 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225: - return writeFunctionDeclaration(node); - case 205: - return writeVariableStatement(node); - case 227: - return writeInterfaceDeclaration(node); case 226: - return writeClassDeclaration(node); + return writeFunctionDeclaration(node); + case 206: + return writeVariableStatement(node); case 228: - return writeTypeAliasDeclaration(node); + return writeInterfaceDeclaration(node); + case 227: + return writeClassDeclaration(node); case 229: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 230: + return writeEnumDeclaration(node); + case 231: return writeModuleDeclaration(node); - case 234: - return writeImportEqualsDeclaration(node); case 235: + return writeImportEqualsDeclaration(node); + case 236: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 261) { + if (node.parent.kind === 262) { var modifiers = ts.getModifierFlags(node); if (modifiers & 1) { write("export "); @@ -47157,7 +47743,7 @@ var ts; if (modifiers & 512) { write("default "); } - else if (node.kind !== 227 && !noDeclare) { + else if (node.kind !== 228 && !noDeclare) { write("declare "); } } @@ -47207,7 +47793,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 238) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -47230,7 +47816,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 237) { + if (node.importClause.namedBindings.kind === 238) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -47247,13 +47833,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231; var moduleSpecifier; - if (parent.kind === 234) { + if (parent.kind === 235) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230) { + else if (parent.kind === 231) { moduleSpecifier = parent.name; } else { @@ -47321,7 +47907,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231) { + while (node.body && node.body.kind !== 232) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -47419,10 +48005,10 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 226: + case 227: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227: + case 228: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 154: @@ -47436,17 +48022,17 @@ var ts; if (ts.hasModifier(node.parent, 32)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226) { + else if (node.parent.parent.kind === 227) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225: + case 226: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228: + case 229: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -47483,7 +48069,7 @@ var ts; } function getHeritageClauseVisibilityError() { var diagnosticMessage; - if (node.parent.parent.kind === 226) { + if (node.parent.parent.kind === 227) { 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; @@ -47566,7 +48152,7 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 223 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 224 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -47589,7 +48175,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223) { + if (node.kind === 224) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47604,7 +48190,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -47764,13 +48350,13 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225) { + if (node.kind === 226) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 149 || node.kind === 150) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225) { + if (node.kind === 226) { write("function "); writeTextOfNode(currentText, node.name); } @@ -47864,7 +48450,7 @@ var ts; 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 === 226) { + else if (node.parent.kind === 227) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47877,7 +48463,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225: + case 226: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -47954,7 +48540,7 @@ var ts; 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 === 226) { + else if (node.parent.parent.kind === 227) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.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 : @@ -47966,7 +48552,7 @@ var ts; 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; } - case 225: + case 226: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -48018,19 +48604,19 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225: - case 230: - case 234: - case 227: case 226: - case 228: - case 229: - return emitModuleElement(node, isModuleElementVisible(node)); - case 205: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 231: case 235: + case 228: + case 227: + case 229: + case 230: + return emitModuleElement(node, isModuleElementVisible(node)); + case 206: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 236: return emitModuleElement(node, !node.importClause); - case 241: + case 242: return emitExportDeclaration(node); case 150: case 149: @@ -48046,11 +48632,11 @@ var ts; case 147: case 146: return emitPropertyDeclaration(node); - case 260: - return emitEnumMemberDeclaration(node); - case 240: - return emitExportAssignment(node); case 261: + return emitEnumMemberDeclaration(node); + case 241: + return emitExportAssignment(node); + case 262: return emitSourceFile(node); } } @@ -48267,7 +48853,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -48280,7 +48866,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 293 + if (node.kind !== 294 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -48424,7 +49010,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293; + var isEmittedNode = node.kind !== 294; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0; if (!skipLeadingComments) { @@ -48438,7 +49024,7 @@ var ts; } if (!skipTrailingComments) { containerEnd = end; - if (node.kind === 224) { + if (node.kind === 225) { declarationListContainerEnd = end; } } @@ -48794,7 +49380,7 @@ var ts; function pipelineEmitInSourceFileContext(node) { var kind = node.kind; switch (kind) { - case 261: + case 262: return emitSourceFile(node); } } @@ -48917,119 +49503,119 @@ var ts; return emitArrayBindingPattern(node); case 174: return emitBindingElement(node); - case 202: - return emitTemplateSpan(node); case 203: - return emitSemicolonClassElement(); + return emitTemplateSpan(node); case 204: - return emitBlock(node); + return emitSemicolonClassElement(); case 205: - return emitVariableStatement(node); + return emitBlock(node); case 206: - return emitEmptyStatement(); + return emitVariableStatement(node); case 207: - return emitExpressionStatement(node); + return emitEmptyStatement(); case 208: - return emitIfStatement(node); + return emitExpressionStatement(node); case 209: - return emitDoStatement(node); + return emitIfStatement(node); case 210: - return emitWhileStatement(node); + return emitDoStatement(node); case 211: - return emitForStatement(node); + return emitWhileStatement(node); case 212: - return emitForInStatement(node); + return emitForStatement(node); case 213: - return emitForOfStatement(node); + return emitForInStatement(node); case 214: - return emitContinueStatement(node); + return emitForOfStatement(node); case 215: - return emitBreakStatement(node); + return emitContinueStatement(node); case 216: - return emitReturnStatement(node); + return emitBreakStatement(node); case 217: - return emitWithStatement(node); + return emitReturnStatement(node); case 218: - return emitSwitchStatement(node); + return emitWithStatement(node); case 219: - return emitLabeledStatement(node); + return emitSwitchStatement(node); case 220: - return emitThrowStatement(node); + return emitLabeledStatement(node); case 221: - return emitTryStatement(node); + return emitThrowStatement(node); case 222: - return emitDebuggerStatement(node); + return emitTryStatement(node); case 223: - return emitVariableDeclaration(node); + return emitDebuggerStatement(node); case 224: - return emitVariableDeclarationList(node); + return emitVariableDeclaration(node); case 225: - return emitFunctionDeclaration(node); + return emitVariableDeclarationList(node); case 226: - return emitClassDeclaration(node); + return emitFunctionDeclaration(node); case 227: - return emitInterfaceDeclaration(node); + return emitClassDeclaration(node); case 228: - return emitTypeAliasDeclaration(node); + return emitInterfaceDeclaration(node); case 229: - return emitEnumDeclaration(node); + return emitTypeAliasDeclaration(node); case 230: - return emitModuleDeclaration(node); + return emitEnumDeclaration(node); case 231: - return emitModuleBlock(node); + return emitModuleDeclaration(node); case 232: + return emitModuleBlock(node); + case 233: return emitCaseBlock(node); - case 234: - return emitImportEqualsDeclaration(node); case 235: - return emitImportDeclaration(node); + return emitImportEqualsDeclaration(node); case 236: - return emitImportClause(node); + return emitImportDeclaration(node); case 237: - return emitNamespaceImport(node); + return emitImportClause(node); case 238: - return emitNamedImports(node); + return emitNamespaceImport(node); case 239: - return emitImportSpecifier(node); + return emitNamedImports(node); case 240: - return emitExportAssignment(node); + return emitImportSpecifier(node); case 241: - return emitExportDeclaration(node); + return emitExportAssignment(node); case 242: - return emitNamedExports(node); + return emitExportDeclaration(node); case 243: - return emitExportSpecifier(node); + return emitNamedExports(node); case 244: - return; + return emitExportSpecifier(node); case 245: + return; + case 246: return emitExternalModuleReference(node); case 10: return emitJsxText(node); - case 248: - return emitJsxOpeningElement(node); case 249: - return emitJsxClosingElement(node); + return emitJsxOpeningElement(node); case 250: - return emitJsxAttribute(node); + return emitJsxClosingElement(node); case 251: - return emitJsxSpreadAttribute(node); + return emitJsxAttribute(node); case 252: - return emitJsxExpression(node); + return emitJsxSpreadAttribute(node); case 253: - return emitCaseClause(node); + return emitJsxExpression(node); case 254: - return emitDefaultClause(node); + return emitCaseClause(node); case 255: - return emitHeritageClause(node); + return emitDefaultClause(node); case 256: - return emitCatchClause(node); + return emitHeritageClause(node); case 257: - return emitPropertyAssignment(node); + return emitCatchClause(node); case 258: - return emitShorthandPropertyAssignment(node); + return emitPropertyAssignment(node); case 259: - return emitSpreadAssignment(node); + return emitShorthandPropertyAssignment(node); case 260: + return emitSpreadAssignment(node); + case 261: return emitEnumMember(node); } if (ts.isExpression(node)) { @@ -49106,14 +49692,14 @@ var ts; return emitAsExpression(node); case 201: return emitNonNullExpression(node); - case 246: - return emitJsxElement(node); + case 202: + return emitMetaProperty(node); case 247: + return emitJsxElement(node); + case 248: return emitJsxSelfClosingElement(node); - case 294: + case 295: return emitPartiallyEmittedExpression(node); - case 297: - return writeLines(node.text); } } function emitNumericLiteral(node) { @@ -49558,6 +50144,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } function emitTemplateSpan(node) { emitExpression(node.expression); emit(node.literal); @@ -49600,27 +50191,27 @@ var ts; writeToken(18, openParenPos, node); emitExpression(node.expression); writeToken(19, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81, node.thenStatement.end, node); - if (node.elseStatement.kind === 208) { + if (node.elseStatement.kind === 209) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -49630,7 +50221,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49642,7 +50233,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49652,7 +50243,7 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87, node.pos); @@ -49662,11 +50253,11 @@ var ts; write(" of "); emitExpression(node.expression); writeToken(19, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224) { + if (node.kind === 225) { emit(node); } else { @@ -49693,7 +50284,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97, node.pos); @@ -49717,9 +50308,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -49895,7 +50489,7 @@ var ts; write(node.flags & 16 ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230) { + while (body.kind === 231) { write("."); emit(body.name); body = body.body; @@ -50046,6 +50640,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -50245,8 +50842,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1) { write(" "); emit(node); } @@ -50375,6 +50972,14 @@ var ts; write(getClosingBracket(format)); } } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1) { + write(" "); + } + else { + writeLine(); + } + } function writeIfAny(nodes, text) { if (nodes && nodes.length > 0) { write(text); @@ -50555,21 +51160,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_42 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_42)) { + var name_43 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_43)) { tempFlags |= flags; - return name_42; + return name_43; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_43 = count < 26 + var name_44 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_43)) { - return name_43; + if (isUniqueName(name_44)) { + return name_44; } } } @@ -50603,22 +51208,32 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(0); + } function generateNameForNode(node) { switch (node.kind) { case 70: return makeUniqueName(getTextOfNode(node)); + case 231: case 230: - case 229: return generateNameForModuleOrEnum(node); - case 235: - case 241: + case 236: + case 242: return generateNameForImportOrExportDeclaration(node); - case 225: case 226: - case 240: + case 227: + case 241: return generateNameForExportDefault(); case 197: return generateNameForClassExpression(); + case 149: + case 151: + case 152: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0); } @@ -50649,11 +51264,14 @@ var ts; } return node; } + function generateNameForNodeCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } function getGeneratedIdentifier(name) { if (name.autoGenerateKind === 4) { var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { var autoGenerateId = name.autoGenerateId; @@ -50722,7 +51340,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { return true; @@ -50905,10 +51524,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_44 = names_1[_i]; - var result = name_44 in cache - ? cache[name_44] - : cache[name_44] = loader(name_44, containingFile); + var name_45 = names_1[_i]; + var result = name_45 in cache + ? cache[name_45] + : cache[name_45] = loader(name_45, containingFile); resolutions.push(result); } return resolutions; @@ -50933,6 +51552,7 @@ var ts; var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -50945,7 +51565,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -50981,6 +51602,7 @@ var ts; } } } + moduleResolutionCache = undefined; oldProgram = undefined; program = { getRootFileNames: function () { return rootNames; }, @@ -51187,7 +51809,7 @@ var ts; newSourceFile.resolvedModules = oldSourceFile.resolvedModules; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -51345,42 +51967,42 @@ var ts; case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: - case 223: + case 226: + case 224: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); return; } } switch (node.kind) { - case 234: + case 235: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240: + case 241: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255: + case 256: var heritageClause = node; if (heritageClause.token === 107) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227: + case 228: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230: + case 231: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228: + case 229: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229: + case 230: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case 182: @@ -51398,23 +52020,23 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226: + case 227: case 149: case 148: case 150: case 151: case 152: case 184: - case 225: + case 226: case 185: - case 225: + case 226: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } - case 205: + case 206: if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205); + return checkModifiers(nodes, parent.kind === 206); } break; case 147: @@ -51526,7 +52148,7 @@ var ts; && !file.isDeclarationFile) { var externalHelpersModuleReference = ts.createSynthesizedNode(9); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235); + var importDecl = ts.createSynthesizedNode(236); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -51544,9 +52166,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { + case 236: case 235: - case 234: - case 241: + case 242: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -51558,7 +52180,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230: + case 231: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -52182,32 +52804,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 144: - case 223: + case 224: case 174: case 147: case 146: - case 257: case 258: - case 260: + case 259: + case 261: case 149: case 148: case 150: case 151: case 152: - case 225: + case 226: case 184: case 185: - case 256: + case 257: return 1; case 143: - case 227: case 228: + case 229: case 161: return 2; - case 226: - case 229: - return 1 | 2; + case 227: case 230: + return 1 | 2; + case 231: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -52217,21 +52839,21 @@ var ts; else { return 4; } - case 238: case 239: - case 234: - case 235: case 240: + case 235: + case 236: case 241: + case 242: return 1 | 2 | 4; - case 261: + case 262: return 4 | 1; } return 1 | 2 | 4; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240) { + if (node.parent.kind === 241) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -52255,7 +52877,7 @@ var ts; ts.Debug.assert(node.kind === 70); if (node.parent.kind === 141 && node.parent.right === node && - node.parent.parent.kind === 234) { + node.parent.parent.kind === 235) { return 1 | 2 | 4; } return 4; @@ -52289,10 +52911,10 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 255) { + if (!isLastClause && root.parent.kind === 199 && root.parent.parent.kind === 256) { var decl = root.parent.parent.parent; - return (decl.kind === 226 && root.parent.parent.token === 107) || - (decl.kind === 227 && root.parent.parent.token === 84); + return (decl.kind === 227 && root.parent.parent.token === 107) || + (decl.kind === 228 && root.parent.parent.token === 84); } return false; } @@ -52323,7 +52945,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 220 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -52333,13 +52955,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 && - (node.parent.kind === 215 || node.parent.kind === 214) && + (node.parent.kind === 216 || node.parent.kind === 215) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 && - node.parent.kind === 219 && + node.parent.kind === 220 && node.parent.label === node; } function isLabelName(node) { @@ -52355,7 +52977,7 @@ var ts; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 && node.parent.name === node; + return node.parent.kind === 231 && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -52368,13 +52990,13 @@ var ts; switch (node.parent.kind) { case 147: case 146: - case 257: - case 260: + case 258: + case 261: case 149: case 148: case 151: case 152: - case 230: + case 231: return node.parent.name === node; case 178: return node.parent.argumentExpression === node; @@ -52422,17 +53044,17 @@ var ts; return undefined; } switch (node.kind) { - case 261: + case 262: case 149: case 148: - case 225: + case 226: case 184: case 151: case 152: - case 226: case 227: - case 229: + case 228: case 230: + case 231: return node; } } @@ -52440,22 +53062,22 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261: + case 262: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230: + case 231: return ts.ScriptElementKind.moduleElement; - case 226: + case 227: case 197: return ts.ScriptElementKind.classElement; - case 227: return ts.ScriptElementKind.interfaceElement; - case 228: return ts.ScriptElementKind.typeElement; - case 229: return ts.ScriptElementKind.enumElement; - case 223: + case 228: return ts.ScriptElementKind.interfaceElement; + case 229: return ts.ScriptElementKind.typeElement; + case 230: return ts.ScriptElementKind.enumElement; + case 224: return getKindOfVariableDeclaration(node); case 174: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); case 185: - case 225: + case 226: case 184: return ts.ScriptElementKind.functionElement; case 151: return ts.ScriptElementKind.memberGetAccessorElement; @@ -52471,15 +53093,15 @@ var ts; case 153: return ts.ScriptElementKind.callSignatureElement; case 150: return ts.ScriptElementKind.constructorImplementationElement; case 143: return ts.ScriptElementKind.typeParameterElement; - case 260: return ts.ScriptElementKind.enumMemberElement; + case 261: return ts.ScriptElementKind.enumMemberElement; case 144: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234: - case 239: - case 236: - case 243: + case 235: + case 240: case 237: + case 244: + case 238: return ts.ScriptElementKind.alias; - case 285: + case 286: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -52551,19 +53173,19 @@ var ts; return false; } switch (n.kind) { - case 226: case 227: - case 229: + case 228: + case 230: case 176: case 172: case 161: - case 204: - case 231: + case 205: case 232: - case 238: - case 242: + case 233: + case 239: + case 243: return nodeEndsWith(n, 17, sourceFile); - case 256: + case 257: return isCompletedNode(n.block, sourceFile); case 180: if (!n.arguments) { @@ -52579,7 +53201,7 @@ var ts; case 150: case 151: case 152: - case 225: + case 226: case 184: case 149: case 148: @@ -52593,14 +53215,14 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 230: + case 231: return n.body && isCompletedNode(n.body, sourceFile); - case 208: + case 209: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 207: + case 208: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24); case 175: @@ -52614,15 +53236,15 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21, sourceFile); - case 253: case 254: + case 255: return false; - case 211: case 212: case 213: - case 210: + case 214: + case 211: return isCompletedNode(n.statement, sourceFile); - case 209: + case 210: var hasWhileKeyword = findChildOfKind(n, 105, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 19, sourceFile); @@ -52642,10 +53264,10 @@ var ts; case 194: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 202: + case 203: return ts.nodeIsPresent(n.literal); - case 241: - case 235: + case 242: + case 236: return ts.nodeIsPresent(n.moduleSpecifier); case 190: return isCompletedNode(n.operand, sourceFile); @@ -52694,7 +53316,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 292 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 293 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -52749,8 +53371,8 @@ var ts; } } } - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; if (ts.isJSDocNode(child)) { continue; } @@ -52814,7 +53436,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; if (position < child.end && (nodeHasTokens(child) || child.kind === 10)) { var start = child.getStart(sourceFile); @@ -52829,7 +53451,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261); + ts.Debug.assert(startNode !== undefined || n.kind === 262); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -52874,13 +53496,13 @@ var ts; if (token.kind === 26 && token.parent.kind === 10) { return true; } - if (token.kind === 26 && token.parent.kind === 252) { + if (token.kind === 26 && token.parent.kind === 253) { return true; } - if (token && token.kind === 17 && token.parent.kind === 252) { + if (token && token.kind === 17 && token.parent.kind === 253) { return true; } - if (token.kind === 26 && token.parent.kind === 249) { + if (token.kind === 26 && token.parent.kind === 250) { return true; } return false; @@ -52974,7 +53596,7 @@ var ts; if (node.kind === 157 || node.kind === 179) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 || node.kind === 227) { + if (ts.isFunctionLike(node) || node.kind === 227 || node.kind === 228) { return node.typeParameters; } return undefined; @@ -53047,11 +53669,11 @@ var ts; node.parent.operatorToken.kind === 57) { return true; } - if (node.parent.kind === 213 && + if (node.parent.kind === 214 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 ? node.parent.parent : node.parent)) { return true; } } @@ -53268,7 +53890,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 || location.parent.kind === 243) && + (location.parent.kind === 240 || location.parent.kind === 244) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -53325,6 +53947,10 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getOpenBraceEnd(constructor, sourceFile) { + return constructor.body.getFirstToken(sourceFile).getEnd(); + } + ts.getOpenBraceEnd = getOpenBraceEnd; })(ts || (ts = {})); var ts; (function (ts) { @@ -53373,15 +53999,15 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205: + case 206: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223: + case 224: case 147: case 146: return spanInVariableDeclaration(node); case 144: return spanInParameterDeclaration(node); - case 225: + case 226: case 149: case 148: case 151: @@ -53390,72 +54016,72 @@ var ts; case 184: case 185: return spanInFunctionDeclaration(node); - case 204: + case 205: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 231: + case 232: return spanInBlock(node); - case 256: + case 257: return spanInBlock(node.block); - case 207: - return textSpan(node.expression); - case 216: - return textSpan(node.getChildAt(0), node.expression); - case 210: - return textSpanEndingAtNextToken(node, node.expression); - case 209: - return spanInNode(node.statement); - case 222: - return textSpan(node.getChildAt(0)); case 208: - return textSpanEndingAtNextToken(node, node.expression); - case 219: - return spanInNode(node.statement); - case 215: - case 214: - return textSpan(node.getChildAt(0), node.label); + return textSpan(node.expression); + case 217: + return textSpan(node.getChildAt(0), node.expression); case 211: - return spanInForStatement(node); - case 212: return textSpanEndingAtNextToken(node, node.expression); - case 213: - return spanInInitializerOfForLike(node); - case 218: + case 210: + return spanInNode(node.statement); + case 223: + return textSpan(node.getChildAt(0)); + case 209: return textSpanEndingAtNextToken(node, node.expression); - case 253: - case 254: - return spanInNode(node.statements[0]); - case 221: - return spanInBlock(node.tryBlock); case 220: + return spanInNode(node.statement); + case 216: + case 215: + return textSpan(node.getChildAt(0), node.label); + case 212: + return spanInForStatement(node); + case 213: + return textSpanEndingAtNextToken(node, node.expression); + case 214: + return spanInInitializerOfForLike(node); + case 219: + return textSpanEndingAtNextToken(node, node.expression); + case 254: + case 255: + return spanInNode(node.statements[0]); + case 222: + return spanInBlock(node.tryBlock); + case 221: return textSpan(node, node.expression); - case 240: - return textSpan(node, node.expression); - case 234: - return textSpan(node, node.moduleReference); - case 235: - return textSpan(node, node.moduleSpecifier); case 241: + return textSpan(node, node.expression); + case 235: + return textSpan(node, node.moduleReference); + case 236: return textSpan(node, node.moduleSpecifier); - case 230: + case 242: + return textSpan(node, node.moduleSpecifier); + case 231: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 226: - case 229: - case 260: + case 227: + case 230: + case 261: case 174: return textSpan(node); - case 217: + case 218: return spanInNode(node.statement); case 145: return spanInNodeArray(node.parent.decorators); case 172: case 173: return spanInBindingPattern(node); - case 227: case 228: + case 229: return undefined; case 24: case 1: @@ -53491,8 +54117,8 @@ var ts; } if ((node.kind === 70 || node.kind == 196 || - node.kind === 257 || - node.kind === 258) && + node.kind === 258 || + node.kind === 259) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -53511,12 +54137,12 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209: + case 210: return spanInPreviousNode(node); case 145: return spanInNode(node.parent); - case 211: - case 213: + case 212: + case 214: return textSpan(node); case 192: if (node.parent.operatorToken.kind === 25) { @@ -53530,7 +54156,7 @@ var ts; break; } } - if (node.parent.kind === 257 && + if (node.parent.kind === 258 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -53541,7 +54167,7 @@ var ts; if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 223 || + if ((node.parent.kind === 224 || node.parent.kind === 144)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || @@ -53571,7 +54197,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 212) { + if (variableDeclaration.parent.parent.kind === 213) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -53579,7 +54205,7 @@ var ts; } if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1) || - variableDeclaration.parent.parent.kind === 213) { + variableDeclaration.parent.parent.kind === 214) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -53611,7 +54237,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1) || - (functionDeclaration.parent.kind === 226 && functionDeclaration.kind !== 150); + (functionDeclaration.parent.kind === 227 && functionDeclaration.kind !== 150); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -53631,22 +54257,22 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230: + case 231: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 210: - case 208: - case 212: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 211: + case 209: case 213: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 212: + case 214: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224) { + if (forLikeStatement.initializer.kind === 225) { var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -53690,33 +54316,33 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229: + case 230: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226: + case 227: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232: + case 233: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231: + case 232: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 229: - case 226: + case 230: + case 227: return textSpan(node); - case 204: + case 205: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 256: + case 257: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232: + case 233: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { @@ -53748,7 +54374,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 || + if (node.parent.kind === 210 || node.parent.kind === 179 || node.parent.kind === 180) { return spanInPreviousNode(node); @@ -53761,17 +54387,17 @@ var ts; function spanInCloseParenToken(node) { switch (node.parent.kind) { case 184: - case 225: + case 226: case 185: case 149: case 148: case 151: case 152: case 150: - case 210: - case 209: case 211: - case 213: + case 210: + case 212: + case 214: case 179: case 180: case 183: @@ -53782,7 +54408,7 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 || + node.parent.kind === 258 || node.parent.kind === 144) { return spanInPreviousNode(node); } @@ -53795,13 +54421,13 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209) { + if (node.parent.kind === 210) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213) { + if (node.parent.kind === 214) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -53845,7 +54471,7 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; var length_4 = dense[i + 1]; var type = dense[i + 2]; @@ -54152,10 +54778,10 @@ var ts; ts.getSemanticClassifications = getSemanticClassifications; function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 230: - case 226: + case 231: case 227: - case 225: + case 228: + case 226: cancellationToken.throwIfCancellationRequested(); } } @@ -54199,7 +54825,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 && + return declaration.kind === 231 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -54256,7 +54882,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -54340,16 +54966,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 281: + case 282: processJSDocParameterTag(tag); break; - case 284: + case 285: processJSDocTemplateTag(tag); break; - case 283: + case 284: processElement(tag.typeExpression); break; - case 282: + case 283: processElement(tag.typeExpression); break; } @@ -54430,22 +55056,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248: + case 249: if (token.parent.tagName === token) { return 19; } break; - case 249: + case 250: if (token.parent.tagName === token) { return 20; } break; - case 247: + case 248: if (token.parent.tagName === token) { return 21; } break; - case 250: + case 251: if (token.parent.name === token) { return 22; } @@ -54465,10 +55091,10 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 57) { - if (token.parent.kind === 223 || + if (token.parent.kind === 224 || token.parent.kind === 147 || token.parent.kind === 144 || - token.parent.kind === 250) { + token.parent.kind === 251) { return 5; } } @@ -54485,7 +55111,7 @@ var ts; return 4; } else if (tokenKind === 9) { - return token.parent.kind === 250 ? 24 : 6; + return token.parent.kind === 251 ? 24 : 6; } else if (tokenKind === 11) { return 6; @@ -54499,7 +55125,7 @@ var ts; else if (tokenKind === 70) { if (token) { switch (token.parent.kind) { - case 226: + case 227: if (token.parent.name === token) { return 11; } @@ -54509,17 +55135,17 @@ var ts; return 15; } return; - case 227: + case 228: if (token.parent.name === token) { return 13; } return; - case 229: + case 230: if (token.parent.name === token) { return 12; } return; - case 230: + case 231: if (token.parent.name === token) { return 14; } @@ -54540,9 +55166,8 @@ var ts; } if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { processElement(child); } @@ -54579,7 +55204,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 249) { + location.parent && location.parent.kind === 250) { var tagName = location.parent.parent.openingElement.tagName; entries.push({ name: tagName.text, @@ -54601,13 +55226,13 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_45 in nameTable) { - if (nameTable[name_45] === position) { + for (var name_46 in nameTable) { + if (nameTable[name_46] === position) { continue; } - if (!uniqueNames[name_45]) { - uniqueNames[name_45] = name_45; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); + if (!uniqueNames[name_46]) { + uniqueNames[name_46] = name_46; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, true); if (displayName) { var entry = { name: displayName, @@ -54657,7 +55282,7 @@ var ts; if (!node || node.kind !== 9) { return undefined; } - if (node.parent.kind === 257 && + if (node.parent.kind === 258 && node.parent.parent.kind === 176 && node.parent.name === node) { return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); @@ -54665,7 +55290,7 @@ var ts; else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { return getStringLiteralCompletionEntriesFromElementAccess(node.parent); } - else if (node.parent.kind === 235 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + else if (node.parent.kind === 236 || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { return getStringLiteralCompletionEntriesFromModuleNames(node); } else { @@ -54725,6 +55350,9 @@ var ts; return undefined; } function addStringLiteralCompletionsFromType(type, result) { + if (type && type.flags & 16384) { + type = typeChecker.getApparentType(type); + } if (!type) { return; } @@ -55029,11 +55657,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent_14 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_14) { break; } - currentDir = parent_13; + currentDir = parent_14; } else { break; @@ -55165,9 +55793,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 283: - case 281: + case 284: case 282: + case 283: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -55202,13 +55830,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; + var parent_15 = contextToken.parent, kind = contextToken.kind; if (kind === 22) { - if (parent_14.kind === 177) { + if (parent_15.kind === 177) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141) { + else if (parent_15.kind === 141) { node = contextToken.parent.left; isRightOfDot = true; } @@ -55221,7 +55849,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 && contextToken.parent.kind === 249) { + else if (kind === 40 && contextToken.parent.kind === 250) { isStartingCloseTag = true; location = contextToken; } @@ -55312,7 +55940,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247) || (jsxContainer.kind === 248)) { + if ((jsxContainer.kind === 248) || (jsxContainer.kind === 249)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -55333,9 +55961,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 || + scopeNode.kind === 262 || scopeNode.kind === 194 || - scopeNode.kind === 252 || + scopeNode.kind === 253 || ts.isStatement(scopeNode); } var symbolMeanings = 793064 | 107455 | 1920 | 8388608; @@ -55363,11 +55991,11 @@ var ts; return true; } if (contextToken.kind === 28 && contextToken.parent) { - if (contextToken.parent.kind === 248) { + if (contextToken.parent.kind === 249) { return true; } - if (contextToken.parent.kind === 249 || contextToken.parent.kind === 247) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246; + if (contextToken.parent.kind === 250 || contextToken.parent.kind === 248) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 247; } } return false; @@ -55397,16 +56025,16 @@ var ts; case 128: return true; case 22: - return containingNodeKind === 230; + return containingNodeKind === 231; case 16: - return containingNodeKind === 226; + return containingNodeKind === 227; case 57: - return containingNodeKind === 223 + return containingNodeKind === 224 || containingNodeKind === 192; case 13: return containingNodeKind === 194; case 14: - return containingNodeKind === 202; + return containingNodeKind === 203; case 113: case 111: case 112: @@ -55482,9 +56110,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 ? - 235 : - 241; + var declarationKind = namedImportsOrExports.kind === 239 ? + 236 : + 242; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -55505,9 +56133,9 @@ var ts; switch (contextToken.kind) { case 16: case 25: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 || parent_15.kind === 172)) { - return parent_15; + var parent_16 = contextToken.parent; + if (parent_16 && (parent_16.kind === 176 || parent_16.kind === 172)) { + return parent_16; } break; } @@ -55520,8 +56148,8 @@ var ts; case 16: case 25: switch (contextToken.parent.kind) { - case 238: - case 242: + case 239: + case 243: return contextToken.parent; } } @@ -55530,34 +56158,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent_17 = contextToken.parent; switch (contextToken.kind) { case 27: case 40: case 70: - case 250: case 251: - if (parent_16 && (parent_16.kind === 247 || parent_16.kind === 248)) { - return parent_16; + case 252: + if (parent_17 && (parent_17.kind === 248 || parent_17.kind === 249)) { + return parent_17; } - else if (parent_16.kind === 250) { - return parent_16.parent; + else if (parent_17.kind === 251) { + return parent_17.parent; } break; case 9: - if (parent_16 && ((parent_16.kind === 250) || (parent_16.kind === 251))) { - return parent_16.parent; + if (parent_17 && ((parent_17.kind === 251) || (parent_17.kind === 252))) { + return parent_17.parent; } break; case 17: - if (parent_16 && - parent_16.kind === 252 && - parent_16.parent && - (parent_16.parent.kind === 250)) { - return parent_16.parent.parent; + if (parent_17 && + parent_17.kind === 253 && + parent_17.parent && + (parent_17.parent.kind === 251)) { + return parent_17.parent.parent; } - if (parent_16 && parent_16.kind === 251) { - return parent_16.parent; + if (parent_17 && parent_17.kind === 252) { + return parent_17.parent; } break; } @@ -55568,7 +56196,7 @@ var ts; switch (kind) { case 184: case 185: - case 225: + case 226: case 149: case 148: case 151: @@ -55584,16 +56212,16 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25: - return containingNodeKind === 223 || - containingNodeKind === 224 || - containingNodeKind === 205 || - containingNodeKind === 229 || + return containingNodeKind === 224 || + containingNodeKind === 225 || + containingNodeKind === 206 || + containingNodeKind === 230 || isFunction(containingNodeKind) || - containingNodeKind === 226 || - containingNodeKind === 197 || containingNodeKind === 227 || + containingNodeKind === 197 || + containingNodeKind === 228 || containingNodeKind === 173 || - containingNodeKind === 228; + containingNodeKind === 229; case 22: return containingNodeKind === 173; case 55: @@ -55601,22 +56229,22 @@ var ts; case 20: return containingNodeKind === 173; case 18: - return containingNodeKind === 256 || + return containingNodeKind === 257 || isFunction(containingNodeKind); case 16: - return containingNodeKind === 229 || - containingNodeKind === 227 || + return containingNodeKind === 230 || + containingNodeKind === 228 || containingNodeKind === 161; case 24: return containingNodeKind === 146 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 || + (contextToken.parent.parent.kind === 228 || contextToken.parent.parent.kind === 161); case 26: - return containingNodeKind === 226 || + return containingNodeKind === 227 || containingNodeKind === 197 || - containingNodeKind === 227 || containingNodeKind === 228 || + containingNodeKind === 229 || isFunction(containingNodeKind); case 114: return containingNodeKind === 147; @@ -55629,9 +56257,9 @@ var ts; case 112: return containingNodeKind === 144; case 117: - return containingNodeKind === 239 || - containingNodeKind === 243 || - containingNodeKind === 237; + return containingNodeKind === 240 || + containingNodeKind === 244 || + containingNodeKind === 238; case 74: case 82: case 108: @@ -55680,8 +56308,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_46 = element.propertyName || element.name; - existingImportsOrExports[name_46.text] = true; + var name_47 = element.propertyName || element.name; + existingImportsOrExports[name_47.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -55695,8 +56323,8 @@ var ts; var existingMemberNames = ts.createMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 257 && - m.kind !== 258 && + if (m.kind !== 258 && + m.kind !== 259 && m.kind !== 174 && m.kind !== 149 && m.kind !== 151 && @@ -55726,7 +56354,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250) { + if (attr.kind === 251) { seenNames[attr.name.text] = true; } } @@ -55875,58 +56503,58 @@ var ts; switch (node.kind) { case 89: case 81: - if (hasKind(node.parent, 208)) { + if (hasKind(node.parent, 209)) { return getIfElseOccurrences(node.parent); } break; case 95: - if (hasKind(node.parent, 216)) { + if (hasKind(node.parent, 217)) { return getReturnOccurrences(node.parent); } break; case 99: - if (hasKind(node.parent, 220)) { + if (hasKind(node.parent, 221)) { return getThrowOccurrences(node.parent); } break; case 73: - if (hasKind(parent(parent(node)), 221)) { + if (hasKind(parent(parent(node)), 222)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 101: case 86: - if (hasKind(parent(node), 221)) { + if (hasKind(parent(node), 222)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 97: - if (hasKind(node.parent, 218)) { + if (hasKind(node.parent, 219)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 72: case 78: - if (hasKind(parent(parent(parent(node))), 218)) { + if (hasKind(parent(parent(parent(node))), 219)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 71: case 76: - if (hasKind(node.parent, 215) || hasKind(node.parent, 214)) { + if (hasKind(node.parent, 216) || hasKind(node.parent, 215)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 87: - if (hasKind(node.parent, 211) || - hasKind(node.parent, 212) || - hasKind(node.parent, 213)) { + if (hasKind(node.parent, 212) || + hasKind(node.parent, 213) || + hasKind(node.parent, 214)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 105: case 80: - if (hasKind(node.parent, 210) || hasKind(node.parent, 209)) { + if (hasKind(node.parent, 211) || hasKind(node.parent, 210)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -55943,7 +56571,7 @@ var ts; break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 205)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 206)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -55955,10 +56583,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 220) { + if (node.kind === 221) { statementAccumulator.push(node); } - else if (node.kind === 221) { + else if (node.kind === 222) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -55978,17 +56606,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_17 = child.parent; - if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261) { - return parent_17; + var parent_18 = child.parent; + if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262) { + return parent_18; } - if (parent_17.kind === 221) { - var tryStatement = parent_17; + if (parent_18.kind === 222) { + var tryStatement = parent_18; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_17; + child = parent_18; } return undefined; } @@ -55997,7 +56625,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 215 || node.kind === 214) { + if (node.kind === 216 || node.kind === 215) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -56010,23 +56638,23 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218: - if (statement.kind === 214) { + for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { + switch (node_2.kind) { + case 219: + if (statement.kind === 215) { continue; } - case 211: case 212: case 213: + case 214: + case 211: case 210: - case 209: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + if (!statement.label || isLabeledBy(node_2, statement.label.text)) { + return node_2; } break; default: - if (ts.isFunctionLike(node_1)) { + if (ts.isFunctionLike(node_2)) { return undefined; } break; @@ -56037,24 +56665,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 || + if (!(container.kind === 227 || container.kind === 197 || (declaration.kind === 144 && hasKind(container, 150)))) { return undefined; } } else if (modifier === 114) { - if (!(container.kind === 226 || container.kind === 197)) { + if (!(container.kind === 227 || container.kind === 197)) { return undefined; } } else if (modifier === 83 || modifier === 123) { - if (!(container.kind === 231 || container.kind === 261)) { + if (!(container.kind === 232 || container.kind === 262)) { return undefined; } } else if (modifier === 116) { - if (!(container.kind === 226 || declaration.kind === 226)) { + if (!(container.kind === 227 || declaration.kind === 227)) { return undefined; } } @@ -56065,8 +56693,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 231: - case 261: + case 232: + case 262: if (modifierFlag & 128) { nodes = declaration.members.concat(declaration); } @@ -56077,7 +56705,7 @@ var ts; case 150: nodes = container.parameters.concat(container.parent.members); break; - case 226: + case 227: case 197: nodes = container.members; if (modifierFlag & 28) { @@ -56158,7 +56786,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87, 105, 80)) { - if (loopNode.kind === 209) { + if (loopNode.kind === 210) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 105)) { @@ -56179,13 +56807,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 211: case 212: case 213: - case 209: + case 214: case 210: + case 211: return getLoopBreakContinueOccurrences(owner); - case 218: + case 219: return getSwitchCaseDefaultOccurrences(owner); } } @@ -56235,7 +56863,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 204))) { + if (!(func && hasKind(func.body, 205))) { return undefined; } var keywords = []; @@ -56249,7 +56877,7 @@ var ts; } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 208) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 209) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -56260,7 +56888,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 208)) { + if (!hasKind(ifStatement.elseStatement, 209)) { break; } ifStatement = ifStatement.elseStatement; @@ -56295,7 +56923,7 @@ var ts; } DocumentHighlights.getDocumentHighlights = getDocumentHighlights; function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 220; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -56499,16 +57127,16 @@ var ts; } function getAliasSymbolForPropertyNameSymbol(symbol, location) { if (symbol.flags & 8388608) { - var defaultImport = ts.getDeclarationOfKind(symbol, 236); + var defaultImport = ts.getDeclarationOfKind(symbol, 237); if (defaultImport) { return typeChecker.getAliasedSymbol(symbol); } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 || - declaration.kind === 243) ? declaration : undefined; }); + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 || + declaration.kind === 244) ? declaration : undefined; }); if (importOrExportSpecifier && (!importOrExportSpecifier.propertyName || importOrExportSpecifier.propertyName === location)) { - return importOrExportSpecifier.kind === 239 ? + return importOrExportSpecifier.kind === 240 ? typeChecker.getAliasedSymbol(symbol) : typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } @@ -56552,7 +57180,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226); + return ts.getAncestor(privateDeclaration, 227); } } if (symbol.flags & 8388608) { @@ -56576,7 +57204,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 261 && !ts.isExternalModule(container)) { + if (container.kind === 262 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -56813,7 +57441,7 @@ var ts; result.push(getReferenceEntryFromNode(refNode.parent)); } else if (refNode.kind === 70) { - if (refNode.parent.kind === 258) { + if (refNode.parent.kind === 259) { getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } var containingClass = getContainingClassIfInHeritageClause(refNode); @@ -56823,24 +57451,24 @@ var ts; } var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); + var parent_19 = containingTypeReference.parent; + if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { + if (parent_19.body.kind === 205) { + ts.forEachReturnStatement(parent_19.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); + else if (isImplementationExpression(parent_19.body)) { + maybeAdd(getReferenceEntryFromNode(parent_19.body)); } } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_19.expression)); } } } @@ -56876,7 +57504,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 199 - && node.parent.kind === 255 + && node.parent.kind === 256 && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -56923,7 +57551,7 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227) { + else if (declaration.kind === 228) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } @@ -56997,11 +57625,11 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 261: + case 262: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 225: + case 226: case 184: break; default: @@ -57009,7 +57637,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261) { + if (searchSpaceNode.kind === 262) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -57044,7 +57672,7 @@ var ts; var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { case 184: - case 225: + case 226: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -57056,13 +57684,13 @@ var ts; } break; case 197: - case 226: + case 227: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 261: - if (container.kind === 261 && !ts.isExternalModule(container)) { + case 262: + if (container.kind === 262 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -57097,13 +57725,13 @@ var ts; for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { var position = possiblePositions_1[_i]; cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9) { + var node_3 = ts.getTouchingWord(sourceFile, position); + if (!node_3 || node_3.kind !== 9) { return; } - var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + references.push(getReferenceEntryFromNode(node_3)); } } } @@ -57111,7 +57739,7 @@ var ts; function populateSearchSymbolSet(symbol, location) { var result = [symbol]; var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258) { + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); if (propertySymbol) { result.push(propertySymbol); @@ -57161,7 +57789,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227) { + else if (declaration.kind === 228) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -57293,7 +57921,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 223) { + else if (node.kind === 224) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2); } @@ -57303,18 +57931,18 @@ var ts; } else { switch (node.kind) { - case 226: + case 227: case 197: - case 229: case 230: + case 231: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205) { - ts.Debug.assert(node.parent.kind === 224); + if (node.parent && node.parent.parent && node.parent.parent.kind === 206) { + ts.Debug.assert(node.parent.kind === 225); return node.parent.parent; } } @@ -57384,8 +58012,8 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 257: case 258: + case 259: case 149: case 151: case 152: @@ -57447,11 +58075,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 70 && (node.parent === declaration || - (declaration.kind === 239 && declaration.parent && declaration.parent.kind === 238))) { + (declaration.kind === 240 && declaration.parent && declaration.parent.kind === 239))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 258) { + if (node.parent.kind === 259) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -57529,7 +58157,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 150) || - (!selectConstructors && (d.kind === 225 || d.kind === 149 || d.kind === 148))) { + (!selectConstructors && (d.kind === 226 || d.kind === 149 || d.kind === 148))) { declarations.push(d); if (d.body) definition = d; @@ -57605,7 +58233,7 @@ var ts; var GoToImplementation; (function (GoToImplementation) { function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { - if (node.parent.kind === 258) { + if (node.parent.kind === 259) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -57697,7 +58325,7 @@ var ts; JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -57731,16 +58359,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225: + case 226: case 149: case 150: - case 226: - case 205: + case 227: + case 206: break findOwner; - case 261: + case 262: return undefined; - case 230: - if (commentOwner.parent.kind === 230) { + case 231: + if (commentOwner.parent.kind === 231) { return undefined; } break findOwner; @@ -57755,7 +58383,7 @@ var ts; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 ? currentName.text : @@ -57780,7 +58408,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205) { + if (commentOwner.kind === 206) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -57823,10 +58451,10 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_47 in nameToDeclarations) { - var declarations = nameToDeclarations[name_47]; + for (var name_48 in nameToDeclarations) { + var declarations = nameToDeclarations[name_48]; if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_47); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); if (!matches) { continue; } @@ -57837,21 +58465,21 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_47); + matches = patternMatcher.getMatches(containers, name_48); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } }); rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 || decl.kind === 239 || decl.kind === 234) { + if (decl.kind === 237 || decl.kind === 240 || decl.kind === 235) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -58076,14 +58704,14 @@ var ts; addLeafNode(node); } break; - case 236: + case 237: var importClause = node; if (importClause.name) { addLeafNode(importClause); } var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237) { + if (namedBindings.kind === 238) { addLeafNode(namedBindings); } else { @@ -58095,11 +58723,11 @@ var ts; } break; case 174: - case 223: + case 224: var decl = node; - var name_48 = decl.name; - if (ts.isBindingPattern(name_48)) { - addChildrenRecursively(name_48); + var name_49 = decl.name; + if (ts.isBindingPattern(name_49)) { + addChildrenRecursively(name_49); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { addChildrenRecursively(decl.initializer); @@ -58109,11 +58737,11 @@ var ts; } break; case 185: - case 225: + case 226: case 184: addNodeWithRecursiveChild(node, node.body); break; - case 229: + case 230: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -58123,9 +58751,9 @@ var ts; } endNode(); break; - case 226: - case 197: case 227: + case 197: + case 228: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -58133,21 +58761,21 @@ var ts; } endNode(); break; - case 230: + case 231: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243: - case 234: + case 244: + case 235: case 155: case 153: case 154: - case 228: + case 229: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285) { + if (tag.kind === 286) { addLeafNode(tag); } }); @@ -58195,12 +58823,12 @@ var ts; } }); function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 231 || areSameModule(a, b)); function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230) { + if (a.body.kind !== 231) { return true; } return areSameModule(a.body, b.body); @@ -58251,7 +58879,7 @@ var ts; return a.length - b.length; }; function tryGetName(node) { - if (node.kind === 230) { + if (node.kind === 231) { return getModuleName(node); } var decl = node; @@ -58263,14 +58891,14 @@ var ts; case 185: case 197: return getFunctionOrClassName(node); - case 285: + case 286: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230) { + if (node.kind === 231) { return getModuleName(node); } var name = node.name; @@ -58281,15 +58909,15 @@ var ts; } } switch (node.kind) { - case 261: + case 262: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; case 185: - case 225: - case 184: case 226: + case 184: + case 227: case 197: if (ts.getModifierFlags(node) & 512) { return "default"; @@ -58303,7 +58931,7 @@ var ts; return "()"; case 155: return "[]"; - case 285: + case 286: return getJSDocTypedefTagName(node); default: return ""; @@ -58315,7 +58943,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205) { + if (parentNode && parentNode.kind === 206) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70) { @@ -58343,23 +58971,23 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226: - case 197: - case 229: case 227: + case 197: case 230: - case 261: case 228: - case 285: + case 231: + case 262: + case 229: + case 286: return true; case 150: case 149: case 151: case 152: - case 223: + case 224: return hasSomeImportantChild(item); case 185: - case 225: + case 226: case 184: return isTopLevelFunctionDeclaration(item); default: @@ -58370,8 +58998,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231: - case 261: + case 232: + case 262: case 149: case 150: return true; @@ -58382,7 +59010,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 && childKind !== 174; + return childKind !== 224 && childKind !== 174; }); } } @@ -58437,20 +59065,20 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 231) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } return result.join("."); } function getInteriorModule(decl) { - return decl.body.kind === 230 ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 231 ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 142; } function getNodeSpan(node) { - return node.kind === 261 + return node.kind === 262 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); } @@ -58458,14 +59086,14 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223) { + else if (node.parent.kind === 224) { return ts.declarationNameToString(node.parent.name); } else if (node.parent.kind === 192 && node.parent.operatorToken.kind === 57) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 && node.parent.name) { + else if (node.parent.kind === 258 && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512) { @@ -58561,26 +59189,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204: + case 205: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent_20 = n.parent; var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); - if (parent_19.kind === 209 || - parent_19.kind === 212 || - parent_19.kind === 213 || - parent_19.kind === 211 || - parent_19.kind === 208 || - parent_19.kind === 210 || - parent_19.kind === 217 || - parent_19.kind === 256) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent_20.kind === 210 || + parent_20.kind === 213 || + parent_20.kind === 214 || + parent_20.kind === 212 || + parent_20.kind === 209 || + parent_20.kind === 211 || + parent_20.kind === 218 || + parent_20.kind === 257) { + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221) { - var tryStatement = parent_19; + if (parent_20.kind === 222) { + var tryStatement = parent_20; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -58600,17 +59228,17 @@ var ts; }); break; } - case 231: { + case 232: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226: case 227: - case 229: + case 228: + case 230: case 176: - case 232: { + case 233: { var openBrace = ts.findChildOfKind(n, 16, sourceFile); var closeBrace = ts.findChildOfKind(n, 17, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -58878,7 +59506,8 @@ var ts; return str === str.toLowerCase(); } function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -58886,7 +59515,7 @@ var ts; return -1; } function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -58954,7 +59583,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -59527,7 +60156,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 && node.parent.parent.parent.kind === 181) { + else if (node.parent.kind === 203 && node.parent.parent.parent.kind === 181) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -59604,7 +60233,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261; n = n.parent) { + for (var n = node; n.kind !== 262; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -59966,7 +60595,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230); + var declaration = ts.getDeclarationOfKind(symbol, 231); var isNamespace = declaration && declaration.name && declaration.name.kind === 70; displayParts.push(ts.keywordPart(isNamespace ? 128 : 127)); displayParts.push(ts.spacePart()); @@ -60001,7 +60630,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); } - else if (declaration.kind === 228) { + else if (declaration.kind === 229) { addInPrefix(); displayParts.push(ts.keywordPart(136)); displayParts.push(ts.spacePart()); @@ -60014,7 +60643,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260) { + if (declaration.kind === 261) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -60026,7 +60655,7 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233) { + if (symbol.declarations[0].kind === 234) { displayParts.push(ts.keywordPart(83)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128)); @@ -60037,7 +60666,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234) { + if (declaration.kind === 235) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -60105,7 +60734,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); if (documentation.length === 0 && symbol.flags & 4) { - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 192) { @@ -60191,11 +60820,11 @@ var ts; if (declaration.kind === 184) { return true; } - if (declaration.kind !== 223 && declaration.kind !== 225) { + if (declaration.kind !== 224 && declaration.kind !== 226) { return false; } - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { - if (parent_20.kind === 261 || parent_20.kind === 231) { + for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { + if (parent_21.kind === 262 || parent_21.kind === 232) { return false; } } @@ -60386,10 +61015,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 251: + case 249: case 250: case 248: - case 249: - case 247: return node.kind === 70; } } @@ -60722,10 +61351,10 @@ var ts; this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromRange(0, 140, [19])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17, 81), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17, 105), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([19, 21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.FromTokens([21, 25, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60736,10 +61365,10 @@ var ts; this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19, 3, 80, 101, 86, 81]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, 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, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8)); this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); @@ -60759,6 +61388,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109, 75]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); @@ -60767,9 +61397,10 @@ var ts; this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124, 133]), 70), 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.IsNonJsxSameLineTokenContext, 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.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127, 131]), 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 133, 114, 136, 138]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116, 74, 123, 78, 82, 83, 84, 124, 107, 90, 108, 127, 128, 111, 113, 112, 130, 133, 114, 136, 138, 126]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84, 107, 138])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2)); @@ -60797,6 +61428,7 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40, 28), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8)); + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, @@ -60825,7 +61457,7 @@ var ts; this.NoSpaceBetweenTagAndTemplateString, this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -60840,6 +61472,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; this.LowPriorityCommonRules = [ this.NoSpaceBeforeSemicolon, @@ -60848,7 +61481,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2)); @@ -60889,15 +61521,15 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_49 in o) { - if (o[name_49] === rule) { - return name_49; + for (var name_50 in o) { + if (o[name_50] === rule) { + return name_50; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 211; + return context.contextNode.kind === 212; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -60907,24 +61539,25 @@ var ts; case 192: case 193: case 200: - case 243: - case 239: + case 244: + case 240: case 156: case 164: case 165: return true; case 174: - case 228: - case 234: - case 223: + case 229: + case 235: + case 224: case 144: - case 260: + case 261: case 147: case 146: return context.currentTokenSpan.kind === 57 || context.nextTokenSpan.kind === 57; - case 212: - return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; case 213: + case 143: + return context.currentTokenSpan.kind === 91 || context.nextTokenSpan.kind === 91; + case 214: return context.currentTokenSpan.kind === 140 || context.nextTokenSpan.kind === 140; } return false; @@ -60938,6 +61571,9 @@ var ts; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 172 || Rules.IsSingleLineBlockContext(context); + }; Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); }; @@ -60958,17 +61594,17 @@ var ts; return true; } switch (node.kind) { - case 204: - case 232: + case 205: + case 233: case 176: - case 231: + case 232: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225: + case 226: case 149: case 148: case 151: @@ -60977,58 +61613,64 @@ var ts; case 184: case 150: case 185: - case 227: + case 228: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 || context.contextNode.kind === 184; + return context.contextNode.kind === 226 || context.contextNode.kind === 184; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226: - case 197: case 227: - case 229: - case 161: + case 197: + case 228: case 230: - case 241: + case 161: + case 231: case 242: - case 235: - case 238: + case 243: + case 236: + case 239: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226: - case 230: - case 229: - case 204: - case 256: + case 227: case 231: - case 218: + case 230: + case 257: + case 232: + case 219: return true; + case 205: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 185 && + blockParent.kind !== 184) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208: - case 218: - case 211: + case 209: + case 219: case 212: case 213: + case 214: + case 211: + case 222: case 210: - case 221: - case 209: - case 217: - case 256: + case 218: + case 257: return true; default: return false; @@ -61059,19 +61701,19 @@ var ts; return context.TokensAreOnSameLine() && context.contextNode.kind !== 10; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246; + return context.contextNode.kind !== 247; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252; + return context.contextNode.kind === 253; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250; + return context.nextTokenParent.kind === 251; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250; + return context.contextNode.kind === 251; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247; + return context.contextNode.kind === 248; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -61089,14 +61731,14 @@ var ts; return node.kind === 145; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 && + return context.currentTokenParent.kind === 225 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230; + return context.contextNode.kind === 231; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 161; @@ -61108,10 +61750,11 @@ var ts; switch (parent.kind) { case 157: case 182: - case 226: - case 197: + case 229: case 227: - case 225: + case 197: + case 228: + case 226: case 184: case 185: case 149: @@ -61139,6 +61782,9 @@ var ts; Rules.IsYieldOrYieldStarWithOperand = function (context) { return context.contextNode.kind === 195 && context.contextNode.expression !== undefined; }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 201; + }; return Rules; }()); formatting.Rules = Rules; @@ -61423,6 +62069,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -61501,6 +62153,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -61598,17 +62256,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 226: case 227: + case 228: return ts.rangeContainsRange(parent.members, node); - case 230: - var body = parent.body; - return body && body.kind === 231 && ts.rangeContainsRange(body.statements, node); - case 261: - case 204: case 231: + var body = parent.body; + return body && body.kind === 232 && ts.rangeContainsRange(body.statements, node); + case 262: + case 205: + case 232: return ts.rangeContainsRange(parent.statements, node); - case 256: + case 257: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -61764,10 +62422,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226: return 74; - case 227: return 108; - case 225: return 88; - case 229: return 229; + case 227: return 74; + case 228: return 108; + case 226: return 88; + case 230: return 230; case 151: return 124; case 152: return 133; case 149: @@ -61799,17 +62457,30 @@ var ts; switch (kind) { case 16: case 17: - case 20: - case 21: case 18: case 19: case 81: case 105: case 56: return indentation; - default: - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40: + case 28: { + if (container.kind === 249 || + container.kind === 250 || + container.kind === 248) { + return indentation; + } + break; + } + case 20: + case 21: { + if (container.kind !== 170) { + return indentation; + } + break; + } } + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -61850,7 +62521,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -61880,7 +62551,7 @@ var ts; if (tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -61915,10 +62586,10 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -61931,7 +62602,7 @@ var ts; if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -62121,7 +62792,7 @@ var ts; startLine++; } var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -62212,7 +62883,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 150: - case 225: + case 226: case 184: case 149: case 148: @@ -62436,7 +63107,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 || !parentAndChildShareLine); + (parent.kind === 262 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -62460,7 +63131,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 && parent.elseStatement === child) { + if (parent.kind === 209 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -62482,7 +63153,7 @@ var ts; return node.parent.properties; case 175: return node.parent.elements; - case 225: + case 226: case 184: case 185: case 149: @@ -62604,35 +63275,36 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207: - case 226: - case 197: + case 208: case 227: - case 229: + case 197: case 228: + case 230: + case 229: case 175: - case 204: - case 231: + case 205: + case 232: case 176: case 161: + case 170: case 163: - case 232: + case 233: + case 255: case 254: - case 253: case 183: case 177: case 179: case 180: - case 205: - case 223: - case 240: - case 216: + case 206: + case 224: + case 241: + case 217: case 193: case 173: case 172: + case 249: case 248: - case 247: - case 252: + case 253: case 148: case 153: case 154: @@ -62642,10 +63314,10 @@ var ts; case 166: case 181: case 189: - case 242: - case 238: case 243: case 239: + case 244: + case 240: return true; } return false; @@ -62653,27 +63325,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 209: case 210: - case 212: - case 213: case 211: - case 208: - case 225: + case 213: + case 214: + case 212: + case 209: + case 226: case 184: case 149: case 185: case 150: case 151: case 152: - return childKind !== 204; - case 241: - return childKind !== 242; - case 235: - return childKind !== 236 || - (child.namedBindings && child.namedBindings.kind !== 238); - case 246: - return childKind !== 249; + return childKind !== 205; + case 242: + return childKind !== 243; + case 236: + return childKind !== 237 || + (child.namedBindings && child.namedBindings.kind !== 239); + case 247: + return childKind !== 250; } return indentByDefault; } @@ -62723,24 +63395,120 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - return constructor.body.getFirstToken(sourceFile).getEnd(); - } codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122) { - return undefined; - } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] - }]; - } + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDecl = ts.getContainingClass(token); + if (!classDecl) { + return undefined; + } + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDecl); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeFromTypeNode(implementedTypeNode); + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8); }); + var insertion = getMissingIndexSignatureInsertion(implementedType, 1, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, 0, classDecl, hasStringIndexSignature); + insertion += codefix.getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); + } + } + return result; + function getMissingIndexSignatureInsertion(type, kind, enclosingDeclaration, hasIndexSigOfKind) { + if (!hasIndexSigOfKind) { + var IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + var writer = ts.getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + var result_7 = writer.string(); + ts.releaseStringWriter(writer); + return result_7; + } + } + return ""; + } + function pushAction(result, insertion, description) { + var newAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }; + result.push(newAction); + } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDecl = token.parent; + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var instantiatedExtendsType = checker.getBaseTypes(classType)[0]; + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var insertion = codefix.getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + if (insertion.length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8) && !!(flags & 128); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -62762,7 +63530,7 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); + var newPosition = ts.getOpenBraceEnd(constructor, sourceFile); var changes = [{ fileName: sourceFile.fileName, textChanges: [{ newText: superCall.getText(sourceFile), @@ -62778,7 +63546,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 207 && ts.isSuperCall(n.expression)) { + if (n.kind === 208 && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -62791,6 +63559,216 @@ var ts; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122) { + return undefined; + } + var newPosition = ts.getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84)) { + return undefined; + } + var changeStart = extendsToken.getStart(sourceFile); + var changeEnd = extendsToken.getEnd(); + var textChanges = [{ newText: " implements", span: { start: changeStart, length: changeEnd - changeStart } }]; + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeStart = keywordToken.getStart(sourceFile); + changeEnd = keywordToken.getEnd(); + textChanges.push({ newText: ",", span: { start: changeStart, length: changeEnd - changeStart } }); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + if (token.kind === 20) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70: + switch (token.parent.kind) { + case 224: + switch (token.parent.parent.parent.kind) { + case 212: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 214: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 225) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 213: + return undefined; + case 257: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + case 235: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 240: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + case 237: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 238: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 238: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 236 && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var codefix; (function (codefix) { @@ -62876,7 +63854,10 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -62887,6 +63868,11 @@ var ts; var symbolIdActionMap = new ImportCodeActionMap(); var cachedImportDeclarations = ts.createMap(); var cachedNewImportInsertPosition; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, false, true); + } var allPotentialModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; @@ -62894,7 +63880,6 @@ var ts; allPotentialModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { var moduleSymbol = allPotentialModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); @@ -62931,10 +63916,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235) { + if (node.kind === 236) { return node; } - if (node.kind === 234) { + if (node.kind === 235) { return node; } node = node.parent; @@ -62952,7 +63937,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { return getCodeActionsForExistingImport(existingDeclarations); @@ -62967,9 +63952,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 235) { + if (declaration.kind === 236) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237) { + if (namedBindings && namedBindings.kind === 238) { namespaceImportDeclaration = declaration; } else { @@ -62985,7 +63970,7 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { var textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); var moduleSpecifierWithoutQuotes = ts.stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); @@ -62996,7 +63981,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245) { + if (declaration.moduleReference && declaration.moduleReference.kind === 246) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -63029,7 +64014,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235) { + if (declaration.kind === 236) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -63055,7 +64040,9 @@ var ts; var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); var importStatementText = isDefault ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + : isNamespaceImport + ? "import * as " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; var newText = cachedNewImportInsertPosition === sourceFile.getStart() ? importStatementText + ";" + context.newLineCharacter + context.newLineCharacter : "" + context.newLineCharacter + importStatementText + ";"; @@ -63072,7 +64059,7 @@ var ts; tryGetModuleNameAsNodeModule() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261) { + if (moduleSymbol.valueDeclaration.kind !== 262) { return moduleSymbol.name; } } @@ -63085,6 +64072,7 @@ var ts; if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -63104,7 +64092,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -63223,144 +64211,120 @@ var ts; (function (ts) { var codefix; (function (codefix) { - codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - if (token.kind === 20) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70: - switch (token.parent.kind) { - case 223: - switch (token.parent.parent.parent.kind) { - case 211: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212: - return undefined; - case 256: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - case 234: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - case 236: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 && importDecl.parent) { - importDecl = importDecl.parent; + function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var insertion = ""; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); + } + return insertion; + } + codefix.getMissingMembersInsertion = getMissingMembersInsertion; + function getInsertionForMemberSymbol(symbol, enclosingDeclaration, checker, newlineChar) { + var type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return ""; + } + var declaration = declarations[0]; + var name = declaration.name ? declaration.name.getText() : undefined; + var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); + switch (declaration.kind) { + case 151: + case 152: + case 146: + case 147: + var typeString = checker.typeToString(type, enclosingDeclaration, 0); + return "" + visibility + name + ": " + typeString + ";" + newlineChar; + case 148: + case 149: + var signatures = checker.getSignaturesOfType(type, 0); + if (!(signatures && signatures.length > 0)) { + return ""; } - return importDecl; - } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] - }] - }]; - } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048, 0); + return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar); + } + var result = ""; + for (var i = 0; i < signatures.length; i++) { + var sigString_2 = checker.signatureToString(signatures[i], enclosingDeclaration, 2048, 0); + result += "" + visibility + name + sigString_2 + ";" + newlineChar; + } + var bodySig = undefined; + if (declarations.length > signatures.length) { + bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } + var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048, 0); + result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar); + return result; + default: + return ""; + } + } + function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { + var newSignatureDeclaration = ts.createNode(153); + newSignatureDeclaration.parent = enclosingDeclaration; + newSignatureDeclaration.name = signatures[0].getDeclaration().name; + var maxNonRestArgs = -1; + var maxArgsIndex = 0; + var minArgumentCount = signatures[0].minArgumentCount; + var hasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + hasRestParameter = hasRestParameter || sig.hasRestParameter; + var nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); + if (nonRestLength > maxNonRestArgs) { + maxNonRestArgs = nonRestLength; + maxArgsIndex = i; } } - }); + var maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(function (symbol) { return symbol.getName(); }); + var optionalToken = ts.createToken(54); + newSignatureDeclaration.parameters = ts.createNodeArray(); + for (var i = 0; i < maxNonRestArgs; i++) { + var newParameter = createParameterDeclarationWithoutType(i, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + if (hasRestParameter) { + var restParameter = createParameterDeclarationWithoutType(maxNonRestArgs, minArgumentCount, newSignatureDeclaration); + restParameter.dotDotDotToken = ts.createToken(23); + newSignatureDeclaration.parameters.push(restParameter); + } + return checker.getSignatureFromDeclaration(newSignatureDeclaration); + function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { + var newParameter = ts.createNode(144); + newParameter.symbol = new SymbolConstructor(1, maxArgsParameterSymbolNames[index] || "rest"); + newParameter.symbol.valueDeclaration = newParameter; + newParameter.symbol.declarations = [newParameter]; + newParameter.parent = enclosingSignatureDeclaration; + if (index >= minArgCount) { + newParameter.questionToken = optionalToken; + } + return newParameter; + } + } + function getMethodBodyStub(newLineChar) { + return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar; + } + function getVisibilityPrefix(flags) { + if (flags & 4) { + return "public "; + } + else if (flags & 16) { + return "protected "; + } + return ""; + } + var SymbolConstructor = ts.objectAllocator.getSymbolConstructor(); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); var ts; @@ -63425,7 +64389,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292, nodes.pos, nodes.end, this); + var list = createNode(293, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -63448,7 +64412,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 && this.kind <= 291; + var useJSDocScanner_1 = this.kind >= 279 && this.kind <= 292; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -63721,9 +64685,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_7 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_7 !== undefined) { - return result_7; + var result_8 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_8 !== undefined) { + return result_8; } if (declaration.name.kind === 142) { var expr = declaration.name.expression; @@ -63747,7 +64711,7 @@ var ts; } function visit(node) { switch (node.kind) { - case 225: + case 226: case 184: case 149: case 148: @@ -63767,18 +64731,18 @@ var ts; } ts.forEachChild(node, visit); break; - case 226: - case 197: case 227: + case 197: case 228: case 229: case 230: - case 234: - case 243: - case 239: - case 234: - case 236: + case 231: + case 235: + case 244: + case 240: + case 235: case 237: + case 238: case 151: case 152: case 161: @@ -63789,7 +64753,7 @@ var ts; if (!ts.hasModifier(node, 92)) { break; } - case 223: + case 224: case 174: { var decl = node; if (ts.isBindingPattern(decl.name)) { @@ -63799,24 +64763,24 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260: + case 261: case 147: case 146: addDeclaration(node); break; - case 241: + case 242: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235: + case 236: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237) { + if (importClause.namedBindings.kind === 238) { addDeclaration(importClause.namedBindings); } else { @@ -64411,7 +65375,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 230 && + if (nodeForStartPos.parent.parent.kind === 231 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -64600,7 +65564,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -64709,7 +65673,7 @@ var ts; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 245 || + node.parent.kind === 246 || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; @@ -65075,15 +66039,15 @@ var ts; var compilerOptions = this.getCompilationSettings(); var lastDeletedFileName = this.project.projectService.lastDeletedFile && this.project.projectService.lastDeletedFile.fileName; for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { - var name_50 = names_2[_i]; - var resolution = newResolutions[name_50]; + var name_51 = names_2[_i]; + var resolution = newResolutions[name_51]; if (!resolution) { - var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_50]; + var existingResolution = currentResolutionsInFile && currentResolutionsInFile[name_51]; if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - newResolutions[name_50] = resolution = loader(name_50, containingFile, compilerOptions, this); + newResolutions[name_51] = resolution = loader(name_51, containingFile, compilerOptions, this); } if (logChanges && this.filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) { this.filesWithChangedSetOfUnresolvedImports.push(path); @@ -65123,6 +66087,9 @@ var ts; return resolution.failedLookupLocations.length === 0; } }; + LSHost.prototype.getNewLine = function () { + return this.host.newLine; + }; LSHost.prototype.getProjectVersion = function () { return this.project.getProjectVersion(); }; @@ -65328,7 +66295,7 @@ var ts; BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var statement = _a[_i]; - if (statement.kind !== 230 || statement.name.kind !== 9) { + if (statement.kind !== 231 || statement.name.kind !== 9) { return false; } } @@ -65439,7 +66406,7 @@ var ts; var ModuleBuilderFileInfo = (function (_super) { __extends(ModuleBuilderFileInfo, _super); function ModuleBuilderFileInfo() { - var _this = _super.apply(this, arguments) || this; + var _this = _super !== null && _super.apply(this, arguments) || this; _this.references = []; _this.referencedBy = []; return _this; @@ -65802,7 +66769,7 @@ var ts; info.detachFromProject(this); } } - else { + if (!this.program || !this.languageServiceEnabled) { for (var _b = 0, _c = this.rootFiles; _b < _c.length; _b++) { var root = _c[_b]; root.detachFromProject(this); @@ -65948,9 +66915,9 @@ var ts; } var unresolvedImports; if (file.resolvedModules) { - for (var name_51 in file.resolvedModules) { - if (!file.resolvedModules[name_51] && !ts.isExternalModuleNameRelative(name_51)) { - var trimmed = name_51.trim(); + for (var name_52 in file.resolvedModules) { + if (!file.resolvedModules[name_52] && !ts.isExternalModuleNameRelative(name_52)) { + var trimmed = name_52.trim(); var i = trimmed.indexOf("/"); if (i !== -1 && trimmed.charCodeAt(0) === 64) { i = trimmed.indexOf("/", i + 1); @@ -68539,9 +69506,9 @@ var ts; if (simplifiedResult) { return completions.entries.reduce(function (result, entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { - var name_52 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; + var name_53 = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name_52, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + result.push({ name: name_53, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); } return result; }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); @@ -69022,7 +69989,7 @@ var ts; if (len > 1) { var insertedNodes = new Array(len - 1); var startNode = leafNode; - for (var i = 1, len_1 = lines.length; i < len_1; i++) { + for (var i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } var pathIndex = this.startPath.length - 2; @@ -69219,8 +70186,8 @@ var ts; var snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { var snapIndex = snap.index; - for (var i = 0, len = this.changes.length; i < len; i++) { - var change = this.changes[i]; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } snap = new LineIndexSnapshot(this.currentVersion + 1, this); @@ -69241,8 +70208,8 @@ var ts; var textChangeRanges = []; for (var i = oldVersion + 1; i <= newVersion; i++) { var snap = this.versions[this.versionToIndex(i)]; - for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { - var textChange = snap.changesSincePreviousVersion[j]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); } } @@ -69342,7 +70309,7 @@ var ts; LineIndex.prototype.load = function (lines) { if (lines.length > 0) { var leaves = []; - for (var i = 0, len = lines.length; i < len; i++) { + for (var i = 0; i < lines.length; i++) { leaves[i] = new LineLeaf(lines[i]); } this.root = LineIndex.buildTreeFromBottom(leaves); @@ -69502,8 +70469,8 @@ var ts; LineNode.prototype.updateCounts = function () { this.totalChars = 0; this.totalLines = 0; - for (var i = 0, len = this.children.length; i < len; i++) { - var child = this.children[i]; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; this.totalChars += child.charCount(); this.totalLines += child.lineCount(); } @@ -70464,7 +71431,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index c5cee20bdde..65a33f28c33 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -239,102 +239,102 @@ declare namespace ts { ExpressionWithTypeArguments = 199, AsExpression = 200, NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, + MetaProperty = 202, + TemplateSpan = 203, + SemicolonClassElement = 204, + Block = 205, + VariableStatement = 206, + EmptyStatement = 207, + ExpressionStatement = 208, + IfStatement = 209, + DoStatement = 210, + WhileStatement = 211, + ForStatement = 212, + ForInStatement = 213, + ForOfStatement = 214, + ContinueStatement = 215, + BreakStatement = 216, + ReturnStatement = 217, + WithStatement = 218, + SwitchStatement = 219, + LabeledStatement = 220, + ThrowStatement = 221, + TryStatement = 222, + DebuggerStatement = 223, + VariableDeclaration = 224, + VariableDeclarationList = 225, + FunctionDeclaration = 226, + ClassDeclaration = 227, + InterfaceDeclaration = 228, + TypeAliasDeclaration = 229, + EnumDeclaration = 230, + ModuleDeclaration = 231, + ModuleBlock = 232, + CaseBlock = 233, + NamespaceExportDeclaration = 234, + ImportEqualsDeclaration = 235, + ImportDeclaration = 236, + ImportClause = 237, + NamespaceImport = 238, + NamedImports = 239, + ImportSpecifier = 240, + ExportAssignment = 241, + ExportDeclaration = 242, + NamedExports = 243, + ExportSpecifier = 244, + MissingDeclaration = 245, + ExternalModuleReference = 246, + JsxElement = 247, + JsxSelfClosingElement = 248, + JsxOpeningElement = 249, + JsxClosingElement = 250, + JsxAttribute = 251, + JsxSpreadAttribute = 252, + JsxExpression = 253, + CaseClause = 254, + DefaultClause = 255, + HeritageClause = 256, + CatchClause = 257, + PropertyAssignment = 258, + ShorthandPropertyAssignment = 259, + SpreadAssignment = 260, + EnumMember = 261, + SourceFile = 262, + JSDocTypeExpression = 263, + JSDocAllType = 264, + JSDocUnknownType = 265, + JSDocArrayType = 266, + JSDocUnionType = 267, + JSDocTupleType = 268, + JSDocNullableType = 269, + JSDocNonNullableType = 270, + JSDocRecordType = 271, + JSDocRecordMember = 272, + JSDocTypeReference = 273, + JSDocOptionalType = 274, + JSDocFunctionType = 275, + JSDocVariadicType = 276, + JSDocConstructorType = 277, + JSDocThisType = 278, + JSDocComment = 279, + JSDocTag = 280, + JSDocAugmentsTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + JSDocLiteralType = 289, + JSDocNullKeyword = 290, + JSDocUndefinedKeyword = 291, + JSDocNeverKeyword = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, Count = 298, FirstAssignment = 57, LastAssignment = 69, @@ -361,10 +361,10 @@ declare namespace ts { FirstBinaryOperator = 26, LastBinaryOperator = 69, FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + FirstJSDocNode = 263, + LastJSDocNode = 289, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 292, } enum NodeFlags { None = 0, @@ -969,6 +969,11 @@ declare namespace ts { kind: SyntaxKind.NonNullExpression; expression: Expression; } + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; @@ -1003,6 +1008,7 @@ declare namespace ts { } interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + dotDotDotToken?: Token; expression?: Expression; } interface JsxText extends Node { @@ -1022,7 +1028,7 @@ declare namespace ts { kind: SyntaxKind.MissingDeclaration; name?: Identifier; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; @@ -1569,6 +1575,7 @@ declare namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; @@ -1581,6 +1588,8 @@ declare namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -1603,11 +1612,13 @@ declare namespace ts { isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1645,6 +1656,7 @@ declare namespace ts { InFirstTypeArgument = 256, InTypeAlias = 512, UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, } enum SymbolFormatFlags { None = 0, @@ -1815,6 +1827,7 @@ declare namespace ts { interface ObjectType extends Type { objectFlags: ObjectFlags; } + /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; @@ -1828,6 +1841,16 @@ declare namespace ts { declaredStringIndexInfo: IndexInfo; declaredNumberIndexInfo: IndexInfo; } + /** + * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * a "this" type, references to the class or interface are made using type references. The + * typeArguments property specifies the types to substitute for the type parameters of the + * class or interface and optionally includes an extra element that specifies the type to + * substitute for "this" in the resulting instantiation. When no extra argument is present, + * the type reference itself is substituted for "this". The typeArguments property is undefined + * if the class or interface has no type parameters and the reference isn't specifying an + * explicit "this" argument. + */ interface TypeReference extends ObjectType { target: GenericType; typeArguments: Type[]; @@ -2106,7 +2129,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -2325,9 +2347,28 @@ declare namespace ts { * this list is only the set of defaults that are implicitly included. */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; } declare namespace ts { function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; @@ -2674,6 +2715,7 @@ declare namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -2682,6 +2724,7 @@ declare namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -2689,6 +2732,7 @@ declare namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; @@ -2697,6 +2741,7 @@ declare namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } diff --git a/lib/typescript.js b/lib/typescript.js index 7f41e5d07f5..bae2811e4de 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -244,115 +249,115 @@ var ts; SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 202] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 202] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 203] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 203] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 204] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 204] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 205] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 206] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 207] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 208] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 209] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 210] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 211] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 212] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 213] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 214] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 215] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 216] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 217] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 218] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 219] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 220] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 221] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 222] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 223] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 224] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 225] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 226] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 227] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 228] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 229] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 230] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 231] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 232] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 233] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 234] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 235] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 236] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 237] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 238] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 239] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 240] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 241] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 242] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 243] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 244] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 205] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 206] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 207] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 208] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 209] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 210] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 211] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 212] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 213] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 214] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 215] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 216] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 217] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 218] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 219] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 220] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 221] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 222] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 223] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 225] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 226] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 227] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 228] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 229] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 230] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 231] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 232] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 233] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 234] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 235] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 236] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 237] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 238] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 239] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 240] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 241] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 242] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 243] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 244] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 245] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 246] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 247] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 248] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 249] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 250] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 251] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 252] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 247] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 248] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 249] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 250] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 251] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 252] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 253] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 253] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 254] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 255] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 256] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 254] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 255] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 256] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 257] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 257] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 258] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 259] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 258] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 259] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 260] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 260] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 261] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 261] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 262] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 262] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 263] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 263] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 264] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 264] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 265] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 266] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 267] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 268] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 269] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 270] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 271] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 272] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 273] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 274] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 275] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 276] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 265] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 266] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 267] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 268] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 269] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 270] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 271] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 272] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 273] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 274] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 275] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 276] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 277] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 278] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 279] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 280] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 281] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 289] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 290] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 291] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 292] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; // Enum value count SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers @@ -381,10 +386,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 263] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 289] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -511,6 +516,7 @@ var ts; TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; (function (SymbolFormatFlags) { @@ -647,6 +653,7 @@ var ts; NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; @@ -1290,7 +1297,7 @@ var ts; */ function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1314,7 +1321,7 @@ var ts; */ function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -1325,7 +1332,7 @@ var ts; ts.every = every; /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -1339,7 +1346,7 @@ var ts; * This is like `forEach`, but never returns undefined. */ function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1362,7 +1369,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -1372,7 +1379,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -2220,6 +2227,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -3915,7 +3923,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -4072,6 +4080,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4301,6 +4310,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -4310,6 +4321,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -4361,6 +4373,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4529,6 +4543,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -4542,10 +4557,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -4594,6 +4609,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -4650,22 +4667,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); /// @@ -5132,7 +5152,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -5344,7 +5364,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -6524,7 +6544,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261 /* SourceFile */) { + while (node && node.kind !== 262 /* SourceFile */) { node = node.parent; } return node; @@ -6532,11 +6552,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 205 /* Block */: + case 233 /* CaseBlock */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return true; } return false; @@ -6627,18 +6647,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; + return node.kind >= 263 /* FirstJSDocNode */ && node.kind <= 289 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; + return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6742,11 +6762,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */; + return node.kind === 224 /* VariableDeclaration */ && node.parent.kind === 257 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 /* ModuleDeclaration */ && + return node && node.kind === 231 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -6757,11 +6777,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 230 /* ModuleDeclaration */ && (!node.body); + return node.kind === 231 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 /* SourceFile */ || - node.kind === 230 /* ModuleDeclaration */ || + return node.kind === 262 /* SourceFile */ || + node.kind === 231 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6777,9 +6797,9 @@ var ts; return false; } switch (node.parent.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.isExternalModule(node.parent); - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6791,22 +6811,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 256 /* CatchClause */: - case 230 /* ModuleDeclaration */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 262 /* SourceFile */: + case 233 /* CaseBlock */: + case 257 /* CatchClause */: + case 231 /* ModuleDeclaration */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: case 150 /* Constructor */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return true; - case 204 /* Block */: + case 205 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6891,7 +6911,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204 /* Block */) { + if (node.body && node.body.kind === 205 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6905,7 +6925,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -6914,20 +6934,20 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 225 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: errorNode = node.name; break; case 185 /* ArrowFunction */: @@ -6953,7 +6973,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 /* EnumDeclaration */ && isConst(node); + return node.kind === 230 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6970,7 +6990,7 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ + return node.kind === 208 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -7053,9 +7073,9 @@ var ts; case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 144 /* Parameter */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return node === parent_1.type; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 150 /* Constructor */: @@ -7081,29 +7101,43 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 190 /* PrefixUnaryExpression */; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitor(node); - case 232 /* CaseBlock */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 254 /* DefaultClause */: - case 219 /* LabeledStatement */: - case 221 /* TryStatement */: - case 256 /* CatchClause */: + case 233 /* CaseBlock */: + case 205 /* Block */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 218 /* WithStatement */: + case 219 /* SwitchStatement */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: + case 220 /* LabeledStatement */: + case 222 /* TryStatement */: + case 257 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7119,11 +7153,11 @@ var ts; if (operand) { traverse(operand); } - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 226 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be @@ -7170,13 +7204,13 @@ var ts; if (node) { switch (node.kind) { case 174 /* BindingElement */: - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 144 /* Parameter */: - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 258 /* ShorthandPropertyAssignment */: - case 223 /* VariableDeclaration */: + case 259 /* ShorthandPropertyAssignment */: + case 224 /* VariableDeclaration */: return true; } } @@ -7188,7 +7222,7 @@ var ts; } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7199,7 +7233,7 @@ var ts; switch (kind) { case 150 /* Constructor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -7222,7 +7256,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return true; } @@ -7231,20 +7265,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: return true; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatmentOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 220 /* LabeledStatement */) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 205 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -7323,9 +7369,9 @@ var ts; continue; } // Fall through - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 149 /* MethodDeclaration */: @@ -7336,13 +7382,26 @@ var ts; case 153 /* CallSignature */: case 154 /* ConstructSignature */: case 155 /* IndexSignature */: - case 229 /* EnumDeclaration */: - case 261 /* SourceFile */: + case 230 /* EnumDeclaration */: + case 262 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (container) { + switch (container.kind) { + case 150 /* Constructor */: + case 226 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; /** * Given an super call/property node, returns the closest node where * - a super call/property access is legal in the node and not legal in the parent node the node. @@ -7361,7 +7420,7 @@ var ts; case 142 /* ComputedPropertyName */: node = node.parent; break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: if (!stopOnFunctions) { @@ -7418,7 +7477,7 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return node.typeName; case 199 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) @@ -7453,25 +7512,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // classes are valid targets return true; case 147 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 226 /* ClassDeclaration */; + return node.parent.kind === 227 /* ClassDeclaration */; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 149 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 226 /* ClassDeclaration */; + && node.parent.kind === 227 /* ClassDeclaration */; case 144 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return node.parent.body !== undefined && (node.parent.kind === 150 /* Constructor */ || node.parent.kind === 149 /* MethodDeclaration */ || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 226 /* ClassDeclaration */; + && node.parent.parent.kind === 227 /* ClassDeclaration */; } return false; } @@ -7487,7 +7546,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); case 149 /* MethodDeclaration */: case 152 /* SetAccessor */: @@ -7497,9 +7556,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 /* JsxOpeningElement */ || - parent.kind === 247 /* JsxSelfClosingElement */ || - parent.kind === 249 /* JsxClosingElement */) { + if (parent.kind === 249 /* JsxOpeningElement */ || + parent.kind === 248 /* JsxSelfClosingElement */ || + parent.kind === 250 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7538,10 +7597,11 @@ var ts; case 194 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 198 /* OmittedExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: case 195 /* YieldExpression */: case 189 /* AwaitExpression */: + case 202 /* MetaProperty */: return true; case 141 /* QualifiedName */: while (node.parent.kind === 141 /* QualifiedName */) { @@ -7558,46 +7618,46 @@ var ts; case 98 /* ThisKeyword */: var parent_3 = node.parent; switch (parent_3.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: + case 261 /* EnumMember */: + case 258 /* PropertyAssignment */: case 174 /* BindingElement */: return parent_3.initializer === node; - case 207 /* ExpressionStatement */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 216 /* ReturnStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 220 /* ThrowStatement */: - case 218 /* SwitchStatement */: + case 208 /* ExpressionStatement */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 217 /* ReturnStatement */: + case 218 /* WithStatement */: + case 219 /* SwitchStatement */: + case 254 /* CaseClause */: + case 221 /* ThrowStatement */: + case 219 /* SwitchStatement */: return parent_3.expression === node; - case 211 /* ForStatement */: + case 212 /* ForStatement */: var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 225 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225 /* VariableDeclarationList */) || forInStatement.expression === node; case 182 /* TypeAssertionExpression */: case 200 /* AsExpression */: return node === parent_3.expression; - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return node === parent_3.expression; case 142 /* ComputedPropertyName */: return node === parent_3.expression; case 145 /* Decorator */: - case 252 /* JsxExpression */: - case 251 /* JsxSpreadAttribute */: - case 259 /* SpreadAssignment */: + case 253 /* JsxExpression */: + case 252 /* JsxSpreadAttribute */: + case 260 /* SpreadAssignment */: return true; case 199 /* ExpressionWithTypeArguments */: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7617,7 +7677,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */; + return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7626,7 +7686,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */; + return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 246 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7660,7 +7720,7 @@ var ts; * This function does not test if the node is in a JavaScript file or not. */ function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) { + if (s.valueDeclaration && s.valueDeclaration.kind === 224 /* VariableDeclaration */) { var declaration = s.valueDeclaration; return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; } @@ -7713,35 +7773,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 245 /* ExternalModuleReference */) { + if (reference.kind === 246 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 241 /* ExportDeclaration */) { + if (node.kind === 242 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 231 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 /* ImportDeclaration */ + return node.kind === 236 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7752,8 +7812,8 @@ var ts; case 144 /* Parameter */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - case 258 /* ShorthandPropertyAssignment */: - case 257 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return node.questionToken !== undefined; @@ -7763,9 +7823,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 /* JSDocFunctionType */ && + return node.kind === 275 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 276 /* JSDocConstructorType */; + node.parameters[0].type.kind === 277 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -7778,7 +7838,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === 282 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } @@ -7810,9 +7870,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205 /* VariableStatement */; + parent.parent.parent.kind === 206 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205 /* VariableStatement */; + parent.parent.kind === 206 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7823,13 +7883,13 @@ var ts; var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 207 /* ExpressionStatement */; + parent.parent.kind === 208 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && - parent && parent.kind === 230 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 231 /* ModuleDeclaration */ && + parent && parent.kind === 231 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 258 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } @@ -7848,18 +7908,18 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 282 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + return ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7869,7 +7929,7 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (!tag && node.kind === 144 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -7880,15 +7940,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 281 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7901,8 +7961,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { + if (node.type && node.type.kind === 276 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276 /* JSDocVariadicType */; })) { return true; } } @@ -7932,20 +7992,20 @@ var ts; case 191 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; case 183 /* ParenthesizedExpression */: case 175 /* ArrayLiteralExpression */: case 196 /* SpreadElement */: node = parent; break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } // Fall through - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: node = parent.parent; break; default: @@ -7962,6 +8022,18 @@ var ts; return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + function isDeleteTarget(node) { + if (node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + return false; + } + node = node.parent; + while (node && node.kind === 183 /* ParenthesizedExpression */) { + node = node.parent; + } + return node && node.kind === 186 /* DeleteExpression */; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -7973,7 +8045,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 262 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7987,7 +8059,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) { + if (parent.kind === 240 /* ImportSpecifier */ || parent.kind === 244 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -8014,8 +8086,8 @@ var ts; case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: + case 261 /* EnumMember */: + case 258 /* PropertyAssignment */: case 177 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; @@ -8029,10 +8101,10 @@ var ts; } return false; case 174 /* BindingElement */: - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8048,13 +8120,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 233 /* NamespaceExportDeclaration */ || - node.kind === 236 /* ImportClause */ && !!node.name || - node.kind === 237 /* NamespaceImport */ || - node.kind === 239 /* ImportSpecifier */ || - node.kind === 243 /* ExportSpecifier */ || - node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 235 /* ImportEqualsDeclaration */ || + node.kind === 234 /* NamespaceExportDeclaration */ || + node.kind === 237 /* ImportClause */ && !!node.name || + node.kind === 238 /* NamespaceImport */ || + node.kind === 240 /* ImportSpecifier */ || + node.kind === 244 /* ExportSpecifier */ || + node.kind === 241 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8249,13 +8321,13 @@ var ts; var kind = node.kind; return kind === 150 /* Constructor */ || kind === 184 /* FunctionExpression */ - || kind === 225 /* FunctionDeclaration */ + || kind === 226 /* FunctionDeclaration */ || kind === 185 /* ArrowFunction */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ - || kind === 230 /* ModuleDeclaration */ - || kind === 261 /* SourceFile */; + || kind === 231 /* ModuleDeclaration */ + || kind === 262 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8387,14 +8459,13 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 197 /* ClassExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: case 194 /* TemplateExpression */: case 183 /* ParenthesizedExpression */: case 198 /* OmittedExpression */: - case 297 /* RawExpression */: return 19; case 181 /* TaggedTemplateExpression */: case 177 /* PropertyAccessExpression */: @@ -8578,13 +8649,12 @@ var ts; * Note that this doesn't actually wrap the input in double quotes. */ function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -9638,8 +9708,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9660,7 +9730,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 227 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9725,6 +9795,10 @@ var ts; return node.kind === 70 /* Identifier */; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188 /* VoidExpression */; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. return isIdentifier(node) && node.autoGenerateKind > 0 /* None */; @@ -9797,18 +9871,18 @@ var ts; || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ || kind === 155 /* IndexSignature */ - || kind === 203 /* SemicolonClassElement */; + || kind === 204 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 /* PropertyAssignment */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 259 /* SpreadAssignment */ + return kind === 258 /* PropertyAssignment */ + || kind === 259 /* ShorthandPropertyAssignment */ + || kind === 260 /* SpreadAssignment */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ - || kind === 244 /* MissingDeclaration */; + || kind === 245 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -9871,7 +9945,7 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 174 /* BindingElement */: return true; @@ -9959,8 +10033,8 @@ var ts; || kind === 178 /* ElementAccessExpression */ || kind === 180 /* NewExpression */ || kind === 179 /* CallExpression */ - || kind === 246 /* JsxElement */ - || kind === 247 /* JsxSelfClosingElement */ + || kind === 247 /* JsxElement */ + || kind === 248 /* JsxSelfClosingElement */ || kind === 181 /* TaggedTemplateExpression */ || kind === 175 /* ArrayLiteralExpression */ || kind === 183 /* ParenthesizedExpression */ @@ -9979,7 +10053,7 @@ var ts; || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ || kind === 201 /* NonNullExpression */ - || kind === 297 /* RawExpression */; + || kind === 202 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10007,7 +10081,6 @@ var ts; || kind === 196 /* SpreadElement */ || kind === 200 /* AsExpression */ || kind === 198 /* OmittedExpression */ - || kind === 297 /* RawExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10021,11 +10094,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294 /* PartiallyEmittedExpression */; + return node.kind === 295 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293 /* NotEmittedStatement */; + return node.kind === 294 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10039,12 +10112,12 @@ var ts; ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 202 /* TemplateSpan */; + return node.kind === 203 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 204 /* Block */; + return node.kind === 205 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10062,121 +10135,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223 /* VariableDeclaration */; + return node.kind === 224 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224 /* VariableDeclarationList */; + return node.kind === 225 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232 /* CaseBlock */; + return node.kind === 233 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 /* ModuleBlock */ - || kind === 230 /* ModuleDeclaration */; + return kind === 232 /* ModuleBlock */ + || kind === 231 /* ModuleDeclaration */; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */; + return node.kind === 235 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236 /* ImportClause */; + return node.kind === 237 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 /* NamedImports */ - || kind === 237 /* NamespaceImport */; + return kind === 239 /* NamedImports */ + || kind === 238 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239 /* ImportSpecifier */; + return node.kind === 240 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242 /* NamedExports */; + return node.kind === 243 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243 /* ExportSpecifier */; + return node.kind === 244 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */; + return node.kind === 231 /* ModuleDeclaration */ || node.kind === 230 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { return kind === 185 /* ArrowFunction */ || kind === 174 /* BindingElement */ - || kind === 226 /* ClassDeclaration */ + || kind === 227 /* ClassDeclaration */ || kind === 197 /* ClassExpression */ || kind === 150 /* Constructor */ - || kind === 229 /* EnumDeclaration */ - || kind === 260 /* EnumMember */ - || kind === 243 /* ExportSpecifier */ - || kind === 225 /* FunctionDeclaration */ + || kind === 230 /* EnumDeclaration */ + || kind === 261 /* EnumMember */ + || kind === 244 /* ExportSpecifier */ + || kind === 226 /* FunctionDeclaration */ || kind === 184 /* FunctionExpression */ || kind === 151 /* GetAccessor */ - || kind === 236 /* ImportClause */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 239 /* ImportSpecifier */ - || kind === 227 /* InterfaceDeclaration */ + || kind === 237 /* ImportClause */ + || kind === 235 /* ImportEqualsDeclaration */ + || kind === 240 /* ImportSpecifier */ + || kind === 228 /* InterfaceDeclaration */ || kind === 149 /* MethodDeclaration */ || kind === 148 /* MethodSignature */ - || kind === 230 /* ModuleDeclaration */ - || kind === 233 /* NamespaceExportDeclaration */ - || kind === 237 /* NamespaceImport */ + || kind === 231 /* ModuleDeclaration */ + || kind === 234 /* NamespaceExportDeclaration */ + || kind === 238 /* NamespaceImport */ || kind === 144 /* Parameter */ - || kind === 257 /* PropertyAssignment */ + || kind === 258 /* PropertyAssignment */ || kind === 147 /* PropertyDeclaration */ || kind === 146 /* PropertySignature */ || kind === 152 /* SetAccessor */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 228 /* TypeAliasDeclaration */ + || kind === 259 /* ShorthandPropertyAssignment */ + || kind === 229 /* TypeAliasDeclaration */ || kind === 143 /* TypeParameter */ - || kind === 223 /* VariableDeclaration */ - || kind === 285 /* JSDocTypedefTag */; + || kind === 224 /* VariableDeclaration */ + || kind === 286 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 225 /* FunctionDeclaration */ - || kind === 244 /* MissingDeclaration */ - || kind === 226 /* ClassDeclaration */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 229 /* EnumDeclaration */ - || kind === 230 /* ModuleDeclaration */ - || kind === 235 /* ImportDeclaration */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 241 /* ExportDeclaration */ - || kind === 240 /* ExportAssignment */ - || kind === 233 /* NamespaceExportDeclaration */; + return kind === 226 /* FunctionDeclaration */ + || kind === 245 /* MissingDeclaration */ + || kind === 227 /* ClassDeclaration */ + || kind === 228 /* InterfaceDeclaration */ + || kind === 229 /* TypeAliasDeclaration */ + || kind === 230 /* EnumDeclaration */ + || kind === 231 /* ModuleDeclaration */ + || kind === 236 /* ImportDeclaration */ + || kind === 235 /* ImportEqualsDeclaration */ + || kind === 242 /* ExportDeclaration */ + || kind === 241 /* ExportAssignment */ + || kind === 234 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 /* BreakStatement */ - || kind === 214 /* ContinueStatement */ - || kind === 222 /* DebuggerStatement */ - || kind === 209 /* DoStatement */ - || kind === 207 /* ExpressionStatement */ - || kind === 206 /* EmptyStatement */ - || kind === 212 /* ForInStatement */ - || kind === 213 /* ForOfStatement */ - || kind === 211 /* ForStatement */ - || kind === 208 /* IfStatement */ - || kind === 219 /* LabeledStatement */ - || kind === 216 /* ReturnStatement */ - || kind === 218 /* SwitchStatement */ - || kind === 220 /* ThrowStatement */ - || kind === 221 /* TryStatement */ - || kind === 205 /* VariableStatement */ - || kind === 210 /* WhileStatement */ - || kind === 217 /* WithStatement */ - || kind === 293 /* NotEmittedStatement */ - || kind === 296 /* EndOfDeclarationMarker */ - || kind === 295 /* MergeDeclarationMarker */; + return kind === 216 /* BreakStatement */ + || kind === 215 /* ContinueStatement */ + || kind === 223 /* DebuggerStatement */ + || kind === 210 /* DoStatement */ + || kind === 208 /* ExpressionStatement */ + || kind === 207 /* EmptyStatement */ + || kind === 213 /* ForInStatement */ + || kind === 214 /* ForOfStatement */ + || kind === 212 /* ForStatement */ + || kind === 209 /* IfStatement */ + || kind === 220 /* LabeledStatement */ + || kind === 217 /* ReturnStatement */ + || kind === 219 /* SwitchStatement */ + || kind === 221 /* ThrowStatement */ + || kind === 222 /* TryStatement */ + || kind === 206 /* VariableStatement */ + || kind === 211 /* WhileStatement */ + || kind === 218 /* WithStatement */ + || kind === 294 /* NotEmittedStatement */ + || kind === 297 /* EndOfDeclarationMarker */ + || kind === 296 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10197,24 +10270,24 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204 /* Block */; + || kind === 205 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 245 /* ExternalModuleReference */ + return kind === 246 /* ExternalModuleReference */ || kind === 141 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 248 /* JsxOpeningElement */; + return node.kind === 249 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249 /* JsxClosingElement */; + return node.kind === 250 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { @@ -10226,64 +10299,64 @@ var ts; ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 /* JsxElement */ - || kind === 252 /* JsxExpression */ - || kind === 247 /* JsxSelfClosingElement */ + return kind === 247 /* JsxElement */ + || kind === 253 /* JsxExpression */ + || kind === 248 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 /* JsxAttribute */ - || kind === 251 /* JsxSpreadAttribute */; + return kind === 251 /* JsxAttribute */ + || kind === 252 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251 /* JsxSpreadAttribute */; + return node.kind === 252 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250 /* JsxAttribute */; + return node.kind === 251 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 252 /* JsxExpression */; + || kind === 253 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 /* CaseClause */ - || kind === 254 /* DefaultClause */; + return kind === 254 /* CaseClause */ + || kind === 255 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255 /* HeritageClause */; + return node.kind === 256 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256 /* CatchClause */; + return node.kind === 257 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 257 /* PropertyAssignment */; + return node.kind === 258 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258 /* ShorthandPropertyAssignment */; + return node.kind === 259 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 261 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 261 /* SourceFile */; + return node.kind === 262 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10515,7 +10588,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 143 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228 /* InterfaceDeclaration */) { return current; } } @@ -10535,14 +10608,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 225 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 206 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10558,14 +10631,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 225 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 206 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -10634,7 +10707,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 /* SourceFile */ + var ConstructorForKind = kind === 262 /* SourceFile */ ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -11351,7 +11424,7 @@ var ts; ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; // Misc function createTemplateSpan(expression, literal, location) { - var node = createNode(202 /* TemplateSpan */, location); + var node = createNode(203 /* TemplateSpan */, location); node.expression = expression; node.literal = literal; return node; @@ -11366,7 +11439,7 @@ var ts; ts.updateTemplateSpan = updateTemplateSpan; // Element function createBlock(statements, location, multiLine, flags) { - var block = createNode(204 /* Block */, location, flags); + var block = createNode(205 /* Block */, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11382,7 +11455,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205 /* VariableStatement */, location, flags); + var node = createNode(206 /* VariableStatement */, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11397,7 +11470,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224 /* VariableDeclarationList */, location, flags); + var node = createNode(225 /* VariableDeclarationList */, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11410,7 +11483,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223 /* VariableDeclaration */, location, flags); + var node = createNode(224 /* VariableDeclaration */, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11425,11 +11498,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(206 /* EmptyStatement */, location); + return createNode(207 /* EmptyStatement */, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(207 /* ExpressionStatement */, location, flags); + var node = createNode(208 /* ExpressionStatement */, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11442,7 +11515,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208 /* IfStatement */, location); + var node = createNode(209 /* IfStatement */, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11457,7 +11530,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(209 /* DoStatement */, location); + var node = createNode(210 /* DoStatement */, location); node.statement = statement; node.expression = expression; return node; @@ -11471,7 +11544,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(210 /* WhileStatement */, location); + var node = createNode(211 /* WhileStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11485,7 +11558,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined); + var node = createNode(212 /* ForStatement */, location, /*flags*/ undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11501,7 +11574,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(212 /* ForInStatement */, location); + var node = createNode(213 /* ForInStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11516,7 +11589,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(213 /* ForOfStatement */, location); + var node = createNode(214 /* ForOfStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11531,7 +11604,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(214 /* ContinueStatement */, location); + var node = createNode(215 /* ContinueStatement */, location); if (label) { node.label = label; } @@ -11546,7 +11619,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(215 /* BreakStatement */, location); + var node = createNode(216 /* BreakStatement */, location); if (label) { node.label = label; } @@ -11561,7 +11634,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(216 /* ReturnStatement */, location); + var node = createNode(217 /* ReturnStatement */, location); node.expression = expression; return node; } @@ -11574,7 +11647,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(217 /* WithStatement */, location); + var node = createNode(218 /* WithStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11588,7 +11661,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(218 /* SwitchStatement */, location); + var node = createNode(219 /* SwitchStatement */, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11602,7 +11675,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(219 /* LabeledStatement */, location); + var node = createNode(220 /* LabeledStatement */, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11616,7 +11689,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(220 /* ThrowStatement */, location); + var node = createNode(221 /* ThrowStatement */, location); node.expression = expression; return node; } @@ -11629,7 +11702,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221 /* TryStatement */, location); + var node = createNode(222 /* TryStatement */, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11644,7 +11717,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(232 /* CaseBlock */, location); + var node = createNode(233 /* CaseBlock */, location); node.clauses = createNodeArray(clauses); return node; } @@ -11657,7 +11730,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225 /* FunctionDeclaration */, location, flags); + var node = createNode(226 /* FunctionDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11677,7 +11750,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226 /* ClassDeclaration */, location); + var node = createNode(227 /* ClassDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11695,7 +11768,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235 /* ImportDeclaration */, location); + var node = createNode(236 /* ImportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11711,7 +11784,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(236 /* ImportClause */, location); + var node = createNode(237 /* ImportClause */, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11725,7 +11798,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(237 /* NamespaceImport */, location); + var node = createNode(238 /* NamespaceImport */, location); node.name = name; return node; } @@ -11738,7 +11811,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(238 /* NamedImports */, location); + var node = createNode(239 /* NamedImports */, location); node.elements = createNodeArray(elements); return node; } @@ -11751,7 +11824,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(239 /* ImportSpecifier */, location); + var node = createNode(240 /* ImportSpecifier */, location); node.propertyName = propertyName; node.name = name; return node; @@ -11765,7 +11838,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240 /* ExportAssignment */, location); + var node = createNode(241 /* ExportAssignment */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11781,7 +11854,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241 /* ExportDeclaration */, location); + var node = createNode(242 /* ExportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11797,7 +11870,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(242 /* NamedExports */, location); + var node = createNode(243 /* NamedExports */, location); node.elements = createNodeArray(elements); return node; } @@ -11810,7 +11883,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(243 /* ExportSpecifier */, location); + var node = createNode(244 /* ExportSpecifier */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11825,7 +11898,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // JSX function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246 /* JsxElement */, location); + var node = createNode(247 /* JsxElement */, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11840,7 +11913,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247 /* JsxSelfClosingElement */, location); + var node = createNode(248 /* JsxSelfClosingElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11854,7 +11927,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248 /* JsxOpeningElement */, location); + var node = createNode(249 /* JsxOpeningElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11868,7 +11941,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(249 /* JsxClosingElement */, location); + var node = createNode(250 /* JsxClosingElement */, location); node.tagName = tagName; return node; } @@ -11881,7 +11954,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(250 /* JsxAttribute */, location); + var node = createNode(251 /* JsxAttribute */, location); node.name = name; node.initializer = initializer; return node; @@ -11895,7 +11968,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(251 /* JsxSpreadAttribute */, location); + var node = createNode(252 /* JsxSpreadAttribute */, location); node.expression = expression; return node; } @@ -11907,22 +11980,23 @@ var ts; return node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252 /* JsxExpression */, location); + function createJsxExpression(expression, dotDotDotToken, location) { + var node = createNode(253 /* JsxExpression */, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } ts.updateJsxExpression = updateJsxExpression; // Clauses function createHeritageClause(token, types, location) { - var node = createNode(255 /* HeritageClause */, location); + var node = createNode(256 /* HeritageClause */, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11936,7 +12010,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(253 /* CaseClause */, location); + var node = createNode(254 /* CaseClause */, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11950,7 +12024,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(254 /* DefaultClause */, location); + var node = createNode(255 /* DefaultClause */, location); node.statements = createNodeArray(statements); return node; } @@ -11963,7 +12037,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256 /* CatchClause */, location); + var node = createNode(257 /* CatchClause */, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11978,7 +12052,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer, location) { - var node = createNode(257 /* PropertyAssignment */, location); + var node = createNode(258 /* PropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11993,14 +12067,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258 /* ShorthandPropertyAssignment */, location); + var node = createNode(259 /* ShorthandPropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(259 /* SpreadAssignment */, location); + var node = createNode(260 /* SpreadAssignment */, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -12022,7 +12096,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags); + var updated = createNode(262 /* SourceFile */, /*location*/ node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12089,7 +12163,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(294 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12099,7 +12173,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(296 /* EndOfDeclarationMarker */); + var node = createNode(297 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12110,7 +12184,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(295 /* MergeDeclarationMarker */); + var node = createNode(296 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12125,7 +12199,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(295 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12138,19 +12212,6 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - /** - * Creates a node that emits a string of raw text in an expression position. Raw text is never - * transformed, should be ES3 compliant, and should have the same precedence as - * PrimaryExpression. - * - * @param text The raw text of the node. - */ - function createRawExpression(text) { - var node = createNode(297 /* RawExpression */); - node.text = text; - return node; - } - ts.createRawExpression = createRawExpression; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); @@ -12326,6 +12387,20 @@ var ts; return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } ts.getHelperName = getHelperName; + // Utilities + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 /* LabeledStatement */ + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12432,9 +12507,9 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 149 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -12999,7 +13074,7 @@ var ts; case 177 /* PropertyAccessExpression */: node = node.expression; continue; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13054,7 +13129,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294 /* PartiallyEmittedExpression */) { + while (node.kind === 295 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13133,7 +13208,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -13391,10 +13466,10 @@ var ts; var name_9 = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 236 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 242 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -13514,7 +13589,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13526,11 +13601,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13567,7 +13642,7 @@ var ts; // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13591,7 +13666,7 @@ var ts; : propertyName; } break; - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13603,7 +13678,7 @@ var ts; : propertyName; } break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13717,20 +13792,20 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + case 235 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13760,13 +13835,13 @@ var ts; } } break; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13774,7 +13849,7 @@ var ts; } } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -13794,7 +13869,7 @@ var ts; } } break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -13847,7 +13922,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261 /* SourceFile */) { + if (kind === 262 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { @@ -13903,20 +13978,20 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 223 /* VariableDeclaration */: + case 258 /* PropertyAssignment */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13942,7 +14017,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -14034,6 +14109,8 @@ var ts; visitNode(cbNode, node.type); case 201 /* NonNullExpression */: return visitNode(cbNode, node.expression); + case 202 /* MetaProperty */: + return visitNode(cbNode, node.name); case 193 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || @@ -14042,76 +14119,76 @@ var ts; visitNode(cbNode, node.whenFalse); case 196 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: return visitNode(cbNode, node.label); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 253 /* CaseClause */: + case 254 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 145 /* Decorator */: return visitNode(cbNode, node.expression); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -14119,155 +14196,156 @@ var ts; visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 194 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 142 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return visitNodes(cbNodes, node.types); case 199 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245 /* ExternalModuleReference */: + case 246 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 252 /* JsxExpression */: - return visitNode(cbNode, node.expression); - case 249 /* JsxClosingElement */: + case 253 /* JsxExpression */: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 250 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 262 /* JSDocTypeExpression */: + case 263 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 266 /* JSDocUnionType */: + case 267 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 267 /* JSDocTupleType */: + case 268 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 265 /* JSDocArrayType */: + case 266 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 269 /* JSDocNonNullableType */: + case 270 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 268 /* JSDocNullableType */: + case 269 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocRecordType */: + case 271 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273 /* JSDocOptionalType */: + case 274 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275 /* JSDocVariadicType */: + case 276 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 276 /* JSDocConstructorType */: + case 277 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 277 /* JSDocThisType */: + case 278 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordMember */: + case 272 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278 /* JSDocComment */: + case 279 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 281 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 280 /* JSDocAugmentsTag */: + case 281 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 288 /* JSDocLiteralType */: + case 289 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14539,7 +14617,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(262 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -15327,7 +15405,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 147 /* PropertyDeclaration */: - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return true; case 149 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal @@ -15344,8 +15422,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: return true; } } @@ -15354,42 +15432,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 205 /* VariableStatement */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 207 /* ExpressionStatement */: - case 220 /* ThrowStatement */: - case 216 /* ReturnStatement */: - case 218 /* SwitchStatement */: - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 206 /* EmptyStatement */: - case 221 /* TryStatement */: - case 219 /* LabeledStatement */: - case 209 /* DoStatement */: - case 222 /* DebuggerStatement */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 226 /* FunctionDeclaration */: + case 206 /* VariableStatement */: + case 205 /* Block */: + case 209 /* IfStatement */: + case 208 /* ExpressionStatement */: + case 221 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 219 /* SwitchStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 212 /* ForStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: + case 207 /* EmptyStatement */: + case 222 /* TryStatement */: + case 220 /* LabeledStatement */: + case 210 /* DoStatement */: + case 223 /* DebuggerStatement */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: + case 241 /* ExportAssignment */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 229 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 261 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -15405,7 +15483,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223 /* VariableDeclaration */) { + if (node.kind !== 224 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15590,7 +15668,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202 /* TemplateSpan */); + var span = createNode(203 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -17179,8 +17257,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248 /* JsxOpeningElement */) { - var node = createNode(246 /* JsxElement */, opening.pos); + if (opening.kind === 249 /* JsxOpeningElement */) { + var node = createNode(247 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17190,7 +17268,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 248 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17264,7 +17342,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(248 /* JsxOpeningElement */, fullStart); + node = createNode(249 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17276,7 +17354,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(247 /* JsxSelfClosingElement */, fullStart); + node = createNode(248 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17300,9 +17378,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252 /* JsxExpression */); + var node = createNode(253 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -17319,7 +17398,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250 /* JsxAttribute */); + var node = createNode(251 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17334,7 +17413,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251 /* JsxSpreadAttribute */); + var node = createNode(252 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17342,7 +17421,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249 /* JsxClosingElement */); + var node = createNode(250 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17581,7 +17660,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(259 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(260 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17606,7 +17685,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(259 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17617,7 +17696,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(258 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17668,8 +17747,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180 /* NewExpression */); + var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); + if (parseOptional(22 /* DotToken */)) { + var node_1 = createNode(202 /* MetaProperty */, fullStart); + node_1.keywordToken = 93 /* NewKeyword */; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(180 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17679,7 +17765,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204 /* Block */); + var node = createNode(205 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17712,12 +17798,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206 /* EmptyStatement */); + var node = createNode(207 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(208 /* IfStatement */); + var node = createNode(209 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17727,7 +17813,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209 /* DoStatement */); + var node = createNode(210 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17742,7 +17828,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210 /* WhileStatement */); + var node = createNode(211 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17765,21 +17851,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(212 /* ForInStatement */, pos); + var forInStatement = createNode(213 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(213 /* ForOfStatement */, pos); + var forOfStatement = createNode(214 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(211 /* ForStatement */, pos); + var forStatement = createNode(212 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17797,7 +17883,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 216 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17805,7 +17891,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216 /* ReturnStatement */); + var node = createNode(217 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17814,7 +17900,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217 /* WithStatement */); + var node = createNode(218 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17823,7 +17909,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253 /* CaseClause */); + var node = createNode(254 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17831,7 +17917,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254 /* DefaultClause */); + var node = createNode(255 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17841,12 +17927,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218 /* SwitchStatement */); + var node = createNode(219 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(233 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17861,7 +17947,7 @@ var 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(220 /* ThrowStatement */); + var node = createNode(221 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17869,7 +17955,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(221 /* TryStatement */); + var node = createNode(222 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17882,7 +17968,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256 /* CatchClause */); + var result = createNode(257 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17892,7 +17978,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222 /* DebuggerStatement */); + var node = createNode(223 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17904,13 +17990,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(219 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(220 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(208 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -18091,9 +18177,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(214 /* ContinueStatement */); + return parseBreakOrContinueStatement(215 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(215 /* BreakStatement */); + return parseBreakOrContinueStatement(216 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18175,7 +18261,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(245 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18248,7 +18334,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223 /* VariableDeclaration */); + var node = createNode(224 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18257,7 +18343,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224 /* VariableDeclarationList */); + var node = createNode(225 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18295,7 +18381,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205 /* VariableStatement */, fullStart); + var node = createNode(206 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18303,7 +18389,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* FunctionDeclaration */, fullStart); + var node = createNode(226 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18527,7 +18613,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(203 /* SemicolonClassElement */); + var result = createNode(204 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18568,7 +18654,7 @@ var ts; /*modifiers*/ undefined, 197 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18612,7 +18698,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(255 /* HeritageClause */); + var node = createNode(256 /* HeritageClause */); node.token = token(); nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -18635,7 +18721,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227 /* InterfaceDeclaration */, fullStart); + var node = createNode(228 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18646,7 +18732,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* TypeAliasDeclaration */, fullStart); + var node = createNode(229 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(136 /* TypeKeyword */); @@ -18662,13 +18748,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(260 /* EnumMember */, scanner.getStartPos()); + var node = createNode(261 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* EnumDeclaration */, fullStart); + var node = createNode(230 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18683,7 +18769,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(232 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18694,7 +18780,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(231 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18708,7 +18794,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(231 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (token() === 139 /* GlobalKeyword */) { @@ -18755,7 +18841,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(234 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18774,7 +18860,7 @@ var ts; // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(235 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -18785,7 +18871,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(236 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18808,7 +18894,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(236 /* ImportClause */, fullStart); + var importClause = createNode(237 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18818,7 +18904,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(239 /* NamedImports */); } return finishNode(importClause); } @@ -18828,7 +18914,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(245 /* ExternalModuleReference */); + var node = createNode(246 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18851,7 +18937,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(237 /* NamespaceImport */); + var namespaceImport = createNode(238 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18866,14 +18952,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 239 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243 /* ExportSpecifier */); + return parseImportOrExportSpecifier(244 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239 /* ImportSpecifier */); + return parseImportOrExportSpecifier(240 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18898,14 +18984,14 @@ var ts; else { node.name = identifierName; } - if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 240 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportDeclaration */, fullStart); + var node = createNode(242 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { @@ -18913,7 +18999,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(243 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. @@ -18926,7 +19012,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240 /* ExportAssignment */, fullStart); + var node = createNode(241 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -19008,10 +19094,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */ - || node.kind === 235 /* ImportDeclaration */ - || node.kind === 240 /* ExportAssignment */ - || node.kind === 241 /* ExportDeclaration */ + || node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */ + || node.kind === 236 /* ImportDeclaration */ + || node.kind === 241 /* ExportAssignment */ + || node.kind === 242 /* ExportDeclaration */ ? node : undefined; }); @@ -19086,7 +19172,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(263 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19097,12 +19183,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(266 /* JSDocUnionType */, type.pos); + var unionType = createNode(267 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(273 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(274 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19113,20 +19199,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(265 /* JSDocArrayType */, type.pos); + var arrayType = createNode(266 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(268 /* JSDocNullableType */, type.pos); + var nullableType = createNode(269 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(270 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19178,27 +19264,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277 /* JSDocThisType */); + var result = createNode(278 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276 /* JSDocConstructorType */); + var result = createNode(277 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275 /* JSDocVariadicType */); + var result = createNode(276 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274 /* JSDocFunctionType */); + var result = createNode(275 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19220,7 +19306,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272 /* JSDocTypeReference */); + var result = createNode(273 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19261,18 +19347,18 @@ var ts; return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270 /* JSDocRecordType */); + var result = createNode(271 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269 /* JSDocNonNullableType */); + var result = createNode(270 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267 /* JSDocTupleType */); + var result = createNode(268 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19286,7 +19372,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266 /* JSDocUnionType */); + var result = createNode(267 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19302,12 +19388,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263 /* JSDocAllType */); + var result = createNode(264 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288 /* JSDocLiteralType */); + var result = createNode(289 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19330,11 +19416,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(264 /* JSDocUnknownType */, pos); + var result = createNode(265 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(268 /* JSDocNullableType */, pos); + var result = createNode(269 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19499,7 +19585,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(278 /* JSDocComment */, start); + var result = createNode(279 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19615,7 +19701,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279 /* JSDocTag */, atToken.pos); + var result = createNode(280 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19672,7 +19758,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281 /* JSDocParameterTag */, atToken.pos); + var result = createNode(282 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19683,20 +19769,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocReturnTag */, atToken.pos); + var result = createNode(283 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocTypeTag */, atToken.pos); + var result = createNode(284 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19711,7 +19797,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(287 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19720,7 +19806,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(281 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19729,7 +19815,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -19743,7 +19829,7 @@ var ts; typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 273 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { var name_14 = jsDocTypeReference.name; @@ -19761,7 +19847,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19802,7 +19888,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(231 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19848,7 +19934,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' @@ -19872,7 +19958,7 @@ var ts; break; } } - var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20346,7 +20432,7 @@ var 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 (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -20392,16 +20478,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 229 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 231 /* ModuleBlock */) { + else if (node.kind === 232 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20420,7 +20506,7 @@ var ts; }); return state_1; } - else if (node.kind === 230 /* ModuleDeclaration */) { + else if (node.kind === 231 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20561,7 +20647,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20596,9 +20682,9 @@ var ts; return "__new"; case 155 /* IndexSignature */: return "__index"; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return "__export"; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; case 192 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { @@ -20615,22 +20701,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: + case 226 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 144 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 275 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 206 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20717,7 +20803,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 241 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20737,7 +20823,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 244 /* ExportSpecifier */ || (node.kind === 235 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -20760,7 +20846,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20847,7 +20933,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -20926,43 +21012,43 @@ var ts; return; } switch (node.kind) { - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: bindWhileStatement(node); break; - case 209 /* DoStatement */: + case 210 /* DoStatement */: bindDoStatement(node); break; - case 211 /* ForStatement */: + case 212 /* ForStatement */: bindForStatement(node); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 208 /* IfStatement */: + case 209 /* IfStatement */: bindIfStatement(node); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 221 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 221 /* TryStatement */: + case 222 /* TryStatement */: bindTryStatement(node); break; - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: bindSwitchStatement(node); break; - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: bindCaseBlock(node); break; - case 253 /* CaseClause */: + case 254 /* CaseClause */: bindCaseClause(node); break; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: bindLabeledStatement(node); break; case 190 /* PrefixUnaryExpression */: @@ -20980,7 +21066,7 @@ var ts; case 193 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; case 179 /* CallExpression */: @@ -21147,11 +21233,11 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208 /* IfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: + case 209 /* IfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: return parent.expression === node; - case 211 /* ForStatement */: + case 212 /* ForStatement */: case 193 /* ConditionalExpression */: return parent.condition === node; } @@ -21215,7 +21301,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 220 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21252,7 +21338,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224 /* VariableDeclarationList */) { + if (node.initializer.kind !== 225 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21274,7 +21360,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216 /* ReturnStatement */) { + if (node.kind === 217 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21294,7 +21380,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 216 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21360,7 +21446,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21427,7 +21513,7 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 210 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); @@ -21459,13 +21545,13 @@ var ts; else if (node.kind === 176 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257 /* PropertyAssignment */) { + if (p.kind === 258 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258 /* ShorthandPropertyAssignment */) { + else if (p.kind === 259 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259 /* SpreadAssignment */) { + else if (p.kind === 260 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21565,7 +21651,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 213 /* ForInStatement */ || node.parent.parent.kind === 214 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } @@ -21595,28 +21681,28 @@ var ts; function getContainerFlags(node) { switch (node.kind) { case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: + case 271 /* JSDocRecordType */: return 1 /* IsContainer */; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 274 /* JSDocFunctionType */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 275 /* JSDocFunctionType */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: case 170 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 261 /* SourceFile */: + case 262 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 149 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: @@ -21629,17 +21715,17 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; case 147 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 256 /* CatchClause */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 232 /* CaseBlock */: + case 257 /* CatchClause */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 233 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 204 /* Block */: + case 205 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21676,20 +21762,20 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 161 /* TypeLiteral */: case 176 /* ObjectLiteralExpression */: - case 227 /* InterfaceDeclaration */: - case 270 /* JSDocRecordType */: - case 287 /* JSDocTypeLiteral */: + case 228 /* InterfaceDeclaration */: + case 271 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -21706,11 +21792,11 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: - case 228 /* TypeAliasDeclaration */: + case 275 /* JSDocFunctionType */: + case 229 /* TypeAliasDeclaration */: case 170 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -21732,11 +21818,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) { + var body = node.kind === 262 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 262 /* SourceFile */ || body.kind === 232 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) { + if (stat.kind === 242 /* ExportDeclaration */ || stat.kind === 241 /* ExportAssignment */) { return true; } } @@ -21829,7 +21915,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 260 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21841,7 +21927,7 @@ var 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 = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -21863,10 +21949,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -21977,8 +22063,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 261 /* SourceFile */ && - blockScopeContainer.kind !== 230 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 262 /* SourceFile */ && + blockScopeContainer.kind !== 231 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22091,14 +22177,14 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 259 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -22131,7 +22217,7 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return checkStrictModeCatchClause(node); case 186 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); @@ -22141,7 +22227,7 @@ var ts; return checkStrictModePostfixUnaryExpression(node); case 190 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return checkStrictModeWithStatement(node); case 167 /* ThisType */: seenThisKeyword = true; @@ -22152,22 +22238,22 @@ var ts; return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); case 144 /* Parameter */: return bindParameter(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 271 /* JSDocRecordMember */: + case 272 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 286 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 259 /* SpreadAssignment */: - case 251 /* JsxSpreadAttribute */: + case 260 /* SpreadAssignment */: + case 252 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { @@ -22192,7 +22278,7 @@ var ts; // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 150 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); @@ -22202,12 +22288,12 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); case 161 /* TypeLiteral */: case 170 /* MappedType */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: + case 271 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); case 176 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); @@ -22221,46 +22307,46 @@ var ts; break; // Members of classes, interfaces, and modules case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 234 /* ImportEqualsDeclaration */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return bindImportClause(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return bindExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return bindExportAssignment(node); - case 261 /* SourceFile */: + case 262 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204 /* Block */: + case 205 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // Fall through - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22292,7 +22378,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 241 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22302,7 +22388,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261 /* SourceFile */) { + if (node.parent.kind !== 262 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -22357,7 +22443,7 @@ var ts; function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { + if (container.kind === 226 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { container.symbol.members = container.symbol.members || ts.createMap(); // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); @@ -22405,7 +22491,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22541,13 +22627,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 207 /* EmptyStatement */) || // report error on class declarations - node.kind === 226 /* ClassDeclaration */ || + node.kind === 227 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 230 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22561,7 +22647,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 /* VariableStatement */ || + (node.kind !== 206 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22585,13 +22671,13 @@ var ts; return computeCallExpression(node, subtreeFlags); case 180 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); case 183 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); case 192 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); case 144 /* Parameter */: return computeParameter(node, subtreeFlags); @@ -22599,23 +22685,23 @@ var ts; return computeArrowFunction(node, subtreeFlags); case 184 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); case 197 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return computeCatchClause(node, subtreeFlags); case 199 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -22628,7 +22714,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); case 177 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); @@ -23113,8 +23199,8 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: case 182 /* TypeAssertionExpression */: case 200 /* AsExpression */: case 201 /* NonNullExpression */: @@ -23122,18 +23208,18 @@ var ts; // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: case 10 /* JsxText */: - case 249 /* JsxClosingElement */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - case 252 /* JsxExpression */: + case 250 /* JsxClosingElement */: + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: + case 253 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH @@ -23143,8 +23229,9 @@ var ts; case 15 /* TemplateTail */: case 194 /* TemplateExpression */: case 181 /* TaggedTemplateExpression */: - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: + case 202 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; @@ -23176,8 +23263,8 @@ var ts; case 164 /* UnionType */: case 165 /* IntersectionType */: case 166 /* ParenthesizedType */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: case 167 /* ThisType */: case 168 /* TypeOperator */: case 169 /* IndexedAccessType */: @@ -23207,7 +23294,7 @@ var ts; case 196 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23266,23 +23353,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* ReturnStatement */: - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 217 /* ReturnStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23306,18 +23393,18 @@ var ts; case 180 /* NewExpression */: case 175 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; case 144 /* Parameter */: return 536872257 /* ParameterExcludes */; case 185 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return 539358529 /* ClassExcludes */; case 150 /* Constructor */: @@ -23339,12 +23426,12 @@ var ts; case 153 /* CallSignature */: case 154 /* ConstructSignature */: case 155 /* IndexSignature */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; case 176 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 256 /* CatchClause */: + case 257 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; case 172 /* ObjectBindingPattern */: case 173 /* ArrayBindingPattern */: @@ -23386,10 +23473,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - /** Create Resolved from a file with unknown extension. */ - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; @@ -23402,13 +23485,14 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2 /* DtsOnly */: - case 0 /* TypeScript */: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1 /* JavaScript */: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -23475,6 +23559,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -23535,7 +23620,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -23552,7 +23641,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -23605,31 +23695,134 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_5 = ts.getDirectoryPath(current); + if (parent_5 === current || directoryPathMap.contains(parent_5)) { + break; + } + directoryPathMap.set(parent_5, result); + current = parent_5; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + // find first position where directory and resolution differs + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + // find last directory separator before position i + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + // put result in per-module name cache + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -23822,34 +24015,34 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -23866,10 +24059,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } /* @internal */ function directoryProbablyExists(directoryName, host) { @@ -23908,11 +24124,11 @@ var ts; } } switch (extensions) { - case 2 /* DtsOnly */: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0 /* TypeScript */: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1 /* JavaScript */: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -23922,19 +24138,21 @@ var ts; } /** Return the file if it exists. */ function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -23943,18 +24161,23 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. - return resolvedFromAnyFile(fromFile); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -23964,7 +24187,7 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results @@ -23972,70 +24195,116 @@ var ts; } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. - return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1 /* JavaScript */) { - return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { // Climb up parent directories looking for a module. - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0 /* TypeScript */) { + if (extensions === Extensions.TypeScript) { // If we didn't find the file normally, look it up in @types. return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); } } } @@ -24052,10 +24321,17 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ function forEachAncestorDirectory(directory, callback) { while (true) { @@ -24142,9 +24418,11 @@ var ts; getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getTypeFromTypeNode: getTypeFromTypeNode, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -24153,6 +24431,7 @@ var ts; getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + signatureToString: signatureToString, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -24177,7 +24456,8 @@ var ts; // we deliberately exclude augmentations // since we are only interested in declarations of the module itself return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -24281,6 +24561,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var TypeFacts; @@ -24501,7 +24782,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 231 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 231 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -24606,7 +24887,7 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 262 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -24662,9 +24943,21 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 223 /* VariableDeclaration */ || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174 /* BindingElement */) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + var errorBindingElement = ts.getAncestor(usage, 174 /* BindingElement */); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224 /* VariableDeclaration */), usage); + } + else if (declaration.kind === 224 /* VariableDeclaration */) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) @@ -24673,9 +24966,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205 /* VariableStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 206 /* VariableStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24684,8 +24977,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24713,6 +25006,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with @@ -24736,7 +25038,7 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 279 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 144 /* Parameter */ || @@ -24763,13 +25065,13 @@ var ts; } } switch (location.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 262 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports["default"]) { @@ -24792,7 +25094,7 @@ var ts; // which is not the desired behavior. if (moduleExports[name] && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 244 /* ExportSpecifier */)) { break; } } @@ -24800,7 +25102,7 @@ var ts; break loop; } break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } @@ -24823,9 +25125,9 @@ var ts; } } break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -24854,7 +25156,7 @@ var ts; // case 142 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 228 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -24867,7 +25169,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; @@ -24960,7 +25262,7 @@ var ts; // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 234 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -25048,7 +25350,7 @@ var ts; // Block-scoped variables cannot be used before their definition 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 (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -25069,10 +25371,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 235 /* ImportDeclaration */) { + while (node && node.kind !== 236 /* ImportDeclaration */) { node = node.parent; } return node; @@ -25082,7 +25384,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -25207,19 +25509,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return getTargetOfImportClause(node); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return getTargetOfExportAssignment(node); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node); } } @@ -25266,11 +25568,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240 /* ExportAssignment */) { + if (node.kind === 241 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 243 /* ExportSpecifier */) { + else if (node.kind === 244 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25298,14 +25600,16 @@ var ts; else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 235 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol) { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } - // Resolves a qualified name and any involved aliases + /** + * Resolves a qualified name and any involved aliases. + */ function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (ts.nodeIsMissing(name)) { return undefined; @@ -25626,11 +25930,11 @@ var ts; } } switch (location_1.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -25682,7 +25986,7 @@ var ts; return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -25722,7 +26026,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -25821,7 +26125,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25867,7 +26171,7 @@ var ts; meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 234 /* ImportEqualsDeclaration */) { + entityName.parent.kind === 235 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -25966,7 +26270,7 @@ var ts; while (node.kind === 166 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -25974,7 +26278,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 /* ModuleBlock */ && + node.parent.kind === 232 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { @@ -26066,9 +26370,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_6) { + walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26218,14 +26522,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26291,7 +26595,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */; + return declaration.parent.kind === 262 /* SourceFile */ || declaration.parent.kind === 232 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26305,25 +26609,6 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130 /* ReadonlyKeyword */); - writeSpace(writer); - } - writePunctuation(writer, 20 /* OpenBracketToken */); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21 /* CloseBracketToken */); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeType(info.type, 0 /* None */); - writePunctuation(writer, 24 /* SemicolonToken */); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130 /* ReadonlyKeyword */); @@ -26407,8 +26692,8 @@ var ts; writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */); - writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0 /* String */, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1 /* Number */, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -26588,6 +26873,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 /* SuppressAnyReturnType */ && isTypeAny(returnType)) { + return; + } if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); writePunctuation(writer, 35 /* EqualsGreaterThanToken */); @@ -26600,7 +26889,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -26620,6 +26908,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 20 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + switch (kind) { + case 1 /* Number */: + writeKeyword(writer, 132 /* NumberKeyword */); + break; + case 0 /* String */: + writeKeyword(writer, 134 /* StringKeyword */); + break; + } + writePunctuation(writer, 21 /* CloseBracketToken */); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24 /* SemicolonToken */); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -26630,6 +26944,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -26646,32 +26961,32 @@ var ts; switch (node.kind) { case 174 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 225 /* FunctionDeclaration */: - case 229 /* EnumDeclaration */: - case 234 /* ImportEqualsDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 226 /* FunctionDeclaration */: + case 230 /* EnumDeclaration */: + case 235 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent_8 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 235 /* ImportEqualsDeclaration */ && parent_8.kind !== 262 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { + return isGlobalSourceFile(parent_8); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent_8); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 151 /* GetAccessor */: @@ -26688,7 +27003,7 @@ var ts; case 153 /* CallSignature */: case 155 /* IndexSignature */: case 144 /* Parameter */: - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: @@ -26701,18 +27016,18 @@ var ts; return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: return false; // Type parameters are always visible case 143 /* TypeParameter */: // Source file and namespace export are always visible - case 261 /* SourceFile */: - case 233 /* NamespaceExportDeclaration */: + case 262 /* SourceFile */: + case 234 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return false; default: return false; @@ -26721,10 +27036,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 241 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243 /* ExportSpecifier */) { + else if (node.parent.kind === 244 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -26817,12 +27132,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 223 /* VariableDeclaration */: - case 224 /* VariableDeclarationList */: - case 239 /* ImportSpecifier */: - case 238 /* NamedImports */: - case 237 /* NamespaceImport */: - case 236 /* ImportClause */: + case 224 /* VariableDeclaration */: + case 225 /* VariableDeclarationList */: + case 240 /* ImportSpecifier */: + case 239 /* NamedImports */: + case 238 /* NamespaceImport */: + case 237 /* ImportClause */: node = node.parent; break; default: @@ -26846,9 +27161,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192 /* Never */) !== 0; - } // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node) { @@ -27007,11 +27319,11 @@ var ts; } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 212 /* ForInStatement */) { + if (declaration.parent.parent.kind === 213 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 214 /* ForOfStatement */) { // 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, @@ -27026,7 +27338,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && - declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 224 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27074,7 +27386,7 @@ var ts; return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 258 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 259 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27177,7 +27489,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 257 /* PropertyAssignment */) { + if (declaration.kind === 258 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27210,10 +27522,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 240 /* ExportAssignment */) { + if (declaration.kind === 241 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 287 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27443,8 +27755,8 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || + if (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || + node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { @@ -27455,7 +27767,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -27464,8 +27776,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 227 /* ClassDeclaration */ || + node.kind === 197 /* ClassExpression */ || node.kind === 229 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27497,11 +27809,13 @@ var ts; } return signatures; } - // The base constructor of a class can resolve to - // undefinedType if the class has no extends clause, - // unknownType if an error occurred during resolution of the extends expression, - // nullType if the extends expression is the null value, or - // an object type with at least one construct signature. + /** + * The base constructor of a class can resolve to + * * undefinedType if the class has no extends clause, + * * unknownType if an error occurred during resolution of the extends expression, + * * nullType if the extends expression is the null value, or + * * an object type with at least one construct signature. + */ function getBaseConstructorTypeOfClass(type) { if (!type.resolvedBaseConstructorType) { var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27616,7 +27930,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 228 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -27648,7 +27962,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 228 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -27705,7 +28019,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 286 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -27716,7 +28030,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 229 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -27750,7 +28064,7 @@ var ts; function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 230 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -27778,7 +28092,7 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 230 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -28176,6 +28490,9 @@ var ts; } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } + /** + * Converts an AnonymousType to a ResolvedType. + */ function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { @@ -28306,8 +28623,8 @@ var ts; // the modifiers type is T. Otherwise, the modifiers type is {}. var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); - var extendedConstraint = constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + var extendedConstraint = constraint && constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; @@ -28618,7 +28935,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (node.flags & 65536 /* JavaScriptFile */) { - if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 274 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28629,7 +28946,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 274 /* JSDocOptionalType */; } } } @@ -28685,7 +29002,7 @@ var ts; // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature @@ -28773,12 +29090,12 @@ var ts; if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: @@ -28789,7 +29106,7 @@ var ts; case 152 /* SetAccessor */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // 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). @@ -29080,7 +29397,7 @@ var ts; switch (node.kind) { case 157 /* TypeReference */: return node.typeName; - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return node.name; case 199 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other @@ -29108,7 +29425,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 273 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29121,7 +29438,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272 /* JSDocTypeReference */) { + if (node.kind === 273 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -29163,9 +29480,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: return declaration; } } @@ -29358,8 +29675,9 @@ var ts; return false; } 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, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -29479,8 +29797,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; addTypeToIntersection(typeSet, type); } } @@ -29618,7 +29936,7 @@ var ts; getIndexInfoOfType(objectType, 0 /* String */) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -29745,7 +30063,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 229 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -29875,7 +30193,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 228 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -29894,8 +30212,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 263 /* JSDocAllType */: - case 264 /* JSDocUnknownType */: + case 264 /* JSDocAllType */: + case 265 /* JSDocUnknownType */: return anyType; case 134 /* StringKeyword */: return stringType; @@ -29913,21 +30231,21 @@ var ts; return nullType; case 129 /* NeverKeyword */: return neverType; - case 289 /* JSDocNullKeyword */: + case 290 /* JSDocNullKeyword */: return nullType; - case 290 /* JSDocUndefinedKeyword */: + case 291 /* JSDocUndefinedKeyword */: return undefinedType; - case 291 /* JSDocNeverKeyword */: + case 292 /* JSDocNeverKeyword */: return neverType; case 167 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); case 171 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 288 /* JSDocLiteralType */: + case 289 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return getTypeFromTypeReference(node); case 156 /* TypePredicate */: return booleanType; @@ -29936,29 +30254,29 @@ var ts; case 160 /* TypeQuery */: return getTypeFromTypeQueryNode(node); case 162 /* ArrayType */: - case 265 /* JSDocArrayType */: + case 266 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); case 163 /* TupleType */: return getTypeFromTupleTypeNode(node); case 164 /* UnionType */: - case 266 /* JSDocUnionType */: + case 267 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); case 165 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); case 166 /* ParenthesizedType */: - case 268 /* JSDocNullableType */: - case 269 /* JSDocNonNullableType */: - case 276 /* JSDocConstructorType */: - case 277 /* JSDocThisType */: - case 273 /* JSDocOptionalType */: + case 269 /* JSDocNullableType */: + case 270 /* JSDocNonNullableType */: + case 277 /* JSDocConstructorType */: + case 278 /* JSDocThisType */: + case 274 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 270 /* JSDocRecordType */: + case 271 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 274 /* JSDocFunctionType */: + case 288 /* JSDocTypeLiteral */: + case 275 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -29972,9 +30290,9 @@ var ts; case 141 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267 /* JSDocTupleType */: + case 268 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 275 /* JSDocVariadicType */: + case 276 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -30136,17 +30454,19 @@ var ts; var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144 /* Index */) { var typeVariable_1 = constraintType.type; - var mappedTypeVariable = instantiateType(typeVariable_1, mapper); - if (typeVariable_1 !== mappedTypeVariable) { - return mapType(mappedTypeVariable, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable_1.flags & 16384 /* TypeParameter */) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -30170,12 +30490,12 @@ var ts; // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: @@ -30186,10 +30506,10 @@ var ts; case 152 /* SetAccessor */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30199,15 +30519,24 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 228 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: + case 275 /* JSDocFunctionType */: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 231 /* ModuleDeclaration */: + case 262 /* SourceFile */: return false; } node = node.parent; @@ -30217,7 +30546,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */; + return parentKind === 262 /* SourceFile */ || parentKind === 232 /* ModuleBlock */; } return false; } @@ -30309,7 +30638,7 @@ var ts; case 192 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return isContextSensitive(node.initializer); case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -30376,7 +30705,7 @@ var ts; // subtype of T but not structurally identical to T. This specifically means that two distinct but // structurally identical types (such as two classes) are not considered instances of each other. function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } /** * This is *not* a bi-directional relationship. @@ -30710,10 +31039,12 @@ var ts; } return false; } - // Compare two types and return - // Ternary.True if they are related with no assumptions, - // Ternary.Maybe if they are related with assumptions of other relationships, or - // Ternary.False if they are not related. + /** + * Compare two types and return + * * Ternary.True if they are related with no assumptions, + * * Ternary.Maybe if they are related with assumptions of other relationships, or + * * Ternary.False if they are not related. + */ function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { @@ -31177,8 +31508,11 @@ var ts; } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1 /* True */; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + return -1 /* True */; + } } return 0 /* False */; } @@ -31345,7 +31679,7 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; @@ -31584,8 +31918,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31593,8 +31927,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -31700,8 +32034,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; result |= getFalsyFlags(t); } return result; @@ -31883,7 +32217,7 @@ var ts; case 174 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -32269,8 +32603,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32411,7 +32745,7 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 224 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; @@ -32516,8 +32850,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getTypeFacts(t); } return result; @@ -32605,7 +32939,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? + return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 258 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -32624,9 +32958,9 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return stringType; - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression) || unknownType; case 192 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); @@ -32636,9 +32970,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 196 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32664,26 +32998,26 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212 /* ForInStatement */) { + if (node.parent.parent.kind === 213 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.parent.kind === 214 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 /* VariableDeclaration */ ? + return node.kind === 224 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 /* VariableDeclaration */ && node.initializer && + return node.kind === 224 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); @@ -32710,7 +33044,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 254 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -32825,8 +33159,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -33461,8 +33795,8 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 /* ModuleBlock */ || - node.kind === 261 /* SourceFile */ || + node.kind === 232 /* ModuleBlock */ || + node.kind === 262 /* SourceFile */ || node.kind === 147 /* PropertyDeclaration */) { return node; } @@ -33542,7 +33876,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 227 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33573,6 +33907,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -33611,7 +33946,7 @@ var ts; // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph @@ -33646,7 +33981,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 257 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -33671,8 +34006,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 211 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container && + if (container.kind === 212 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 225 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -33793,11 +34128,11 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; @@ -33861,9 +34196,9 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 275 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -34254,8 +34589,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -34338,13 +34673,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250 /* JsxAttribute */) { + if (attribute.kind === 251 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 251 /* JsxSpreadAttribute */) { + else if (attribute.kind === 252 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -34382,14 +34717,14 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 174 /* BindingElement */: return getContextualTypeForInitializerExpression(node); case 185 /* ArrowFunction */: - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); case 195 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); @@ -34401,22 +34736,22 @@ var ts; return getTypeFromTypeNode(parent.type); case 192 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); case 175 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); case 193 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 183 /* ParenthesizedExpression */: return getContextualType(parent); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return getContextualType(parent); - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -34477,8 +34812,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34683,18 +35018,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 /* PropertyAssignment */ || - memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 258 /* PropertyAssignment */ || + memberDecl.kind === 259 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257 /* PropertyAssignment */) { + if (memberDecl.kind === 258 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 149 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 259 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -34702,8 +35037,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 258 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 259 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -34731,7 +35066,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259 /* SpreadAssignment */) { + else if (memberDecl.kind === 260 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -34842,13 +35177,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: checkJsxExpression(child); break; - case 246 /* JsxElement */: + case 247 /* JsxElement */: checkJsxElement(child); break; - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -35223,11 +35558,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250 /* JsxAttribute */) { + if (node.attributes[i].kind === 251 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 252 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -35248,7 +35583,11 @@ var ts; } function checkJsxExpression(node) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -35276,7 +35615,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ? + var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 224 /* VariableDeclaration */ ? node.name : node.right; if (left.kind === 96 /* SuperKeyword */) { @@ -35453,7 +35792,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer.kind === 225 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35482,7 +35821,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 /* ForInStatement */ && + if (node.kind === 213 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35591,13 +35930,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent_9; index = cutoffIndex; } } @@ -35605,7 +35944,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent_9; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35909,7 +36248,7 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 145 /* Decorator */) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; @@ -35953,7 +36292,7 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); @@ -35998,7 +36337,7 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -36049,7 +36388,7 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -36554,7 +36893,7 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 144 /* Parameter */: @@ -36693,9 +37032,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 225 /* FunctionDeclaration */ + ? 226 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 223 /* VariableDeclaration */ + ? 224 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -36722,6 +37061,23 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + ts.Debug.assert(node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target", "Unrecognized meta-property."); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 150 /* Constructor */) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -36863,7 +37219,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 204 /* Block */) { + if (func.body.kind !== 205 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -36953,7 +37309,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 219 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -37015,7 +37371,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -37095,6 +37451,7 @@ var ts; if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } @@ -37115,7 +37472,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204 /* Block */) { + if (node.body.kind === 205 /* Block */) { checkSourceElement(node.body); } else { @@ -37184,7 +37541,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237 /* NamespaceImport */; + return declaration && declaration.kind === 238 /* NamespaceImport */; } } } @@ -37201,6 +37558,16 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 177 /* PropertyAccessExpression */ && expr.kind !== 178 /* ElementAccessExpression */) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { @@ -37276,8 +37643,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37294,8 +37661,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37304,8 +37671,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { + var t = types_18[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37363,7 +37730,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 258 /* PropertyAssignment */ || property.kind === 259 /* ShorthandPropertyAssignment */) { var name_20 = property.name; if (name_20.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(name_20); @@ -37378,7 +37745,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 259 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37390,7 +37757,7 @@ var ts; error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } - else if (property.kind === 259 /* SpreadAssignment */) { + else if (property.kind === 260 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -37463,7 +37830,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 259 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37493,7 +37860,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 /* SpreadAssignment */ ? + var error = target.parent.kind === 260 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37530,8 +37897,8 @@ var ts; case 176 /* ObjectLiteralExpression */: case 187 /* TypeOfExpression */: case 201 /* NonNullExpression */: - case 247 /* JsxSelfClosingElement */: - case 246 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: return true; case 193 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && @@ -38038,6 +38405,8 @@ var ts; return checkAssertion(node); case 201 /* NonNullExpression */: return checkNonNullAssertion(node); + case 202 /* MetaProperty */: + return checkMetaProperty(node); case 186 /* DeleteExpression */: return checkDeleteExpression(node); case 188 /* VoidExpression */: @@ -38058,13 +38427,13 @@ var ts; return undefinedWideningType; case 195 /* YieldExpression */: return checkYieldExpression(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return checkJsxExpression(node); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return checkJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -38118,7 +38487,7 @@ var ts; return false; } return node.kind === 149 /* MethodDeclaration */ || - node.kind === 225 /* FunctionDeclaration */ || + node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { @@ -38179,14 +38548,14 @@ var ts; switch (node.parent.kind) { case 185 /* ArrowFunction */: case 153 /* CallSignature */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 158 /* FunctionType */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; } } } @@ -38215,7 +38584,7 @@ var ts; if (node.kind === 155 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || + else if (node.kind === 158 /* FunctionType */ || node.kind === 226 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || node.kind === 154 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); @@ -38349,7 +38718,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227 /* InterfaceDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */) { var 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 @@ -38445,7 +38814,7 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) { + else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 226 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -38480,7 +38849,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38641,8 +39010,8 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 227 /* InterfaceDeclaration */ && - n.parent.kind !== 226 /* ClassDeclaration */ && + if (n.parent.kind !== 228 /* InterfaceDeclaration */ && + n.parent.kind !== 227 /* ClassDeclaration */ && n.parent.kind !== 197 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { @@ -38770,7 +39139,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 228 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -38781,7 +39150,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 226 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -38903,16 +39272,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -38924,7 +39293,8 @@ var ts; } function checkNonThenableType(type, location, message) { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + var apparentType = getApparentType(type); + if ((apparentType.flags & (1 /* Any */ | 8192 /* Never */)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -39175,7 +39545,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -39238,7 +39608,7 @@ var ts; checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -39271,6 +39641,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39342,28 +39713,28 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261 /* SourceFile */: - case 230 /* ModuleDeclaration */: + case 262 /* SourceFile */: + case 231 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 205 /* Block */: + case 233 /* CaseBlock */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; case 150 /* Constructor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: @@ -39387,7 +39758,7 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + if (node.parent.kind !== 228 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { @@ -39420,9 +39791,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 212 /* ForInStatement */ || - declaration.parent.parent.kind === 213 /* ForOfStatement */)) { + if (declaration.kind === 224 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 213 /* ForInStatement */ || + declaration.parent.parent.kind === 214 /* ForOfStatement */)) { return; } } @@ -39485,7 +39856,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -39494,7 +39865,7 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 204 /* Block */) { + if (node.kind === 205 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39542,6 +39913,11 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; @@ -39559,6 +39935,22 @@ var ts; current = current.parent; } } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { + var isDeclaration_2 = node.kind !== 70 /* Identifier */; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -39570,8 +39962,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70 /* Identifier */; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70 /* Identifier */; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -39588,12 +39980,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39603,12 +39995,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39643,7 +40035,7 @@ var ts; // 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 === 223 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 224 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -39653,17 +40045,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 206 /* 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) var namesShareScope = container && - (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 231 /* ModuleBlock */ || - container.kind === 230 /* ModuleDeclaration */ || - container.kind === 261 /* SourceFile */); + (container.kind === 205 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 232 /* ModuleBlock */ || + container.kind === 231 /* ModuleDeclaration */ || + container.kind === 262 /* 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 @@ -39708,7 +40100,8 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */) { + if (symbol.valueDeclaration.kind === 144 /* Parameter */ || + symbol.valueDeclaration.kind === 174 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -39756,7 +40149,7 @@ var ts; } } if (node.kind === 174 /* BindingElement */) { - if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements @@ -39764,13 +40157,13 @@ var ts; checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); var name_24 = node.propertyName || node.name; var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -39785,7 +40178,7 @@ var ts; // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39796,7 +40189,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39819,18 +40212,19 @@ var ts; if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) || - (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 144 /* Parameter */ && right.kind === 224 /* VariableDeclaration */) || + (left.kind === 224 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -39881,7 +40275,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206 /* EmptyStatement */) { + if (node.thenStatement.kind === 207 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -39901,12 +40295,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 225 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -39929,7 +40323,7 @@ var ts; // 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 === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { @@ -39968,7 +40362,7 @@ var ts; // 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 === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -40318,7 +40712,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 255 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40330,7 +40724,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 254 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -40361,7 +40755,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 220 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -40501,7 +40895,7 @@ var ts; /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -40522,7 +40916,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 227 /* ClassDeclaration */ || declaration.kind === 228 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -40555,6 +40949,7 @@ var ts; if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40590,7 +40985,7 @@ var ts; checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) { + baseType_1.symbol.valueDeclaration.kind === 227 /* ClassDeclaration */) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -40751,7 +41146,7 @@ var 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++) { + for (var i = 0; i < list1.length; i++) { var tp1 = list1[i]; var tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -40811,7 +41206,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -40953,6 +41348,7 @@ var ts; } return undefined; case 8 /* NumericLiteral */: + checkGrammarNumericLiteral(e); return +e.text; case 183 /* ParenthesizedExpression */: return evalConstant(e.expression); @@ -41033,6 +41429,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -41061,7 +41458,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 229 /* EnumDeclaration */) { + if (declaration.kind !== 230 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -41084,8 +41481,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 226 /* ClassDeclaration */ || - (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 227 /* ClassDeclaration */ || + (declaration.kind === 226 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -41149,7 +41546,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 227 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -41200,23 +41597,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 241 /* ExportAssignment */: + case 242 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: var name_25 = node.name; if (ts.isBindingPattern(name_25)) { for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { @@ -41227,12 +41624,12 @@ var ts; break; } // fallthrough - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 225 /* FunctionDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 226 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41273,9 +41670,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 242 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41308,7 +41705,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 /* ExportSpecifier */ ? + var message = node.kind === 244 /* ExportSpecifier */ ? 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)); @@ -41336,7 +41733,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41393,8 +41790,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41408,7 +41805,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 262 /* SourceFile */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 231 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41434,9 +41831,14 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 262 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 231 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } // Grammar checking @@ -41510,7 +41912,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 226 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || !!declaration.body; } } @@ -41523,10 +41925,10 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -41575,71 +41977,71 @@ var ts; return checkIndexedAccessType(node); case 170 /* MappedType */: return checkMappedType(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return checkBlock(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return checkVariableStatement(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return checkExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return checkIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return checkDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return checkWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return checkForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return checkForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return checkForOfStatement(node); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return checkReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return checkWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return checkSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return checkLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return checkThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return checkTryStatement(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return checkVariableDeclaration(node); case 174 /* BindingElement */: return checkBindingElement(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return checkClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return checkImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return checkExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return checkExportAssignment(node); - case 206 /* EmptyStatement */: + case 207 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -41696,6 +42098,7 @@ var ts; // Grammar checking checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -41715,6 +42118,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1 /* TypeChecked */; } } @@ -41772,7 +42179,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 218 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -41795,14 +42202,14 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; case 197 /* ClassExpression */: @@ -41812,8 +42219,8 @@ var ts; } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -41872,10 +42279,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 143 /* TypeParameter */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: return true; } } @@ -41885,7 +42292,7 @@ var ts; while (node.parent && node.parent.kind === 141 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 273 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -41912,10 +42319,10 @@ var ts; while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 235 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 241 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -41939,13 +42346,13 @@ var ts; default: } } - if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 241 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 235 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -41995,10 +42402,10 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 273 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 250 /* JsxAttribute */) { + else if (entityName.parent.kind === 251 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 156 /* TypePredicate */) { @@ -42008,7 +42415,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -42066,7 +42473,7 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) && + ((node.parent.kind === 236 /* ImportDeclaration */ || node.parent.kind === 242 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -42093,7 +42500,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 258 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 259 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -42159,7 +42566,7 @@ var ts; // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 213 /* ForOfStatement */) { + if (expr.parent.kind === 214 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } @@ -42171,7 +42578,7 @@ var ts; } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 257 /* PropertyAssignment */) { + if (expr.parent.kind === 258 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -42312,7 +42719,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 262 /* SourceFile */) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -42369,7 +42776,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 205 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42415,16 +42822,16 @@ var ts; return true; } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42434,7 +42841,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 262 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42500,7 +42907,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 260 /* EnumMember */) { + if (node.kind === 261 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42601,9 +43008,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent_12 = reference.parent; + if (ts.isDeclaration(parent_12) && reference === parent_12.name) { + location = getDeclarationContainer(parent_12); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42732,15 +43139,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 262 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -42760,7 +43167,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 262 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -42946,7 +43353,7 @@ var ts; } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) { + if (node.kind !== 230 /* EnumDeclaration */ && node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -42972,7 +43379,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -42995,7 +43402,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 144 /* Parameter */) { @@ -43031,7 +43438,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 144 /* Parameter */) { @@ -43046,13 +43453,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -43062,14 +43469,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226 /* ClassDeclaration */) { + if (node.kind !== 227 /* ClassDeclaration */) { if (node.kind !== 149 /* MethodDeclaration */ && node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 151 /* GetAccessor */ && node.kind !== 152 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 227 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -43111,7 +43518,7 @@ var ts; } return; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { @@ -43145,29 +43552,29 @@ var ts; case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 155 /* IndexSignature */: - case 230 /* ModuleDeclaration */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: + case 231 /* ModuleDeclaration */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: + case 241 /* ExportAssignment */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 144 /* Parameter */: return false; default: - if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return false; } switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 227 /* InterfaceDeclaration */: - case 205 /* VariableStatement */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 206 /* VariableStatement */: + case 229 /* TypeAliasDeclaration */: return true; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -43181,7 +43588,7 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 149 /* MethodDeclaration */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: if (!node.asteriskToken) { @@ -43392,7 +43799,7 @@ var ts; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ || + ts.Debug.assert(node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || node.kind === 149 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { @@ -43419,7 +43826,7 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */) { + if (prop.kind === 260 /* SpreadAssignment */) { continue; } var name_28 = prop.name; @@ -43427,7 +43834,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_28); } - if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 259 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43450,7 +43857,7 @@ var ts; // 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 = void 0; - if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) { + if (prop.kind === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_28.kind === 8 /* NumericLiteral */) { @@ -43500,7 +43907,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251 /* JsxSpreadAttribute */) { + if (attr.kind === 252 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -43512,7 +43919,7 @@ var ts; return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 253 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43521,7 +43928,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43536,20 +43943,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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 === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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); @@ -43642,7 +44049,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 228 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 161 /* TypeLiteral */) { @@ -43656,11 +44063,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: 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 === 214 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 215 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -43668,8 +44075,8 @@ var ts; return false; } break; - case 218 /* SwitchStatement */: - if (node.kind === 215 /* BreakStatement */ && !node.label) { + case 219 /* SwitchStatement */: + if (node.kind === 216 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -43684,13 +44091,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 216 /* BreakStatement */ ? 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 === 215 /* BreakStatement */ + var message = node.kind === 216 /* BreakStatement */ ? 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); @@ -43717,7 +44124,7 @@ var ts; expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) { + if (node.parent.parent.kind !== 213 /* ForInStatement */ && node.parent.parent.kind !== 214 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -43782,15 +44189,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return false; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -43805,6 +44212,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -43845,7 +44259,7 @@ var ts; return true; } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 228 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43878,13 +44292,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 227 /* InterfaceDeclaration */ || - node.kind === 228 /* TypeAliasDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 241 /* ExportDeclaration */ || - node.kind === 240 /* ExportAssignment */ || - node.kind === 233 /* NamespaceExportDeclaration */ || + if (node.kind === 228 /* InterfaceDeclaration */ || + node.kind === 229 /* TypeAliasDeclaration */ || + node.kind === 236 /* ImportDeclaration */ || + node.kind === 235 /* ImportEqualsDeclaration */ || + node.kind === 242 /* ExportDeclaration */ || + node.kind === 241 /* ExportAssignment */ || + node.kind === 234 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -43893,7 +44307,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 206 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -43919,7 +44333,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 205 /* Block */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -43932,8 +44346,22 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1 /* ES5 */) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 171 /* LiteralType */)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 261 /* EnumMember */)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37 /* MinusToken */; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -43997,31 +44425,31 @@ var ts; _a[201 /* NonNullExpression */] = [ { name: "expression", test: ts.isLeftHandSideExpression } ], - _a[229 /* EnumDeclaration */] = [ + _a[230 /* EnumDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "members", test: ts.isEnumMember } ], - _a[230 /* ModuleDeclaration */] = [ + _a[231 /* ModuleDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isModuleName }, { name: "body", test: ts.isModuleBody } ], - _a[231 /* ModuleBlock */] = [ + _a[232 /* ModuleBlock */] = [ { name: "statements", test: ts.isStatement } ], - _a[234 /* ImportEqualsDeclaration */] = [ + _a[235 /* ImportEqualsDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "moduleReference", test: ts.isModuleReference } ], - _a[245 /* ExternalModuleReference */] = [ + _a[246 /* ExternalModuleReference */] = [ { name: "expression", test: ts.isExpression, optional: true } ], - _a[260 /* EnumMember */] = [ + _a[261 /* EnumMember */] = [ { name: "name", test: ts.isPropertyName }, { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } ], @@ -44059,11 +44487,11 @@ var ts; var result = initial; switch (node.kind) { // Leaf nodes - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: + case 204 /* SemicolonClassElement */: + case 207 /* EmptyStatement */: case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: - case 293 /* NotEmittedStatement */: + case 223 /* DebuggerStatement */: + case 294 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -44211,73 +44639,73 @@ var ts; result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 204 /* Block */: + case 205 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 208 /* IfStatement */: + case 209 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209 /* DoStatement */: + case 210 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 210 /* WhileStatement */: - case 217 /* WithStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 211 /* ForStatement */: + case 212 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 221 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221 /* TryStatement */: + case 222 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44286,7 +44714,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44294,97 +44722,97 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236 /* ImportClause */: + case 237 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // fall-through - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 256 /* CatchClause */: + case 257 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; default: @@ -44542,10 +44970,10 @@ var ts; return node; } switch (node.kind) { - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: + case 204 /* SemicolonClassElement */: + case 207 /* EmptyStatement */: case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: // No need to visit nodes with no children. return node; // Names @@ -44620,107 +45048,107 @@ var ts; case 199 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 204 /* Block */: + case 205 /* Block */: return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238 /* NamedImports */: + case 239 /* NamedImports */: return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 242 /* NamedExports */: + case 243 /* NamedExports */: return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -44836,7 +45264,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 199 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -45412,15 +45840,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: + case 262 /* SourceFile */: + case 233 /* CaseBlock */: + case 232 /* ModuleBlock */: + case 205 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: + case 226 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45467,13 +45895,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45493,11 +45921,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 241 /* ExportDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 236 /* ImportClause */ || - (node.kind === 234 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 245 /* ExternalModuleReference */)) { + if (node.kind === 242 /* ExportDeclaration */ || + node.kind === 236 /* ImportDeclaration */ || + node.kind === 237 /* ImportClause */ || + (node.kind === 235 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 246 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45539,7 +45967,7 @@ var ts; case 149 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -45608,18 +46036,18 @@ var ts; // TypeScript index signatures are elided. case 145 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. case 147 /* PropertyDeclaration */: // TypeScript property declarations are elided. return undefined; case 150 /* Constructor */: return visitConstructor(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45641,7 +46069,7 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: @@ -45660,7 +46088,7 @@ var ts; case 152 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: @@ -45694,18 +46122,18 @@ var ts; case 201 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -46113,7 +46541,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -46622,7 +47050,7 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; case 149 /* MethodDeclaration */: @@ -46645,7 +47073,7 @@ var ts; return serializeTypeNode(node.type); case 152 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: case 149 /* MethodDeclaration */: return ts.createIdentifier("Function"); @@ -46730,6 +47158,9 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: return ts.createVoidZero(); case 166 /* ParenthesizedType */: return serializeTypeNode(node.type); @@ -46768,34 +47199,7 @@ var ts; return serializeTypeReferenceNode(node); case 165 /* IntersectionType */: case 164 /* UnionType */: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - // Non identifier - if (serializedIndividual.kind !== 70 /* Identifier */) { - serializedUnion = undefined; - break; - } - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - // Different types - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - // If we were able to find common type - if (serializedUnion) { - return serializedUnion; - } - } - // Fallthrough + return serializeUnionOrIntersectionType(node); case 160 /* TypeQuery */: case 168 /* TypeOperator */: case 169 /* IndexedAccessType */: @@ -46810,6 +47214,37 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + // Different types + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + // If we were able to find common type, use it + return serializedUnion; + } /** * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with * decorator type metadata. @@ -47411,7 +47846,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 229 /* EnumDeclaration */) { + if (node.kind === 230 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47530,8 +47965,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231 /* ModuleBlock */) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 232 /* ModuleBlock */) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -47576,13 +48011,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 231 /* ModuleBlock */) { + if (body.kind !== 232 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -47623,7 +48058,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 237 /* NamespaceImport */) { + if (node.kind === 238 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -47855,16 +48290,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); + context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(230 /* ModuleDeclaration */); + context.enableEmitNotification(231 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 230 /* EnumDeclaration */; } /** * Hook for node emit. @@ -47960,9 +48395,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 261 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */); + if (container && container.kind !== 262 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 231 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 230 /* EnumDeclaration */); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); } @@ -48082,11 +48517,11 @@ var ts; return visitObjectLiteralExpression(node); case 192 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitForOfStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); case 188 /* VoidExpression */: return visitVoidExpression(node); @@ -48098,7 +48533,7 @@ var ts; return visitGetAccessorDeclaration(node); case 152 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); @@ -48106,7 +48541,7 @@ var ts; return visitArrowFunction(node); case 144 /* Parameter */: return visitParameter(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return visitExpressionStatement(node); case 183 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); @@ -48119,7 +48554,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { + if (e.kind === 260 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -48131,7 +48566,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257 /* PropertyAssignment */) { + if (e.kind === 258 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -48361,11 +48796,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48375,11 +48810,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return visitJsxExpression(node); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48440,7 +48875,10 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; } - else if (node.kind === 252 /* JsxExpression */) { + else if (node.kind === 253 /* JsxExpression */) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } return visitJsxExpression(node); } else { @@ -48522,7 +48960,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246 /* JsxElement */) { + if (node.kind === 247 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -48868,7 +49306,7 @@ var ts; case 149 /* MethodDeclaration */: // ES2017 method declarations may be 'async' return visitMethodDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // ES2017 function declarations may be 'async' return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: @@ -49032,7 +49470,7 @@ var ts; context.enableSubstitution(177 /* PropertyAccessExpression */); context.enableSubstitution(178 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(226 /* ClassDeclaration */); + context.enableEmitNotification(227 /* ClassDeclaration */); context.enableEmitNotification(149 /* MethodDeclaration */); context.enableEmitNotification(151 /* GetAccessor */); context.enableEmitNotification(152 /* SetAccessor */); @@ -49089,7 +49527,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 226 /* ClassDeclaration */ + return kind === 227 /* ClassDeclaration */ || kind === 150 /* Constructor */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ @@ -49299,6 +49737,82 @@ var ts; */ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); + // Facts we track as we traverse the tree + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + // + // Ancestor facts + // + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + // + // Ancestor masks + // + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + // A source file is a top-level block scope. + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + // Arrow functions are lexically scoped to their container, but are new block scopes. + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + // 'for' statements are new block scopes and have special handling for 'let' declarations. + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + // Blocks (other than function bodies) are new block scopes. + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + // Computed property names track subtree flags differently than their containing members. + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + // + // Subtree facts + // + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + // + // Subtree masks + // + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); @@ -49308,15 +49822,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; /** * Used to track if we are emitting body of the converted loop */ @@ -49334,185 +49840,116 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0 /* None */; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + **/ + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */; + return ancestorFacts; } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - // keep track of the enclosing variable statement when in the context of - // variable statements, variable declarations, binding elements, and binding - // patterns. - switch (currentNode.kind) { - case 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + **/ + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; + return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ + && node.kind === 217 /* ReturnStatement */ + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64 /* ES2015 */) !== 0 || - node.kind === 219 /* LabeledStatement */ || - (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && ts.isStatement(node)) + || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216 /* ReturnStatement */: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - return visitBreakOrContinueStatement(node); - case 98 /* ThisKeyword */: - return visitThisKeyword(node); - case 70 /* Identifier */: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96 /* SuperKeyword */) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); case 197 /* ClassExpression */: return visitClassExpression(node); case 144 /* Parameter */: return visitParameter(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 185 /* ArrowFunction */: return visitArrowFunction(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* LabeledStatement */: + case 219 /* SwitchStatement */: + return visitSwitchStatement(node); + case 233 /* CaseBlock */: + return visitCaseBlock(node); + case 205 /* Block */: + return visitBlock(node, /*isFunctionBody*/ false); + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: + return visitBreakOrContinueStatement(node); + case 220 /* LabeledStatement */: return visitLabeledStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 207 /* ExpressionStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); + case 212 /* ForStatement */: + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForInStatement */: + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); + case 214 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 208 /* ExpressionStatement */: return visitExpressionStatement(node); case 176 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitCatchClause(node); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); + case 142 /* ComputedPropertyName */: + return visitComputedPropertyName(node); case 175 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); case 179 /* CallExpression */: @@ -49537,54 +49974,82 @@ var ts; case 196 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: - return visitSuperKeyword(); - case 195 /* YieldExpression */: - // `yield` will be handled by a generators transform. - return ts.visitEachChild(node, visitor, context); + return visitSuperKeyword(/*isExpressionOfCall*/ false); + case 98 /* ThisKeyword */: + return visitThisKeyword(node); + case 202 /* MetaProperty */: + return visitMetaProperty(node); case 149 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 205 /* VariableStatement */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return visitAccessorDeclaration(node); + case 206 /* VariableStatement */: return visitVariableStatement(node); + case 217 /* ReturnStatement */: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); var statements = []; startLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8 /* Return */; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8 /* Return */; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2 /* ArrowFunction */) { + // if the enclosing function is an ArrowFunction then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -49604,13 +50069,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 216 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 216 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -49621,7 +50086,7 @@ var ts; } } else { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 216 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -49813,6 +50278,9 @@ var ts; * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration( @@ -49826,6 +50294,8 @@ var ts; ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; } /** * Transforms the parameters of the constructor declaration of a class. @@ -49871,26 +50341,31 @@ var ts; addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); // The last statement expression was replaced. Skip it. if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1 /* ReplaceSuperCapture */) { + hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); + } var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ constructor ? constructor.body.statements : node.members), /*location*/ constructor ? constructor.body : node, @@ -49907,17 +50382,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 216 /* ReturnStatement */) { + if (statement.kind === 217 /* ReturnStatement */) { return true; } - else if (statement.kind === 208 /* IfStatement */) { + else if (statement.kind === 209 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204 /* Block */) { + else if (statement.kind === 205 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -49930,9 +50405,9 @@ var ts; * * @returns The new statement offset into the `statements` array. */ - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { // If this isn't a derived class, just capture 'this' for arrow functions if necessary. - if (!hasExtendsClause) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -49975,9 +50450,8 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } // Return the result if we have an immediate super() call on the last statement, @@ -49996,18 +50470,18 @@ var ts; return 2 /* ReplaceWithReturn */; } // Perform the capture. - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; } return 0 /* NoReplacement */; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -50202,6 +50676,46 @@ var ts; ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384 /* NewTarget */) { + var newTarget = void 0; + switch (node.kind) { + case 185 /* ArrowFunction */: + return statements; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + // Methods and accessors cannot be constructors, so 'new.target' will + // always return 'undefined'. + newTarget = ts.createVoidZero(); + break; + case 150 /* Constructor */: + // Class constructors can only be called with `new`, so `this.constructor` + // should be relatively safe to use. + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); + break; + case 226 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + // Functions can be called or constructed, and may have a `this` due to + // being a member or when calling an imported function via `other_1.f()`. + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", + /*type*/ undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -50213,17 +50727,17 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; case 149 /* MethodDeclaration */: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 151 /* GetAccessor */: case 152 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; case 150 /* Constructor */: @@ -50249,11 +50763,12 @@ var ts; * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); - var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); ts.setEmitFlags(memberFunction, 1536 /* NoComments */); ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), @@ -50264,6 +50779,7 @@ var ts; // No source map should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 48 /* NoSourceMap */); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return statement; } /** @@ -50272,8 +50788,8 @@ var ts; * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false), /*location*/ ts.getSourceMapRange(accessors.firstAccessor)); // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the @@ -50287,8 +50803,9 @@ var ts; * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); @@ -50299,7 +50816,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -50307,7 +50824,7 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); @@ -50324,6 +50841,7 @@ var ts; if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return call; } /** @@ -50335,6 +50853,9 @@ var ts; if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); var func = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -50343,6 +50864,8 @@ var ts; /*type*/ undefined, transformFunctionBody(node), node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8 /* CapturesThis */); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; return func; } /** @@ -50351,12 +50874,24 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var ancestorFacts = ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */ + ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Visits a FunctionDeclaration node. @@ -50364,12 +50899,22 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Transforms a function-like node into a FunctionExpression. @@ -50378,18 +50923,24 @@ var ts; * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */) + ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression( + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body, location), /*original*/ node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; } /** * Transforms the body of a function-like node. @@ -50451,6 +51002,7 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); // If we added any final generated statements, this must be a multi-line block if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; @@ -50465,6 +51017,23 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, /*copyOnWrite*/ true), + /*location*/ updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + // A function body is not a block scope. + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */ + ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) + : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -50511,9 +51080,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { + var ancestorFacts = enterSubtree(0 /* None */, ts.hasModifier(node, 1 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3 /* BlockScoped */) === 0) { // we are inside a converted loop - hoist variable declarations var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -50531,14 +51103,18 @@ var ts; } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); + updated = ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } /** * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`). @@ -50546,25 +51122,28 @@ var ts; * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node) { - if (node.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64 /* ES2015 */) { + if (node.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 /* ContainsBindingPattern */ - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } /** * Gets a value indicating whether we should emit an explicit initializer for a variable @@ -50615,18 +51194,16 @@ var ts; var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */ - && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */ + && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0)); return emitExplicitInitializer; } /** @@ -50655,55 +51232,52 @@ var ts; * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern. + var ancestorFacts = enterSubtree(32 /* ExportedVariableStatement */, 0 /* None */); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, - /*value*/ undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, (ancestorFacts & 32 /* ExportedVariableStatement */) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels[node.label.text] = node.label.text; + } + function resetLabel(node) { + convertedLoopState.labels[node.label.text] = undefined; + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, convertForOfToFor); } - function convertForOfToFor(node, convertedLoopBodyStatements) { + function convertForOfToFor(node, outermostLabeledStatement, convertedLoopBodyStatements) { // The following ES6 code: // // for (let v of expr) { } @@ -50815,7 +51389,20 @@ var ts; /*location*/ node); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); - return forStatement; + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 212 /* ForStatement */: + return visitForStatement(node, outermostLabeledStatement); + case 213 /* ForInStatement */: + return visitForInStatement(node, outermostLabeledStatement); + case 214 /* ForOfStatement */: + return visitForOfStatement(node, outermostLabeledStatement); + } } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50829,31 +51416,40 @@ var ts; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 /* ContainsYield */ - || property.name.kind === 142 /* ComputedPropertyName */) { + if ((property.transformFlags & 16777216 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 142 /* ComputedPropertyName */) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - // 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 temp = ts.createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 32768 /* Indented */)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + // 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 temp = ts.createTempVariable(hoistVariableDeclaration); + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), + /*location*/ undefined, node.multiLine), 32768 /* Indented */)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; @@ -50880,7 +51476,7 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { @@ -50889,7 +51485,9 @@ var ts; saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; } - var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -50898,11 +51496,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 225 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -50939,7 +51537,7 @@ var ts; } } startLexicalEnvironment(); - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock); var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; @@ -50951,11 +51549,13 @@ var ts; ts.addRange(statements_4, lexicalEnvironment); loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); } - if (!ts.isBlock(loopBody)) { + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + var isAsyncBlockContainingAwait = hierarchyFacts & 4 /* AsyncFunctionBody */ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -51038,25 +51638,24 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); + var clone_4 = ts.getMutableClone(node); // clean statement part - loop.statement = undefined; + clone_4.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = ts.visitEachChild(loop, visitor, context); + clone_4 = ts.visitEachChild(clone_4, visitor, context); // set loop statement - loop.statement = ts.createBlock(convertedLoopBodyStatements, + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, /*location*/ undefined, /*multiline*/ true); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 /* LabeledStatement */ - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -51186,18 +51785,18 @@ var ts; case 152 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257 /* PropertyAssignment */: + case 149 /* MethodDeclaration */: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 258 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149 /* MethodDeclaration */: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -51241,22 +51840,32 @@ var ts; * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container), /*location*/ method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); - var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); + var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -51273,11 +51882,26 @@ var ts; // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); + var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, /*location*/ node); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return updated; + } /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * @@ -51287,6 +51911,12 @@ var ts; return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), /*location*/ node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0 /* ComputedPropertyNameExcludes */, 8192 /* ComputedPropertyNameIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 32768 /* NewTargetInComputedPropertyName */ : 0 /* None */); + return updated; + } /** * Visits a YieldExpression node. * @@ -51302,8 +51932,11 @@ var ts; * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node) { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & 64 /* ES2015 */) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } /** * Visits a CallExpression that contains either a spread element or `super`. @@ -51311,7 +51944,11 @@ var ts; * @param node a CallExpression. */ function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & 64 /* ES2015 */) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); @@ -51338,7 +51975,7 @@ var ts; // _super.apply(this, a.concat([b])) // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); } else { // [source] @@ -51350,18 +51987,18 @@ var ts; // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), /*location*/ node); } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } /** * Visits a NewExpression that contains a spread element. @@ -51369,16 +52006,18 @@ var ts; * @param node A NewExpression node. */ function visitNewExpression(node) { - // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), - /*typeArguments*/ undefined, []); + if (node.transformFlags & 524288 /* ContainsSpread */) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), + /*typeArguments*/ undefined, []); + } + return ts.visitEachChild(node, visitor, context); } /** * Transforms an array of Expression nodes that contains a SpreadExpression. @@ -51581,27 +52220,40 @@ var ts; /** * Visits the `super` keyword */ - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */) - && currentParent.kind !== 179 /* CallExpression */ + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 /* NonStaticClassElement */ + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target") { + if (hierarchyFacts & 8192 /* ComputedPropertyName */) { + hierarchyFacts |= 32768 /* NewTargetInComputedPropertyName */; + } + else { + hierarchyFacts |= 16384 /* NewTarget */; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } /** * Called by the printer just before a node is printed. * * @param node The node to be printed. */ function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ + ? 65 /* FunctionIncludes */ | 16 /* CapturesThis */ + : 65 /* FunctionIncludes */); + previousOnEmitNode(emitContext, node, emitCallback); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return; } previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; } /** * Enables a more costly code path for substitutions when we determine a source file @@ -51627,7 +52279,7 @@ var ts; context.enableEmitNotification(152 /* SetAccessor */); context.enableEmitNotification(185 /* ArrowFunction */); context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(225 /* FunctionDeclaration */); + context.enableEmitNotification(226 /* FunctionDeclaration */); } } /** @@ -51670,9 +52322,9 @@ var ts; var parent = node.parent; switch (parent.kind) { case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 223 /* VariableDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 224 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -51713,8 +52365,7 @@ var ts; */ function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { + && hierarchyFacts & 16 /* CapturesThis */) { return ts.createIdentifier("_this", /*location*/ node); } return node; @@ -51731,7 +52382,7 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; @@ -51763,7 +52414,7 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); /// @@ -52036,13 +52687,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitWhileStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -52055,24 +52706,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); case 151 /* GetAccessor */: case 152 /* SetAccessor */: return visitAccessorDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitForInStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return visitBreakStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return visitContinueStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -52120,7 +52771,7 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); @@ -52405,10 +53056,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -52553,7 +53204,7 @@ var ts; emitYield(expression, /*location*/ node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** * Visits an ArrayLiteralExpression that contains a YieldExpression. @@ -52667,10 +53318,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -52737,35 +53388,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204 /* Block */: + case 205 /* Block */: return transformAndEmitBlock(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return transformAndEmitIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return transformAndEmitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return transformAndEmitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return transformAndEmitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); @@ -52785,7 +53436,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name_37 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_37, variable.name); + hoistVariableDeclaration(name_37); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -52828,7 +53481,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -53185,7 +53838,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 255 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -53198,7 +53851,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 254 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -53359,12 +54012,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_37) { - var clone_6 = ts.getMutableClone(name_37); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_38) { + var clone_7 = ts.getMutableClone(name_38); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -54249,9 +54902,9 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), operationLocation)); + : [createInstruction(2 /* Return */)]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a Break operation to the current label's statement list. @@ -54261,10 +54914,10 @@ var ts; */ function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation)); + ]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a BreakWhenTrue operation to the current label's statement list. @@ -54274,10 +54927,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a BreakWhenFalse operation to the current label's statement list. @@ -54287,10 +54940,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a Yield operation to the current label's statement list. @@ -54300,9 +54953,9 @@ var ts; */ function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4 /* Yield */), expression] - : [createInstruction(4 /* Yield */)]), operationLocation)); + : [createInstruction(4 /* Yield */)]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a YieldStar instruction to the current label's statement list. @@ -54312,10 +54965,10 @@ var ts; */ function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(5 /* YieldStar */), expression - ]), operationLocation)); + ]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes an Endfinally instruction to the current label's statement list. @@ -54411,10 +55064,22 @@ var ts; * @param context Context and state information for the transformation. */ function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + // enable emit notification only if using --jsx preserve + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 /* Preserve */) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(249 /* JsxOpeningElement */); + context.enableEmitNotification(250 /* JsxClosingElement */); + context.enableEmitNotification(248 /* JsxSelfClosingElement */); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(257 /* PropertyAssignment */); + context.enableSubstitution(258 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -54424,6 +55089,22 @@ var ts; function transformSourceFile(node) { return node; } + /** + * Called by the printer just before a node is printed. + * + * @param node The node to be printed. + */ + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 249 /* JsxOpeningElement */: + case 250 /* JsxClosingElement */: + case 248 /* JsxSelfClosingElement */: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } /** * Hooks node substitutions. * @@ -54431,6 +55112,9 @@ var ts; * @param node The node to substitute. */ function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } node = previousOnSubstituteNode(emitContext, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); @@ -54490,7 +55174,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261 /* SourceFile */); + context.enableEmitNotification(262 /* SourceFile */); context.enableSubstitution(70 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -54517,10 +55201,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -54595,7 +55279,7 @@ var ts; context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. @@ -54815,7 +55499,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 242 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -54840,7 +55524,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241 /* ExportDeclaration */) { + if (externalImport.kind !== 242 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -54921,19 +55605,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -54983,15 +55667,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -55169,7 +55853,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 262 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -55233,7 +55917,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -55289,10 +55973,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 239 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -55471,43 +56155,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitForOfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitWhileStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitLabeledStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return visitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitSwitchStatement(node); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return visitCaseBlock(node); - case 253 /* CaseClause */: + case 254 /* CaseClause */: return visitCaseClause(node); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return visitDefaultClause(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return visitTryStatement(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitCatchClause(node); - case 204 /* Block */: + case 205 /* Block */: return visitBlock(node); - case 295 /* MergeDeclarationMarker */: + case 296 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: + case 297 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -55735,7 +56419,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261 /* SourceFile */; + return container !== undefined && container.kind === 262 /* SourceFile */; } else { return false; @@ -55768,7 +56452,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -55941,7 +56625,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -55997,8 +56681,8 @@ var ts; context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -56052,26 +56736,6 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true); - } - /** - * Transforms a SourceFile into a UMD module. - * - * @param node The SourceFile node. - */ - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); - } - /** - * Transforms a SourceFile into an AMD or UMD module. - * - * @param node The SourceFile node. - * @param define The expression used to define the module. - * @param moduleName An expression for the module name, if available. - * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies. - */ - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { // An AMD define function has the following shape: // // define(id?, dependencies?, factory); @@ -56092,7 +56756,7 @@ var ts; // /// // // we need to add modules without alias names to the end of the dependencies list - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; // Create an updated SourceFile: // // define(moduleName?, ["module1", "module2"], function ... @@ -56122,6 +56786,73 @@ var ts; ], /*location*/ node.statements)); } + /** + * Transforms a SourceFile into a UMD module. + * + * @param node The SourceFile node. + */ + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, [ + ts.createVariableDeclaration("v", + /*type*/ undefined, ts.createCall(ts.createIdentifier("factory"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1 /* SingleLine */) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], + /*location*/ undefined, + /*multiLine*/ true)); + // Create an updated SourceFile: + // + // (function (factory) { + // if (typeof module === "object" && typeof module.exports === "object") { + // var v = factory(require, exports); + // if (v !== undefined) module.exports = v; + // } + // else if (typeof define === 'function' && define.amd) { + // define(["require", "exports"], factory); + // } + // })(function ...) + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, + /*typeArguments*/ undefined, [ + // Add the module body function argument: + // + // function (require, exports) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ])) + ], + /*location*/ node.statements)); + } /** * Collect the additional asynchronous dependencies for the module. * @@ -56226,23 +56957,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); - case 295 /* MergeDeclarationMarker */: + case 296 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: + case 297 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -56554,7 +57285,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -56609,10 +57340,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 239 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56811,7 +57542,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = ts.createMap(); @@ -56899,7 +57630,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), /*location*/ node); } @@ -56910,8 +57641,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_38 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), + var name_39 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), /*location*/ node); } } @@ -57013,8 +57744,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - // emit output for the UMD helper function. - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); /// /// @@ -57521,7 +58250,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -57534,7 +58263,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -57713,7 +58442,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -57732,7 +58461,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 225 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -58045,7 +58774,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 236 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -58120,10 +58849,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223 /* VariableDeclaration */) { + if (declaration.kind === 224 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) { + else if (declaration.kind === 239 /* NamedImports */ || declaration.kind === 240 /* ImportSpecifier */ || declaration.kind === 237 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -58141,7 +58870,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 236 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -58151,12 +58880,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -58334,7 +59063,7 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 235 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); @@ -58456,9 +59185,9 @@ var ts; var count = 0; while (true) { count++; - var name_39 = baseName + "_" + count; - if (!(name_39 in currentIdentifiers)) { - return name_39; + var name_40 = baseName + "_" + count; + if (!(name_40 in currentIdentifiers)) { + return name_40; } } } @@ -58505,10 +59234,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 /* ImportEqualsDeclaration */ || - (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 235 /* ImportEqualsDeclaration */ || + (node.parent.kind === 262 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -58518,7 +59247,7 @@ var ts; }); } else { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -58536,23 +59265,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return writeVariableStatement(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return writeClassDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -58560,7 +59289,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 262 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -58569,7 +59298,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 228 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -58621,7 +59350,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 238 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -58645,7 +59374,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 238 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -58666,13 +59395,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 234 /* ImportEqualsDeclaration */) { + if (parent.kind === 235 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230 /* ModuleDeclaration */) { + else if (parent.kind === 231 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -58742,7 +59471,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231 /* ModuleBlock */) { + while (node.body && node.body.kind !== 232 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -58842,10 +59571,10 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 154 /* ConstructSignature */: @@ -58859,17 +59588,17 @@ var ts; if (ts.hasModifier(node.parent, 32 /* Static */)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 227 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -58907,7 +59636,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + if (node.parent.parent.kind === 227 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -58994,7 +59723,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 224 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -59022,7 +59751,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59038,7 +59767,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59212,13 +59941,13 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 226 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 226 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } @@ -59323,7 +60052,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59337,7 +60066,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59420,7 +60149,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 227 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59433,7 +60162,7 @@ var ts; 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; } - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59509,20 +60238,20 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 227 /* InterfaceDeclaration */: - case 226 /* ClassDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 226 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 228 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return emitExportDeclaration(node); case 150 /* Constructor */: case 149 /* MethodDeclaration */: @@ -59538,11 +60267,11 @@ var ts; case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return emitPropertyDeclaration(node); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return emitExportAssignment(node); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return emitSourceFile(node); } } @@ -59835,7 +60564,7 @@ var ts; var kind = node.kind; switch (kind) { // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: return emitSourceFile(node); } } @@ -59983,126 +60712,126 @@ var ts; case 174 /* BindingElement */: return emitBindingElement(node); // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return emitTemplateSpan(node); - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 204 /* Block */: + case 205 /* Block */: return emitBlock(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return emitVariableStatement(node); - case 206 /* EmptyStatement */: + case 207 /* EmptyStatement */: return emitEmptyStatement(); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return emitExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return emitIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return emitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return emitWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return emitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return emitForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return emitForOfStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return emitContinueStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return emitBreakStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return emitReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return emitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return emitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return emitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return emitThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return emitTryStatement(node); - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return emitClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return emitModuleBlock(node); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return emitCaseBlock(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return emitImportDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return emitImportClause(node); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return emitNamespaceImport(node); - case 238 /* NamedImports */: + case 239 /* NamedImports */: return emitNamedImports(node); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return emitImportSpecifier(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return emitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return emitExportDeclaration(node); - case 242 /* NamedExports */: + case 243 /* NamedExports */: return emitNamedExports(node); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return emitExportSpecifier(node); - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return; // Module references - case 245 /* ExternalModuleReference */: + case 246 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return emitJsxAttribute(node); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: return emitCaseClause(node); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return emitDefaultClause(node); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return emitHeritageClause(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 260 /* EnumMember */: + case 261 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -60191,16 +60920,16 @@ var ts; return emitAsExpression(node); case 201 /* NonNullExpression */: return emitNonNullExpression(node); + case 202 /* MetaProperty */: + return emitMetaProperty(node); // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: return emitJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 297 /* RawExpression */: - return writeLines(node.text); } } // @@ -60693,6 +61422,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } // // Misc // @@ -60741,27 +61475,27 @@ var ts; writeToken(18 /* OpenParenToken */, openParenPos, node); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 208 /* IfStatement */) { + if (node.elseStatement.kind === 209 /* IfStatement */) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -60771,7 +61505,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60783,7 +61517,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60793,7 +61527,7 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60803,11 +61537,11 @@ var ts; write(" of "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 225 /* VariableDeclarationList */) { emit(node); } else { @@ -60834,7 +61568,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos); @@ -60858,9 +61592,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -61046,7 +61783,7 @@ var ts; write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230 /* ModuleDeclaration */) { + while (body.kind === 231 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -61203,6 +61940,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -61438,8 +62178,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1 /* SingleLine */) { write(" "); emit(node); } @@ -61580,6 +62320,14 @@ var ts; write(getClosingBracket(format)); } } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + write(" "); + } + else { + writeLine(); + } + } function writeIfAny(nodes, text) { if (nodes && nodes.length > 0) { write(text); @@ -61771,10 +62519,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_40 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_40)) { + var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_41)) { tempFlags |= flags; - return name_40; + return name_41; } } while (true) { @@ -61782,11 +62530,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_41 = count < 26 + var name_42 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_41)) { - return name_41; + if (isUniqueName(name_42)) { + return name_42; } } } @@ -61826,6 +62574,12 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(0 /* Auto */); + } /** * Generates a unique name from a node. * @@ -61835,18 +62589,22 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 235 /* ImportDeclaration */: - case 241 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: + case 242 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: - case 240 /* ExportAssignment */: + case 226 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: + case 241 /* ExportAssignment */: return generateNameForExportDefault(); case 197 /* ClassExpression */: return generateNameForClassExpression(); + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); } @@ -61890,6 +62648,10 @@ var ts; // otherwise, return the original node for the source; return node; } + function generateNameForNodeCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } /** * Gets the generated identifier text from a generated identifier. * @@ -61900,8 +62662,7 @@ var ts; // Generated names generate unique names based on their original node // and are cached based on that node's id var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -62046,7 +62807,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -62237,10 +62999,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_42 = names_1[_i]; - var result = name_42 in cache - ? cache[name_42] - : cache[name_42] = loader(name_42, containingFile); + var name_43 = names_1[_i]; + var result = name_43 in cache + ? cache[name_43] + : cache[name_43] = loader(name_43, containingFile); resolutions.push(result); } return resolutions; @@ -62276,6 +63038,7 @@ var ts; var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -62289,7 +63052,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -62335,6 +63099,8 @@ var ts; } } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; program = { @@ -62600,7 +63366,7 @@ var ts; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -62787,10 +63553,10 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 223 /* VariableDeclaration */: + case 226 /* FunctionDeclaration */: + case 224 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -62798,32 +63564,32 @@ var ts; } } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case 182 /* TypeAssertionExpression */: @@ -62841,26 +63607,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // pass through - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 206 /* VariableStatement */); } break; case 147 /* PropertyDeclaration */: @@ -62983,7 +63749,7 @@ var ts; // synthesize 'import "tslib"' declaration var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */); + var importDecl = ts.createSynthesizedNode(236 /* ImportDeclaration */); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -63001,9 +63767,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -63018,7 +63784,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -64281,11 +65047,11 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_43 in options) { - if (ts.hasProperty(options, name_43)) { + for (var name_44 in options) { + if (ts.hasProperty(options, name_44)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_43) { + switch (name_44) { case "init": case "watch": case "version": @@ -64293,14 +65059,14 @@ var ts; case "project": break; default: - var value = options[name_43]; - var optionDefinition = optionsNameMap[name_43.toLowerCase()]; + var value = options[name_44]; + var optionDefinition = optionsNameMap[name_44.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_43] = value; + result[name_44] = value; } else { if (optionDefinition.type === "list") { @@ -64309,11 +65075,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_43] = convertedValue; + result[name_44] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -64361,6 +65127,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -65130,32 +65897,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 144 /* Parameter */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 260 /* EnumMember */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: + case 261 /* EnumMember */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 256 /* CatchClause */: + case 257 /* CatchClause */: return 1 /* Value */; case 143 /* TypeParameter */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: case 161 /* TypeLiteral */: return 2 /* Type */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -65165,22 +65932,22 @@ var ts; else { return 4 /* Namespace */; } - case 238 /* NamedImports */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 239 /* NamedImports */: + case 240 /* ImportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportDeclaration */: + case 241 /* ExportAssignment */: + case 242 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 261 /* SourceFile */: + case 262 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent.kind === 241 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -65207,7 +65974,7 @@ var ts; // import a = |b.c|.d; // Namespace if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 235 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; @@ -65241,10 +66008,10 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 256 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 227 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 228 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -65275,7 +66042,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 220 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -65285,13 +66052,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) && + (node.parent.kind === 216 /* BreakStatement */ || node.parent.kind === 215 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 219 /* LabeledStatement */ && + node.parent.kind === 220 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -65307,7 +66074,7 @@ var ts; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 231 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -65320,13 +66087,13 @@ var ts; switch (node.parent.kind) { case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 260 /* EnumMember */: + case 258 /* PropertyAssignment */: + case 261 /* EnumMember */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return node.parent.name === node; case 178 /* ElementAccessExpression */: return node.parent.argumentExpression === node; @@ -65379,17 +66146,17 @@ var ts; return undefined; } switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return node; } } @@ -65397,22 +66164,22 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 223 /* VariableDeclaration */: + case 228 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 229 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 230 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 224 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); case 174 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; @@ -65428,15 +66195,15 @@ var ts; case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 261 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234 /* ImportEqualsDeclaration */: - case 239 /* ImportSpecifier */: - case 236 /* ImportClause */: - case 243 /* ExportSpecifier */: - case 237 /* NamespaceImport */: + case 235 /* ImportEqualsDeclaration */: + case 240 /* ImportSpecifier */: + case 237 /* ImportClause */: + case 244 /* ExportSpecifier */: + case 238 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -65511,19 +66278,19 @@ var ts; return false; } switch (n.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 172 /* ObjectBindingPattern */: case 161 /* TypeLiteral */: - case 204 /* Block */: - case 231 /* ModuleBlock */: - case 232 /* CaseBlock */: - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 205 /* Block */: + case 232 /* ModuleBlock */: + case 233 /* CaseBlock */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return isCompletedNode(n.block, sourceFile); case 180 /* NewExpression */: if (!n.arguments) { @@ -65540,7 +66307,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -65556,14 +66323,14 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 208 /* IfStatement */: + case 209 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24 /* SemicolonToken */); case 175 /* ArrayLiteralExpression */: @@ -65577,16 +66344,16 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 209 /* DoStatement */: + case 210 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { @@ -65607,10 +66374,10 @@ var ts; case 194 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 241 /* ExportDeclaration */: - case 235 /* ImportDeclaration */: + case 242 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); case 190 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); @@ -65672,7 +66439,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65739,8 +66506,8 @@ var ts; } } // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; // all jsDocComment nodes were already visited if (ts.isJSDocNode(child)) { continue; @@ -65819,7 +66586,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' @@ -65844,7 +66611,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 262 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -65903,17 +66670,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 253 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 253 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 250 /* JsxClosingElement */) { return true; } return false; @@ -66028,7 +66795,7 @@ var ts; if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 227 /* ClassDeclaration */ || node.kind === 228 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -66105,7 +66872,7 @@ var ts; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 213 /* ForOfStatement */ && + if (node.parent.kind === 214 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -66113,7 +66880,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -66339,7 +67106,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) && + (location.parent.kind === 240 /* ImportSpecifier */ || location.parent.kind === 244 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -66406,6 +67173,11 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getOpenBraceEnd(constructor, sourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile).getEnd(); + } + ts.getOpenBraceEnd = getOpenBraceEnd; })(ts || (ts = {})); var ts; (function (ts) { @@ -66473,7 +67245,7 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; var length_4 = dense[i + 1]; var type = dense[i + 2]; @@ -66845,10 +67617,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -66899,7 +67671,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 /* ModuleDeclaration */ && + return declaration.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -66960,7 +67732,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -67063,16 +67835,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 281 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 284 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 283 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 282 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -67159,22 +67931,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -67202,10 +67974,10 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 223 /* VariableDeclaration */ || + if (token.parent.kind === 224 /* VariableDeclaration */ || token.parent.kind === 147 /* PropertyDeclaration */ || token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 250 /* JsxAttribute */) { + token.parent.kind === 251 /* JsxAttribute */) { return 5 /* operator */; } } @@ -67222,7 +67994,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 251 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -67238,7 +68010,7 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } @@ -67248,17 +68020,17 @@ var ts; return 15 /* typeParameterName */; } return; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } @@ -67280,9 +68052,8 @@ var ts; // Ignore nodes that don't intersect the original span to classify. if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); @@ -67323,7 +68094,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 249 /* JsxClosingElement */) { + location.parent && location.parent.kind === 250 /* JsxClosingElement */) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. // For example: @@ -67350,14 +68121,14 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_44 in nameTable) { + for (var name_45 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_44] === position) { + if (nameTable[name_45] === position) { continue; } - if (!uniqueNames[name_44]) { - uniqueNames[name_44] = name_44; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -67417,7 +68188,7 @@ var ts; if (!node || node.kind !== 9 /* StringLiteral */) { return undefined; } - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && node.parent.name === node) { // Get quoted name of properties of the object literal expression @@ -67443,7 +68214,7 @@ var ts; // a['/*completion position*/'] return getStringLiteralCompletionEntriesFromElementAccess(node.parent); } - else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + else if (node.parent.kind === 236 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // import x = require("/*completion position*/"); @@ -67512,6 +68283,9 @@ var ts; return undefined; } function addStringLiteralCompletionsFromType(type, result) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); + } if (!type) { return; } @@ -67870,11 +68644,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent_14 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_14) { break; } - currentDir = parent_13; + currentDir = parent_14; } else { break; @@ -68026,9 +68800,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 283 /* JSDocTypeTag */: - case 281 /* JSDocParameterTag */: - case 282 /* JSDocReturnTag */: + case 284 /* JSDocTypeTag */: + case 282 /* JSDocParameterTag */: + case 283 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -68073,13 +68847,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; + var parent_15 = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_14.kind === 177 /* PropertyAccessExpression */) { + if (parent_15.kind === 177 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141 /* QualifiedName */) { + else if (parent_15.kind === 141 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -68094,7 +68868,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) { + else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 250 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -68199,7 +68973,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 248 /* JsxSelfClosingElement */) || (jsxContainer.kind === 249 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -68247,9 +69021,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 /* SourceFile */ || + scopeNode.kind === 262 /* SourceFile */ || scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 252 /* JsxExpression */ || + scopeNode.kind === 253 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -68282,11 +69056,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 248 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 249 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */; + if (contextToken.parent.kind === 250 /* JsxClosingElement */ || contextToken.parent.kind === 248 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 247 /* JsxElement */; } } return false; @@ -68316,16 +69090,16 @@ var ts; case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 230 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 231 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 226 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 227 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 223 /* VariableDeclaration */ // const x = a| + return containingNodeKind === 224 /* VariableDeclaration */ // const x = a| || containingNodeKind === 192 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 203 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: @@ -68439,9 +69213,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ? - 235 /* ImportDeclaration */ : - 241 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 239 /* NamedImports */ ? + 236 /* ImportDeclaration */ : + 242 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -68466,9 +69240,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { - return parent_15; + var parent_16 = contextToken.parent; + if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { + return parent_16; } break; } @@ -68485,8 +69259,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return contextToken.parent; } } @@ -68495,37 +69269,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent_17 = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { - return parent_16; + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: + if (parent_17 && (parent_17.kind === 248 /* JsxSelfClosingElement */ || parent_17.kind === 249 /* JsxOpeningElement */)) { + return parent_17; } - else if (parent_16.kind === 250 /* JsxAttribute */) { - return parent_16.parent; + else if (parent_17.kind === 251 /* JsxAttribute */) { + return parent_17.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { - return parent_16.parent; + if (parent_17 && ((parent_17.kind === 251 /* JsxAttribute */) || (parent_17.kind === 252 /* JsxSpreadAttribute */))) { + return parent_17.parent; } break; case 17 /* CloseBraceToken */: - if (parent_16 && - parent_16.kind === 252 /* JsxExpression */ && - parent_16.parent && - (parent_16.parent.kind === 250 /* JsxAttribute */)) { - return parent_16.parent.parent; + if (parent_17 && + parent_17.kind === 253 /* JsxExpression */ && + parent_17.parent && + (parent_17.parent.kind === 251 /* JsxAttribute */)) { + return parent_17.parent.parent; } - if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { - return parent_16.parent; + if (parent_17 && parent_17.kind === 252 /* JsxSpreadAttribute */) { + return parent_17.parent; } break; } @@ -68536,7 +69310,7 @@ var ts; switch (kind) { case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -68555,16 +69329,16 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 223 /* VariableDeclaration */ || - containingNodeKind === 224 /* VariableDeclarationList */ || - containingNodeKind === 205 /* VariableStatement */ || - containingNodeKind === 229 /* EnumDeclaration */ || + return containingNodeKind === 224 /* VariableDeclaration */ || + containingNodeKind === 225 /* VariableDeclarationList */ || + containingNodeKind === 206 /* VariableStatement */ || + containingNodeKind === 230 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 226 /* ClassDeclaration */ || + containingNodeKind === 227 /* ClassDeclaration */ || containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 229 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: @@ -68572,22 +69346,22 @@ var ts; case 20 /* OpenBracketToken */: return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 256 /* CatchClause */ || + return containingNodeKind === 257 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 229 /* EnumDeclaration */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || + return containingNodeKind === 230 /* EnumDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || containingNodeKind === 161 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: return containingNodeKind === 146 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ || + (contextToken.parent.parent.kind === 228 /* InterfaceDeclaration */ || contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 226 /* ClassDeclaration */ || + return containingNodeKind === 227 /* ClassDeclaration */ || containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 228 /* TypeAliasDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || + containingNodeKind === 229 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: return containingNodeKind === 147 /* PropertyDeclaration */; @@ -68600,9 +69374,9 @@ var ts; case 112 /* ProtectedKeyword */: return containingNodeKind === 144 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 239 /* ImportSpecifier */ || - containingNodeKind === 243 /* ExportSpecifier */ || - containingNodeKind === 237 /* NamespaceImport */; + return containingNodeKind === 240 /* ImportSpecifier */ || + containingNodeKind === 244 /* ExportSpecifier */ || + containingNodeKind === 238 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: @@ -68662,8 +69436,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_45 = element.propertyName || element.name; - existingImportsOrExports[name_45.text] = true; + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -68684,8 +69458,8 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 257 /* PropertyAssignment */ && - m.kind !== 258 /* ShorthandPropertyAssignment */ && + if (m.kind !== 258 /* PropertyAssignment */ && + m.kind !== 259 /* ShorthandPropertyAssignment */ && m.kind !== 174 /* BindingElement */ && m.kind !== 149 /* MethodDeclaration */ && m.kind !== 151 /* GetAccessor */ && @@ -68727,7 +69501,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250 /* JsxAttribute */) { + if (attr.kind === 251 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -68908,58 +69682,58 @@ var ts; switch (node.kind) { case 89 /* IfKeyword */: case 81 /* ElseKeyword */: - if (hasKind(node.parent, 208 /* IfStatement */)) { + if (hasKind(node.parent, 209 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 95 /* ReturnKeyword */: - if (hasKind(node.parent, 216 /* ReturnStatement */)) { + if (hasKind(node.parent, 217 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 99 /* ThrowKeyword */: - if (hasKind(node.parent, 220 /* ThrowStatement */)) { + if (hasKind(node.parent, 221 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 73 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 221 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 222 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 101 /* TryKeyword */: case 86 /* FinallyKeyword */: - if (hasKind(parent(node), 221 /* TryStatement */)) { + if (hasKind(parent(node), 222 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 97 /* SwitchKeyword */: - if (hasKind(node.parent, 218 /* SwitchStatement */)) { + if (hasKind(node.parent, 219 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 72 /* CaseKeyword */: case 78 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 218 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 219 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 71 /* BreakKeyword */: case 76 /* ContinueKeyword */: - if (hasKind(node.parent, 215 /* BreakStatement */) || hasKind(node.parent, 214 /* ContinueStatement */)) { + if (hasKind(node.parent, 216 /* BreakStatement */) || hasKind(node.parent, 215 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 87 /* ForKeyword */: - if (hasKind(node.parent, 211 /* ForStatement */) || - hasKind(node.parent, 212 /* ForInStatement */) || - hasKind(node.parent, 213 /* ForOfStatement */)) { + if (hasKind(node.parent, 212 /* ForStatement */) || + hasKind(node.parent, 213 /* ForInStatement */) || + hasKind(node.parent, 214 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 105 /* WhileKeyword */: case 80 /* DoKeyword */: - if (hasKind(node.parent, 210 /* WhileStatement */) || hasKind(node.parent, 209 /* DoStatement */)) { + if (hasKind(node.parent, 211 /* WhileStatement */) || hasKind(node.parent, 210 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -68976,7 +69750,7 @@ var ts; break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 205 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 206 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -68992,10 +69766,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 220 /* ThrowStatement */) { + if (node.kind === 221 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 221 /* TryStatement */) { + else if (node.kind === 222 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -69022,19 +69796,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_17 = child.parent; - if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) { - return parent_17; + var parent_18 = child.parent; + if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262 /* SourceFile */) { + return parent_18; } // 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_17.kind === 221 /* TryStatement */) { - var tryStatement = parent_17; + if (parent_18.kind === 222 /* TryStatement */) { + var tryStatement = parent_18; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_17; + child = parent_18; } return undefined; } @@ -69043,7 +69817,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 215 /* BreakStatement */ || node.kind === 214 /* ContinueStatement */) { + if (node.kind === 216 /* BreakStatement */ || node.kind === 215 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -69056,25 +69830,25 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218 /* SwitchStatement */: - if (statement.kind === 214 /* ContinueStatement */) { + for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { + switch (node_2.kind) { + case 219 /* SwitchStatement */: + if (statement.kind === 215 /* ContinueStatement */) { continue; } // Fall through. - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: + if (!statement.label || isLabeledBy(node_2, statement.label.text)) { + return node_2; } break; default: // Don't cross function boundaries. - if (ts.isFunctionLike(node_1)) { + if (ts.isFunctionLike(node_2)) { return undefined; } break; @@ -69086,24 +69860,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 /* ClassDeclaration */ || + if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */ || (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { return undefined; } } else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { + if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { return undefined; } } else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 231 /* ModuleBlock */ || container.kind === 261 /* SourceFile */)) { + if (!(container.kind === 232 /* ModuleBlock */ || container.kind === 262 /* SourceFile */)) { return undefined; } } else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || declaration.kind === 226 /* ClassDeclaration */)) { + if (!(container.kind === 227 /* ClassDeclaration */ || declaration.kind === 227 /* ClassDeclaration */)) { return undefined; } } @@ -69115,8 +69889,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: + case 232 /* ModuleBlock */: + case 262 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -69128,7 +69902,7 @@ var ts; case 150 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search @@ -69212,7 +69986,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 209 /* DoStatement */) { + if (loopNode.kind === 210 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { @@ -69233,13 +70007,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -69293,7 +70067,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 204 /* Block */))) { + if (!(func && hasKind(func.body, 205 /* Block */))) { return undefined; } var keywords = []; @@ -69309,7 +70083,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 209 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -69322,7 +70096,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 209 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -69365,7 +70139,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 220 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -69599,12 +70373,12 @@ var ts; function getAliasSymbolForPropertyNameSymbol(symbol, location) { if (symbol.flags & 8388608 /* Alias */) { // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */); + var defaultImport = ts.getDeclarationOfKind(symbol, 237 /* ImportClause */); if (defaultImport) { return typeChecker.getAliasedSymbol(symbol); } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ || - declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; }); + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 /* ImportSpecifier */ || + declaration.kind === 244 /* ExportSpecifier */) ? declaration : undefined; }); if (importOrExportSpecifier && // export { a } (!importOrExportSpecifier.propertyName || @@ -69612,7 +70386,7 @@ var ts; importOrExportSpecifier.propertyName === location)) { // If Import specifier -> get alias // else Export specifier -> get local target - return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ? + return importOrExportSpecifier.kind === 240 /* ImportSpecifier */ ? typeChecker.getAliasedSymbol(symbol) : typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } @@ -69671,7 +70445,7 @@ var ts; if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 227 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -69702,7 +70476,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -69978,7 +70752,7 @@ var ts; result.push(getReferenceEntryFromNode(refNode.parent)); } else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 259 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } @@ -69991,24 +70765,24 @@ var ts; // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); + var parent_19 = containingTypeReference.parent; + if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { + if (parent_19.body.kind === 205 /* Block */) { + ts.forEachReturnStatement(parent_19.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); + else if (isImplementationExpression(parent_19.body)) { + maybeAdd(getReferenceEntryFromNode(parent_19.body)); } } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_19.expression)); } } } @@ -70049,7 +70823,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 255 /* HeritageClause */ + && node.parent.kind === 256 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -70120,7 +70894,7 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 228 /* InterfaceDeclaration */) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } @@ -70200,12 +70974,12 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, @@ -70215,7 +70989,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261 /* SourceFile */) { + if (searchSpaceNode.kind === 262 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -70250,7 +71024,7 @@ var ts; var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -70262,15 +71036,15 @@ var ts; } break; case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 261 /* SourceFile */: - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + case 262 /* SourceFile */: + if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -70306,13 +71080,13 @@ var ts; for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { var position = possiblePositions_1[_i]; cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + var node_3 = ts.getTouchingWord(sourceFile, position); + if (!node_3 || node_3.kind !== 9 /* StringLiteral */) { return; } - var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + references.push(getReferenceEntryFromNode(node_3)); } } } @@ -70324,7 +71098,7 @@ var ts; // Search the property symbol // for ( { property: p2 } of elems) { } var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); if (propertySymbol) { result.push(propertySymbol); @@ -70427,7 +71201,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 228 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -70593,7 +71367,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 223 /* VariableDeclaration */) { + else if (node.kind === 224 /* VariableDeclaration */) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); } @@ -70603,18 +71377,18 @@ var ts; } else { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */); + if (node.parent && node.parent.parent && node.parent.parent.kind === 206 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 225 /* VariableDeclarationList */); return node.parent.parent; } } @@ -70689,8 +71463,8 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: @@ -70768,7 +71542,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) { + (declaration.kind === 240 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 239 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -70777,7 +71551,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // 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 === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -70861,7 +71635,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + (!selectConstructors && (d.kind === 226 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -70941,7 +71715,7 @@ var ts; function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -71048,7 +71822,7 @@ var ts; */ function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -71108,19 +71882,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 150 /* Constructor */: - case 226 /* ClassDeclaration */: - case 205 /* VariableStatement */: + case 227 /* ClassDeclaration */: + case 206 /* VariableStatement */: break findOwner; - case 261 /* SourceFile */: + case 262 /* SourceFile */: return undefined; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 231 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -71135,7 +71909,7 @@ var ts; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : @@ -71167,7 +71941,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205 /* VariableStatement */) { + if (commentOwner.kind === 206 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -71287,9 +72061,9 @@ var ts; } } // Add the cached typing locations for inferred typings that are already installed - for (var name_46 in packageNameToTypingLocation) { - if (name_46 in inferredTypings && !inferredTypings[name_46]) { - inferredTypings[name_46] = packageNameToTypingLocation[name_46]; + for (var name_47 in packageNameToTypingLocation) { + if (name_47 in inferredTypings && !inferredTypings[name_47]) { + inferredTypings[name_47] = packageNameToTypingLocation[name_47]; } } // Remove typings that the user has added to the exclude list @@ -71427,12 +72201,12 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_47 in nameToDeclarations) { - var declarations = nameToDeclarations[name_47]; + for (var name_48 in nameToDeclarations) { + var declarations = nameToDeclarations[name_48]; if (declarations) { // 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_47); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); if (!matches) { continue; } @@ -71445,14 +72219,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_47); + matches = patternMatcher.getMatches(containers, name_48); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -71460,7 +72234,7 @@ var ts; // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) { + if (decl.kind === 237 /* ImportClause */ || decl.kind === 240 /* ImportSpecifier */ || decl.kind === 235 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -71715,7 +72489,7 @@ var ts; addLeafNode(node); } break; - case 236 /* ImportClause */: + case 237 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -71727,7 +72501,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 238 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -71739,11 +72513,11 @@ var ts; } break; case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: var decl = node; - var name_48 = decl.name; - if (ts.isBindingPattern(name_48)) { - addChildrenRecursively(name_48); + var name_49 = decl.name; + if (ts.isBindingPattern(name_49)) { + addChildrenRecursively(name_49); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -71754,11 +72528,11 @@ var ts; } break; case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -71768,9 +72542,9 @@ var ts; } endNode(); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -71778,21 +72552,21 @@ var ts; } endNode(); break; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243 /* ExportSpecifier */: - case 234 /* ImportEqualsDeclaration */: + case 244 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: case 155 /* IndexSignature */: case 153 /* CallSignature */: case 154 /* ConstructSignature */: - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -71843,14 +72617,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 231 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230 /* ModuleDeclaration */) { + if (a.body.kind !== 231 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -71910,7 +72684,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 231 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -71922,14 +72696,14 @@ var ts; case 185 /* ArrowFunction */: case 197 /* ClassExpression */: return getFunctionOrClassName(node); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 231 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -71940,15 +72714,15 @@ var ts; } } switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; @@ -71965,7 +72739,7 @@ var ts; return "()"; case 155 /* IndexSignature */: return "[]"; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71977,7 +72751,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 206 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -72006,23 +72780,23 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - case 228 /* TypeAliasDeclaration */: - case 285 /* JSDocTypedefTag */: + case 230 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 262 /* SourceFile */: + case 229 /* TypeAliasDeclaration */: + case 286 /* JSDocTypedefTag */: return true; case 150 /* Constructor */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return hasSomeImportantChild(item); case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: @@ -72033,8 +72807,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: + case 232 /* ModuleBlock */: + case 262 /* SourceFile */: case 149 /* MethodDeclaration */: case 150 /* Constructor */: return true; @@ -72045,7 +72819,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 224 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; }); } } @@ -72103,7 +72877,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -72114,13 +72888,13 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 231 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 142 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 261 /* SourceFile */ + return node.kind === 262 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); } @@ -72128,14 +72902,14 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223 /* VariableDeclaration */) { + else if (node.parent.kind === 224 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } else if (node.parent.kind === 192 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -72248,30 +73022,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204 /* Block */: + case 205 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent_20 = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_19.kind === 209 /* DoStatement */ || - parent_19.kind === 212 /* ForInStatement */ || - parent_19.kind === 213 /* ForOfStatement */ || - parent_19.kind === 211 /* ForStatement */ || - parent_19.kind === 208 /* IfStatement */ || - parent_19.kind === 210 /* WhileStatement */ || - parent_19.kind === 217 /* WithStatement */ || - parent_19.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent_20.kind === 210 /* DoStatement */ || + parent_20.kind === 213 /* ForInStatement */ || + parent_20.kind === 214 /* ForOfStatement */ || + parent_20.kind === 212 /* ForStatement */ || + parent_20.kind === 209 /* IfStatement */ || + parent_20.kind === 211 /* WhileStatement */ || + parent_20.kind === 218 /* WithStatement */ || + parent_20.kind === 257 /* CatchClause */) { + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221 /* TryStatement */) { + if (parent_20.kind === 222 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_19; + var tryStatement = parent_20; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -72294,17 +73068,17 @@ var ts; break; } // Fallthrough. - case 231 /* ModuleBlock */: { + case 232 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: - case 232 /* CaseBlock */: { + case 233 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -72690,7 +73464,8 @@ var ts; } // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -72699,7 +73474,7 @@ var ts; } // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -72771,7 +73546,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -73597,7 +74372,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 203 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -73728,7 +74503,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 262 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -74124,7 +74899,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 231 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -74161,7 +74936,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 228 /* TypeAliasDeclaration */) { + else if (declaration.kind === 229 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path @@ -74177,7 +74952,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260 /* EnumMember */) { + if (declaration.kind === 261 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -74189,7 +74964,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 234 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -74200,7 +74975,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234 /* ImportEqualsDeclaration */) { + if (declaration.kind === 235 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -74273,7 +75048,7 @@ var ts; // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { @@ -74360,13 +75135,13 @@ var ts; if (declaration.kind === 184 /* FunctionExpression */) { return true; } - if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) { + if (declaration.kind !== 224 /* VariableDeclaration */ && declaration.kind !== 226 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { // Reached source file or module block - if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { + if (parent_21.kind === 262 /* SourceFile */ || parent_21.kind === 232 /* ModuleBlock */) { return false; } } @@ -74604,10 +75379,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 250 /* JsxAttribute */: - case 248 /* JsxOpeningElement */: - case 249 /* JsxClosingElement */: - case 247 /* JsxSelfClosingElement */: + case 251 /* JsxAttribute */: + case 249 /* JsxOpeningElement */: + case 250 /* JsxClosingElement */: + case 248 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -75019,11 +75794,11 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 140 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -75040,10 +75815,10 @@ var ts; this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8 /* Delete */)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); @@ -75073,6 +75848,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -75089,11 +75865,12 @@ var ts; this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -75130,6 +75907,8 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ExclamationToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -75160,7 +75939,7 @@ var ts; this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -75175,6 +75954,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. this.LowPriorityCommonRules = [ @@ -75184,7 +75964,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; /// @@ -75242,9 +76021,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_49 in o) { - if (o[name_49] === rule) { - return name_49; + for (var name_50 in o) { + if (o[name_50] === rule) { + return name_50; } } throw new Error("Unknown rule"); @@ -75253,7 +76032,7 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 211 /* ForStatement */; + return context.contextNode.kind === 212 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -75263,8 +76042,8 @@ var ts; case 192 /* BinaryExpression */: case 193 /* ConditionalExpression */: case 200 /* AsExpression */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: case 156 /* TypePredicate */: case 164 /* UnionType */: case 165 /* IntersectionType */: @@ -75272,22 +76051,24 @@ var ts; // equals in binding elements: function foo([[x, y] = [1, 2]]) case 174 /* BindingElement */: // equals in type X = ... - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: // equal in p = 0; case 144 /* Parameter */: - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: + // "in" keyword in [P in keyof T]: T[P] + case 143 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; } return false; @@ -75317,6 +76098,9 @@ var ts; //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 172 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -75340,17 +76124,17 @@ var ts; return true; } switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: + case 205 /* Block */: + case 233 /* CaseBlock */: case 176 /* ObjectLiteralExpression */: - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: @@ -75364,60 +76148,66 @@ var ts; // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 226 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 161 /* TypeLiteral */: - case 230 /* ModuleDeclaration */: - case 241 /* ExportDeclaration */: - case 242 /* NamedExports */: - case 235 /* ImportDeclaration */: - case 238 /* NamedImports */: + case 231 /* ModuleDeclaration */: + case 242 /* ExportDeclaration */: + case 243 /* NamedExports */: + case 236 /* ImportDeclaration */: + case 239 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226 /* ClassDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 204 /* Block */: - case 256 /* CatchClause */: - case 231 /* ModuleBlock */: - case 218 /* SwitchStatement */: + case 227 /* ClassDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 257 /* CatchClause */: + case 232 /* ModuleBlock */: + case 219 /* SwitchStatement */: return true; + case 205 /* Block */: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 185 /* ArrowFunction */ && + blockParent.kind !== 184 /* FunctionExpression */) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208 /* IfStatement */: - case 218 /* SwitchStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 221 /* TryStatement */: - case 209 /* DoStatement */: - case 217 /* WithStatement */: + case 209 /* IfStatement */: + case 219 /* SwitchStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 222 /* TryStatement */: + case 210 /* DoStatement */: + case 218 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 256 /* CatchClause */: + case 257 /* CatchClause */: return true; default: return false; @@ -75448,19 +76238,19 @@ var ts; return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246 /* JsxElement */; + return context.contextNode.kind !== 247 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252 /* JsxExpression */; + return context.contextNode.kind === 253 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250 /* JsxAttribute */; + return context.nextTokenParent.kind === 251 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250 /* JsxAttribute */; + return context.contextNode.kind === 251 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247 /* JsxSelfClosingElement */; + return context.contextNode.kind === 248 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -75478,14 +76268,14 @@ var ts; return node.kind === 145 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 225 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230 /* ModuleDeclaration */; + return context.contextNode.kind === 231 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; @@ -75497,10 +76287,11 @@ var ts; switch (parent.kind) { case 157 /* TypeReference */: case 182 /* TypeAssertionExpression */: - case 226 /* ClassDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: @@ -75528,6 +76319,9 @@ var ts; Rules.IsYieldOrYieldStarWithOperand = function (context) { return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 201 /* NonNullExpression */; + }; return Rules; }()); formatting.Rules = Rules; @@ -75846,6 +76640,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -75926,6 +76726,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -76058,17 +76864,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 261 /* SourceFile */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + return body && body.kind === 232 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 262 /* SourceFile */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -76273,10 +77079,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */; + case 227 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 228 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 226 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 230 /* EnumDeclaration */: return 230 /* EnumDeclaration */; case 151 /* GetAccessor */: return 124 /* GetKeyword */; case 152 /* SetAccessor */: return 133 /* SetKeyword */; case 149 /* MethodDeclaration */: @@ -76316,18 +77122,31 @@ var ts; // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent case 16 /* OpenBraceToken */: case 17 /* CloseBraceToken */: - case 20 /* OpenBracketToken */: - case 21 /* CloseBracketToken */: case 18 /* OpenParenToken */: case 19 /* CloseParenToken */: case 81 /* ElseKeyword */: case 105 /* WhileKeyword */: case 56 /* AtToken */: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40 /* SlashToken */: + case 28 /* GreaterThanToken */: { + if (container.kind === 249 /* JsxOpeningElement */ || + container.kind === 250 /* JsxClosingElement */ || + container.kind === 248 /* JsxSelfClosingElement */) { + return indentation; + } + break; + } + case 20 /* OpenBracketToken */: + case 21 /* CloseBracketToken */: { + if (container.kind !== 170 /* MappedType */) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -76383,7 +77202,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -76417,7 +77236,7 @@ var ts; // stop when formatting scanner advances past the beginning of the child break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -76457,11 +77276,11 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -76479,7 +77298,7 @@ var ts; // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -76686,7 +77505,7 @@ var ts; } // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -76792,7 +77611,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -77052,7 +77871,7 @@ var ts; // - 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 = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 262 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -77085,7 +77904,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 209 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -77107,7 +77926,7 @@ var ts; return node.parent.properties; case 175 /* ArrayLiteralExpression */: return node.parent.elements; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: @@ -77241,35 +78060,36 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207 /* ExpressionStatement */: - case 226 /* ClassDeclaration */: + case 208 /* ExpressionStatement */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 229 /* TypeAliasDeclaration */: case 175 /* ArrayLiteralExpression */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: + case 170 /* MappedType */: case 163 /* TupleType */: - case 232 /* CaseBlock */: - case 254 /* DefaultClause */: - case 253 /* CaseClause */: + case 233 /* CaseBlock */: + case 255 /* DefaultClause */: + case 254 /* CaseClause */: case 183 /* ParenthesizedExpression */: case 177 /* PropertyAccessExpression */: case 179 /* CallExpression */: case 180 /* NewExpression */: - case 205 /* VariableStatement */: - case 223 /* VariableDeclaration */: - case 240 /* ExportAssignment */: - case 216 /* ReturnStatement */: + case 206 /* VariableStatement */: + case 224 /* VariableDeclaration */: + case 241 /* ExportAssignment */: + case 217 /* ReturnStatement */: case 193 /* ConditionalExpression */: case 173 /* ArrayBindingPattern */: case 172 /* ObjectBindingPattern */: - case 248 /* JsxOpeningElement */: - case 247 /* JsxSelfClosingElement */: - case 252 /* JsxExpression */: + case 249 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 253 /* JsxExpression */: case 148 /* MethodSignature */: case 153 /* CallSignature */: case 154 /* ConstructSignature */: @@ -77279,10 +78099,10 @@ var ts; case 166 /* ParenthesizedType */: case 181 /* TaggedTemplateExpression */: case 189 /* AwaitExpression */: - case 242 /* NamedExports */: - case 238 /* NamedImports */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 243 /* NamedExports */: + case 239 /* NamedImports */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: return true; } return false; @@ -77291,27 +78111,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 208 /* IfStatement */: - case 225 /* FunctionDeclaration */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 212 /* ForStatement */: + case 209 /* IfStatement */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 185 /* ArrowFunction */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - return childKind !== 204 /* Block */; - case 241 /* ExportDeclaration */: - return childKind !== 242 /* NamedExports */; - case 235 /* ImportDeclaration */: - return childKind !== 236 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */); - case 246 /* JsxElement */: - return childKind !== 249 /* JsxClosingElement */; + return childKind !== 205 /* Block */; + case 242 /* ExportDeclaration */: + return childKind !== 243 /* NamedExports */; + case 236 /* ImportDeclaration */: + return childKind !== 237 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 239 /* NamedImports */); + case 247 /* JsxElement */: + return childKind !== 250 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -77367,25 +78187,128 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - // First token is the open curly, this is where we want to put the 'super' call. - return constructor.body.getFirstToken(sourceFile).getEnd(); - } codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122 /* ConstructorKeyword */) { - return undefined; - } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] - }]; - } + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDecl = ts.getContainingClass(token); + if (!classDecl) { + return undefined; + } + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDecl); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1 /* Number */); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0 /* String */); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeFromTypeNode(implementedTypeNode); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8 /* Private */); }); + var insertion = getMissingIndexSignatureInsertion(implementedType, 1 /* Number */, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, 0 /* String */, classDecl, hasStringIndexSignature); + insertion += codefix.getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); + } + } + return result; + function getMissingIndexSignatureInsertion(type, kind, enclosingDeclaration, hasIndexSigOfKind) { + if (!hasIndexSigOfKind) { + var IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + var writer = ts.getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + var result_7 = writer.string(); + ts.releaseStringWriter(writer); + return result_7; + } + } + return ""; + } + function pushAction(result, insertion, description) { + var newAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }; + result.push(newAction); + } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier in the case of a class declaration + // or the class keyword token in the case of a class expression. + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDecl = token.parent; + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var instantiatedExtendsType = checker.getBaseTypes(classType)[0]; + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var insertion = codefix.getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + if (insertion.length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8 /* Private */) && !!(flags & 128 /* Abstract */); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -77409,7 +78332,7 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); + var newPosition = ts.getOpenBraceEnd(constructor, sourceFile); var changes = [{ fileName: sourceFile.fileName, textChanges: [{ newText: superCall.getText(sourceFile), @@ -77425,7 +78348,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -77439,6 +78362,227 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122 /* ConstructorKeyword */) { + return undefined; + } + var newPosition = ts.getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 /* Identifier */ && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84 /* ExtendsKeyword */)) { + return undefined; + } + var changeStart = extendsToken.getStart(sourceFile); + var changeEnd = extendsToken.getEnd(); + var textChanges = [{ newText: " implements", span: { start: changeStart, length: changeEnd - changeStart } }]; + // We replace existing keywords with commas. + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeStart = keywordToken.getStart(sourceFile); + changeEnd = keywordToken.getEnd(); + textChanges.push({ newText: ",", span: { start: changeStart, length: changeEnd - changeStart } }); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 224 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 212 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 214 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 213 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 257 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + // handle case where 'import a = A;' + case 235 /* ImportEqualsDeclaration */: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 240 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 237 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 238 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147 /* PropertyDeclaration */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 238 /* NamespaceImport */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 236 /* ImportDeclaration */ && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -77538,7 +78682,10 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -77550,6 +78697,11 @@ var ts; // this is a module id -> module import declaration map var cachedImportDeclarations = ts.createMap(); var cachedNewImportInsertPosition; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, /*isDefault*/ false, /*isNamespaceImport*/ true); + } var allPotentialModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; @@ -77557,7 +78709,6 @@ var ts; allPotentialModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { var moduleSymbol = allPotentialModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); @@ -77597,10 +78748,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { return node; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -77618,7 +78769,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { // With an existing import statement, there are more than one actions the user can do. @@ -77646,9 +78797,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 236 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 238 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -77672,7 +78823,7 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { /** * If the existing import declaration already has a named import list, just @@ -77688,7 +78839,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 246 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -77736,7 +78887,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 236 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -77773,7 +78924,9 @@ var ts; var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); var importStatementText = isDefault ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + : isNamespaceImport + ? "import * as " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; // if this file doesn't have any import statements, insert an import statement and then insert a new line // between the only import statement and user code. Otherwise just insert the statement because chances // are there are already a new line seperating code and import statements. @@ -77793,7 +78946,7 @@ var ts; tryGetModuleNameAsNodeModule() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 262 /* SourceFile */) { return moduleSymbol.name; } } @@ -77806,6 +78959,7 @@ var ts; if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -77825,7 +78979,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -77947,156 +79101,149 @@ var ts; (function (ts) { var codefix; (function (codefix) { - codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - // this handles var ["computed"] = 12; - if (token.kind === 20 /* OpenBracketToken */) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70 /* Identifier */: - switch (token.parent.kind) { - case 223 /* VariableDeclaration */: - switch (token.parent.parent.parent.kind) { - case 211 /* ForStatement */: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213 /* ForOfStatement */: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212 /* ForInStatement */: - // There is no valid fix in the case of: - // for .. in - return undefined; - case 256 /* CatchClause */: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143 /* TypeParameter */: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144 /* Parameter */: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - // handle case where 'import a = A;' - case 234 /* ImportEqualsDeclaration */: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239 /* ImportSpecifier */: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - // Only 1 import and it is unused. So the entire declaration should be removed. - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - // handle case where "import d, * as ns from './file'" - // or "'import {a, b as ns} from './file'" - case 236 /* ImportClause */: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237 /* NamespaceImport */: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147 /* PropertyDeclaration */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237 /* NamespaceImport */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { - importDecl = importDecl.parent; + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns Empty string iff there are no member insertions. + */ + function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var insertion = ""; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); + } + return insertion; + } + codefix.getMissingMembersInsertion = getMissingMembersInsertion; + /** + * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`. + */ + function getInsertionForMemberSymbol(symbol, enclosingDeclaration, checker, newlineChar) { + // const name = symbol.getName(); + var type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return ""; + } + var declaration = declarations[0]; + var name = declaration.name ? declaration.name.getText() : undefined; + var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); + switch (declaration.kind) { + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 146 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + var typeString = checker.typeToString(type, enclosingDeclaration, 0 /* None */); + return "" + visibility + name + ": " + typeString + ";" + newlineChar; + case 148 /* MethodSignature */: + case 149 /* MethodDeclaration */: + // The signature for the implementation appears as an entry in `signatures` iff + // there is only one signature. + // If there are overloads and an implementation signature, it appears as an + // extra declaration that isn't a signature for `type`. + // If there is more than one overload but no implementation signature + // (eg: an abstract method or interface declaration), there is a 1-1 + // correspondence of declarations and signatures. + var signatures = checker.getSignaturesOfType(type, 0 /* Call */); + if (!(signatures && signatures.length > 0)) { + return ""; } - return importDecl; - } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] - }] - }]; - } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar); + } + var result = ""; + for (var i = 0; i < signatures.length; i++) { + var sigString_2 = checker.signatureToString(signatures[i], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + result += "" + visibility + name + sigString_2 + ";" + newlineChar; + } + // If there is a declaration with a body, it is the last declaration, + // and it isn't caught by `getSignaturesOfType`. + var bodySig = undefined; + if (declarations.length > signatures.length) { + bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } + var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar); + return result; + default: + return ""; + } + } + function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { + var newSignatureDeclaration = ts.createNode(153 /* CallSignature */); + newSignatureDeclaration.parent = enclosingDeclaration; + newSignatureDeclaration.name = signatures[0].getDeclaration().name; + var maxNonRestArgs = -1; + var maxArgsIndex = 0; + var minArgumentCount = signatures[0].minArgumentCount; + var hasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + hasRestParameter = hasRestParameter || sig.hasRestParameter; + var nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); + if (nonRestLength > maxNonRestArgs) { + maxNonRestArgs = nonRestLength; + maxArgsIndex = i; } } - }); + var maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(function (symbol) { return symbol.getName(); }); + var optionalToken = ts.createToken(54 /* QuestionToken */); + newSignatureDeclaration.parameters = ts.createNodeArray(); + for (var i = 0; i < maxNonRestArgs; i++) { + var newParameter = createParameterDeclarationWithoutType(i, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + if (hasRestParameter) { + var restParameter = createParameterDeclarationWithoutType(maxNonRestArgs, minArgumentCount, newSignatureDeclaration); + restParameter.dotDotDotToken = ts.createToken(23 /* DotDotDotToken */); + newSignatureDeclaration.parameters.push(restParameter); + } + return checker.getSignatureFromDeclaration(newSignatureDeclaration); + function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { + var newParameter = ts.createNode(144 /* Parameter */); + newParameter.symbol = new SymbolConstructor(1 /* FunctionScopedVariable */, maxArgsParameterSymbolNames[index] || "rest"); + newParameter.symbol.valueDeclaration = newParameter; + newParameter.symbol.declarations = [newParameter]; + newParameter.parent = enclosingSignatureDeclaration; + if (index >= minArgCount) { + newParameter.questionToken = optionalToken; + } + return newParameter; + } + } + function getMethodBodyStub(newLineChar) { + return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar; + } + function getVisibilityPrefix(flags) { + if (flags & 4 /* Public */) { + return "public "; + } + else if (flags & 16 /* Protected */) { + return "protected "; + } + return ""; + } + var SymbolConstructor = ts.objectAllocator.getSymbolConstructor(); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); -/// -/// -/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// @@ -78122,7 +79269,7 @@ var ts; /// /// /// -/// +/// /// var ts; (function (ts) { @@ -78187,7 +79334,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -78210,7 +79357,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 279 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -78489,9 +79636,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_7 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_7 !== undefined) { - return result_7; + var result_8 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_8 !== undefined) { + return result_8; } if (declaration.name.kind === 142 /* ComputedPropertyName */) { var expr = declaration.name.expression; @@ -78515,7 +79662,7 @@ var ts; } function visit(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -78538,18 +79685,18 @@ var ts; } ts.forEachChild(node, visit); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 161 /* TypeLiteral */: @@ -78562,7 +79709,7 @@ var ts; break; } // fall through - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { @@ -78572,19 +79719,19 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: addDeclaration(node); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -78596,7 +79743,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -79297,7 +80444,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 231 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -79529,7 +80676,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -79683,7 +80830,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 245 /* ExternalModuleReference */ || + node.parent.kind === 246 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; @@ -79787,16 +80934,16 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return spanInVariableDeclaration(node); case 144 /* Parameter */: return spanInParameterDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -79805,85 +80952,85 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 204 /* Block */: + case 205 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return spanInBlock(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return spanInBlock(node.block); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 209 /* DoStatement */: + case 210 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 208 /* IfStatement */: + case 209 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return spanInForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 221 /* TryStatement */: + case 222 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: case 174 /* BindingElement */: // span on complete node return textSpan(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: // span in statement return spanInNode(node.statement); case 145 /* Decorator */: @@ -79892,8 +81039,8 @@ var ts; case 173 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -79937,8 +81084,8 @@ var ts; // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || node.kind == 196 /* SpreadElement */ || - node.kind === 257 /* PropertyAssignment */ || - node.kind === 258 /* ShorthandPropertyAssignment */) && + node.kind === 258 /* PropertyAssignment */ || + node.kind === 259 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -79965,14 +81112,14 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209 /* DoStatement */: + case 210 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); case 145 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: return textSpan(node); case 192 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { @@ -79989,7 +81136,7 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -80003,7 +81150,7 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 223 /* VariableDeclaration */ || + if ((node.parent.kind === 224 /* VariableDeclaration */ || node.parent.kind === 144 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || @@ -80038,7 +81185,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 213 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -80049,7 +81196,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 214 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -80089,7 +81236,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 227 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -80112,25 +81259,25 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 210 /* WhileStatement */: - case 208 /* IfStatement */: - case 212 /* ForInStatement */: + case 211 /* WhileStatement */: + case 209 /* IfStatement */: + case 213 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 225 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -80184,13 +81331,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -80198,24 +81345,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 229 /* EnumDeclaration */: - case 226 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 204 /* Block */: + case 205 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through - case 256 /* CatchClause */: + case 257 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -80254,7 +81401,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 /* DoStatement */ || + if (node.parent.kind === 210 /* DoStatement */ || node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { return spanInPreviousNode(node); @@ -80269,17 +81416,17 @@ var ts; // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 150 /* Constructor */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: case 179 /* CallExpression */: case 180 /* NewExpression */: case 183 /* ParenthesizedExpression */: @@ -80292,7 +81439,7 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 /* PropertyAssignment */ || + node.parent.kind === 258 /* PropertyAssignment */ || node.parent.kind === 144 /* Parameter */) { return spanInPreviousNode(node); } @@ -80305,7 +81452,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209 /* DoStatement */) { + if (node.parent.kind === 210 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -80313,7 +81460,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.kind === 214 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -81102,7 +82249,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index e11c200ef44..24ec0a740ca 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -239,102 +239,102 @@ declare namespace ts { ExpressionWithTypeArguments = 199, AsExpression = 200, NonNullExpression = 201, - TemplateSpan = 202, - SemicolonClassElement = 203, - Block = 204, - VariableStatement = 205, - EmptyStatement = 206, - ExpressionStatement = 207, - IfStatement = 208, - DoStatement = 209, - WhileStatement = 210, - ForStatement = 211, - ForInStatement = 212, - ForOfStatement = 213, - ContinueStatement = 214, - BreakStatement = 215, - ReturnStatement = 216, - WithStatement = 217, - SwitchStatement = 218, - LabeledStatement = 219, - ThrowStatement = 220, - TryStatement = 221, - DebuggerStatement = 222, - VariableDeclaration = 223, - VariableDeclarationList = 224, - FunctionDeclaration = 225, - ClassDeclaration = 226, - InterfaceDeclaration = 227, - TypeAliasDeclaration = 228, - EnumDeclaration = 229, - ModuleDeclaration = 230, - ModuleBlock = 231, - CaseBlock = 232, - NamespaceExportDeclaration = 233, - ImportEqualsDeclaration = 234, - ImportDeclaration = 235, - ImportClause = 236, - NamespaceImport = 237, - NamedImports = 238, - ImportSpecifier = 239, - ExportAssignment = 240, - ExportDeclaration = 241, - NamedExports = 242, - ExportSpecifier = 243, - MissingDeclaration = 244, - ExternalModuleReference = 245, - JsxElement = 246, - JsxSelfClosingElement = 247, - JsxOpeningElement = 248, - JsxClosingElement = 249, - JsxAttribute = 250, - JsxSpreadAttribute = 251, - JsxExpression = 252, - CaseClause = 253, - DefaultClause = 254, - HeritageClause = 255, - CatchClause = 256, - PropertyAssignment = 257, - ShorthandPropertyAssignment = 258, - SpreadAssignment = 259, - EnumMember = 260, - SourceFile = 261, - JSDocTypeExpression = 262, - JSDocAllType = 263, - JSDocUnknownType = 264, - JSDocArrayType = 265, - JSDocUnionType = 266, - JSDocTupleType = 267, - JSDocNullableType = 268, - JSDocNonNullableType = 269, - JSDocRecordType = 270, - JSDocRecordMember = 271, - JSDocTypeReference = 272, - JSDocOptionalType = 273, - JSDocFunctionType = 274, - JSDocVariadicType = 275, - JSDocConstructorType = 276, - JSDocThisType = 277, - JSDocComment = 278, - JSDocTag = 279, - JSDocAugmentsTag = 280, - JSDocParameterTag = 281, - JSDocReturnTag = 282, - JSDocTypeTag = 283, - JSDocTemplateTag = 284, - JSDocTypedefTag = 285, - JSDocPropertyTag = 286, - JSDocTypeLiteral = 287, - JSDocLiteralType = 288, - JSDocNullKeyword = 289, - JSDocUndefinedKeyword = 290, - JSDocNeverKeyword = 291, - SyntaxList = 292, - NotEmittedStatement = 293, - PartiallyEmittedExpression = 294, - MergeDeclarationMarker = 295, - EndOfDeclarationMarker = 296, - RawExpression = 297, + MetaProperty = 202, + TemplateSpan = 203, + SemicolonClassElement = 204, + Block = 205, + VariableStatement = 206, + EmptyStatement = 207, + ExpressionStatement = 208, + IfStatement = 209, + DoStatement = 210, + WhileStatement = 211, + ForStatement = 212, + ForInStatement = 213, + ForOfStatement = 214, + ContinueStatement = 215, + BreakStatement = 216, + ReturnStatement = 217, + WithStatement = 218, + SwitchStatement = 219, + LabeledStatement = 220, + ThrowStatement = 221, + TryStatement = 222, + DebuggerStatement = 223, + VariableDeclaration = 224, + VariableDeclarationList = 225, + FunctionDeclaration = 226, + ClassDeclaration = 227, + InterfaceDeclaration = 228, + TypeAliasDeclaration = 229, + EnumDeclaration = 230, + ModuleDeclaration = 231, + ModuleBlock = 232, + CaseBlock = 233, + NamespaceExportDeclaration = 234, + ImportEqualsDeclaration = 235, + ImportDeclaration = 236, + ImportClause = 237, + NamespaceImport = 238, + NamedImports = 239, + ImportSpecifier = 240, + ExportAssignment = 241, + ExportDeclaration = 242, + NamedExports = 243, + ExportSpecifier = 244, + MissingDeclaration = 245, + ExternalModuleReference = 246, + JsxElement = 247, + JsxSelfClosingElement = 248, + JsxOpeningElement = 249, + JsxClosingElement = 250, + JsxAttribute = 251, + JsxSpreadAttribute = 252, + JsxExpression = 253, + CaseClause = 254, + DefaultClause = 255, + HeritageClause = 256, + CatchClause = 257, + PropertyAssignment = 258, + ShorthandPropertyAssignment = 259, + SpreadAssignment = 260, + EnumMember = 261, + SourceFile = 262, + JSDocTypeExpression = 263, + JSDocAllType = 264, + JSDocUnknownType = 265, + JSDocArrayType = 266, + JSDocUnionType = 267, + JSDocTupleType = 268, + JSDocNullableType = 269, + JSDocNonNullableType = 270, + JSDocRecordType = 271, + JSDocRecordMember = 272, + JSDocTypeReference = 273, + JSDocOptionalType = 274, + JSDocFunctionType = 275, + JSDocVariadicType = 276, + JSDocConstructorType = 277, + JSDocThisType = 278, + JSDocComment = 279, + JSDocTag = 280, + JSDocAugmentsTag = 281, + JSDocParameterTag = 282, + JSDocReturnTag = 283, + JSDocTypeTag = 284, + JSDocTemplateTag = 285, + JSDocTypedefTag = 286, + JSDocPropertyTag = 287, + JSDocTypeLiteral = 288, + JSDocLiteralType = 289, + JSDocNullKeyword = 290, + JSDocUndefinedKeyword = 291, + JSDocNeverKeyword = 292, + SyntaxList = 293, + NotEmittedStatement = 294, + PartiallyEmittedExpression = 295, + MergeDeclarationMarker = 296, + EndOfDeclarationMarker = 297, Count = 298, FirstAssignment = 57, LastAssignment = 69, @@ -361,10 +361,10 @@ declare namespace ts { FirstBinaryOperator = 26, LastBinaryOperator = 69, FirstNode = 141, - FirstJSDocNode = 262, - LastJSDocNode = 288, - FirstJSDocTagNode = 278, - LastJSDocTagNode = 291, + FirstJSDocNode = 263, + LastJSDocNode = 289, + FirstJSDocTagNode = 279, + LastJSDocTagNode = 292, } enum NodeFlags { None = 0, @@ -969,6 +969,11 @@ declare namespace ts { kind: SyntaxKind.NonNullExpression; expression: Expression; } + interface MetaProperty extends PrimaryExpression { + kind: SyntaxKind.MetaProperty; + keywordToken: SyntaxKind; + name: Identifier; + } interface JsxElement extends PrimaryExpression { kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; @@ -1003,6 +1008,7 @@ declare namespace ts { } interface JsxExpression extends Expression { kind: SyntaxKind.JsxExpression; + dotDotDotToken?: Token; expression?: Expression; } interface JsxText extends Node { @@ -1022,7 +1028,7 @@ declare namespace ts { kind: SyntaxKind.MissingDeclaration; name?: Identifier; } - type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; + type BlockLike = SourceFile | Block | ModuleBlock | CaseOrDefaultClause; interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; @@ -1569,6 +1575,7 @@ declare namespace ts { getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; getPropertyOfType(type: Type, propertyName: string): Symbol; + getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; @@ -1581,6 +1588,8 @@ declare namespace ts { getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; + getTypeFromTypeNode(node: TypeNode): Type; + signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; getSymbolDisplayBuilder(): SymbolDisplayBuilder; @@ -1603,11 +1612,13 @@ declare namespace ts { isOptionalParameter(node: ParameterDeclaration): boolean; getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; + getApparentType(type: Type): Type; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void; + buildIndexSignatureDisplay(info: IndexInfo, writer: SymbolWriter, kind: IndexKind, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, symbolStack?: Symbol[]): void; buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1645,6 +1656,7 @@ declare namespace ts { InFirstTypeArgument = 256, InTypeAlias = 512, UseTypeAliasValue = 1024, + SuppressAnyReturnType = 2048, } enum SymbolFormatFlags { None = 0, @@ -1815,6 +1827,7 @@ declare namespace ts { interface ObjectType extends Type { objectFlags: ObjectFlags; } + /** Class and interface types (TypeFlags.Class and TypeFlags.Interface). */ interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; @@ -1828,6 +1841,16 @@ declare namespace ts { declaredStringIndexInfo: IndexInfo; declaredNumberIndexInfo: IndexInfo; } + /** + * Type references (TypeFlags.Reference). When a class or interface has type parameters or + * a "this" type, references to the class or interface are made using type references. The + * typeArguments property specifies the types to substitute for the type parameters of the + * class or interface and optionally includes an extra element that specifies the type to + * substitute for "this" in the resulting instantiation. When no extra argument is present, + * the type reference itself is substituted for "this". The typeArguments property is undefined + * if the class or interface has no type parameters and the reference isn't specifying an + * explicit "this" argument. + */ interface TypeReference extends ObjectType { target: GenericType; typeArguments: Type[]; @@ -2106,7 +2129,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -2325,9 +2347,28 @@ declare namespace ts { * this list is only the set of defaults that are implicitly included. */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; } declare namespace ts { function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; @@ -2674,6 +2715,7 @@ declare namespace ts { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; @@ -2682,6 +2724,7 @@ declare namespace ts { InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; } @@ -2689,6 +2732,7 @@ declare namespace ts { insertSpaceAfterCommaDelimiter?: boolean; insertSpaceAfterSemicolonInForStatements?: boolean; insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; insertSpaceAfterKeywordsInControlFlowStatements?: boolean; insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; @@ -2697,6 +2741,7 @@ declare namespace ts { insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; placeOpenBraceOnNewLineForFunctions?: boolean; placeOpenBraceOnNewLineForControlBlocks?: boolean; } diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 7f41e5d07f5..bae2811e4de 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword @@ -244,115 +249,115 @@ var ts; SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 202] = "MetaProperty"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 202] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 203] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 203] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 204] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 204] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 205] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 206] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 207] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 208] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 209] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 210] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 211] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 212] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 213] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 214] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 215] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 216] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 217] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 218] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 219] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 220] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 221] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 222] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 223] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 224] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 225] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 226] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 227] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 228] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 229] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 230] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 231] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 232] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 233] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 234] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 235] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 236] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 237] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 238] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 239] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 240] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 241] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 242] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 243] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 244] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 205] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 206] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 207] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 208] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 209] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 210] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 211] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 212] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 213] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 214] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 215] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 216] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 217] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 218] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 219] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 220] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 221] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 222] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 223] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 224] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 225] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 226] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 227] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 228] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 229] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 230] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 231] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 232] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 233] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 234] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 235] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 236] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 237] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 238] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 239] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 240] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 241] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 242] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 243] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 244] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 245] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 246] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 246] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 247] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 248] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 249] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 250] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 251] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 252] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 247] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 248] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 249] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 250] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 251] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 252] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 253] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 253] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 254] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 255] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 256] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 254] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 255] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 256] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 257] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 257] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 258] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 259] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 258] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 259] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 260] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 260] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 261] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 261] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 262] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 262] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 263] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 263] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 264] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 264] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 265] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 266] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 267] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 268] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 269] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 270] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 271] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 272] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 273] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 274] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 275] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 276] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 280] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 281] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 282] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 283] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 284] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 285] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 286] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 287] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 288] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 289] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 290] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 291] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 265] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 266] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 267] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 268] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 269] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 270] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 271] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 272] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 273] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 274] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 275] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 276] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 277] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 278] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 279] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 280] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 281] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 282] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 283] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 284] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 285] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 286] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 287] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 288] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocLiteralType"] = 289] = "JSDocLiteralType"; + SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 290] = "JSDocNullKeyword"; + SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 291] = "JSDocUndefinedKeyword"; + SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 292] = "JSDocNeverKeyword"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 293] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["RawExpression"] = 297] = "RawExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 294] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 295] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 296] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 297] = "EndOfDeclarationMarker"; // Enum value count SyntaxKind[SyntaxKind["Count"] = 298] = "Count"; // Markers @@ -381,10 +386,10 @@ var ts; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 263] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 289] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 279] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 292] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -511,6 +516,7 @@ var ts; TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; + TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 2048] = "SuppressAnyReturnType"; })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; (function (SymbolFormatFlags) { @@ -647,6 +653,7 @@ var ts; NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget"; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; @@ -1290,7 +1297,7 @@ var ts; */ function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1314,7 +1321,7 @@ var ts; */ function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -1325,7 +1332,7 @@ var ts; ts.every = every; /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -1339,7 +1346,7 @@ var ts; * This is like `forEach`, but never returns undefined. */ function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -1362,7 +1369,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -1372,7 +1379,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -2220,6 +2227,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -3915,7 +3923,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -4072,6 +4080,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -4301,6 +4310,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -4310,6 +4321,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -4361,6 +4373,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -4529,6 +4543,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -4542,10 +4557,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -4594,6 +4609,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -4650,22 +4667,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); /// @@ -5132,7 +5152,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -5344,7 +5364,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -6524,7 +6544,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 261 /* SourceFile */) { + while (node && node.kind !== 262 /* SourceFile */) { node = node.parent; } return node; @@ -6532,11 +6552,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 205 /* Block */: + case 233 /* CaseBlock */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return true; } return false; @@ -6627,18 +6647,18 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 292 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 293 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); } ts.getTokenPosOfNode = getTokenPosOfNode; function isJSDocNode(node) { - return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; + return node.kind >= 263 /* FirstJSDocNode */ && node.kind <= 289 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; + return node.kind >= 279 /* FirstJSDocTagNode */ && node.kind <= 292 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -6742,11 +6762,11 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */; + return node.kind === 224 /* VariableDeclaration */ && node.parent.kind === 257 /* CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 230 /* ModuleDeclaration */ && + return node && node.kind === 231 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; @@ -6757,11 +6777,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 230 /* ModuleDeclaration */ && (!node.body); + return node.kind === 231 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 261 /* SourceFile */ || - node.kind === 230 /* ModuleDeclaration */ || + return node.kind === 262 /* SourceFile */ || + node.kind === 231 /* ModuleDeclaration */ || isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -6777,9 +6797,9 @@ var ts; return false; } switch (node.parent.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.isExternalModule(node.parent); - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -6791,22 +6811,22 @@ var ts; ts.isEffectiveExternalModule = isEffectiveExternalModule; function isBlockScope(node, parentNode) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 256 /* CatchClause */: - case 230 /* ModuleDeclaration */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 262 /* SourceFile */: + case 233 /* CaseBlock */: + case 257 /* CatchClause */: + case 231 /* ModuleDeclaration */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: case 150 /* Constructor */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return true; - case 204 /* Block */: + case 205 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return parentNode && !isFunctionLike(parentNode); @@ -6891,7 +6911,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 204 /* Block */) { + if (node.body && node.body.kind === 205 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -6905,7 +6925,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -6914,20 +6934,20 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: - case 225 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: errorNode = node.name; break; case 185 /* ArrowFunction */: @@ -6953,7 +6973,7 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 229 /* EnumDeclaration */ && isConst(node); + return node.kind === 230 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function isConst(node) { @@ -6970,7 +6990,7 @@ var ts; } ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 207 /* ExpressionStatement */ + return node.kind === 208 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -7053,9 +7073,9 @@ var ts; case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 144 /* Parameter */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return node === parent_1.type; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 150 /* Constructor */: @@ -7081,29 +7101,43 @@ var ts; return false; } ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfNodeWithKind(node, kind) { + while (node) { + if (node.kind === kind) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfNodeWithKind = isChildOfNodeWithKind; + function isPrefixUnaryExpression(node) { + return node.kind === 190 /* PrefixUnaryExpression */; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitor(node); - case 232 /* CaseBlock */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 254 /* DefaultClause */: - case 219 /* LabeledStatement */: - case 221 /* TryStatement */: - case 256 /* CatchClause */: + case 233 /* CaseBlock */: + case 205 /* Block */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 218 /* WithStatement */: + case 219 /* SwitchStatement */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: + case 220 /* LabeledStatement */: + case 222 /* TryStatement */: + case 257 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -7119,11 +7153,11 @@ var ts; if (operand) { traverse(operand); } - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 226 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be @@ -7170,13 +7204,13 @@ var ts; if (node) { switch (node.kind) { case 174 /* BindingElement */: - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 144 /* Parameter */: - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 258 /* ShorthandPropertyAssignment */: - case 223 /* VariableDeclaration */: + case 259 /* ShorthandPropertyAssignment */: + case 224 /* VariableDeclaration */: return true; } } @@ -7188,7 +7222,7 @@ var ts; } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); + return node && (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -7199,7 +7233,7 @@ var ts; switch (kind) { case 150 /* Constructor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -7222,7 +7256,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return true; } @@ -7231,20 +7265,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: return true; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; + function unwrapInnermostStatmentOfLabel(node, beforeUnwrapLabelCallback) { + while (true) { + if (beforeUnwrapLabelCallback) { + beforeUnwrapLabelCallback(node); + } + if (node.statement.kind !== 220 /* LabeledStatement */) { + return node.statement; + } + node = node.statement; + } + } + ts.unwrapInnermostStatmentOfLabel = unwrapInnermostStatmentOfLabel; function isFunctionBlock(node) { - return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 205 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { @@ -7323,9 +7369,9 @@ var ts; continue; } // Fall through - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 149 /* MethodDeclaration */: @@ -7336,13 +7382,26 @@ var ts; case 153 /* CallSignature */: case 154 /* ConstructSignature */: case 155 /* IndexSignature */: - case 229 /* EnumDeclaration */: - case 261 /* SourceFile */: + case 230 /* EnumDeclaration */: + case 262 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; + function getNewTargetContainer(node) { + var container = getThisContainer(node, /*includeArrowFunctions*/ false); + if (container) { + switch (container.kind) { + case 150 /* Constructor */: + case 226 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + return container; + } + } + return undefined; + } + ts.getNewTargetContainer = getNewTargetContainer; /** * Given an super call/property node, returns the closest node where * - a super call/property access is legal in the node and not legal in the parent node the node. @@ -7361,7 +7420,7 @@ var ts; case 142 /* ComputedPropertyName */: node = node.parent; break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: if (!stopOnFunctions) { @@ -7418,7 +7477,7 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return node.typeName; case 199 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) @@ -7453,25 +7512,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // classes are valid targets return true; case 147 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 226 /* ClassDeclaration */; + return node.parent.kind === 227 /* ClassDeclaration */; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 149 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 226 /* ClassDeclaration */; + && node.parent.kind === 227 /* ClassDeclaration */; case 144 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return node.parent.body !== undefined && (node.parent.kind === 150 /* Constructor */ || node.parent.kind === 149 /* MethodDeclaration */ || node.parent.kind === 152 /* SetAccessor */) - && node.parent.parent.kind === 226 /* ClassDeclaration */; + && node.parent.parent.kind === 227 /* ClassDeclaration */; } return false; } @@ -7487,7 +7546,7 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); case 149 /* MethodDeclaration */: case 152 /* SetAccessor */: @@ -7497,9 +7556,9 @@ var ts; ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 248 /* JsxOpeningElement */ || - parent.kind === 247 /* JsxSelfClosingElement */ || - parent.kind === 249 /* JsxClosingElement */) { + if (parent.kind === 249 /* JsxOpeningElement */ || + parent.kind === 248 /* JsxSelfClosingElement */ || + parent.kind === 250 /* JsxClosingElement */) { return parent.tagName === node; } return false; @@ -7538,10 +7597,11 @@ var ts; case 194 /* TemplateExpression */: case 12 /* NoSubstitutionTemplateLiteral */: case 198 /* OmittedExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: case 195 /* YieldExpression */: case 189 /* AwaitExpression */: + case 202 /* MetaProperty */: return true; case 141 /* QualifiedName */: while (node.parent.kind === 141 /* QualifiedName */) { @@ -7558,46 +7618,46 @@ var ts; case 98 /* ThisKeyword */: var parent_3 = node.parent; switch (parent_3.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: + case 261 /* EnumMember */: + case 258 /* PropertyAssignment */: case 174 /* BindingElement */: return parent_3.initializer === node; - case 207 /* ExpressionStatement */: - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 216 /* ReturnStatement */: - case 217 /* WithStatement */: - case 218 /* SwitchStatement */: - case 253 /* CaseClause */: - case 220 /* ThrowStatement */: - case 218 /* SwitchStatement */: + case 208 /* ExpressionStatement */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 217 /* ReturnStatement */: + case 218 /* WithStatement */: + case 219 /* SwitchStatement */: + case 254 /* CaseClause */: + case 221 /* ThrowStatement */: + case 219 /* SwitchStatement */: return parent_3.expression === node; - case 211 /* ForStatement */: + case 212 /* ForStatement */: var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 225 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 225 /* VariableDeclarationList */) || forInStatement.expression === node; case 182 /* TypeAssertionExpression */: case 200 /* AsExpression */: return node === parent_3.expression; - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return node === parent_3.expression; case 142 /* ComputedPropertyName */: return node === parent_3.expression; case 145 /* Decorator */: - case 252 /* JsxExpression */: - case 251 /* JsxSpreadAttribute */: - case 259 /* SpreadAssignment */: + case 253 /* JsxExpression */: + case 252 /* JsxSpreadAttribute */: + case 260 /* SpreadAssignment */: return true; case 199 /* ExpressionWithTypeArguments */: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); @@ -7617,7 +7677,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */; + return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -7626,7 +7686,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */; + return node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 246 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -7660,7 +7720,7 @@ var ts; * This function does not test if the node is in a JavaScript file or not. */ function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) { + if (s.valueDeclaration && s.valueDeclaration.kind === 224 /* VariableDeclaration */) { var declaration = s.valueDeclaration; return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; } @@ -7713,35 +7773,35 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 245 /* ExternalModuleReference */) { + if (reference.kind === 246 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 241 /* ExportDeclaration */) { + if (node.kind === 242 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 231 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 238 /* NamespaceImport */) { return importClause.namedBindings; } } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 235 /* ImportDeclaration */ + return node.kind === 236 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } @@ -7752,8 +7812,8 @@ var ts; case 144 /* Parameter */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - case 258 /* ShorthandPropertyAssignment */: - case 257 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return node.questionToken !== undefined; @@ -7763,9 +7823,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 274 /* JSDocFunctionType */ && + return node.kind === 275 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 276 /* JSDocConstructorType */; + node.parameters[0].type.kind === 277 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getCommentsFromJSDoc(node) { @@ -7778,7 +7838,7 @@ var ts; var result = []; for (var _i = 0, docs_1 = docs; _i < docs_1.length; _i++) { var doc = docs_1[_i]; - if (doc.kind === 281 /* JSDocParameterTag */) { + if (doc.kind === 282 /* JSDocParameterTag */) { if (doc.kind === kind) { result.push(doc); } @@ -7810,9 +7870,9 @@ var ts; // var x = function(name) { return name.length; } var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && - parent.parent.parent.kind === 205 /* VariableStatement */; + parent.parent.parent.kind === 206 /* VariableStatement */; var isVariableOfVariableDeclarationStatement = isVariableLike(node) && - parent.parent.kind === 205 /* VariableStatement */; + parent.parent.kind === 206 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : isVariableOfVariableDeclarationStatement ? parent.parent : undefined; @@ -7823,13 +7883,13 @@ var ts; var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && - parent.parent.kind === 207 /* ExpressionStatement */; + parent.parent.kind === 208 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { getJSDocsWorker(parent.parent); } - var isModuleDeclaration = node.kind === 230 /* ModuleDeclaration */ && - parent && parent.kind === 230 /* ModuleDeclaration */; - var isPropertyAssignmentExpression = parent && parent.kind === 257 /* PropertyAssignment */; + var isModuleDeclaration = node.kind === 231 /* ModuleDeclaration */ && + parent && parent.kind === 231 /* ModuleDeclaration */; + var isPropertyAssignmentExpression = parent && parent.kind === 258 /* PropertyAssignment */; if (isModuleDeclaration || isPropertyAssignmentExpression) { getJSDocsWorker(parent); } @@ -7848,18 +7908,18 @@ var ts; return undefined; } var func = param.parent; - var tags = getJSDocTags(func, 281 /* JSDocParameterTag */); + var tags = getJSDocTags(func, 282 /* JSDocParameterTag */); if (!param.name) { // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */; }); + var paramTags = ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */; }); if (paramTags && 0 <= i && i < paramTags.length) { return [paramTags[i]]; } } else if (param.name.kind === 70 /* Identifier */) { var name_6 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 281 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); + return ts.filter(tags, function (tag) { return tag.kind === 282 /* JSDocParameterTag */ && tag.parameterName.text === name_6; }); } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines @@ -7869,7 +7929,7 @@ var ts; } ts.getJSDocParameterTags = getJSDocParameterTags; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 283 /* JSDocTypeTag */); + var tag = getFirstJSDocTag(node, 284 /* JSDocTypeTag */); if (!tag && node.kind === 144 /* Parameter */) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -7880,15 +7940,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + return getFirstJSDocTag(node, 281 /* JSDocAugmentsTag */); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); + return getFirstJSDocTag(node, 283 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); + return getFirstJSDocTag(node, 285 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -7901,8 +7961,8 @@ var ts; ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { if (node && (node.flags & 65536 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 275 /* JSDocVariadicType */ || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 275 /* JSDocVariadicType */; })) { + if (node.type && node.type.kind === 276 /* JSDocVariadicType */ || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 276 /* JSDocVariadicType */; })) { return true; } } @@ -7932,20 +7992,20 @@ var ts; case 191 /* PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; case 183 /* ParenthesizedExpression */: case 175 /* ArrayLiteralExpression */: case 196 /* SpreadElement */: node = parent; break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* None */; } // Fall through - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: node = parent.parent; break; default: @@ -7962,6 +8022,18 @@ var ts; return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped + function isDeleteTarget(node) { + if (node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { + return false; + } + node = node.parent; + while (node && node.kind === 183 /* ParenthesizedExpression */) { + node = node.parent; + } + return node && node.kind === 186 /* DeleteExpression */; + } + ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) @@ -7973,7 +8045,7 @@ var ts; ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 262 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -7987,7 +8059,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) { + if (parent.kind === 240 /* ImportSpecifier */ || parent.kind === 244 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -8014,8 +8086,8 @@ var ts; case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 260 /* EnumMember */: - case 257 /* PropertyAssignment */: + case 261 /* EnumMember */: + case 258 /* PropertyAssignment */: case 177 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; @@ -8029,10 +8101,10 @@ var ts; } return false; case 174 /* BindingElement */: - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -8048,13 +8120,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 233 /* NamespaceExportDeclaration */ || - node.kind === 236 /* ImportClause */ && !!node.name || - node.kind === 237 /* NamespaceImport */ || - node.kind === 239 /* ImportSpecifier */ || - node.kind === 243 /* ExportSpecifier */ || - node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 235 /* ImportEqualsDeclaration */ || + node.kind === 234 /* NamespaceExportDeclaration */ || + node.kind === 237 /* ImportClause */ && !!node.name || + node.kind === 238 /* NamespaceImport */ || + node.kind === 240 /* ImportSpecifier */ || + node.kind === 244 /* ExportSpecifier */ || + node.kind === 241 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -8249,13 +8321,13 @@ var ts; var kind = node.kind; return kind === 150 /* Constructor */ || kind === 184 /* FunctionExpression */ - || kind === 225 /* FunctionDeclaration */ + || kind === 226 /* FunctionDeclaration */ || kind === 185 /* ArrowFunction */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ - || kind === 230 /* ModuleDeclaration */ - || kind === 261 /* SourceFile */; + || kind === 231 /* ModuleDeclaration */ + || kind === 262 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -8387,14 +8459,13 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 197 /* ClassExpression */: - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: case 11 /* RegularExpressionLiteral */: case 12 /* NoSubstitutionTemplateLiteral */: case 194 /* TemplateExpression */: case 183 /* ParenthesizedExpression */: case 198 /* OmittedExpression */: - case 297 /* RawExpression */: return 19; case 181 /* TaggedTemplateExpression */: case 177 /* PropertyAccessExpression */: @@ -8578,13 +8649,12 @@ var ts; * Note that this doesn't actually wrap the input in double quotes. */ function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -9638,8 +9708,8 @@ var ts; var parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -9660,7 +9730,7 @@ var ts; if (node.symbol) { for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) { + if (declaration.kind === 227 /* ClassDeclaration */ && declaration !== node) { return true; } } @@ -9725,6 +9795,10 @@ var ts; return node.kind === 70 /* Identifier */; } ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188 /* VoidExpression */; + } + ts.isVoidExpression = isVoidExpression; function isGeneratedIdentifier(node) { // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. return isIdentifier(node) && node.autoGenerateKind > 0 /* None */; @@ -9797,18 +9871,18 @@ var ts; || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ || kind === 155 /* IndexSignature */ - || kind === 203 /* SemicolonClassElement */; + || kind === 204 /* SemicolonClassElement */; } ts.isClassElement = isClassElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 257 /* PropertyAssignment */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 259 /* SpreadAssignment */ + return kind === 258 /* PropertyAssignment */ + || kind === 259 /* ShorthandPropertyAssignment */ + || kind === 260 /* SpreadAssignment */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */ - || kind === 244 /* MissingDeclaration */; + || kind === 245 /* MissingDeclaration */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -9871,7 +9945,7 @@ var ts; */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 174 /* BindingElement */: return true; @@ -9959,8 +10033,8 @@ var ts; || kind === 178 /* ElementAccessExpression */ || kind === 180 /* NewExpression */ || kind === 179 /* CallExpression */ - || kind === 246 /* JsxElement */ - || kind === 247 /* JsxSelfClosingElement */ + || kind === 247 /* JsxElement */ + || kind === 248 /* JsxSelfClosingElement */ || kind === 181 /* TaggedTemplateExpression */ || kind === 175 /* ArrayLiteralExpression */ || kind === 183 /* ParenthesizedExpression */ @@ -9979,7 +10053,7 @@ var ts; || kind === 100 /* TrueKeyword */ || kind === 96 /* SuperKeyword */ || kind === 201 /* NonNullExpression */ - || kind === 297 /* RawExpression */; + || kind === 202 /* MetaProperty */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); @@ -10007,7 +10081,6 @@ var ts; || kind === 196 /* SpreadElement */ || kind === 200 /* AsExpression */ || kind === 198 /* OmittedExpression */ - || kind === 297 /* RawExpression */ || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -10021,11 +10094,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 294 /* PartiallyEmittedExpression */; + return node.kind === 295 /* PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 293 /* NotEmittedStatement */; + return node.kind === 294 /* NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10039,12 +10112,12 @@ var ts; ts.isOmittedExpression = isOmittedExpression; // Misc function isTemplateSpan(node) { - return node.kind === 202 /* TemplateSpan */; + return node.kind === 203 /* TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; // Element function isBlock(node) { - return node.kind === 204 /* Block */; + return node.kind === 205 /* Block */; } ts.isBlock = isBlock; function isConciseBody(node) { @@ -10062,121 +10135,121 @@ var ts; } ts.isForInitializer = isForInitializer; function isVariableDeclaration(node) { - return node.kind === 223 /* VariableDeclaration */; + return node.kind === 224 /* VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 224 /* VariableDeclarationList */; + return node.kind === 225 /* VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isCaseBlock(node) { - return node.kind === 232 /* CaseBlock */; + return node.kind === 233 /* CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isModuleBody(node) { var kind = node.kind; - return kind === 231 /* ModuleBlock */ - || kind === 230 /* ModuleDeclaration */; + return kind === 232 /* ModuleBlock */ + || kind === 231 /* ModuleDeclaration */; } ts.isModuleBody = isModuleBody; function isImportEqualsDeclaration(node) { - return node.kind === 234 /* ImportEqualsDeclaration */; + return node.kind === 235 /* ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportClause(node) { - return node.kind === 236 /* ImportClause */; + return node.kind === 237 /* ImportClause */; } ts.isImportClause = isImportClause; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 238 /* NamedImports */ - || kind === 237 /* NamespaceImport */; + return kind === 239 /* NamedImports */ + || kind === 238 /* NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; function isImportSpecifier(node) { - return node.kind === 239 /* ImportSpecifier */; + return node.kind === 240 /* ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isNamedExports(node) { - return node.kind === 242 /* NamedExports */; + return node.kind === 243 /* NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 243 /* ExportSpecifier */; + return node.kind === 244 /* ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isModuleOrEnumDeclaration(node) { - return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */; + return node.kind === 231 /* ModuleDeclaration */ || node.kind === 230 /* EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { return kind === 185 /* ArrowFunction */ || kind === 174 /* BindingElement */ - || kind === 226 /* ClassDeclaration */ + || kind === 227 /* ClassDeclaration */ || kind === 197 /* ClassExpression */ || kind === 150 /* Constructor */ - || kind === 229 /* EnumDeclaration */ - || kind === 260 /* EnumMember */ - || kind === 243 /* ExportSpecifier */ - || kind === 225 /* FunctionDeclaration */ + || kind === 230 /* EnumDeclaration */ + || kind === 261 /* EnumMember */ + || kind === 244 /* ExportSpecifier */ + || kind === 226 /* FunctionDeclaration */ || kind === 184 /* FunctionExpression */ || kind === 151 /* GetAccessor */ - || kind === 236 /* ImportClause */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 239 /* ImportSpecifier */ - || kind === 227 /* InterfaceDeclaration */ + || kind === 237 /* ImportClause */ + || kind === 235 /* ImportEqualsDeclaration */ + || kind === 240 /* ImportSpecifier */ + || kind === 228 /* InterfaceDeclaration */ || kind === 149 /* MethodDeclaration */ || kind === 148 /* MethodSignature */ - || kind === 230 /* ModuleDeclaration */ - || kind === 233 /* NamespaceExportDeclaration */ - || kind === 237 /* NamespaceImport */ + || kind === 231 /* ModuleDeclaration */ + || kind === 234 /* NamespaceExportDeclaration */ + || kind === 238 /* NamespaceImport */ || kind === 144 /* Parameter */ - || kind === 257 /* PropertyAssignment */ + || kind === 258 /* PropertyAssignment */ || kind === 147 /* PropertyDeclaration */ || kind === 146 /* PropertySignature */ || kind === 152 /* SetAccessor */ - || kind === 258 /* ShorthandPropertyAssignment */ - || kind === 228 /* TypeAliasDeclaration */ + || kind === 259 /* ShorthandPropertyAssignment */ + || kind === 229 /* TypeAliasDeclaration */ || kind === 143 /* TypeParameter */ - || kind === 223 /* VariableDeclaration */ - || kind === 285 /* JSDocTypedefTag */; + || kind === 224 /* VariableDeclaration */ + || kind === 286 /* JSDocTypedefTag */; } function isDeclarationStatementKind(kind) { - return kind === 225 /* FunctionDeclaration */ - || kind === 244 /* MissingDeclaration */ - || kind === 226 /* ClassDeclaration */ - || kind === 227 /* InterfaceDeclaration */ - || kind === 228 /* TypeAliasDeclaration */ - || kind === 229 /* EnumDeclaration */ - || kind === 230 /* ModuleDeclaration */ - || kind === 235 /* ImportDeclaration */ - || kind === 234 /* ImportEqualsDeclaration */ - || kind === 241 /* ExportDeclaration */ - || kind === 240 /* ExportAssignment */ - || kind === 233 /* NamespaceExportDeclaration */; + return kind === 226 /* FunctionDeclaration */ + || kind === 245 /* MissingDeclaration */ + || kind === 227 /* ClassDeclaration */ + || kind === 228 /* InterfaceDeclaration */ + || kind === 229 /* TypeAliasDeclaration */ + || kind === 230 /* EnumDeclaration */ + || kind === 231 /* ModuleDeclaration */ + || kind === 236 /* ImportDeclaration */ + || kind === 235 /* ImportEqualsDeclaration */ + || kind === 242 /* ExportDeclaration */ + || kind === 241 /* ExportAssignment */ + || kind === 234 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 215 /* BreakStatement */ - || kind === 214 /* ContinueStatement */ - || kind === 222 /* DebuggerStatement */ - || kind === 209 /* DoStatement */ - || kind === 207 /* ExpressionStatement */ - || kind === 206 /* EmptyStatement */ - || kind === 212 /* ForInStatement */ - || kind === 213 /* ForOfStatement */ - || kind === 211 /* ForStatement */ - || kind === 208 /* IfStatement */ - || kind === 219 /* LabeledStatement */ - || kind === 216 /* ReturnStatement */ - || kind === 218 /* SwitchStatement */ - || kind === 220 /* ThrowStatement */ - || kind === 221 /* TryStatement */ - || kind === 205 /* VariableStatement */ - || kind === 210 /* WhileStatement */ - || kind === 217 /* WithStatement */ - || kind === 293 /* NotEmittedStatement */ - || kind === 296 /* EndOfDeclarationMarker */ - || kind === 295 /* MergeDeclarationMarker */; + return kind === 216 /* BreakStatement */ + || kind === 215 /* ContinueStatement */ + || kind === 223 /* DebuggerStatement */ + || kind === 210 /* DoStatement */ + || kind === 208 /* ExpressionStatement */ + || kind === 207 /* EmptyStatement */ + || kind === 213 /* ForInStatement */ + || kind === 214 /* ForOfStatement */ + || kind === 212 /* ForStatement */ + || kind === 209 /* IfStatement */ + || kind === 220 /* LabeledStatement */ + || kind === 217 /* ReturnStatement */ + || kind === 219 /* SwitchStatement */ + || kind === 221 /* ThrowStatement */ + || kind === 222 /* TryStatement */ + || kind === 206 /* VariableStatement */ + || kind === 211 /* WhileStatement */ + || kind === 218 /* WithStatement */ + || kind === 294 /* NotEmittedStatement */ + || kind === 297 /* EndOfDeclarationMarker */ + || kind === 296 /* MergeDeclarationMarker */; } function isDeclaration(node) { return isDeclarationKind(node.kind); @@ -10197,24 +10270,24 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 204 /* Block */; + || kind === 205 /* Block */; } ts.isStatement = isStatement; // Module references function isModuleReference(node) { var kind = node.kind; - return kind === 245 /* ExternalModuleReference */ + return kind === 246 /* ExternalModuleReference */ || kind === 141 /* QualifiedName */ || kind === 70 /* Identifier */; } ts.isModuleReference = isModuleReference; // JSX function isJsxOpeningElement(node) { - return node.kind === 248 /* JsxOpeningElement */; + return node.kind === 249 /* JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 249 /* JsxClosingElement */; + return node.kind === 250 /* JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxTagNameExpression(node) { @@ -10226,64 +10299,64 @@ var ts; ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 246 /* JsxElement */ - || kind === 252 /* JsxExpression */ - || kind === 247 /* JsxSelfClosingElement */ + return kind === 247 /* JsxElement */ + || kind === 253 /* JsxExpression */ + || kind === 248 /* JsxSelfClosingElement */ || kind === 10 /* JsxText */; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 250 /* JsxAttribute */ - || kind === 251 /* JsxSpreadAttribute */; + return kind === 251 /* JsxAttribute */ + || kind === 252 /* JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; function isJsxSpreadAttribute(node) { - return node.kind === 251 /* JsxSpreadAttribute */; + return node.kind === 252 /* JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxAttribute(node) { - return node.kind === 250 /* JsxAttribute */; + return node.kind === 251 /* JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 9 /* StringLiteral */ - || kind === 252 /* JsxExpression */; + || kind === 253 /* JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 253 /* CaseClause */ - || kind === 254 /* DefaultClause */; + return kind === 254 /* CaseClause */ + || kind === 255 /* DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isHeritageClause(node) { - return node.kind === 255 /* HeritageClause */; + return node.kind === 256 /* HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 256 /* CatchClause */; + return node.kind === 257 /* CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 257 /* PropertyAssignment */; + return node.kind === 258 /* PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 258 /* ShorthandPropertyAssignment */; + return node.kind === 259 /* ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; // Enum function isEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 261 /* EnumMember */; } ts.isEnumMember = isEnumMember; // Top-level nodes function isSourceFile(node) { - return node.kind === 261 /* SourceFile */; + return node.kind === 262 /* SourceFile */; } ts.isSourceFile = isSourceFile; function isWatchSet(options) { @@ -10515,7 +10588,7 @@ var ts; function getTypeParameterOwner(d) { if (d && d.kind === 143 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 228 /* InterfaceDeclaration */) { return current; } } @@ -10535,14 +10608,14 @@ var ts; function getCombinedModifierFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = ts.getModifierFlags(node); - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 225 /* VariableDeclarationList */) { flags |= ts.getModifierFlags(node); node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 206 /* VariableStatement */) { flags |= ts.getModifierFlags(node); } return flags; @@ -10558,14 +10631,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 224 /* VariableDeclarationList */) { + if (node && node.kind === 225 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 205 /* VariableStatement */) { + if (node && node.kind === 206 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -10634,7 +10707,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, location, flags) { - var ConstructorForKind = kind === 261 /* SourceFile */ + var ConstructorForKind = kind === 262 /* SourceFile */ ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); var node = location @@ -11351,7 +11424,7 @@ var ts; ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; // Misc function createTemplateSpan(expression, literal, location) { - var node = createNode(202 /* TemplateSpan */, location); + var node = createNode(203 /* TemplateSpan */, location); node.expression = expression; node.literal = literal; return node; @@ -11366,7 +11439,7 @@ var ts; ts.updateTemplateSpan = updateTemplateSpan; // Element function createBlock(statements, location, multiLine, flags) { - var block = createNode(204 /* Block */, location, flags); + var block = createNode(205 /* Block */, location, flags); block.statements = createNodeArray(statements); if (multiLine) { block.multiLine = true; @@ -11382,7 +11455,7 @@ var ts; } ts.updateBlock = updateBlock; function createVariableStatement(modifiers, declarationList, location, flags) { - var node = createNode(205 /* VariableStatement */, location, flags); + var node = createNode(206 /* VariableStatement */, location, flags); node.decorators = undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; @@ -11397,7 +11470,7 @@ var ts; } ts.updateVariableStatement = updateVariableStatement; function createVariableDeclarationList(declarations, location, flags) { - var node = createNode(224 /* VariableDeclarationList */, location, flags); + var node = createNode(225 /* VariableDeclarationList */, location, flags); node.declarations = createNodeArray(declarations); return node; } @@ -11410,7 +11483,7 @@ var ts; } ts.updateVariableDeclarationList = updateVariableDeclarationList; function createVariableDeclaration(name, type, initializer, location, flags) { - var node = createNode(223 /* VariableDeclaration */, location, flags); + var node = createNode(224 /* VariableDeclaration */, location, flags); node.name = typeof name === "string" ? createIdentifier(name) : name; node.type = type; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11425,11 +11498,11 @@ var ts; } ts.updateVariableDeclaration = updateVariableDeclaration; function createEmptyStatement(location) { - return createNode(206 /* EmptyStatement */, location); + return createNode(207 /* EmptyStatement */, location); } ts.createEmptyStatement = createEmptyStatement; function createStatement(expression, location, flags) { - var node = createNode(207 /* ExpressionStatement */, location, flags); + var node = createNode(208 /* ExpressionStatement */, location, flags); node.expression = parenthesizeExpressionForExpressionStatement(expression); return node; } @@ -11442,7 +11515,7 @@ var ts; } ts.updateStatement = updateStatement; function createIf(expression, thenStatement, elseStatement, location) { - var node = createNode(208 /* IfStatement */, location); + var node = createNode(209 /* IfStatement */, location); node.expression = expression; node.thenStatement = thenStatement; node.elseStatement = elseStatement; @@ -11457,7 +11530,7 @@ var ts; } ts.updateIf = updateIf; function createDo(statement, expression, location) { - var node = createNode(209 /* DoStatement */, location); + var node = createNode(210 /* DoStatement */, location); node.statement = statement; node.expression = expression; return node; @@ -11471,7 +11544,7 @@ var ts; } ts.updateDo = updateDo; function createWhile(expression, statement, location) { - var node = createNode(210 /* WhileStatement */, location); + var node = createNode(211 /* WhileStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11485,7 +11558,7 @@ var ts; } ts.updateWhile = updateWhile; function createFor(initializer, condition, incrementor, statement, location) { - var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined); + var node = createNode(212 /* ForStatement */, location, /*flags*/ undefined); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -11501,7 +11574,7 @@ var ts; } ts.updateFor = updateFor; function createForIn(initializer, expression, statement, location) { - var node = createNode(212 /* ForInStatement */, location); + var node = createNode(213 /* ForInStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11516,7 +11589,7 @@ var ts; } ts.updateForIn = updateForIn; function createForOf(initializer, expression, statement, location) { - var node = createNode(213 /* ForOfStatement */, location); + var node = createNode(214 /* ForOfStatement */, location); node.initializer = initializer; node.expression = expression; node.statement = statement; @@ -11531,7 +11604,7 @@ var ts; } ts.updateForOf = updateForOf; function createContinue(label, location) { - var node = createNode(214 /* ContinueStatement */, location); + var node = createNode(215 /* ContinueStatement */, location); if (label) { node.label = label; } @@ -11546,7 +11619,7 @@ var ts; } ts.updateContinue = updateContinue; function createBreak(label, location) { - var node = createNode(215 /* BreakStatement */, location); + var node = createNode(216 /* BreakStatement */, location); if (label) { node.label = label; } @@ -11561,7 +11634,7 @@ var ts; } ts.updateBreak = updateBreak; function createReturn(expression, location) { - var node = createNode(216 /* ReturnStatement */, location); + var node = createNode(217 /* ReturnStatement */, location); node.expression = expression; return node; } @@ -11574,7 +11647,7 @@ var ts; } ts.updateReturn = updateReturn; function createWith(expression, statement, location) { - var node = createNode(217 /* WithStatement */, location); + var node = createNode(218 /* WithStatement */, location); node.expression = expression; node.statement = statement; return node; @@ -11588,7 +11661,7 @@ var ts; } ts.updateWith = updateWith; function createSwitch(expression, caseBlock, location) { - var node = createNode(218 /* SwitchStatement */, location); + var node = createNode(219 /* SwitchStatement */, location); node.expression = parenthesizeExpressionForList(expression); node.caseBlock = caseBlock; return node; @@ -11602,7 +11675,7 @@ var ts; } ts.updateSwitch = updateSwitch; function createLabel(label, statement, location) { - var node = createNode(219 /* LabeledStatement */, location); + var node = createNode(220 /* LabeledStatement */, location); node.label = typeof label === "string" ? createIdentifier(label) : label; node.statement = statement; return node; @@ -11616,7 +11689,7 @@ var ts; } ts.updateLabel = updateLabel; function createThrow(expression, location) { - var node = createNode(220 /* ThrowStatement */, location); + var node = createNode(221 /* ThrowStatement */, location); node.expression = expression; return node; } @@ -11629,7 +11702,7 @@ var ts; } ts.updateThrow = updateThrow; function createTry(tryBlock, catchClause, finallyBlock, location) { - var node = createNode(221 /* TryStatement */, location); + var node = createNode(222 /* TryStatement */, location); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -11644,7 +11717,7 @@ var ts; } ts.updateTry = updateTry; function createCaseBlock(clauses, location) { - var node = createNode(232 /* CaseBlock */, location); + var node = createNode(233 /* CaseBlock */, location); node.clauses = createNodeArray(clauses); return node; } @@ -11657,7 +11730,7 @@ var ts; } ts.updateCaseBlock = updateCaseBlock; function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { - var node = createNode(225 /* FunctionDeclaration */, location, flags); + var node = createNode(226 /* FunctionDeclaration */, location, flags); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.asteriskToken = asteriskToken; @@ -11677,7 +11750,7 @@ var ts; } ts.updateFunctionDeclaration = updateFunctionDeclaration; function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { - var node = createNode(226 /* ClassDeclaration */, location); + var node = createNode(227 /* ClassDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.name = name; @@ -11695,7 +11768,7 @@ var ts; } ts.updateClassDeclaration = updateClassDeclaration; function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { - var node = createNode(235 /* ImportDeclaration */, location); + var node = createNode(236 /* ImportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.importClause = importClause; @@ -11711,7 +11784,7 @@ var ts; } ts.updateImportDeclaration = updateImportDeclaration; function createImportClause(name, namedBindings, location) { - var node = createNode(236 /* ImportClause */, location); + var node = createNode(237 /* ImportClause */, location); node.name = name; node.namedBindings = namedBindings; return node; @@ -11725,7 +11798,7 @@ var ts; } ts.updateImportClause = updateImportClause; function createNamespaceImport(name, location) { - var node = createNode(237 /* NamespaceImport */, location); + var node = createNode(238 /* NamespaceImport */, location); node.name = name; return node; } @@ -11738,7 +11811,7 @@ var ts; } ts.updateNamespaceImport = updateNamespaceImport; function createNamedImports(elements, location) { - var node = createNode(238 /* NamedImports */, location); + var node = createNode(239 /* NamedImports */, location); node.elements = createNodeArray(elements); return node; } @@ -11751,7 +11824,7 @@ var ts; } ts.updateNamedImports = updateNamedImports; function createImportSpecifier(propertyName, name, location) { - var node = createNode(239 /* ImportSpecifier */, location); + var node = createNode(240 /* ImportSpecifier */, location); node.propertyName = propertyName; node.name = name; return node; @@ -11765,7 +11838,7 @@ var ts; } ts.updateImportSpecifier = updateImportSpecifier; function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { - var node = createNode(240 /* ExportAssignment */, location); + var node = createNode(241 /* ExportAssignment */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.isExportEquals = isExportEquals; @@ -11781,7 +11854,7 @@ var ts; } ts.updateExportAssignment = updateExportAssignment; function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { - var node = createNode(241 /* ExportDeclaration */, location); + var node = createNode(242 /* ExportDeclaration */, location); node.decorators = decorators ? createNodeArray(decorators) : undefined; node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; node.exportClause = exportClause; @@ -11797,7 +11870,7 @@ var ts; } ts.updateExportDeclaration = updateExportDeclaration; function createNamedExports(elements, location) { - var node = createNode(242 /* NamedExports */, location); + var node = createNode(243 /* NamedExports */, location); node.elements = createNodeArray(elements); return node; } @@ -11810,7 +11883,7 @@ var ts; } ts.updateNamedExports = updateNamedExports; function createExportSpecifier(name, propertyName, location) { - var node = createNode(243 /* ExportSpecifier */, location); + var node = createNode(244 /* ExportSpecifier */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; return node; @@ -11825,7 +11898,7 @@ var ts; ts.updateExportSpecifier = updateExportSpecifier; // JSX function createJsxElement(openingElement, children, closingElement, location) { - var node = createNode(246 /* JsxElement */, location); + var node = createNode(247 /* JsxElement */, location); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -11840,7 +11913,7 @@ var ts; } ts.updateJsxElement = updateJsxElement; function createJsxSelfClosingElement(tagName, attributes, location) { - var node = createNode(247 /* JsxSelfClosingElement */, location); + var node = createNode(248 /* JsxSelfClosingElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11854,7 +11927,7 @@ var ts; } ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; function createJsxOpeningElement(tagName, attributes, location) { - var node = createNode(248 /* JsxOpeningElement */, location); + var node = createNode(249 /* JsxOpeningElement */, location); node.tagName = tagName; node.attributes = createNodeArray(attributes); return node; @@ -11868,7 +11941,7 @@ var ts; } ts.updateJsxOpeningElement = updateJsxOpeningElement; function createJsxClosingElement(tagName, location) { - var node = createNode(249 /* JsxClosingElement */, location); + var node = createNode(250 /* JsxClosingElement */, location); node.tagName = tagName; return node; } @@ -11881,7 +11954,7 @@ var ts; } ts.updateJsxClosingElement = updateJsxClosingElement; function createJsxAttribute(name, initializer, location) { - var node = createNode(250 /* JsxAttribute */, location); + var node = createNode(251 /* JsxAttribute */, location); node.name = name; node.initializer = initializer; return node; @@ -11895,7 +11968,7 @@ var ts; } ts.updateJsxAttribute = updateJsxAttribute; function createJsxSpreadAttribute(expression, location) { - var node = createNode(251 /* JsxSpreadAttribute */, location); + var node = createNode(252 /* JsxSpreadAttribute */, location); node.expression = expression; return node; } @@ -11907,22 +11980,23 @@ var ts; return node; } ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(expression, location) { - var node = createNode(252 /* JsxExpression */, location); + function createJsxExpression(expression, dotDotDotToken, location) { + var node = createNode(253 /* JsxExpression */, location); + node.dotDotDotToken = dotDotDotToken; node.expression = expression; return node; } ts.createJsxExpression = createJsxExpression; function updateJsxExpression(node, expression) { if (node.expression !== expression) { - return updateNode(createJsxExpression(expression, node), node); + return updateNode(createJsxExpression(expression, node.dotDotDotToken, node), node); } return node; } ts.updateJsxExpression = updateJsxExpression; // Clauses function createHeritageClause(token, types, location) { - var node = createNode(255 /* HeritageClause */, location); + var node = createNode(256 /* HeritageClause */, location); node.token = token; node.types = createNodeArray(types); return node; @@ -11936,7 +12010,7 @@ var ts; } ts.updateHeritageClause = updateHeritageClause; function createCaseClause(expression, statements, location) { - var node = createNode(253 /* CaseClause */, location); + var node = createNode(254 /* CaseClause */, location); node.expression = parenthesizeExpressionForList(expression); node.statements = createNodeArray(statements); return node; @@ -11950,7 +12024,7 @@ var ts; } ts.updateCaseClause = updateCaseClause; function createDefaultClause(statements, location) { - var node = createNode(254 /* DefaultClause */, location); + var node = createNode(255 /* DefaultClause */, location); node.statements = createNodeArray(statements); return node; } @@ -11963,7 +12037,7 @@ var ts; } ts.updateDefaultClause = updateDefaultClause; function createCatchClause(variableDeclaration, block, location) { - var node = createNode(256 /* CatchClause */, location); + var node = createNode(257 /* CatchClause */, location); node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; node.block = block; return node; @@ -11978,7 +12052,7 @@ var ts; ts.updateCatchClause = updateCatchClause; // Property assignments function createPropertyAssignment(name, initializer, location) { - var node = createNode(257 /* PropertyAssignment */, location); + var node = createNode(258 /* PropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.questionToken = undefined; node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; @@ -11993,14 +12067,14 @@ var ts; } ts.updatePropertyAssignment = updatePropertyAssignment; function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { - var node = createNode(258 /* ShorthandPropertyAssignment */, location); + var node = createNode(259 /* ShorthandPropertyAssignment */, location); node.name = typeof name === "string" ? createIdentifier(name) : name; node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; return node; } ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; function createSpreadAssignment(expression, location) { - var node = createNode(259 /* SpreadAssignment */, location); + var node = createNode(260 /* SpreadAssignment */, location); node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; return node; } @@ -12022,7 +12096,7 @@ var ts; // Top-level nodes function updateSourceFileNode(node, statements) { if (node.statements !== statements) { - var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags); + var updated = createNode(262 /* SourceFile */, /*location*/ node, node.flags); updated.statements = createNodeArray(statements); updated.endOfFileToken = node.endOfFileToken; updated.fileName = node.fileName; @@ -12089,7 +12163,7 @@ var ts; * @param original The original statement. */ function createNotEmittedStatement(original) { - var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); + var node = createNode(294 /* NotEmittedStatement */, /*location*/ original); node.original = original; return node; } @@ -12099,7 +12173,7 @@ var ts; * order to properly emit exports. */ function createEndOfDeclarationMarker(original) { - var node = createNode(296 /* EndOfDeclarationMarker */); + var node = createNode(297 /* EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12110,7 +12184,7 @@ var ts; * order to properly emit exports. */ function createMergeDeclarationMarker(original) { - var node = createNode(295 /* MergeDeclarationMarker */); + var node = createNode(296 /* MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -12125,7 +12199,7 @@ var ts; * @param location The location for the expression. Defaults to the positions from "original" if provided. */ function createPartiallyEmittedExpression(expression, original, location) { - var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); + var node = createNode(295 /* PartiallyEmittedExpression */, /*location*/ location || original); node.expression = expression; node.original = original; return node; @@ -12138,19 +12212,6 @@ var ts; return node; } ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - /** - * Creates a node that emits a string of raw text in an expression position. Raw text is never - * transformed, should be ES3 compliant, and should have the same precedence as - * PrimaryExpression. - * - * @param text The raw text of the node. - */ - function createRawExpression(text) { - var node = createNode(297 /* RawExpression */); - node.text = text; - return node; - } - ts.createRawExpression = createRawExpression; // Compound nodes function createComma(left, right) { return createBinary(left, 25 /* CommaToken */, right); @@ -12326,6 +12387,20 @@ var ts; return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); } ts.getHelperName = getHelperName; + // Utilities + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 220 /* LabeledStatement */ + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { var target = skipParentheses(node); switch (target.kind) { @@ -12432,9 +12507,9 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return createExpressionForPropertyAssignment(property, receiver); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(property, receiver); case 149 /* MethodDeclaration */: return createExpressionForMethodDeclaration(property, receiver); @@ -12999,7 +13074,7 @@ var ts; case 177 /* PropertyAccessExpression */: node = node.expression; continue; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: node = node.expression; continue; } @@ -13054,7 +13129,7 @@ var ts; } ts.skipAssertions = skipAssertions; function skipPartiallyEmittedExpressions(node) { - while (node.kind === 294 /* PartiallyEmittedExpression */) { + while (node.kind === 295 /* PartiallyEmittedExpression */) { node = node.expression; } return node; @@ -13133,7 +13208,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = ts.getSourceFileOfNode(node); @@ -13391,10 +13466,10 @@ var ts; var name_9 = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name_9) ? name_9 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } - if (node.kind === 235 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 236 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 242 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } return undefined; @@ -13514,7 +13589,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -13526,11 +13601,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -13567,7 +13642,7 @@ var ts; // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; case 196 /* SpreadElement */: - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -13591,7 +13666,7 @@ var ts; : propertyName; } break; - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -13603,7 +13678,7 @@ var ts; : propertyName; } break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: // `a` in `({ ...a } = ...)` return bindingElement.name; } @@ -13717,20 +13792,20 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" // import { x, y } from "mod" externalImports.push(node); break; - case 234 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + case 235 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -13760,13 +13835,13 @@ var ts; } } break; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: if (ts.hasModifier(node, 1 /* Export */)) { for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { var decl = _e[_d]; @@ -13774,7 +13849,7 @@ var ts; } } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default function() { } @@ -13794,7 +13869,7 @@ var ts; } } break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: if (ts.hasModifier(node, 1 /* Export */)) { if (ts.hasModifier(node, 512 /* Default */)) { // export default class { } @@ -13847,7 +13922,7 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 261 /* SourceFile */) { + if (kind === 262 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else if (kind === 70 /* Identifier */) { @@ -13903,20 +13978,20 @@ var ts; return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return visitNode(cbNode, node.expression); case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 223 /* VariableDeclaration */: + case 258 /* PropertyAssignment */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -13942,7 +14017,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -14034,6 +14109,8 @@ var ts; visitNode(cbNode, node.type); case 201 /* NonNullExpression */: return visitNode(cbNode, node.expression); + case 202 /* MetaProperty */: + return visitNode(cbNode, node.name); case 193 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || @@ -14042,76 +14119,76 @@ var ts; visitNode(cbNode, node.whenFalse); case 196 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: return visitNode(cbNode, node.label); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 253 /* CaseClause */: + case 254 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 145 /* Decorator */: return visitNode(cbNode, node.expression); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || @@ -14119,155 +14196,156 @@ var ts; visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 194 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 142 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return visitNodes(cbNodes, node.types); case 199 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 245 /* ExternalModuleReference */: + case 246 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 252 /* JsxExpression */: - return visitNode(cbNode, node.expression); - case 249 /* JsxClosingElement */: + case 253 /* JsxExpression */: + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + case 250 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 262 /* JSDocTypeExpression */: + case 263 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 266 /* JSDocUnionType */: + case 267 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 267 /* JSDocTupleType */: + case 268 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 265 /* JSDocArrayType */: + case 266 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 269 /* JSDocNonNullableType */: + case 270 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 268 /* JSDocNullableType */: + case 269 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 270 /* JSDocRecordType */: + case 271 /* JSDocRecordType */: return visitNode(cbNode, node.literal); - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 273 /* JSDocOptionalType */: + case 274 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 275 /* JSDocVariadicType */: + case 276 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 276 /* JSDocConstructorType */: + case 277 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 277 /* JSDocThisType */: + case 278 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 271 /* JSDocRecordMember */: + case 272 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 278 /* JSDocComment */: + case 279 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 281 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 282 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 283 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 280 /* JSDocAugmentsTag */: + case 281 /* JSDocAugmentsTag */: return visitNode(cbNode, node.typeExpression); - case 284 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 287 /* JSDocTypeLiteral */: + case 288 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 286 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return visitNode(cbNode, node.expression); - case 288 /* JSDocLiteralType */: + case 289 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -14539,7 +14617,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(262 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -15327,7 +15405,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 147 /* PropertyDeclaration */: - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return true; case 149 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal @@ -15344,8 +15422,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: return true; } } @@ -15354,42 +15432,42 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 205 /* VariableStatement */: - case 204 /* Block */: - case 208 /* IfStatement */: - case 207 /* ExpressionStatement */: - case 220 /* ThrowStatement */: - case 216 /* ReturnStatement */: - case 218 /* SwitchStatement */: - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 206 /* EmptyStatement */: - case 221 /* TryStatement */: - case 219 /* LabeledStatement */: - case 209 /* DoStatement */: - case 222 /* DebuggerStatement */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 226 /* FunctionDeclaration */: + case 206 /* VariableStatement */: + case 205 /* Block */: + case 209 /* IfStatement */: + case 208 /* ExpressionStatement */: + case 221 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 219 /* SwitchStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 212 /* ForStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: + case 207 /* EmptyStatement */: + case 222 /* TryStatement */: + case 220 /* LabeledStatement */: + case 210 /* DoStatement */: + case 223 /* DebuggerStatement */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: + case 241 /* ExportAssignment */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 229 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 260 /* EnumMember */; + return node.kind === 261 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { @@ -15405,7 +15483,7 @@ var ts; return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 223 /* VariableDeclaration */) { + if (node.kind !== 224 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -15590,7 +15668,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(202 /* TemplateSpan */); + var span = createNode(203 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token() === 17 /* CloseBraceToken */) { @@ -17179,8 +17257,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 248 /* JsxOpeningElement */) { - var node = createNode(246 /* JsxElement */, opening.pos); + if (opening.kind === 249 /* JsxOpeningElement */) { + var node = createNode(247 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -17190,7 +17268,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 248 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -17264,7 +17342,7 @@ var ts; // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(248 /* JsxOpeningElement */, fullStart); + node = createNode(249 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -17276,7 +17354,7 @@ var ts; parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(247 /* JsxSelfClosingElement */, fullStart); + node = createNode(248 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -17300,9 +17378,10 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(252 /* JsxExpression */); + var node = createNode(253 /* JsxExpression */); parseExpected(16 /* OpenBraceToken */); if (token() !== 17 /* CloseBraceToken */) { + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { @@ -17319,7 +17398,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(250 /* JsxAttribute */); + var node = createNode(251 /* JsxAttribute */); node.name = parseIdentifierName(); if (token() === 57 /* EqualsToken */) { switch (scanJsxAttributeValue()) { @@ -17334,7 +17413,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(251 /* JsxSpreadAttribute */); + var node = createNode(252 /* JsxSpreadAttribute */); parseExpected(16 /* OpenBraceToken */); parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); @@ -17342,7 +17421,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(249 /* JsxClosingElement */); + var node = createNode(250 /* JsxClosingElement */); parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -17581,7 +17660,7 @@ var ts; var fullStart = scanner.getStartPos(); var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); if (dotDotDotToken) { - var spreadElement = createNode(259 /* SpreadAssignment */, fullStart); + var spreadElement = createNode(260 /* SpreadAssignment */, fullStart); spreadElement.expression = parseAssignmentExpressionOrHigher(); return addJSDocComment(finishNode(spreadElement)); } @@ -17606,7 +17685,7 @@ var ts; // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(259 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(57 /* EqualsToken */); @@ -17617,7 +17696,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(258 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -17668,8 +17747,15 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(180 /* NewExpression */); + var fullStart = scanner.getStartPos(); parseExpected(93 /* NewKeyword */); + if (parseOptional(22 /* DotToken */)) { + var node_1 = createNode(202 /* MetaProperty */, fullStart); + node_1.keywordToken = 93 /* NewKeyword */; + node_1.name = parseIdentifierName(); + return finishNode(node_1); + } + var node = createNode(180 /* NewExpression */, fullStart); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); if (node.typeArguments || token() === 18 /* OpenParenToken */) { @@ -17679,7 +17765,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(204 /* Block */); + var node = createNode(205 /* Block */); if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -17712,12 +17798,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(206 /* EmptyStatement */); + var node = createNode(207 /* EmptyStatement */); parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(208 /* IfStatement */); + var node = createNode(209 /* IfStatement */); parseExpected(89 /* IfKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17727,7 +17813,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(209 /* DoStatement */); + var node = createNode(210 /* DoStatement */); parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); parseExpected(105 /* WhileKeyword */); @@ -17742,7 +17828,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(210 /* WhileStatement */); + var node = createNode(211 /* WhileStatement */); parseExpected(105 /* WhileKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17765,21 +17851,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(91 /* InKeyword */)) { - var forInStatement = createNode(212 /* ForInStatement */, pos); + var forInStatement = createNode(213 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(140 /* OfKeyword */)) { - var forOfStatement = createNode(213 /* ForOfStatement */, pos); + var forOfStatement = createNode(214 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(211 /* ForStatement */, pos); + var forStatement = createNode(212 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(24 /* SemicolonToken */); if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { @@ -17797,7 +17883,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); + parseExpected(kind === 216 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -17805,7 +17891,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(216 /* ReturnStatement */); + var node = createNode(217 /* ReturnStatement */); parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -17814,7 +17900,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(217 /* WithStatement */); + var node = createNode(218 /* WithStatement */); parseExpected(106 /* WithKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -17823,7 +17909,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(253 /* CaseClause */); + var node = createNode(254 /* CaseClause */); parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(55 /* ColonToken */); @@ -17831,7 +17917,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(254 /* DefaultClause */); + var node = createNode(255 /* DefaultClause */); parseExpected(78 /* DefaultKeyword */); parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -17841,12 +17927,12 @@ var ts; return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(218 /* SwitchStatement */); + var node = createNode(219 /* SwitchStatement */); parseExpected(97 /* SwitchKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(19 /* CloseParenToken */); - var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(233 /* CaseBlock */, scanner.getStartPos()); parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(17 /* CloseBraceToken */); @@ -17861,7 +17947,7 @@ var 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(220 /* ThrowStatement */); + var node = createNode(221 /* ThrowStatement */); parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -17869,7 +17955,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(221 /* TryStatement */); + var node = createNode(222 /* TryStatement */); parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -17882,7 +17968,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(256 /* CatchClause */); + var result = createNode(257 /* CatchClause */); parseExpected(73 /* CatchKeyword */); if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -17892,7 +17978,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(222 /* DebuggerStatement */); + var node = createNode(223 /* DebuggerStatement */); parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -17904,13 +17990,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { - var labeledStatement = createNode(219 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(220 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(208 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -18091,9 +18177,9 @@ var ts; case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 76 /* ContinueKeyword */: - return parseBreakOrContinueStatement(214 /* ContinueStatement */); + return parseBreakOrContinueStatement(215 /* ContinueStatement */); case 71 /* BreakKeyword */: - return parseBreakOrContinueStatement(215 /* BreakStatement */); + return parseBreakOrContinueStatement(216 /* BreakStatement */); case 95 /* ReturnKeyword */: return parseReturnStatement(); case 106 /* WithKeyword */: @@ -18175,7 +18261,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(245 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; node.modifiers = modifiers; @@ -18248,7 +18334,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(223 /* VariableDeclaration */); + var node = createNode(224 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -18257,7 +18343,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(224 /* VariableDeclarationList */); + var node = createNode(225 /* VariableDeclarationList */); switch (token()) { case 103 /* VarKeyword */: break; @@ -18295,7 +18381,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(205 /* VariableStatement */, fullStart); + var node = createNode(206 /* VariableStatement */, fullStart); node.decorators = decorators; node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -18303,7 +18389,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* FunctionDeclaration */, fullStart); + var node = createNode(226 /* FunctionDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(88 /* FunctionKeyword */); @@ -18527,7 +18613,7 @@ var ts; } function parseClassElement() { if (token() === 24 /* SemicolonToken */) { - var result = createNode(203 /* SemicolonClassElement */); + var result = createNode(204 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -18568,7 +18654,7 @@ var ts; /*modifiers*/ undefined, 197 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 227 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -18612,7 +18698,7 @@ var ts; } function parseHeritageClause() { if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { - var node = createNode(255 /* HeritageClause */); + var node = createNode(256 /* HeritageClause */); node.token = token(); nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -18635,7 +18721,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(227 /* InterfaceDeclaration */, fullStart); + var node = createNode(228 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(108 /* InterfaceKeyword */); @@ -18646,7 +18732,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(228 /* TypeAliasDeclaration */, fullStart); + var node = createNode(229 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(136 /* TypeKeyword */); @@ -18662,13 +18748,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(260 /* EnumMember */, scanner.getStartPos()); + var node = createNode(261 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(229 /* EnumDeclaration */, fullStart); + var node = createNode(230 /* EnumDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; parseExpected(82 /* EnumKeyword */); @@ -18683,7 +18769,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(231 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(232 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(17 /* CloseBraceToken */); @@ -18694,7 +18780,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(231 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. var namespaceFlag = flags & 16 /* Namespace */; @@ -18708,7 +18794,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(230 /* ModuleDeclaration */, fullStart); + var node = createNode(231 /* ModuleDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (token() === 139 /* GlobalKeyword */) { @@ -18755,7 +18841,7 @@ var ts; return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(234 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; parseExpected(117 /* AsKeyword */); @@ -18774,7 +18860,7 @@ var ts; // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(235 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; @@ -18785,7 +18871,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(236 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; importDeclaration.modifiers = modifiers; // ImportDeclaration: @@ -18808,7 +18894,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(236 /* ImportClause */, fullStart); + var importClause = createNode(237 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -18818,7 +18904,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(25 /* CommaToken */)) { - importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */); + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(239 /* NamedImports */); } return finishNode(importClause); } @@ -18828,7 +18914,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(245 /* ExternalModuleReference */); + var node = createNode(246 /* ExternalModuleReference */); parseExpected(131 /* RequireKeyword */); parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -18851,7 +18937,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(237 /* NamespaceImport */); + var namespaceImport = createNode(238 /* NamespaceImport */); parseExpected(38 /* AsteriskToken */); parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -18866,14 +18952,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 239 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(243 /* ExportSpecifier */); + return parseImportOrExportSpecifier(244 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(239 /* ImportSpecifier */); + return parseImportOrExportSpecifier(240 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -18898,14 +18984,14 @@ var ts; else { node.name = identifierName; } - if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 240 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(241 /* ExportDeclaration */, fullStart); + var node = createNode(242 /* ExportDeclaration */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(38 /* AsteriskToken */)) { @@ -18913,7 +18999,7 @@ var ts; node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(243 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. @@ -18926,7 +19012,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(240 /* ExportAssignment */, fullStart); + var node = createNode(241 /* ExportAssignment */, fullStart); node.decorators = decorators; node.modifiers = modifiers; if (parseOptional(57 /* EqualsToken */)) { @@ -19008,10 +19094,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return ts.hasModifier(node, 1 /* Export */) - || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */ - || node.kind === 235 /* ImportDeclaration */ - || node.kind === 240 /* ExportAssignment */ - || node.kind === 241 /* ExportDeclaration */ + || node.kind === 235 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 246 /* ExternalModuleReference */ + || node.kind === 236 /* ImportDeclaration */ + || node.kind === 241 /* ExportAssignment */ + || node.kind === 242 /* ExportDeclaration */ ? node : undefined; }); @@ -19086,7 +19172,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(263 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(17 /* CloseBraceToken */); @@ -19097,12 +19183,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token() === 48 /* BarToken */) { - var unionType = createNode(266 /* JSDocUnionType */, type.pos); + var unionType = createNode(267 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token() === 57 /* EqualsToken */) { - var optionalType = createNode(273 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(274 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -19113,20 +19199,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token() === 20 /* OpenBracketToken */) { - var arrayType = createNode(265 /* JSDocArrayType */, type.pos); + var arrayType = createNode(266 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token() === 54 /* QuestionToken */) { - var nullableType = createNode(268 /* JSDocNullableType */, type.pos); + var nullableType = createNode(269 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token() === 50 /* ExclamationToken */) { - var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(270 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -19178,27 +19264,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(277 /* JSDocThisType */); + var result = createNode(278 /* JSDocThisType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(276 /* JSDocConstructorType */); + var result = createNode(277 /* JSDocConstructorType */); nextToken(); parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(275 /* JSDocVariadicType */); + var result = createNode(276 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(274 /* JSDocFunctionType */); + var result = createNode(275 /* JSDocFunctionType */); nextToken(); parseExpected(18 /* OpenParenToken */); result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -19220,7 +19306,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(272 /* JSDocTypeReference */); + var result = createNode(273 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -19261,18 +19347,18 @@ var ts; return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(270 /* JSDocRecordType */); + var result = createNode(271 /* JSDocRecordType */); result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(269 /* JSDocNonNullableType */); + var result = createNode(270 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(267 /* JSDocTupleType */); + var result = createNode(268 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -19286,7 +19372,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(266 /* JSDocUnionType */); + var result = createNode(267 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(19 /* CloseParenToken */); @@ -19302,12 +19388,12 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(263 /* JSDocAllType */); + var result = createNode(264 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(288 /* JSDocLiteralType */); + var result = createNode(289 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -19330,11 +19416,11 @@ var ts; token() === 28 /* GreaterThanToken */ || token() === 57 /* EqualsToken */ || token() === 48 /* BarToken */) { - var result = createNode(264 /* JSDocUnknownType */, pos); + var result = createNode(265 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(268 /* JSDocNullableType */, pos); + var result = createNode(269 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -19499,7 +19585,7 @@ var ts; content.charCodeAt(start + 3) !== 42 /* asterisk */; } function createJSDocComment() { - var result = createNode(278 /* JSDocComment */, start); + var result = createNode(279 /* JSDocComment */, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -19615,7 +19701,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(279 /* JSDocTag */, atToken.pos); + var result = createNode(280 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -19672,7 +19758,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(281 /* JSDocParameterTag */, atToken.pos); + var result = createNode(282 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -19683,20 +19769,20 @@ var ts; return finishNode(result); } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 282 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(282 /* JSDocReturnTag */, atToken.pos); + var result = createNode(283 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 283 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(283 /* JSDocTypeTag */, atToken.pos); + var result = createNode(284 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -19711,7 +19797,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(286 /* JSDocPropertyTag */, atToken.pos); + var result = createNode(287 /* JSDocPropertyTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.name = name; @@ -19720,7 +19806,7 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(280 /* JSDocAugmentsTag */, atToken.pos); + var result = createNode(281 /* JSDocAugmentsTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; @@ -19729,7 +19815,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(286 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); @@ -19743,7 +19829,7 @@ var ts; typedefTag.typeExpression = typeExpression; skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 273 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70 /* Identifier */) { var name_14 = jsDocTypeReference.name; @@ -19761,7 +19847,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(288 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -19802,7 +19888,7 @@ var ts; var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { - var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos); + var jsDocNamespaceNode = createNode(231 /* ModuleDeclaration */, pos); jsDocNamespaceNode.flags |= flags; jsDocNamespaceNode.name = typeNameOrNamespaceName; jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); @@ -19848,7 +19934,7 @@ var ts; return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 284 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 285 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } // Type parameter list looks like '@template T,U,V' @@ -19872,7 +19958,7 @@ var ts; break; } } - var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(285 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -20346,7 +20432,7 @@ var 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 (var i = 0; i < array.length; i++) { var child = array[i]; if (child) { if (child.pos === position) { @@ -20392,16 +20478,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 229 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { + else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 231 /* ModuleBlock */) { + else if (node.kind === 232 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -20420,7 +20506,7 @@ var ts; }); return state_1; } - else if (node.kind === 230 /* ModuleDeclaration */) { + else if (node.kind === 231 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } @@ -20561,7 +20647,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 231 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -20596,9 +20682,9 @@ var ts; return "__new"; case 155 /* IndexSignature */: return "__index"; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return "__export"; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; case 192 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { @@ -20615,22 +20701,22 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: + case 226 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; case 144 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 275 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 206 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -20717,7 +20803,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) { + (isDefaultExport || (node.kind === 241 /* ExportAssignment */ && !node.isExportEquals))) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } } @@ -20737,7 +20823,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 244 /* ExportSpecifier */ || (node.kind === 235 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -20760,7 +20846,7 @@ var ts; // during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation // and this case is specially handled. Module augmentations should only be merged with original module definition // and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. - var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && + var isJSDocTypedefInJSDocNamespace = node.kind === 286 /* JSDocTypedefTag */ && node.name && node.name.kind === 70 /* Identifier */ && node.name.isInJSDocNamespace; @@ -20847,7 +20933,7 @@ var ts; if (hasExplicitReturn) node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -20926,43 +21012,43 @@ var ts; return; } switch (node.kind) { - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: bindWhileStatement(node); break; - case 209 /* DoStatement */: + case 210 /* DoStatement */: bindDoStatement(node); break; - case 211 /* ForStatement */: + case 212 /* ForStatement */: bindForStatement(node); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 208 /* IfStatement */: + case 209 /* IfStatement */: bindIfStatement(node); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 221 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 221 /* TryStatement */: + case 222 /* TryStatement */: bindTryStatement(node); break; - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: bindSwitchStatement(node); break; - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: bindCaseBlock(node); break; - case 253 /* CaseClause */: + case 254 /* CaseClause */: bindCaseClause(node); break; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: bindLabeledStatement(node); break; case 190 /* PrefixUnaryExpression */: @@ -20980,7 +21066,7 @@ var ts; case 193 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; case 179 /* CallExpression */: @@ -21147,11 +21233,11 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 208 /* IfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: + case 209 /* IfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: return parent.expression === node; - case 211 /* ForStatement */: + case 212 /* ForStatement */: case 193 /* ConditionalExpression */: return parent.condition === node; } @@ -21215,7 +21301,7 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */ + var enclosingLabeledStatement = node.parent.kind === 220 /* LabeledStatement */ ? ts.lastOrUndefined(activeLabels) : undefined; // if do statement is wrapped in labeled statement then target labels for break/continue with or without @@ -21252,7 +21338,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 224 /* VariableDeclarationList */) { + if (node.initializer.kind !== 225 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -21274,7 +21360,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 216 /* ReturnStatement */) { + if (node.kind === 217 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -21294,7 +21380,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 216 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -21360,7 +21446,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 255 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -21427,7 +21513,7 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - if (!node.statement || node.statement.kind !== 209 /* DoStatement */) { + if (!node.statement || node.statement.kind !== 210 /* DoStatement */) { // do statement sets current flow inside bindDoStatement addAntecedent(postStatementLabel, currentFlow); currentFlow = finishFlowLabel(postStatementLabel); @@ -21459,13 +21545,13 @@ var ts; else if (node.kind === 176 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 257 /* PropertyAssignment */) { + if (p.kind === 258 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 258 /* ShorthandPropertyAssignment */) { + else if (p.kind === 259 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 259 /* SpreadAssignment */) { + else if (p.kind === 260 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -21565,7 +21651,7 @@ var ts; } function bindVariableDeclarationFlow(node) { bindEachChild(node); - if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.initializer || node.parent.parent.kind === 213 /* ForInStatement */ || node.parent.parent.kind === 214 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } @@ -21595,28 +21681,28 @@ var ts; function getContainerFlags(node) { switch (node.kind) { case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: + case 271 /* JSDocRecordType */: return 1 /* IsContainer */; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 274 /* JSDocFunctionType */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 275 /* JSDocFunctionType */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: case 170 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 261 /* SourceFile */: + case 262 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; case 149 /* MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethod(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; } case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: @@ -21629,17 +21715,17 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; case 147 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 256 /* CatchClause */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 232 /* CaseBlock */: + case 257 /* CatchClause */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 233 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 204 /* Block */: + case 205 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -21676,20 +21762,20 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 161 /* TypeLiteral */: case 176 /* ObjectLiteralExpression */: - case 227 /* InterfaceDeclaration */: - case 270 /* JSDocRecordType */: - case 287 /* JSDocTypeLiteral */: + case 228 /* InterfaceDeclaration */: + case 271 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the @@ -21706,11 +21792,11 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: - case 228 /* TypeAliasDeclaration */: + case 275 /* JSDocFunctionType */: + case 229 /* TypeAliasDeclaration */: case 170 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, @@ -21732,11 +21818,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 261 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) { + var body = node.kind === 262 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 262 /* SourceFile */ || body.kind === 232 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) { + if (stat.kind === 242 /* ExportDeclaration */ || stat.kind === 241 /* ExportAssignment */) { return true; } } @@ -21829,7 +21915,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { + if (prop.kind === 260 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -21841,7 +21927,7 @@ var 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 = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ + var currentKind = prop.kind === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -21863,10 +21949,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -21977,8 +22063,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 261 /* SourceFile */ && - blockScopeContainer.kind !== 230 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 262 /* SourceFile */ && + blockScopeContainer.kind !== 231 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -22091,14 +22177,14 @@ var ts; // current "blockScopeContainer" needs to be set to its immediate namespace parent. if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { + while (parentNode && parentNode.kind !== 286 /* JSDocTypedefTag */) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); break; } case 98 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 259 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); @@ -22131,7 +22217,7 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return checkStrictModeCatchClause(node); case 186 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); @@ -22141,7 +22227,7 @@ var ts; return checkStrictModePostfixUnaryExpression(node); case 190 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return checkStrictModeWithStatement(node); case 167 /* ThisType */: seenThisKeyword = true; @@ -22152,22 +22238,22 @@ var ts; return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); case 144 /* Parameter */: return bindParameter(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 271 /* JSDocRecordMember */: + case 272 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 286 /* JSDocPropertyTag */: + case 287 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 259 /* SpreadAssignment */: - case 251 /* JsxSpreadAttribute */: + case 260 /* SpreadAssignment */: + case 252 /* JsxSpreadAttribute */: var root = container; var hasRest = false; while (root.parent) { @@ -22192,7 +22278,7 @@ var ts; // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return bindFunctionDeclaration(node); case 150 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); @@ -22202,12 +22288,12 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); case 161 /* TypeLiteral */: case 170 /* MappedType */: - case 287 /* JSDocTypeLiteral */: - case 270 /* JSDocRecordType */: + case 288 /* JSDocTypeLiteral */: + case 271 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); case 176 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); @@ -22221,46 +22307,46 @@ var ts; break; // Members of classes, interfaces, and modules case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); } break; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 234 /* ImportEqualsDeclaration */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return bindImportClause(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return bindExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return bindExportAssignment(node); - case 261 /* SourceFile */: + case 262 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 204 /* Block */: + case 205 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // Fall through - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } @@ -22292,7 +22378,7 @@ var ts; // An export default clause with an expression exports a value // We want to exclude both class and function here, this is necessary to issue an error when there are both // default export-assignment and default export function and class declaration. - var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + var flags = node.kind === 241 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); @@ -22302,7 +22388,7 @@ var ts; if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 261 /* SourceFile */) { + if (node.parent.kind !== 262 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } @@ -22357,7 +22443,7 @@ var ts; function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { + if (container.kind === 226 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { container.symbol.members = container.symbol.members || ts.createMap(); // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); @@ -22405,7 +22491,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -22541,13 +22627,13 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 207 /* EmptyStatement */) || // report error on class declarations - node.kind === 226 /* ClassDeclaration */ || + node.kind === 227 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 231 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 230 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -22561,7 +22647,7 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 205 /* VariableStatement */ || + (node.kind !== 206 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -22585,13 +22671,13 @@ var ts; return computeCallExpression(node, subtreeFlags); case 180 /* NewExpression */: return computeNewExpression(node, subtreeFlags); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return computeModuleDeclaration(node, subtreeFlags); case 183 /* ParenthesizedExpression */: return computeParenthesizedExpression(node, subtreeFlags); case 192 /* BinaryExpression */: return computeBinaryExpression(node, subtreeFlags); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return computeExpressionStatement(node, subtreeFlags); case 144 /* Parameter */: return computeParameter(node, subtreeFlags); @@ -22599,23 +22685,23 @@ var ts; return computeArrowFunction(node, subtreeFlags); case 184 /* FunctionExpression */: return computeFunctionExpression(node, subtreeFlags); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return computeFunctionDeclaration(node, subtreeFlags); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return computeVariableDeclaration(node, subtreeFlags); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return computeVariableDeclarationList(node, subtreeFlags); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return computeVariableStatement(node, subtreeFlags); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return computeLabeledStatement(node, subtreeFlags); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return computeClassDeclaration(node, subtreeFlags); case 197 /* ClassExpression */: return computeClassExpression(node, subtreeFlags); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return computeHeritageClause(node, subtreeFlags); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return computeCatchClause(node, subtreeFlags); case 199 /* ExpressionWithTypeArguments */: return computeExpressionWithTypeArguments(node, subtreeFlags); @@ -22628,7 +22714,7 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: return computeAccessor(node, subtreeFlags); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return computeImportEquals(node, subtreeFlags); case 177 /* PropertyAccessExpression */: return computePropertyAccess(node, subtreeFlags); @@ -23113,8 +23199,8 @@ var ts; case 116 /* AbstractKeyword */: case 123 /* DeclareKeyword */: case 75 /* ConstKeyword */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: case 182 /* TypeAssertionExpression */: case 200 /* AsExpression */: case 201 /* NonNullExpression */: @@ -23122,18 +23208,18 @@ var ts; // These nodes are TypeScript syntax. transformFlags |= 3 /* AssertTypeScript */; break; - case 246 /* JsxElement */: - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 247 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: case 10 /* JsxText */: - case 249 /* JsxClosingElement */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - case 252 /* JsxExpression */: + case 250 /* JsxClosingElement */: + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: + case 253 /* JsxExpression */: // These nodes are Jsx syntax. transformFlags |= 4 /* AssertJsx */; break; - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: // for-of might be ESNext if it has a rest destructuring transformFlags |= 8 /* AssertESNext */; // FALLTHROUGH @@ -23143,8 +23229,9 @@ var ts; case 15 /* TemplateTail */: case 194 /* TemplateExpression */: case 181 /* TaggedTemplateExpression */: - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: case 114 /* StaticKeyword */: + case 202 /* MetaProperty */: // These nodes are ES6 syntax. transformFlags |= 192 /* AssertES2015 */; break; @@ -23176,8 +23263,8 @@ var ts; case 164 /* UnionType */: case 165 /* IntersectionType */: case 166 /* ParenthesizedType */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: case 167 /* ThisType */: case 168 /* TypeOperator */: case 169 /* IndexedAccessType */: @@ -23207,7 +23294,7 @@ var ts; case 196 /* SpreadElement */: transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; break; case 96 /* SuperKeyword */: @@ -23266,23 +23353,23 @@ var ts; transformFlags |= 192 /* AssertES2015 */; } break; - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: // A loop containing a block scoped binding *may* need to be transformed from ES6. if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { transformFlags |= 192 /* AssertES2015 */; } break; - case 216 /* ReturnStatement */: - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 217 /* ReturnStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; break; } @@ -23306,18 +23393,18 @@ var ts; case 180 /* NewExpression */: case 175 /* ArrayLiteralExpression */: return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return 574674241 /* ModuleExcludes */; case 144 /* Parameter */: return 536872257 /* ParameterExcludes */; case 185 /* ArrowFunction */: return 601249089 /* ArrowFunctionExcludes */; case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return 601281857 /* FunctionExcludes */; - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return 546309441 /* VariableDeclarationListExcludes */; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return 539358529 /* ClassExcludes */; case 150 /* Constructor */: @@ -23339,12 +23426,12 @@ var ts; case 153 /* CallSignature */: case 154 /* ConstructSignature */: case 155 /* IndexSignature */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: return -3 /* TypeExcludes */; case 176 /* ObjectLiteralExpression */: return 540087617 /* ObjectLiteralExcludes */; - case 256 /* CatchClause */: + case 257 /* CatchClause */: return 537920833 /* CatchClauseExcludes */; case 172 /* ObjectBindingPattern */: case 173 /* ArrayBindingPattern */: @@ -23386,10 +23473,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - /** Create Resolved from a file with unknown extension. */ - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; @@ -23402,13 +23485,14 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2 /* DtsOnly */: - case 0 /* TypeScript */: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1 /* JavaScript */: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -23475,6 +23559,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -23535,7 +23620,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -23552,7 +23641,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -23605,31 +23695,134 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_5 = ts.getDirectoryPath(current); + if (parent_5 === current || directoryPathMap.contains(parent_5)) { + break; + } + directoryPathMap.set(parent_5, result); + current = parent_5; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + // find first position where directory and resolution differs + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + // find last directory separator before position i + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + // put result in per-module name cache + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -23822,34 +24015,34 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -23866,10 +24059,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } /* @internal */ function directoryProbablyExists(directoryName, host) { @@ -23908,11 +24124,11 @@ var ts; } } switch (extensions) { - case 2 /* DtsOnly */: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0 /* TypeScript */: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1 /* JavaScript */: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -23922,19 +24138,21 @@ var ts; } /** Return the file if it exists. */ function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -23943,18 +24161,23 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - // Note: this would allow a package.json to specify a ".js" file as typings. Maybe that should be forbidden. - return resolvedFromAnyFile(fromFile); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -23964,7 +24187,7 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results @@ -23972,70 +24195,116 @@ var ts; } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. - return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1 /* JavaScript */) { - return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); - return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { // Climb up parent directories looking for a module. - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0 /* TypeScript */) { + if (extensions === Extensions.TypeScript) { // If we didn't find the file normally, look it up in @types. return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); } } } @@ -24052,10 +24321,17 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ function forEachAncestorDirectory(directory, callback) { while (true) { @@ -24142,9 +24418,11 @@ var ts; getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, + getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, getBaseTypes: getBaseTypes, + getTypeFromTypeNode: getTypeFromTypeNode, getReturnTypeOfSignature: getReturnTypeOfSignature, getNonNullableType: getNonNullableType, getSymbolsInScope: getSymbolsInScope, @@ -24153,6 +24431,7 @@ var ts; getExportSpecifierLocalTargetSymbol: getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment: getPropertySymbolOfDestructuringAssignment, + signatureToString: signatureToString, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -24177,7 +24456,8 @@ var ts; // we deliberately exclude augmentations // since we are only interested in declarations of the module itself return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); - } + }, + getApparentType: getApparentType }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -24281,6 +24561,7 @@ var ts; var visitedFlowNodes = []; var visitedFlowTypes = []; var potentialThisCollisions = []; + var potentialNewTargetCollisions = []; var awaitedTypeStack = []; var diagnostics = ts.createDiagnosticCollection(); var TypeFacts; @@ -24501,7 +24782,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 231 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 231 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -24606,7 +24887,7 @@ var ts; return type.flags & 32768 /* Object */ ? type.objectFlags : 0; } function isGlobalSourceFile(node) { - return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 262 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -24662,9 +24943,21 @@ var ts; } if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 223 /* VariableDeclaration */ || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174 /* BindingElement */) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + var errorBindingElement = ts.getAncestor(usage, 174 /* BindingElement */); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 224 /* VariableDeclaration */), usage); + } + else if (declaration.kind === 224 /* VariableDeclaration */) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) @@ -24673,9 +24966,9 @@ var ts; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 205 /* VariableStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 206 /* VariableStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -24684,8 +24977,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -24713,6 +25006,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with @@ -24736,7 +25038,7 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 279 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 144 /* Parameter */ || @@ -24763,13 +25065,13 @@ var ts; } } switch (location.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 262 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports["default"]) { @@ -24792,7 +25094,7 @@ var ts; // which is not the desired behavior. if (moduleExports[name] && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 244 /* ExportSpecifier */)) { break; } } @@ -24800,7 +25102,7 @@ var ts; break loop; } break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } @@ -24823,9 +25125,9 @@ var ts; } } break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -24854,7 +25156,7 @@ var ts; // case 142 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 228 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -24867,7 +25169,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; @@ -24960,7 +25262,7 @@ var ts; // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) { + if (decls && decls.length === 1 && decls[0].kind === 234 /* NamespaceExportDeclaration */) { error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } @@ -25048,7 +25350,7 @@ var ts; // Block-scoped variables cannot be used before their definition 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 (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -25069,10 +25371,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 235 /* ImportDeclaration */) { + while (node && node.kind !== 236 /* ImportDeclaration */) { node = node.parent; } return node; @@ -25082,7 +25384,7 @@ var ts; return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 246 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); @@ -25207,19 +25509,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return getTargetOfImportClause(node); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return getTargetOfExportAssignment(node); - case 233 /* NamespaceExportDeclaration */: + case 234 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node); } } @@ -25266,11 +25568,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 240 /* ExportAssignment */) { + if (node.kind === 241 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 243 /* ExportSpecifier */) { + else if (node.kind === 244 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -25298,14 +25600,16 @@ var ts; else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 235 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol) { return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } - // Resolves a qualified name and any involved aliases + /** + * Resolves a qualified name and any involved aliases. + */ function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (ts.nodeIsMissing(name)) { return undefined; @@ -25626,11 +25930,11 @@ var ts; } } switch (location_1.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -25682,7 +25986,7 @@ var ts; return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -25722,7 +26026,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 244 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -25821,7 +26125,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -25867,7 +26171,7 @@ var ts; meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || - entityName.parent.kind === 234 /* ImportEqualsDeclaration */) { + entityName.parent.kind === 235 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -25966,7 +26270,7 @@ var ts; while (node.kind === 166 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 229 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -25974,7 +26278,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 231 /* ModuleBlock */ && + node.parent.kind === 232 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function literalTypeToString(type) { @@ -26066,9 +26370,9 @@ var ts; if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { // Go up and add our parent. - var parent_5 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); - if (parent_5) { - walkSymbol(parent_5, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); + var parent_6 = getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol); + if (parent_6) { + walkSymbol(parent_6, getQualifiedLeftMeaning(meaning), /*endOfChain*/ false); } } if (accessibleSymbolChain) { @@ -26218,14 +26522,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_6 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_7 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_6); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_7); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_6, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_7, typeArguments, start, i, flags); writePunctuation(writer, 22 /* DotToken */); } } @@ -26291,7 +26595,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */; + return declaration.parent.kind === 262 /* SourceFile */ || declaration.parent.kind === 232 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -26305,25 +26609,6 @@ var ts; writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } - function writeIndexSignature(info, keyword) { - if (info) { - if (info.isReadonly) { - writeKeyword(writer, 130 /* ReadonlyKeyword */); - writeSpace(writer); - } - writePunctuation(writer, 20 /* OpenBracketToken */); - writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeKeyword(writer, keyword); - writePunctuation(writer, 21 /* CloseBracketToken */); - writePunctuation(writer, 55 /* ColonToken */); - writeSpace(writer); - writeType(info.type, 0 /* None */); - writePunctuation(writer, 24 /* SemicolonToken */); - writer.writeLine(); - } - } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { writeKeyword(writer, 130 /* ReadonlyKeyword */); @@ -26407,8 +26692,8 @@ var ts; writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */); - writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */); + buildIndexSignatureDisplay(resolved.stringIndexInfo, writer, 0 /* String */, enclosingDeclaration, globalFlags, symbolStack); + buildIndexSignatureDisplay(resolved.numberIndexInfo, writer, 1 /* Number */, enclosingDeclaration, globalFlags, symbolStack); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -26588,6 +26873,10 @@ var ts; buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { + var returnType = getReturnTypeOfSignature(signature); + if (flags & 2048 /* SuppressAnyReturnType */ && isTypeAny(returnType)) { + return; + } if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); writePunctuation(writer, 35 /* EqualsGreaterThanToken */); @@ -26600,7 +26889,6 @@ var ts; buildTypePredicateDisplay(signature.typePredicate, writer, enclosingDeclaration, flags, symbolStack); } else { - var returnType = getReturnTypeOfSignature(signature); buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack); } } @@ -26620,6 +26908,32 @@ var ts; buildDisplayForParametersAndDelimiters(signature.thisParameter, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } + function buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration, globalFlags, symbolStack) { + if (info) { + if (info.isReadonly) { + writeKeyword(writer, 130 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 20 /* OpenBracketToken */); + writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + switch (kind) { + case 1 /* Number */: + writeKeyword(writer, 132 /* NumberKeyword */); + break; + case 0 /* String */: + writeKeyword(writer, 134 /* StringKeyword */); + break; + } + writePunctuation(writer, 21 /* CloseBracketToken */); + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(info.type, writer, enclosingDeclaration, globalFlags, symbolStack); + writePunctuation(writer, 24 /* SemicolonToken */); + writer.writeLine(); + } + } return _displayBuilder || (_displayBuilder = { buildSymbolDisplay: buildSymbolDisplay, buildTypeDisplay: buildTypeDisplay, @@ -26630,6 +26944,7 @@ var ts; buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, buildSignatureDisplay: buildSignatureDisplay, + buildIndexSignatureDisplay: buildIndexSignatureDisplay, buildReturnTypeDisplay: buildReturnTypeDisplay }); } @@ -26646,32 +26961,32 @@ var ts; switch (node.kind) { case 174 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 225 /* FunctionDeclaration */: - case 229 /* EnumDeclaration */: - case 234 /* ImportEqualsDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 226 /* FunctionDeclaration */: + case 230 /* EnumDeclaration */: + case 235 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_7 = getDeclarationContainer(node); + var parent_8 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && - !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_7.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_7))) { - return isGlobalSourceFile(parent_7); + !(node.kind !== 235 /* ImportEqualsDeclaration */ && parent_8.kind !== 262 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { + return isGlobalSourceFile(parent_8); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_7); + return isDeclarationVisible(parent_8); case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 151 /* GetAccessor */: @@ -26688,7 +27003,7 @@ var ts; case 153 /* CallSignature */: case 155 /* IndexSignature */: case 144 /* Parameter */: - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: @@ -26701,18 +27016,18 @@ var ts; return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: return false; // Type parameters are always visible case 143 /* TypeParameter */: // Source file and namespace export are always visible - case 261 /* SourceFile */: - case 233 /* NamespaceExportDeclaration */: + case 262 /* SourceFile */: + case 234 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return false; default: return false; @@ -26721,10 +27036,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 241 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 243 /* ExportSpecifier */) { + else if (node.parent.kind === 244 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -26817,12 +27132,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 223 /* VariableDeclaration */: - case 224 /* VariableDeclarationList */: - case 239 /* ImportSpecifier */: - case 238 /* NamedImports */: - case 237 /* NamespaceImport */: - case 236 /* ImportClause */: + case 224 /* VariableDeclaration */: + case 225 /* VariableDeclarationList */: + case 240 /* ImportSpecifier */: + case 239 /* NamedImports */: + case 238 /* NamespaceImport */: + case 237 /* ImportClause */: node = node.parent; break; default: @@ -26846,9 +27161,6 @@ var ts; function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; } - function isTypeNever(type) { - return type && (type.flags & 8192 /* Never */) !== 0; - } // Return the type of a binding element parent. We check SymbolLinks first to see if a type has been // assigned by contextual typing. function getTypeForBindingElementParent(node) { @@ -27007,11 +27319,11 @@ var ts; } // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (declaration.parent.parent.kind === 212 /* ForInStatement */) { + if (declaration.parent.parent.kind === 213 /* ForInStatement */) { var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 214 /* ForOfStatement */) { // 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, @@ -27026,7 +27338,7 @@ var ts; return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && - declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + declaration.kind === 224 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { // If --noImplicitAny is on or the declaration is in a Javascript file, // use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no @@ -27074,7 +27386,7 @@ var ts; return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 258 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 259 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -27177,7 +27489,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 257 /* PropertyAssignment */) { + if (declaration.kind === 258 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -27210,10 +27522,10 @@ var ts; return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 240 /* ExportAssignment */) { + if (declaration.kind === 241 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 287 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -27443,8 +27755,8 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || - node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || + if (node.kind === 227 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || + node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { @@ -27455,7 +27767,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -27464,8 +27776,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ || - node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */ || node.kind === 227 /* ClassDeclaration */ || + node.kind === 197 /* ClassExpression */ || node.kind === 229 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -27497,11 +27809,13 @@ var ts; } return signatures; } - // The base constructor of a class can resolve to - // undefinedType if the class has no extends clause, - // unknownType if an error occurred during resolution of the extends expression, - // nullType if the extends expression is the null value, or - // an object type with at least one construct signature. + /** + * The base constructor of a class can resolve to + * * undefinedType if the class has no extends clause, + * * unknownType if an error occurred during resolution of the extends expression, + * * nullType if the extends expression is the null value, or + * * an object type with at least one construct signature. + */ function getBaseConstructorTypeOfClass(type) { if (!type.resolvedBaseConstructorType) { var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -27616,7 +27930,7 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 228 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -27648,7 +27962,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 228 /* InterfaceDeclaration */) { if (declaration.flags & 64 /* ContainsThis */) { return false; } @@ -27705,7 +28019,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 286 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -27716,7 +28030,7 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */); + declaration = ts.getDeclarationOfKind(symbol, 229 /* TypeAliasDeclaration */); type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { @@ -27750,7 +28064,7 @@ var ts; function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 230 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -27778,7 +28092,7 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 229 /* EnumDeclaration */) { + if (declaration.kind === 230 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; @@ -28176,6 +28490,9 @@ var ts; } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } + /** + * Converts an AnonymousType to a ResolvedType. + */ function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { @@ -28306,8 +28623,8 @@ var ts; // the modifiers type is T. Otherwise, the modifiers type is {}. var declaredType = getTypeFromMappedTypeNode(type.declaration); var constraint = getConstraintTypeFromMappedType(declaredType); - var extendedConstraint = constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + var extendedConstraint = constraint && constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; } } return type.modifiersType; @@ -28618,7 +28935,7 @@ var ts; } function isJSDocOptionalParameter(node) { if (node.flags & 65536 /* JavaScriptFile */) { - if (node.type && node.type.kind === 273 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 274 /* JSDocOptionalType */) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -28629,7 +28946,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 273 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 274 /* JSDocOptionalType */; } } } @@ -28685,7 +29002,7 @@ var ts; // If this is a JSDoc construct signature, then skip the first parameter in the // parameter list. The first parameter represents the return type of the construct // signature. - for (var i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) { + for (var i = isJSConstructSignature ? 1 : 0; i < declaration.parameters.length; i++) { var param = declaration.parameters[i]; var paramSymbol = param.symbol; // Include parameter symbol instead of property symbol in the signature @@ -28773,12 +29090,12 @@ var ts; if (!symbol) return emptyArray; var result = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { + for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; switch (node.kind) { case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: @@ -28789,7 +29106,7 @@ var ts; case 152 /* SetAccessor */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 274 /* JSDocFunctionType */: + case 275 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // 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). @@ -29080,7 +29397,7 @@ var ts; switch (node.kind) { case 157 /* TypeReference */: return node.typeName; - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return node.name; case 199 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other @@ -29108,7 +29425,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 273 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -29121,7 +29438,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 272 /* JSDocTypeReference */) { + if (node.kind === 273 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -29163,9 +29480,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: return declaration; } } @@ -29358,8 +29675,9 @@ var ts; return false; } 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, types_6 = types; _i < types_6.length; _i++) { + var type = types_6[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -29479,8 +29797,8 @@ var ts; // Add the given types to the given type set. Order is preserved, duplicates are removed, // and nested types of the given kind are flattened into the set. function addTypesToIntersection(typeSet, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; + for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { + var type = types_7[_i]; addTypeToIntersection(typeSet, type); } } @@ -29618,7 +29936,7 @@ var ts; getIndexInfoOfType(objectType, 0 /* String */) || undefined; if (indexInfo) { - if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) { error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); return unknownType; } @@ -29745,7 +30063,7 @@ var ts; return links.resolvedType; } function getAliasSymbolForTypeNode(node) { - return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + return node.parent.kind === 229 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; } function getAliasTypeArgumentsForTypeNode(node) { var symbol = getAliasSymbolForTypeNode(node); @@ -29875,7 +30193,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 228 /* InterfaceDeclaration */)) { if (!(ts.getModifierFlags(container) & 32 /* Static */) && (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -29894,8 +30212,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 118 /* AnyKeyword */: - case 263 /* JSDocAllType */: - case 264 /* JSDocUnknownType */: + case 264 /* JSDocAllType */: + case 265 /* JSDocUnknownType */: return anyType; case 134 /* StringKeyword */: return stringType; @@ -29913,21 +30231,21 @@ var ts; return nullType; case 129 /* NeverKeyword */: return neverType; - case 289 /* JSDocNullKeyword */: + case 290 /* JSDocNullKeyword */: return nullType; - case 290 /* JSDocUndefinedKeyword */: + case 291 /* JSDocUndefinedKeyword */: return undefinedType; - case 291 /* JSDocNeverKeyword */: + case 292 /* JSDocNeverKeyword */: return neverType; case 167 /* ThisType */: case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); case 171 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 288 /* JSDocLiteralType */: + case 289 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); case 157 /* TypeReference */: - case 272 /* JSDocTypeReference */: + case 273 /* JSDocTypeReference */: return getTypeFromTypeReference(node); case 156 /* TypePredicate */: return booleanType; @@ -29936,29 +30254,29 @@ var ts; case 160 /* TypeQuery */: return getTypeFromTypeQueryNode(node); case 162 /* ArrayType */: - case 265 /* JSDocArrayType */: + case 266 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); case 163 /* TupleType */: return getTypeFromTupleTypeNode(node); case 164 /* UnionType */: - case 266 /* JSDocUnionType */: + case 267 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); case 165 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); case 166 /* ParenthesizedType */: - case 268 /* JSDocNullableType */: - case 269 /* JSDocNonNullableType */: - case 276 /* JSDocConstructorType */: - case 277 /* JSDocThisType */: - case 273 /* JSDocOptionalType */: + case 269 /* JSDocNullableType */: + case 270 /* JSDocNonNullableType */: + case 277 /* JSDocConstructorType */: + case 278 /* JSDocThisType */: + case 274 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 270 /* JSDocRecordType */: + case 271 /* JSDocRecordType */: return getTypeFromTypeNode(node.literal); case 158 /* FunctionType */: case 159 /* ConstructorType */: case 161 /* TypeLiteral */: - case 287 /* JSDocTypeLiteral */: - case 274 /* JSDocFunctionType */: + case 288 /* JSDocTypeLiteral */: + case 275 /* JSDocFunctionType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 168 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); @@ -29972,9 +30290,9 @@ var ts; case 141 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 267 /* JSDocTupleType */: + case 268 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 275 /* JSDocVariadicType */: + case 276 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -30136,17 +30454,19 @@ var ts; var constraintType = getConstraintTypeFromMappedType(type); if (constraintType.flags & 262144 /* Index */) { var typeVariable_1 = constraintType.type; - var mappedTypeVariable = instantiateType(typeVariable_1, mapper); - if (typeVariable_1 !== mappedTypeVariable) { - return mapType(mappedTypeVariable, function (t) { - if (isMappableType(t)) { - var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); - var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); - } - return t; - }); + if (typeVariable_1.flags & 16384 /* TypeParameter */) { + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); + } } } return instantiateMappedObjectType(type, mapper); @@ -30170,12 +30490,12 @@ var ts; // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { case 158 /* FunctionType */: case 159 /* ConstructorType */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: @@ -30186,10 +30506,10 @@ var ts; case 152 /* SetAccessor */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -30199,15 +30519,24 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 228 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: + case 275 /* JSDocFunctionType */: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 231 /* ModuleDeclaration */: + case 262 /* SourceFile */: return false; } node = node.parent; @@ -30217,7 +30546,7 @@ var ts; function isTopLevelTypeAlias(symbol) { if (symbol.declarations && symbol.declarations.length) { var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */; + return parentKind === 262 /* SourceFile */ || parentKind === 232 /* ModuleBlock */; } return false; } @@ -30309,7 +30638,7 @@ var ts; case 192 /* BinaryExpression */: return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return isContextSensitive(node.initializer); case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -30376,7 +30705,7 @@ var ts; // subtype of T but not structurally identical to T. This specifically means that two distinct but // structurally identical types (such as two classes) are not considered instances of each other. function isTypeInstanceOf(source, target) { - return source === target || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); + return getTargetType(source) === getTargetType(target) || isTypeSubtypeOf(source, target) && !isTypeIdenticalTo(source, target); } /** * This is *not* a bi-directional relationship. @@ -30710,10 +31039,12 @@ var ts; } return false; } - // Compare two types and return - // Ternary.True if they are related with no assumptions, - // Ternary.Maybe if they are related with assumptions of other relationships, or - // Ternary.False if they are not related. + /** + * Compare two types and return + * * Ternary.True if they are related with no assumptions, + * * Ternary.Maybe if they are related with assumptions of other relationships, or + * * Ternary.False if they are not related. + */ function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { @@ -31177,8 +31508,11 @@ var ts; } } } - else if (relation !== identityRelation && isEmptyObjectType(resolveStructuredTypeMembers(target))) { - return -1 /* True */; + else if (relation !== identityRelation) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + return -1 /* True */; + } } return 0 /* False */; } @@ -31345,7 +31679,7 @@ var ts; return 0 /* False */; } var result = -1 /* True */; - for (var i = 0, len = sourceSignatures.length; i < len; i++) { + for (var i = 0; i < sourceSignatures.length; i++) { var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; @@ -31584,8 +31918,8 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var t = types_7[_i]; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } @@ -31593,8 +31927,8 @@ var ts; } function literalTypesWithSameBaseType(types) { var commonBaseType; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; var baseType = getBaseTypeOfLiteralType(t); if (!commonBaseType) { commonBaseType = baseType; @@ -31700,8 +32034,8 @@ var ts; } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; result |= getFalsyFlags(t); } return result; @@ -31883,7 +32217,7 @@ var ts; case 174 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -32269,8 +32603,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -32411,7 +32745,7 @@ var ts; switch (source.kind) { case 70 /* Identifier */: return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && + (target.kind === 224 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 98 /* ThisKeyword */: return target.kind === 98 /* ThisKeyword */; @@ -32516,8 +32850,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var t = types_11[_i]; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; result |= getTypeFacts(t); } return result; @@ -32605,7 +32939,7 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 257 /* PropertyAssignment */ ? + return node.parent.kind === 175 /* ArrayLiteralExpression */ || node.parent.kind === 258 /* PropertyAssignment */ ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } @@ -32624,9 +32958,9 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return stringType; - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression) || unknownType; case 192 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); @@ -32636,9 +32970,9 @@ var ts; return getAssignedTypeOfArrayLiteralElement(parent, node); case 196 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -32664,26 +32998,26 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 212 /* ForInStatement */) { + if (node.parent.parent.kind === 213 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.parent.kind === 214 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 223 /* VariableDeclaration */ ? + return node.kind === 224 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? + return node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } function isEmptyArrayAssignment(node) { - return node.kind === 223 /* VariableDeclaration */ && node.initializer && + return node.kind === 224 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); @@ -32710,7 +33044,7 @@ var ts; getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 254 /* CaseClause */) { var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } @@ -32825,8 +33159,8 @@ var ts; } function isEvolvingArrayTypeList(types) { var hasEvolvingArrayType = false; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var t = types_12[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var t = types_13[_i]; if (!(t.flags & 8192 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; @@ -33461,8 +33795,8 @@ var ts; while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 231 /* ModuleBlock */ || - node.kind === 261 /* SourceFile */ || + node.kind === 232 /* ModuleBlock */ || + node.kind === 262 /* SourceFile */ || node.kind === 147 /* PropertyDeclaration */) { return node; } @@ -33542,7 +33876,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration_1.kind === 226 /* ClassDeclaration */ + if (declaration_1.kind === 227 /* ClassDeclaration */ && ts.nodeIsDecorated(declaration_1)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -33573,6 +33907,7 @@ var ts; } checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); + checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; @@ -33611,7 +33946,7 @@ var ts; // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). var assumeInitialized = isParameter || isOuterVariable || - type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isInTypeQuery(node)) || ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph @@ -33646,7 +33981,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 257 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -33671,8 +34006,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 211 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container && + if (container.kind === 212 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 225 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -33793,11 +34128,11 @@ var ts; needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; @@ -33861,9 +34196,9 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 274 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 275 /* JSDocFunctionType */) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 277 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 278 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -34254,8 +34589,8 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var current = types_13[_i]; + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -34338,13 +34673,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 250 /* JsxAttribute */) { + if (attribute.kind === 251 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 251 /* JsxSpreadAttribute */) { + else if (attribute.kind === 252 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -34382,14 +34717,14 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 144 /* Parameter */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: case 174 /* BindingElement */: return getContextualTypeForInitializerExpression(node); case 185 /* ArrowFunction */: - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); case 195 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); @@ -34401,22 +34736,22 @@ var ts; return getTypeFromTypeNode(parent.type); case 192 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); case 175 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); case 193 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); case 183 /* ParenthesizedExpression */: return getContextualType(parent); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return getContextualType(parent); - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -34477,8 +34812,8 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var current = types_14[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var current = types_15[_i]; var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { @@ -34683,18 +35018,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 257 /* PropertyAssignment */ || - memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 258 /* PropertyAssignment */ || + memberDecl.kind === 259 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 257 /* PropertyAssignment */) { + if (memberDecl.kind === 258 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 149 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 259 /* ShorthandPropertyAssignment */); type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -34702,8 +35037,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 258 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 259 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -34731,7 +35066,7 @@ var ts; prop.target = member; member = prop; } - else if (memberDecl.kind === 259 /* SpreadAssignment */) { + else if (memberDecl.kind === 260 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -34842,13 +35177,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: checkJsxExpression(child); break; - case 246 /* JsxElement */: + case 247 /* JsxElement */: checkJsxElement(child); break; - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -35223,11 +35558,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 250 /* JsxAttribute */) { + if (node.attributes[i].kind === 251 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 252 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -35248,7 +35583,11 @@ var ts; } function checkJsxExpression(node) { if (node.expression) { - return checkExpression(node.expression); + var type = checkExpression(node.expression); + if (node.dotDotDotToken && type !== anyType && !isArrayType(type)) { + error(node, ts.Diagnostics.JSX_spread_child_must_be_an_array_type, node.toString(), typeToString(type)); + } + return type; } else { return unknownType; @@ -35276,7 +35615,7 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ? + var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 224 /* VariableDeclaration */ ? node.name : node.right; if (left.kind === 96 /* SuperKeyword */) { @@ -35453,7 +35792,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer.kind === 225 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -35482,7 +35821,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 212 /* ForInStatement */ && + if (node.kind === 213 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -35591,13 +35930,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_8 = signature.declaration && signature.declaration.parent; + var parent_9 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_8 === lastParent) { + if (lastParent && parent_9 === lastParent) { index++; } else { - lastParent = parent_8; + lastParent = parent_9; index = cutoffIndex; } } @@ -35605,7 +35944,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_8; + lastParent = parent_9; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -35909,7 +36248,7 @@ var ts; function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 145 /* Decorator */) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; @@ -35953,7 +36292,7 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); @@ -35998,7 +36337,7 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } @@ -36049,7 +36388,7 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 226 /* ClassDeclaration */) { + if (node.kind === 227 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } @@ -36554,7 +36893,7 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; case 144 /* Parameter */: @@ -36693,9 +37032,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ - ? 225 /* FunctionDeclaration */ + ? 226 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ - ? 223 /* VariableDeclaration */ + ? 224 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -36722,6 +37061,23 @@ var ts; function checkNonNullAssertion(node) { return getNonNullableType(checkExpression(node.expression)); } + function checkMetaProperty(node) { + checkGrammarMetaProperty(node); + ts.Debug.assert(node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target", "Unrecognized meta-property."); + var container = ts.getNewTargetContainer(node); + if (!container) { + error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); + return unknownType; + } + else if (container.kind === 150 /* Constructor */) { + var symbol = getSymbolOfNode(container.parent); + return getTypeOfSymbol(symbol); + } + else { + var symbol = getSymbolOfNode(container); + return getTypeOfSymbol(symbol); + } + } function getTypeOfParameter(symbol) { var type = getTypeOfSymbol(symbol); if (strictNullChecks) { @@ -36863,7 +37219,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 204 /* Block */) { + if (func.body.kind !== 205 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -36953,7 +37309,7 @@ var ts; return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 219 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -37015,7 +37371,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 205 /* Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; @@ -37095,6 +37451,7 @@ var ts; if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); } return type; } @@ -37115,7 +37472,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 204 /* Block */) { + if (node.body.kind === 205 /* Block */) { checkSourceElement(node.body); } else { @@ -37184,7 +37541,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 237 /* NamespaceImport */; + return declaration && declaration.kind === 238 /* NamespaceImport */; } } } @@ -37201,6 +37558,16 @@ var ts; } function checkDeleteExpression(node) { checkExpression(node.expression); + var expr = ts.skipParentheses(node.expression); + if (expr.kind !== 177 /* PropertyAccessExpression */ && expr.kind !== 178 /* ElementAccessExpression */) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference); + return booleanType; + } + var links = getNodeLinks(expr); + var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); + if (symbol && isReadonlySymbol(symbol)) { + error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property); + } return booleanType; } function checkTypeOfExpression(node) { @@ -37276,8 +37643,8 @@ var ts; } if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { - var t = types_15[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -37294,8 +37661,8 @@ var ts; } if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { - var t = types_16[_i]; + for (var _i = 0, types_17 = types; _i < types_17.length; _i++) { + var t = types_17[_i]; if (!isTypeOfKind(t, kind)) { return false; } @@ -37304,8 +37671,8 @@ var ts; } if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { - var t = types_17[_a]; + for (var _a = 0, types_18 = types; _a < types_18.length; _a++) { + var t = types_18[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -37363,7 +37730,7 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { - if (property.kind === 257 /* PropertyAssignment */ || property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 258 /* PropertyAssignment */ || property.kind === 259 /* ShorthandPropertyAssignment */) { var name_20 = property.name; if (name_20.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(name_20); @@ -37378,7 +37745,7 @@ var ts; isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 258 /* ShorthandPropertyAssignment */) { + if (property.kind === 259 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -37390,7 +37757,7 @@ var ts; error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_20)); } } - else if (property.kind === 259 /* SpreadAssignment */) { + else if (property.kind === 260 /* SpreadAssignment */) { if (languageVersion < 5 /* ESNext */) { checkExternalEmitHelpers(property, 4 /* Rest */); } @@ -37463,7 +37830,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 259 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -37493,7 +37860,7 @@ var ts; } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - var error = target.parent.kind === 259 /* SpreadAssignment */ ? + var error = target.parent.kind === 260 /* SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; if (checkReferenceExpression(target, error)) { @@ -37530,8 +37897,8 @@ var ts; case 176 /* ObjectLiteralExpression */: case 187 /* TypeOfExpression */: case 201 /* NonNullExpression */: - case 247 /* JsxSelfClosingElement */: - case 246 /* JsxElement */: + case 248 /* JsxSelfClosingElement */: + case 247 /* JsxElement */: return true; case 193 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && @@ -38038,6 +38405,8 @@ var ts; return checkAssertion(node); case 201 /* NonNullExpression */: return checkNonNullAssertion(node); + case 202 /* MetaProperty */: + return checkMetaProperty(node); case 186 /* DeleteExpression */: return checkDeleteExpression(node); case 188 /* VoidExpression */: @@ -38058,13 +38427,13 @@ var ts; return undefinedWideningType; case 195 /* YieldExpression */: return checkYieldExpression(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return checkJsxExpression(node); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return checkJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -38118,7 +38487,7 @@ var ts; return false; } return node.kind === 149 /* MethodDeclaration */ || - node.kind === 225 /* FunctionDeclaration */ || + node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { @@ -38179,14 +38548,14 @@ var ts; switch (node.parent.kind) { case 185 /* ArrowFunction */: case 153 /* CallSignature */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 158 /* FunctionType */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - var parent_9 = node.parent; - if (node === parent_9.type) { - return parent_9; + var parent_10 = node.parent; + if (node === parent_10.type) { + return parent_10; } } } @@ -38215,7 +38584,7 @@ var ts; if (node.kind === 155 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || + else if (node.kind === 158 /* FunctionType */ || node.kind === 226 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || node.kind === 154 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); @@ -38349,7 +38718,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 227 /* InterfaceDeclaration */) { + if (node.kind === 228 /* InterfaceDeclaration */) { var 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 @@ -38445,7 +38814,7 @@ var ts; if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) { + else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 226 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } @@ -38480,7 +38849,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { var statement = statements_3[_i]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; } @@ -38641,8 +39010,8 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 227 /* InterfaceDeclaration */ && - n.parent.kind !== 226 /* ClassDeclaration */ && + if (n.parent.kind !== 228 /* InterfaceDeclaration */ && + n.parent.kind !== 227 /* ClassDeclaration */ && n.parent.kind !== 197 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { @@ -38770,7 +39139,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 228 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -38781,7 +39150,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { + if (node.kind === 226 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -38903,16 +39272,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); @@ -38924,7 +39293,8 @@ var ts; } function checkNonThenableType(type, location, message) { type = getWidenedType(type); - if (!isTypeAny(type) && !isTypeNever(type) && isTypeAssignableTo(type, getGlobalThenableType())) { + var apparentType = getApparentType(type); + if ((apparentType.flags & (1 /* Any */ | 8192 /* Never */)) === 0 && isTypeAssignableTo(type, getGlobalThenableType())) { if (location) { if (!message) { message = ts.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member; @@ -39175,7 +39545,7 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); @@ -39238,7 +39608,7 @@ var ts; checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -39271,6 +39641,7 @@ var ts; checkFunctionOrMethodDeclaration(node) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -39342,28 +39713,28 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 261 /* SourceFile */: - case 230 /* ModuleDeclaration */: + case 262 /* SourceFile */: + case 231 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 204 /* Block */: - case 232 /* CaseBlock */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 205 /* Block */: + case 233 /* CaseBlock */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; case 150 /* Constructor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: @@ -39387,7 +39758,7 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + if (node.parent.kind !== 228 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { @@ -39420,9 +39791,9 @@ var ts; function errorUnusedLocal(node, name) { if (isIdentifierThatStartsWithUnderScore(node)) { var declaration = ts.getRootDeclaration(node.parent); - if (declaration.kind === 223 /* VariableDeclaration */ && - (declaration.parent.parent.kind === 212 /* ForInStatement */ || - declaration.parent.parent.kind === 213 /* ForOfStatement */)) { + if (declaration.kind === 224 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 213 /* ForInStatement */ || + declaration.parent.parent.kind === 214 /* ForOfStatement */)) { return; } } @@ -39485,7 +39856,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -39494,7 +39865,7 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 204 /* Block */) { + if (node.kind === 205 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -39542,6 +39913,11 @@ var ts; potentialThisCollisions.push(node); } } + function checkCollisionWithCapturedNewTargetVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_newTarget")) { + potentialNewTargetCollisions.push(node); + } + } // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; @@ -39559,6 +39935,22 @@ var ts; current = current.parent; } } + function checkIfNewTargetIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { + var isDeclaration_2 = node.kind !== 70 /* Identifier */; + if (isDeclaration_2) { + error(node.name, ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference); + } + return; + } + current = current.parent; + } + } function checkCollisionWithCapturedSuperVariable(node, name) { if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; @@ -39570,8 +39962,8 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 70 /* Identifier */; - if (isDeclaration_2) { + var isDeclaration_3 = node.kind !== 70 /* Identifier */; + if (isDeclaration_3) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -39588,12 +39980,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39603,12 +39995,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { + if (parent.kind === 262 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -39643,7 +40035,7 @@ var ts; // 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 === 223 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 224 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -39653,17 +40045,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 225 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 206 /* 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) var namesShareScope = container && - (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 231 /* ModuleBlock */ || - container.kind === 230 /* ModuleDeclaration */ || - container.kind === 261 /* SourceFile */); + (container.kind === 205 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 232 /* ModuleBlock */ || + container.kind === 231 /* ModuleDeclaration */ || + container.kind === 262 /* 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 @@ -39708,7 +40100,8 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 144 /* Parameter */) { + if (symbol.valueDeclaration.kind === 144 /* Parameter */ || + symbol.valueDeclaration.kind === 174 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -39756,7 +40149,7 @@ var ts; } } if (node.kind === 174 /* BindingElement */) { - if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */) { + if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { checkExternalEmitHelpers(node, 4 /* Rest */); } // check computed properties inside property names of binding elements @@ -39764,13 +40157,13 @@ var ts; checkComputedPropertyName(node.propertyName); } // check private/protected variable access - var parent_10 = node.parent.parent; - var parentType = getTypeForBindingElementParent(parent_10); + var parent_11 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_11); var name_24 = node.propertyName || node.name; var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_24)); markPropertyAsReferenced(property); - if (parent_10.initializer && property && getParentOfSymbol(property)) { - checkClassPropertyAccess(parent_10, parent_10.initializer, parentType, property); + if (parent_11.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); } } // For a binding pattern, check contained binding elements @@ -39785,7 +40178,7 @@ var ts; // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39796,7 +40189,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 213 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -39819,18 +40212,19 @@ var ts; if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { + if (node.kind === 224 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) || - (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { + if ((left.kind === 144 /* Parameter */ && right.kind === 224 /* VariableDeclaration */) || + (left.kind === 224 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -39881,7 +40275,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 206 /* EmptyStatement */) { + if (node.thenStatement.kind === 207 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -39901,12 +40295,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 225 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -39929,7 +40323,7 @@ var ts; // 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 === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { @@ -39968,7 +40362,7 @@ var ts; // 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 === 224 /* VariableDeclarationList */) { + if (node.initializer.kind === 225 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -40318,7 +40712,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 255 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -40330,7 +40724,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 253 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 254 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable @@ -40361,7 +40755,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 220 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -40501,7 +40895,7 @@ var ts; /** Check each type parameter and check that type parameters have no duplicate type parameter declarations */ function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -40522,7 +40916,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.kind === 227 /* ClassDeclaration */ || declaration.kind === 228 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -40555,6 +40949,7 @@ var ts; if (node.name) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } @@ -40590,7 +40985,7 @@ var ts; checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && - baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) { + baseType_1.symbol.valueDeclaration.kind === 227 /* ClassDeclaration */) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -40751,7 +41146,7 @@ var 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++) { + for (var i = 0; i < list1.length; i++) { var tp1 = list1[i]; var tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { @@ -40811,7 +41206,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 228 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -40953,6 +41348,7 @@ var ts; } return undefined; case 8 /* NumericLiteral */: + checkGrammarNumericLiteral(e); return +e.text; case 183 /* ParenthesizedExpression */: return evalConstant(e.expression); @@ -41033,6 +41429,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithCapturedNewTargetVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); @@ -41061,7 +41458,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 229 /* EnumDeclaration */) { + if (declaration.kind !== 230 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -41084,8 +41481,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 226 /* ClassDeclaration */ || - (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 227 /* ClassDeclaration */ || + (declaration.kind === 226 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -41149,7 +41546,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 227 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -41200,23 +41597,23 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 241 /* ExportAssignment */: + case 242 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: var name_25 = node.name; if (ts.isBindingPattern(name_25)) { for (var _b = 0, _c = name_25.elements; _b < _c.length; _b++) { @@ -41227,12 +41624,12 @@ var ts; break; } // fallthrough - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 225 /* FunctionDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 226 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 229 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -41273,9 +41670,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 241 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 242 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -41308,7 +41705,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 243 /* ExportSpecifier */ ? + var message = node.kind === 244 /* ExportSpecifier */ ? 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)); @@ -41336,7 +41733,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -41393,8 +41790,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 232 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 262 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -41408,7 +41805,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 262 /* SourceFile */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 231 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -41434,9 +41831,14 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + var container = node.parent.kind === 262 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 231 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + if (node.isExportEquals) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); + } + else { + error(node, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } return; } // Grammar checking @@ -41510,7 +41912,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + return (declaration.kind !== 226 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || !!declaration.body; } } @@ -41523,10 +41925,10 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -41575,71 +41977,71 @@ var ts; return checkIndexedAccessType(node); case 170 /* MappedType */: return checkMappedType(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return checkBlock(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return checkVariableStatement(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return checkExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return checkIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return checkDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return checkWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return checkForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return checkForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return checkForOfStatement(node); - case 214 /* ContinueStatement */: - case 215 /* BreakStatement */: + case 215 /* ContinueStatement */: + case 216 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return checkReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return checkWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return checkSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return checkLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return checkThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return checkTryStatement(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return checkVariableDeclaration(node); case 174 /* BindingElement */: return checkBindingElement(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return checkClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return checkImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return checkExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return checkExportAssignment(node); - case 206 /* EmptyStatement */: + case 207 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -41696,6 +42098,7 @@ var ts; // Grammar checking checkGrammarSourceFile(node); potentialThisCollisions.length = 0; + potentialNewTargetCollisions.length = 0; deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -41715,6 +42118,10 @@ var ts; ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); potentialThisCollisions.length = 0; } + if (potentialNewTargetCollisions.length) { + ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); + potentialNewTargetCollisions.length = 0; + } links.flags |= 1 /* TypeChecked */; } } @@ -41772,7 +42179,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 218 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -41795,14 +42202,14 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; case 197 /* ClassExpression */: @@ -41812,8 +42219,8 @@ var ts; } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -41872,10 +42279,10 @@ var ts; function isTypeDeclaration(node) { switch (node.kind) { case 143 /* TypeParameter */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: return true; } } @@ -41885,7 +42292,7 @@ var ts; while (node.parent && node.parent.kind === 141 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 273 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -41912,10 +42319,10 @@ var ts; while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 235 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 241 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -41939,13 +42346,13 @@ var ts; default: } } - if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + if (entityName.parent.kind === 241 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 235 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } @@ -41995,10 +42402,10 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 273 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 250 /* JsxAttribute */) { + else if (entityName.parent.kind === 251 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } if (entityName.parent.kind === 156 /* TypePredicate */) { @@ -42008,7 +42415,7 @@ var ts; return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -42066,7 +42473,7 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) && + ((node.parent.kind === 236 /* ImportDeclaration */ || node.parent.kind === 242 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -42093,7 +42500,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 258 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 259 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -42159,7 +42566,7 @@ var ts; // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 213 /* ForOfStatement */) { + if (expr.parent.kind === 214 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } @@ -42171,7 +42578,7 @@ var ts; } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 257 /* PropertyAssignment */) { + if (expr.parent.kind === 258 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } @@ -42312,7 +42719,7 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 262 /* SourceFile */) { var symbolFile = parentSymbol.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -42369,7 +42776,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 205 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -42415,16 +42822,16 @@ var ts; return true; } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return node.expression && node.expression.kind === 70 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) @@ -42434,7 +42841,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(node) { node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 262 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -42500,7 +42907,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 260 /* EnumMember */) { + if (node.kind === 261 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -42601,9 +43008,9 @@ var ts; if (startInDeclarationContainer) { // When resolving the name of a declaration as a value, we need to start resolution // at a point outside of the declaration. - var parent_11 = reference.parent; - if (ts.isDeclaration(parent_11) && reference === parent_11.name) { - location = getDeclarationContainer(parent_11); + var parent_12 = reference.parent; + if (ts.isDeclaration(parent_12) && reference === parent_12.name) { + location = getDeclarationContainer(parent_12); } } return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -42732,15 +43139,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 262 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -42760,7 +43167,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 262 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -42946,7 +43353,7 @@ var ts; } switch (modifier.kind) { case 75 /* ConstKeyword */: - if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) { + if (node.kind !== 230 /* EnumDeclaration */ && node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; @@ -42972,7 +43379,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -42995,7 +43402,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + else if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } else if (node.kind === 144 /* Parameter */) { @@ -43031,7 +43438,7 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } else if (node.kind === 144 /* Parameter */) { @@ -43046,13 +43453,13 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 232 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -43062,14 +43469,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 226 /* ClassDeclaration */) { + if (node.kind !== 227 /* ClassDeclaration */) { if (node.kind !== 149 /* MethodDeclaration */ && node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 151 /* GetAccessor */ && node.kind !== 152 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { + if (!(node.parent.kind === 227 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -43111,7 +43518,7 @@ var ts; } return; } - else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 236 /* ImportDeclaration */ || node.kind === 235 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { @@ -43145,29 +43552,29 @@ var ts; case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 155 /* IndexSignature */: - case 230 /* ModuleDeclaration */: - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: - case 240 /* ExportAssignment */: + case 231 /* ModuleDeclaration */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: + case 241 /* ExportAssignment */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 144 /* Parameter */: return false; default: - if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { return false; } switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); - case 227 /* InterfaceDeclaration */: - case 205 /* VariableStatement */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 206 /* VariableStatement */: + case 229 /* TypeAliasDeclaration */: return true; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); @@ -43181,7 +43588,7 @@ var ts; function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { case 149 /* MethodDeclaration */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: if (!node.asteriskToken) { @@ -43392,7 +43799,7 @@ var ts; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ || + ts.Debug.assert(node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || node.kind === 149 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { @@ -43419,7 +43826,7 @@ var ts; var GetOrSetAccessor = GetAccessor | SetAccessor; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 259 /* SpreadAssignment */) { + if (prop.kind === 260 /* SpreadAssignment */) { continue; } var name_28 = prop.name; @@ -43427,7 +43834,7 @@ var ts; // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_28); } - if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 259 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -43450,7 +43857,7 @@ var ts; // 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 = void 0; - if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) { + if (prop.kind === 258 /* PropertyAssignment */ || prop.kind === 259 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_28.kind === 8 /* NumericLiteral */) { @@ -43500,7 +43907,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 251 /* JsxSpreadAttribute */) { + if (attr.kind === 252 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -43512,7 +43919,7 @@ var ts; return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 253 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -43521,7 +43928,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -43536,20 +43943,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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 = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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 === 212 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 213 /* ForInStatement */ ? 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); @@ -43642,7 +44049,7 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 228 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === 161 /* TypeLiteral */) { @@ -43656,11 +44063,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: 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 === 214 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 215 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -43668,8 +44075,8 @@ var ts; return false; } break; - case 218 /* SwitchStatement */: - if (node.kind === 215 /* BreakStatement */ && !node.label) { + case 219 /* SwitchStatement */: + if (node.kind === 216 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -43684,13 +44091,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 215 /* BreakStatement */ + var message = node.kind === 216 /* BreakStatement */ ? 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 === 215 /* BreakStatement */ + var message = node.kind === 216 /* BreakStatement */ ? 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); @@ -43717,7 +44124,7 @@ var ts; expr.operand.kind === 8 /* NumericLiteral */; } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) { + if (node.parent.parent.kind !== 213 /* ForInStatement */ && node.parent.parent.kind !== 214 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { if (ts.isConst(node) && !node.type) { @@ -43782,15 +44189,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 208 /* IfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 217 /* WithStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 209 /* IfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: return false; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -43805,6 +44212,13 @@ var ts; } } } + function checkGrammarMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */) { + if (node.name.text !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0, node.name.text, ts.tokenToString(node.keywordToken), "target"); + } + } + } function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } @@ -43845,7 +44259,7 @@ var ts; return true; } } - else if (node.parent.kind === 227 /* InterfaceDeclaration */) { + else if (node.parent.kind === 228 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -43878,13 +44292,13 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 227 /* InterfaceDeclaration */ || - node.kind === 228 /* TypeAliasDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 234 /* ImportEqualsDeclaration */ || - node.kind === 241 /* ExportDeclaration */ || - node.kind === 240 /* ExportAssignment */ || - node.kind === 233 /* NamespaceExportDeclaration */ || + if (node.kind === 228 /* InterfaceDeclaration */ || + node.kind === 229 /* TypeAliasDeclaration */ || + node.kind === 236 /* ImportDeclaration */ || + node.kind === 235 /* ImportEqualsDeclaration */ || + node.kind === 242 /* ExportDeclaration */ || + node.kind === 241 /* ExportAssignment */ || + node.kind === 234 /* NamespaceExportDeclaration */ || ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } @@ -43893,7 +44307,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 206 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -43919,7 +44333,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 205 /* Block */ || node.parent.kind === 232 /* ModuleBlock */ || node.parent.kind === 262 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -43932,8 +44346,22 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1 /* ES5 */) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 171 /* LiteralType */)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + else if (ts.isChildOfNodeWithKind(node, 261 /* EnumMember */)) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37 /* MinusToken */; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { @@ -43997,31 +44425,31 @@ var ts; _a[201 /* NonNullExpression */] = [ { name: "expression", test: ts.isLeftHandSideExpression } ], - _a[229 /* EnumDeclaration */] = [ + _a[230 /* EnumDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "members", test: ts.isEnumMember } ], - _a[230 /* ModuleDeclaration */] = [ + _a[231 /* ModuleDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isModuleName }, { name: "body", test: ts.isModuleBody } ], - _a[231 /* ModuleBlock */] = [ + _a[232 /* ModuleBlock */] = [ { name: "statements", test: ts.isStatement } ], - _a[234 /* ImportEqualsDeclaration */] = [ + _a[235 /* ImportEqualsDeclaration */] = [ { name: "decorators", test: ts.isDecorator }, { name: "modifiers", test: ts.isModifier }, { name: "name", test: ts.isIdentifier }, { name: "moduleReference", test: ts.isModuleReference } ], - _a[245 /* ExternalModuleReference */] = [ + _a[246 /* ExternalModuleReference */] = [ { name: "expression", test: ts.isExpression, optional: true } ], - _a[260 /* EnumMember */] = [ + _a[261 /* EnumMember */] = [ { name: "name", test: ts.isPropertyName }, { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } ], @@ -44059,11 +44487,11 @@ var ts; var result = initial; switch (node.kind) { // Leaf nodes - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: + case 204 /* SemicolonClassElement */: + case 207 /* EmptyStatement */: case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: - case 293 /* NotEmittedStatement */: + case 223 /* DebuggerStatement */: + case 294 /* NotEmittedStatement */: // No need to visit nodes with no children. break; // Names @@ -44211,73 +44639,73 @@ var ts; result = reduceNodes(node.typeArguments, cbNodes, result); break; // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); break; // Element - case 204 /* Block */: + case 205 /* Block */: result = reduceNodes(node.statements, cbNodes, result); break; - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.declarationList, cbNode, result); break; - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 208 /* IfStatement */: + case 209 /* IfStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.thenStatement, cbNode, result); result = reduceNode(node.elseStatement, cbNode, result); break; - case 209 /* DoStatement */: + case 210 /* DoStatement */: result = reduceNode(node.statement, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 210 /* WhileStatement */: - case 217 /* WithStatement */: + case 211 /* WhileStatement */: + case 218 /* WithStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 211 /* ForStatement */: + case 212 /* ForStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.condition, cbNode, result); result = reduceNode(node.incrementor, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: result = reduceNode(node.initializer, cbNode, result); result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 216 /* ReturnStatement */: - case 220 /* ThrowStatement */: + case 217 /* ReturnStatement */: + case 221 /* ThrowStatement */: result = reduceNode(node.expression, cbNode, result); break; - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.caseBlock, cbNode, result); break; - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: result = reduceNode(node.label, cbNode, result); result = reduceNode(node.statement, cbNode, result); break; - case 221 /* TryStatement */: + case 222 /* TryStatement */: result = reduceNode(node.tryBlock, cbNode, result); result = reduceNode(node.catchClause, cbNode, result); result = reduceNode(node.finallyBlock, cbNode, result); break; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.type, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: result = reduceNodes(node.declarations, cbNodes, result); break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44286,7 +44714,7 @@ var ts; result = reduceNode(node.type, cbNode, result); result = reduceNode(node.body, cbNode, result); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.name, cbNode, result); @@ -44294,97 +44722,97 @@ var ts; result = reduceNodes(node.heritageClauses, cbNodes, result); result = reduceNodes(node.members, cbNodes, result); break; - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: result = reduceNodes(node.clauses, cbNodes, result); break; - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: result = reduceNodes(node.decorators, cbNodes, result); result = reduceNodes(node.modifiers, cbNodes, result); result = reduceNode(node.importClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; - case 236 /* ImportClause */: + case 237 /* ImportClause */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.namedBindings, cbNode, result); break; - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: result = reduceNode(node.name, cbNode, result); break; - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: result = reduceNodes(node.elements, cbNodes, result); break; - case 239 /* ImportSpecifier */: - case 243 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: result = reduceNode(node.propertyName, cbNode, result); result = reduceNode(node.name, cbNode, result); break; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.expression, cbNode, result); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: result = ts.reduceLeft(node.decorators, cbNode, result); result = ts.reduceLeft(node.modifiers, cbNode, result); result = reduceNode(node.exportClause, cbNode, result); result = reduceNode(node.moduleSpecifier, cbNode, result); break; // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: result = reduceNode(node.openingElement, cbNode, result); result = ts.reduceLeft(node.children, cbNode, result); result = reduceNode(node.closingElement, cbNode, result); break; - case 247 /* JsxSelfClosingElement */: - case 248 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 249 /* JsxOpeningElement */: result = reduceNode(node.tagName, cbNode, result); result = reduceNodes(node.attributes, cbNodes, result); break; - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: result = reduceNode(node.tagName, cbNode, result); break; - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: result = reduceNode(node.expression, cbNode, result); break; - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: result = reduceNode(node.expression, cbNode, result); break; // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: result = reduceNode(node.expression, cbNode, result); // fall-through - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: result = reduceNodes(node.statements, cbNodes, result); break; - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: result = reduceNodes(node.types, cbNodes, result); break; - case 256 /* CatchClause */: + case 257 /* CatchClause */: result = reduceNode(node.variableDeclaration, cbNode, result); result = reduceNode(node.block, cbNode, result); break; // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.initializer, cbNode, result); break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: result = reduceNode(node.name, cbNode, result); result = reduceNode(node.objectAssignmentInitializer, cbNode, result); break; - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: result = reduceNode(node.expression, cbNode, result); break; // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: result = reduceNodes(node.statements, cbNodes, result); break; - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: result = reduceNode(node.expression, cbNode, result); break; default: @@ -44542,10 +44970,10 @@ var ts; return node; } switch (node.kind) { - case 203 /* SemicolonClassElement */: - case 206 /* EmptyStatement */: + case 204 /* SemicolonClassElement */: + case 207 /* EmptyStatement */: case 198 /* OmittedExpression */: - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: // No need to visit nodes with no children. return node; // Names @@ -44620,107 +45048,107 @@ var ts; case 199 /* ExpressionWithTypeArguments */: return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); // Element - case 204 /* Block */: + case 205 /* Block */: return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return ts.updateVariableDeclarationList(node, visitNodes(node.declarations, visitor, ts.isVariableDeclaration)); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return ts.updateFunctionDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitParameterList(node.parameters, visitor, context), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitFunctionBody(node.body, visitor, context)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return ts.updateClassDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNodes(node.typeParameters, visitor, ts.isTypeParameter), visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), visitNodes(node.members, visitor, ts.isClassElement)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); - case 238 /* NamedImports */: + case 239 /* NamedImports */: return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); - case 242 /* NamedExports */: + case 243 /* NamedExports */: return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); default: var updated = void 0; @@ -44836,7 +45264,7 @@ var ts; function aggregateTransformFlagsForSubtree(node) { // We do not transform ambient declarations or types, so there is no need to // recursively aggregate transform flags. - if (ts.hasModifier(node, 2 /* Ambient */) || ts.isTypeNode(node)) { + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 199 /* ExpressionWithTypeArguments */)) { return 0 /* None */; } // Aggregate the transform flags of each child. @@ -45412,15 +45840,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 261 /* SourceFile */: - case 232 /* CaseBlock */: - case 231 /* ModuleBlock */: - case 204 /* Block */: + case 262 /* SourceFile */: + case 233 /* CaseBlock */: + case 232 /* ModuleBlock */: + case 205 /* Block */: currentScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 226 /* ClassDeclaration */: - case 225 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: + case 226 /* FunctionDeclaration */: if (ts.hasModifier(node, 2 /* Ambient */)) { break; } @@ -45467,13 +45895,13 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitExportDeclaration(node); default: return visitorWorker(node); @@ -45493,11 +45921,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 241 /* ExportDeclaration */ || - node.kind === 235 /* ImportDeclaration */ || - node.kind === 236 /* ImportClause */ || - (node.kind === 234 /* ImportEqualsDeclaration */ && - node.moduleReference.kind === 245 /* ExternalModuleReference */)) { + if (node.kind === 242 /* ExportDeclaration */ || + node.kind === 236 /* ImportDeclaration */ || + node.kind === 237 /* ImportClause */ || + (node.kind === 235 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 246 /* ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -45539,7 +45967,7 @@ var ts; case 149 /* MethodDeclaration */: // Fallback to the default visit behavior. return visitorWorker(node); - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return node; default: ts.Debug.failBadSyntaxKind(node); @@ -45608,18 +46036,18 @@ var ts; // TypeScript index signatures are elided. case 145 /* Decorator */: // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: // TypeScript type-only declarations are elided. case 147 /* PropertyDeclaration */: // TypeScript property declarations are elided. return undefined; case 150 /* Constructor */: return visitConstructor(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return ts.createNotEmittedStatement(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // This is a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -45641,7 +46069,7 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: // This is a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: @@ -45660,7 +46088,7 @@ var ts; case 152 /* SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: @@ -45694,18 +46122,18 @@ var ts; case 201 /* NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); default: @@ -46113,7 +46541,7 @@ var ts; return index; } var statement = statements[index]; - if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + if (statement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { result.push(ts.visitNode(statement, visitor, ts.isStatement)); return index + 1; } @@ -46622,7 +47050,7 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; case 149 /* MethodDeclaration */: @@ -46645,7 +47073,7 @@ var ts; return serializeTypeNode(node.type); case 152 /* SetAccessor */: return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: case 149 /* MethodDeclaration */: return ts.createIdentifier("Function"); @@ -46730,6 +47158,9 @@ var ts; } switch (node.kind) { case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: return ts.createVoidZero(); case 166 /* ParenthesizedType */: return serializeTypeNode(node.type); @@ -46768,34 +47199,7 @@ var ts; return serializeTypeReferenceNode(node); case 165 /* IntersectionType */: case 164 /* UnionType */: - { - var unionOrIntersection = node; - var serializedUnion = void 0; - for (var _i = 0, _a = unionOrIntersection.types; _i < _a.length; _i++) { - var typeNode = _a[_i]; - var serializedIndividual = serializeTypeNode(typeNode); - // Non identifier - if (serializedIndividual.kind !== 70 /* Identifier */) { - serializedUnion = undefined; - break; - } - // One of the individual is global object, return immediately - if (serializedIndividual.text === "Object") { - return serializedIndividual; - } - // Different types - if (serializedUnion && serializedUnion.text !== serializedIndividual.text) { - serializedUnion = undefined; - break; - } - serializedUnion = serializedIndividual; - } - // If we were able to find common type - if (serializedUnion) { - return serializedUnion; - } - } - // Fallthrough + return serializeUnionOrIntersectionType(node); case 160 /* TypeQuery */: case 168 /* TypeOperator */: case 169 /* IndexedAccessType */: @@ -46810,6 +47214,37 @@ var ts; } return ts.createIdentifier("Object"); } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + // Different types + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + // If we were able to find common type, use it + return serializedUnion; + } /** * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with * decorator type metadata. @@ -47411,7 +47846,7 @@ var ts; recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 229 /* EnumDeclaration */) { + if (node.kind === 230 /* EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -47530,8 +47965,8 @@ var ts; var statementsLocation; var blockLocation; var body = node.body; - if (body.kind === 231 /* ModuleBlock */) { - ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); + if (body.kind === 232 /* ModuleBlock */) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = body.statements; blockLocation = body; } @@ -47576,13 +48011,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (body.kind !== 231 /* ModuleBlock */) { + if (body.kind !== 232 /* ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -47623,7 +48058,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 237 /* NamespaceImport */) { + if (node.kind === 238 /* NamespaceImport */) { // Elide a namespace import if it is not referenced. return resolver.isReferencedAliasDeclaration(node) ? node : undefined; } @@ -47855,16 +48290,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(70 /* Identifier */); - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); + context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(230 /* ModuleDeclaration */); + context.enableEmitNotification(231 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 231 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */; + return ts.getOriginalNode(node).kind === 230 /* EnumDeclaration */; } /** * Hook for node emit. @@ -47960,9 +48395,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 261 /* SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) || - (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */); + if (container && container.kind !== 262 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 231 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 230 /* EnumDeclaration */); if (substitute) { return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); } @@ -48082,11 +48517,11 @@ var ts; return visitObjectLiteralExpression(node); case 192 /* BinaryExpression */: return visitBinaryExpression(node, noDestructuringValue); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitForOfStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); case 188 /* VoidExpression */: return visitVoidExpression(node); @@ -48098,7 +48533,7 @@ var ts; return visitGetAccessorDeclaration(node); case 152 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); @@ -48106,7 +48541,7 @@ var ts; return visitArrowFunction(node); case 144 /* Parameter */: return visitParameter(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return visitExpressionStatement(node); case 183 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, noDestructuringValue); @@ -48119,7 +48554,7 @@ var ts; var objects = []; for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) { var e = elements_3[_i]; - if (e.kind === 259 /* SpreadAssignment */) { + if (e.kind === 260 /* SpreadAssignment */) { if (chunkObject) { objects.push(ts.createObjectLiteral(chunkObject)); chunkObject = undefined; @@ -48131,7 +48566,7 @@ var ts; if (!chunkObject) { chunkObject = []; } - if (e.kind === 257 /* PropertyAssignment */) { + if (e.kind === 258 /* PropertyAssignment */) { var p = e; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } @@ -48361,11 +48796,11 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -48375,11 +48810,11 @@ var ts; switch (node.kind) { case 10 /* JsxText */: return visitJsxText(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return visitJsxExpression(node); - case 246 /* JsxElement */: + case 247 /* JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); default: ts.Debug.failBadSyntaxKind(node); @@ -48440,7 +48875,10 @@ var ts; var decoded = tryDecodeEntities(node.text); return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; } - else if (node.kind === 252 /* JsxExpression */) { + else if (node.kind === 253 /* JsxExpression */) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } return visitJsxExpression(node); } else { @@ -48522,7 +48960,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 246 /* JsxElement */) { + if (node.kind === 247 /* JsxElement */) { return getTagName(node.openingElement); } else { @@ -48868,7 +49306,7 @@ var ts; case 149 /* MethodDeclaration */: // ES2017 method declarations may be 'async' return visitMethodDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // ES2017 function declarations may be 'async' return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: @@ -49032,7 +49470,7 @@ var ts; context.enableSubstitution(177 /* PropertyAccessExpression */); context.enableSubstitution(178 /* ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(226 /* ClassDeclaration */); + context.enableEmitNotification(227 /* ClassDeclaration */); context.enableEmitNotification(149 /* MethodDeclaration */); context.enableEmitNotification(151 /* GetAccessor */); context.enableEmitNotification(152 /* SetAccessor */); @@ -49089,7 +49527,7 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 226 /* ClassDeclaration */ + return kind === 227 /* ClassDeclaration */ || kind === 150 /* Constructor */ || kind === 149 /* MethodDeclaration */ || kind === 151 /* GetAccessor */ @@ -49299,6 +49737,82 @@ var ts; */ SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; })(SuperCaptureResult || (SuperCaptureResult = {})); + // Facts we track as we traverse the tree + var HierarchyFacts; + (function (HierarchyFacts) { + HierarchyFacts[HierarchyFacts["None"] = 0] = "None"; + // + // Ancestor facts + // + HierarchyFacts[HierarchyFacts["Function"] = 1] = "Function"; + HierarchyFacts[HierarchyFacts["ArrowFunction"] = 2] = "ArrowFunction"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBody"] = 4] = "AsyncFunctionBody"; + HierarchyFacts[HierarchyFacts["NonStaticClassElement"] = 8] = "NonStaticClassElement"; + HierarchyFacts[HierarchyFacts["CapturesThis"] = 16] = "CapturesThis"; + HierarchyFacts[HierarchyFacts["ExportedVariableStatement"] = 32] = "ExportedVariableStatement"; + HierarchyFacts[HierarchyFacts["TopLevel"] = 64] = "TopLevel"; + HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block"; + HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement"; + HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock"; + HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement"; + HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper"; + HierarchyFacts[HierarchyFacts["ComputedPropertyName"] = 8192] = "ComputedPropertyName"; + // NOTE: do not add more ancestor flags without also updating AncestorFactsMask below. + // + // Ancestor masks + // + HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask"; + // We are always in *some* kind of block scope, but only specific block-scope containers are + // top-level or Blocks. + HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes"; + HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes"; + // A source file is a top-level block scope. + HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes"; + HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes"; + // Functions, methods, and accessors are both new lexical scopes and new block scopes. + HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes"; + HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes"; + HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes"; + // Arrow functions are lexically scoped to their container, but are new block scopes. + HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes"; + HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 16256] = "ArrowFunctionExcludes"; + // Constructors are both new lexical scopes and new block scopes. Constructors are also + // always considered non-static members of a class. + HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes"; + HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes"; + // 'do' and 'while' statements are not block scopes. We track that the subtree is contained + // within an IterationStatement to indicate whether the embedded statement is an + // IterationStatementBlock. + HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes"; + HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes"; + // 'for' statements are new block scopes and have special handling for 'let' declarations. + HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes"; + // 'for-in' and 'for-of' statements are new block scopes and have special handling for + // 'let' declarations. + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes"; + HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes"; + // Blocks (other than function bodies) are new block scopes. + HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes"; + HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes"; + HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes"; + // Computed property names track subtree flags differently than their containing members. + HierarchyFacts[HierarchyFacts["ComputedPropertyNameIncludes"] = 8192] = "ComputedPropertyNameIncludes"; + HierarchyFacts[HierarchyFacts["ComputedPropertyNameExcludes"] = 0] = "ComputedPropertyNameExcludes"; + // + // Subtree facts + // + HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget"; + HierarchyFacts[HierarchyFacts["NewTargetInComputedPropertyName"] = 32768] = "NewTargetInComputedPropertyName"; + // + // Subtree masks + // + HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask"; + HierarchyFacts[HierarchyFacts["PropagateNewTargetMask"] = 49152] = "PropagateNewTargetMask"; + })(HierarchyFacts || (HierarchyFacts = {})); function transformES2015(context) { var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; var resolver = context.getEmitResolver(); @@ -49308,15 +49822,7 @@ var ts; context.onSubstituteNode = onSubstituteNode; var currentSourceFile; var currentText; - var currentParent; - var currentNode; - var enclosingVariableStatement; - var enclosingBlockScopeContainer; - var enclosingBlockScopeContainerParent; - var enclosingFunction; - var enclosingNonArrowFunction; - var enclosingNonAsyncFunctionBody; - var isInConstructorWithCapturedSuper; + var hierarchyFacts; /** * Used to track if we are emitting body of the converted loop */ @@ -49334,185 +49840,116 @@ var ts; } currentSourceFile = node; currentText = node.text; - var visited = saveStateAndInvoke(node, visitSourceFile); + var visited = visitSourceFile(node); ts.addEmitHelpers(visited, context.readEmitHelpers()); currentSourceFile = undefined; currentText = undefined; + hierarchyFacts = 0 /* None */; return visited; } - function visitor(node) { - return saveStateAndInvoke(node, dispatcher); + /** + * Sets the `HierarchyFacts` for this node prior to visiting this node's subtree, returning the facts set prior to modification. + * @param excludeFacts The existing `HierarchyFacts` to reset before visiting the subtree. + * @param includeFacts The new `HierarchyFacts` to set before visiting the subtree. + **/ + function enterSubtree(excludeFacts, includeFacts) { + var ancestorFacts = hierarchyFacts; + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */; + return ancestorFacts; } - function dispatcher(node) { - return convertedLoopState - ? visitorForConvertedLoopWorker(node) - : visitorWorker(node); - } - function saveStateAndInvoke(node, f) { - var savedEnclosingFunction = enclosingFunction; - var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; - var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; - var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; - var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; - var savedEnclosingVariableStatement = enclosingVariableStatement; - var savedCurrentParent = currentParent; - var savedCurrentNode = currentNode; - var savedConvertedLoopState = convertedLoopState; - var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; - if (ts.nodeStartsNewLexicalEnvironment(node)) { - // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body - isInConstructorWithCapturedSuper = false; - convertedLoopState = undefined; - } - onBeforeVisitNode(node); - var visited = f(node); - isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; - convertedLoopState = savedConvertedLoopState; - enclosingFunction = savedEnclosingFunction; - enclosingNonArrowFunction = savedEnclosingNonArrowFunction; - enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; - enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; - enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; - enclosingVariableStatement = savedEnclosingVariableStatement; - currentParent = savedCurrentParent; - currentNode = savedCurrentNode; - return visited; - } - function onBeforeVisitNode(node) { - if (currentNode) { - if (ts.isBlockScope(currentNode, currentParent)) { - enclosingBlockScopeContainer = currentNode; - enclosingBlockScopeContainerParent = currentParent; - } - if (ts.isFunctionLike(currentNode)) { - enclosingFunction = currentNode; - if (currentNode.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = currentNode; - if (!(ts.getEmitFlags(currentNode) & 131072 /* AsyncFunctionBody */)) { - enclosingNonAsyncFunctionBody = currentNode; - } - } - } - // keep track of the enclosing variable statement when in the context of - // variable statements, variable declarations, binding elements, and binding - // patterns. - switch (currentNode.kind) { - case 205 /* VariableStatement */: - enclosingVariableStatement = currentNode; - break; - case 224 /* VariableDeclarationList */: - case 223 /* VariableDeclaration */: - case 174 /* BindingElement */: - case 172 /* ObjectBindingPattern */: - case 173 /* ArrayBindingPattern */: - break; - default: - enclosingVariableStatement = undefined; - } - } - currentParent = currentNode; - currentNode = node; - } - function returnCapturedThis(node) { - return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); + /** + * Restores the `HierarchyFacts` for this node's ancestor after visiting this node's + * subtree, propagating specific facts from the subtree. + * @param ancestorFacts The `HierarchyFacts` of the ancestor to restore after visiting the subtree. + * @param excludeFacts The existing `HierarchyFacts` of the subtree that should not be propagated. + * @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated. + **/ + function exitSubtree(ancestorFacts, excludeFacts, includeFacts) { + hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; + return hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ + && node.kind === 217 /* ReturnStatement */ + && !node.expression; } - function shouldCheckNode(node) { - return (node.transformFlags & 64 /* ES2015 */) !== 0 || - node.kind === 219 /* LabeledStatement */ || - (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + function shouldVisitNode(node) { + return (node.transformFlags & 128 /* ContainsES2015 */) !== 0 + || convertedLoopState !== undefined + || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && ts.isStatement(node)) + || (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); } - function visitorWorker(node) { - if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { - return returnCapturedThis(node); - } - else if (shouldCheckNode(node)) { + function visitor(node) { + if (shouldVisitNode(node)) { return visitJavaScript(node); } - else if (node.transformFlags & 128 /* ContainsES2015 */ || (isInConstructorWithCapturedSuper && !ts.isExpression(node))) { - // we want to dive in this branch either if node has children with ES2015 specific syntax - // or we are inside constructor that captures result of the super call so all returns without expression should be - // rewritten. Note: we skip expressions since returns should never appear there - return ts.visitEachChild(node, visitor, context); - } else { return node; } } - function visitorForConvertedLoopWorker(node) { - var result; - if (shouldCheckNode(node)) { - result = visitJavaScript(node); + function functionBodyVisitor(node) { + if (shouldVisitNode(node)) { + return visitBlock(node, /*isFunctionBody*/ true); } - else { - result = visitNodesInConvertedLoop(node); - } - return result; + return node; } - function visitNodesInConvertedLoop(node) { - switch (node.kind) { - case 216 /* ReturnStatement */: - node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; - return visitReturnStatement(node); - case 205 /* VariableStatement */: - return visitVariableStatement(node); - case 218 /* SwitchStatement */: - return visitSwitchStatement(node); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: - return visitBreakOrContinueStatement(node); - case 98 /* ThisKeyword */: - return visitThisKeyword(node); - case 70 /* Identifier */: - return visitIdentifier(node); - default: - return ts.visitEachChild(node, visitor, context); + function callExpressionVisitor(node) { + if (node.kind === 96 /* SuperKeyword */) { + return visitSuperKeyword(/*isExpressionOfCall*/ true); } + return visitor(node); } function visitJavaScript(node) { switch (node.kind) { case 114 /* StaticKeyword */: return undefined; // elide static keyword - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); case 197 /* ClassExpression */: return visitClassExpression(node); case 144 /* Parameter */: return visitParameter(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 185 /* ArrowFunction */: return visitArrowFunction(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return visitVariableDeclaration(node); case 70 /* Identifier */: return visitIdentifier(node); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 219 /* LabeledStatement */: + case 219 /* SwitchStatement */: + return visitSwitchStatement(node); + case 233 /* CaseBlock */: + return visitCaseBlock(node); + case 205 /* Block */: + return visitBlock(node, /*isFunctionBody*/ false); + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: + return visitBreakOrContinueStatement(node); + case 220 /* LabeledStatement */: return visitLabeledStatement(node); - case 209 /* DoStatement */: - return visitDoStatement(node); - case 210 /* WhileStatement */: - return visitWhileStatement(node); - case 211 /* ForStatement */: - return visitForStatement(node); - case 212 /* ForInStatement */: - return visitForInStatement(node); - case 213 /* ForOfStatement */: - return visitForOfStatement(node); - case 207 /* ExpressionStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); + case 212 /* ForStatement */: + return visitForStatement(node, /*outermostLabeledStatement*/ undefined); + case 213 /* ForInStatement */: + return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); + case 214 /* ForOfStatement */: + return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); + case 208 /* ExpressionStatement */: return visitExpressionStatement(node); case 176 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitCatchClause(node); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); + case 142 /* ComputedPropertyName */: + return visitComputedPropertyName(node); case 175 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); case 179 /* CallExpression */: @@ -49537,54 +49974,82 @@ var ts; case 196 /* SpreadElement */: return visitSpreadElement(node); case 96 /* SuperKeyword */: - return visitSuperKeyword(); - case 195 /* YieldExpression */: - // `yield` will be handled by a generators transform. - return ts.visitEachChild(node, visitor, context); + return visitSuperKeyword(/*isExpressionOfCall*/ false); + case 98 /* ThisKeyword */: + return visitThisKeyword(node); + case 202 /* MetaProperty */: + return visitMetaProperty(node); case 149 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 205 /* VariableStatement */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return visitAccessorDeclaration(node); + case 206 /* VariableStatement */: return visitVariableStatement(node); + case 217 /* ReturnStatement */: + return visitReturnStatement(node); default: - ts.Debug.failBadSyntaxKind(node); return ts.visitEachChild(node, visitor, context); } } function visitSourceFile(node) { + var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */); var statements = []; startLexicalEnvironment(); var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ false, visitor); addCaptureThisForNodeIfNeeded(statements, node); ts.addRange(statements, ts.visitNodes(node.statements, visitor, ts.isStatement, statementOffset)); ts.addRange(statements, endLexicalEnvironment()); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); return ts.updateSourceFileNode(node, ts.createNodeArray(statements, node.statements)); } function visitSwitchStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; - var result = ts.visitEachChild(node, visitor, context); - convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; - return result; + if (convertedLoopState !== undefined) { + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + return ts.visitEachChild(node, visitor, context); + } + function visitCaseBlock(node) { + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function returnCapturedThis(node) { + return ts.setOriginalNode(ts.createReturn(ts.createIdentifier("_this")), node); } function visitReturnStatement(node) { - ts.Debug.assert(convertedLoopState !== undefined); - convertedLoopState.nonLocalJumps |= 8 /* Return */; - return ts.createReturn(ts.createObjectLiteral([ - ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression - ? ts.visitNode(node.expression, visitor, ts.isExpression) - : ts.createVoidZero()) - ])); + if (convertedLoopState) { + convertedLoopState.nonLocalJumps |= 8 /* Return */; + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + node = returnCapturedThis(node); + } + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + else if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + return ts.visitEachChild(node, visitor, context); } function visitThisKeyword(node) { - ts.Debug.assert(convertedLoopState !== undefined); - if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) { - // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. - convertedLoopState.containsLexicalThis = true; - return node; + if (convertedLoopState) { + if (hierarchyFacts & 2 /* ArrowFunction */) { + // if the enclosing function is an ArrowFunction then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); } - return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + return node; } function visitIdentifier(node) { if (!convertedLoopState) { @@ -49604,13 +50069,13 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 216 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; if (!node.label) { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 216 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } @@ -49621,7 +50086,7 @@ var ts; } } else { - if (node.kind === 215 /* BreakStatement */) { + if (node.kind === 216 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -49813,6 +50278,9 @@ var ts; * @param extendsClauseElement The expression for the class `extends` clause. */ function addConstructor(statements, node, extendsClauseElement) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */); var constructor = ts.getFirstConstructorWithBody(node); var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); var constructorFunction = ts.createFunctionDeclaration( @@ -49826,6 +50294,8 @@ var ts; ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); } statements.push(constructorFunction); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; } /** * Transforms the parameters of the constructor declaration of a class. @@ -49871,26 +50341,31 @@ var ts; addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); } - var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, !!extendsClauseElement, hasSynthesizedSuper, statementOffset); + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); // The last statement expression was replaced. Skip it. if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) { statementOffset++; } if (constructor) { - var body = saveStateAndInvoke(constructor, function (constructor) { - isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */; - return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset); - }); - ts.addRange(statements, body); + if (superCaptureStatus === 1 /* ReplaceSuperCapture */) { + hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */; + } + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset)); } // Return `_this` unless we're sure enough that it would be pointless to add a return statement. // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. - if (extendsClauseElement + if (isDerivedClass && superCaptureStatus !== 2 /* ReplaceWithReturn */ && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { statements.push(ts.createReturn(ts.createIdentifier("_this"))); } ts.addRange(statements, endLexicalEnvironment()); + if (constructor) { + prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false); + } var block = ts.createBlock(ts.createNodeArray(statements, /*location*/ constructor ? constructor.body.statements : node.members), /*location*/ constructor ? constructor.body : node, @@ -49907,17 +50382,17 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 216 /* ReturnStatement */) { + if (statement.kind === 217 /* ReturnStatement */) { return true; } - else if (statement.kind === 208 /* IfStatement */) { + else if (statement.kind === 209 /* IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 204 /* Block */) { + else if (statement.kind === 205 /* Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -49930,9 +50405,9 @@ var ts; * * @returns The new statement offset into the `statements` array. */ - function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, hasExtendsClause, hasSynthesizedSuper, statementOffset) { + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { // If this isn't a derived class, just capture 'this' for arrow functions if necessary. - if (!hasExtendsClause) { + if (!isDerivedClass) { if (ctor) { addCaptureThisForNodeIfNeeded(statements, ctor); } @@ -49975,9 +50450,8 @@ var ts; var ctorStatements = ctor.body.statements; if (statementOffset < ctorStatements.length) { firstStatement = ctorStatements[statementOffset]; - if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { - var superCall = firstStatement.expression; - superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + if (firstStatement.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + superCallExpression = visitImmediateSuperCallInBody(firstStatement.expression); } } // Return the result if we have an immediate super() call on the last statement, @@ -49996,18 +50470,18 @@ var ts; return 2 /* ReplaceWithReturn */; } // Perform the capture. - captureThisForNode(statements, ctor, superCallExpression, firstStatement); + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); // If we're actually replacing the original statement, we need to signal this to the caller. if (superCallExpression) { return 1 /* ReplaceSuperCapture */; } return 0 /* NoReplacement */; } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); + } function createDefaultSuperCallOrThis() { - var actualThis = ts.createThis(); - ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); - var superCall = ts.createFunctionApply(ts.createIdentifier("_super"), actualThis, ts.createIdentifier("arguments")); - return ts.createLogicalOr(superCall, actualThis); + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); } /** * Visits a parameter declaration. @@ -50202,6 +50676,46 @@ var ts; ts.setSourceMapRange(captureThisStatement, node); statements.push(captureThisStatement); } + function prependCaptureNewTargetIfNeeded(statements, node, copyOnWrite) { + if (hierarchyFacts & 16384 /* NewTarget */) { + var newTarget = void 0; + switch (node.kind) { + case 185 /* ArrowFunction */: + return statements; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + // Methods and accessors cannot be constructors, so 'new.target' will + // always return 'undefined'. + newTarget = ts.createVoidZero(); + break; + case 150 /* Constructor */: + // Class constructors can only be called with `new`, so `this.constructor` + // should be relatively safe to use. + newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"); + break; + case 226 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + // Functions can be called or constructed, and may have a `this` due to + // being a member or when calling an imported function via `other_1.f()`. + newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 92 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero()); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + var captureNewTargetStatement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration("_newTarget", + /*type*/ undefined, newTarget) + ])); + if (copyOnWrite) { + return [captureNewTargetStatement].concat(statements); + } + statements.unshift(captureNewTargetStatement); + } + return statements; + } /** * Adds statements to the class body function for a class to define the members of the * class. @@ -50213,17 +50727,17 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; case 149 /* MethodDeclaration */: - statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; case 151 /* GetAccessor */: case 152 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { - statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; case 150 /* Constructor */: @@ -50249,11 +50763,12 @@ var ts; * @param receiver The receiver for the member. * @param member The MethodDeclaration node. */ - function transformClassMethodDeclarationToStatement(receiver, member) { + function transformClassMethodDeclarationToStatement(receiver, member, container) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); var commentRange = ts.getCommentRange(member); var sourceMapRange = ts.getSourceMapRange(member); var memberName = ts.createMemberAccessForPropertyName(receiver, ts.visitNode(member.name, visitor, ts.isPropertyName), /*location*/ member.name); - var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined); + var memberFunction = transformFunctionLikeToExpression(member, /*location*/ member, /*name*/ undefined, container); ts.setEmitFlags(memberFunction, 1536 /* NoComments */); ts.setSourceMapRange(memberFunction, sourceMapRange); var statement = ts.createStatement(ts.createAssignment(memberName, memberFunction), @@ -50264,6 +50779,7 @@ var ts; // No source map should be emitted for this statement to align with the // old emitter. ts.setEmitFlags(statement, 48 /* NoSourceMap */); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return statement; } /** @@ -50272,8 +50788,8 @@ var ts; * @param receiver The receiver for the member. * @param accessors The set of related get/set accessors. */ - function transformAccessorsToStatement(receiver, accessors) { - var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), + function transformAccessorsToStatement(receiver, accessors, container) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, container, /*startsOnNewLine*/ false), /*location*/ ts.getSourceMapRange(accessors.firstAccessor)); // The location for the statement is used to emit source maps only. // No comments should be emitted for this statement to align with the @@ -50287,8 +50803,9 @@ var ts; * * @param receiver The receiver for the member. */ - function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + function transformAccessorsToExpression(receiver, _a, container, startsOnNewLine) { var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); // To align with source maps in the old emitter, the receiver and property name // arguments are both mapped contiguously to the accessor name. var target = ts.getMutableClone(receiver); @@ -50299,7 +50816,7 @@ var ts; ts.setSourceMapRange(propertyName, firstAccessor.name); var properties = []; if (getAccessor) { - var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined); + var getterFunction = transformFunctionLikeToExpression(getAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(getterFunction, ts.getSourceMapRange(getAccessor)); ts.setEmitFlags(getterFunction, 512 /* NoLeadingComments */); var getter = ts.createPropertyAssignment("get", getterFunction); @@ -50307,7 +50824,7 @@ var ts; properties.push(getter); } if (setAccessor) { - var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined, container); ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); var setter = ts.createPropertyAssignment("set", setterFunction); @@ -50324,6 +50841,7 @@ var ts; if (startsOnNewLine) { call.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return call; } /** @@ -50335,6 +50853,9 @@ var ts; if (node.transformFlags & 16384 /* ContainsLexicalThis */) { enableSubstitutionsForCapturedThis(); } + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16256 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */); var func = ts.createFunctionExpression( /*modifiers*/ undefined, /*asteriskToken*/ undefined, @@ -50343,6 +50864,8 @@ var ts; /*type*/ undefined, transformFunctionBody(node), node); ts.setOriginalNode(func, node); ts.setEmitFlags(func, 8 /* CapturesThis */); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; return func; } /** @@ -50351,12 +50874,24 @@ var ts; * @param node a FunctionExpression node. */ function visitFunctionExpression(node) { - return ts.updateFunctionExpression(node, - /*modifiers*/ undefined, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var ancestorFacts = ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */ + ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionExpression(node, + /*modifiers*/ undefined, name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Visits a FunctionDeclaration node. @@ -50364,12 +50899,22 @@ var ts; * @param node a FunctionDeclaration node. */ function visitFunctionDeclaration(node) { - return ts.updateFunctionDeclaration(node, - /*decorators*/ undefined, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, node.transformFlags & 64 /* ES2015 */ + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = node.transformFlags & 64 /* ES2015 */ ? transformFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : visitFunctionBodyDownLevel(node); + var name = hierarchyFacts & 16384 /* NewTarget */ + ? ts.getLocalName(node) + : node.name; + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.updateFunctionDeclaration(node, + /*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), name, + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body); } /** * Transforms a function-like node into a FunctionExpression. @@ -50378,18 +50923,24 @@ var ts; * @param location The source-map location for the new FunctionExpression. * @param name The name of the new FunctionExpression. */ - function transformFunctionLikeToExpression(node, location, name) { - var savedContainingNonArrowFunction = enclosingNonArrowFunction; - if (node.kind !== 185 /* ArrowFunction */) { - enclosingNonArrowFunction = node; + function transformFunctionLikeToExpression(node, location, name, container) { + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */) + ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) + : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var parameters = ts.visitParameterList(node.parameters, visitor, context); + var body = transformFunctionBody(node); + if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 226 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */)) { + name = ts.getGeneratedNameForNode(node); } - var expression = ts.setOriginalNode(ts.createFunctionExpression( + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return ts.setOriginalNode(ts.createFunctionExpression( /*modifiers*/ undefined, node.asteriskToken, name, - /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), - /*type*/ undefined, saveStateAndInvoke(node, transformFunctionBody), location), + /*typeParameters*/ undefined, parameters, + /*type*/ undefined, body, location), /*original*/ node); - enclosingNonArrowFunction = savedContainingNonArrowFunction; - return expression; } /** * Transforms the body of a function-like node. @@ -50451,6 +51002,7 @@ var ts; } var lexicalEnvironment = context.endLexicalEnvironment(); ts.addRange(statements, lexicalEnvironment); + prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false); // If we added any final generated statements, this must be a multi-line block if (!multiLine && lexicalEnvironment && lexicalEnvironment.length) { multiLine = true; @@ -50465,6 +51017,23 @@ var ts; ts.setOriginalNode(block, node.body); return block; } + function visitFunctionBodyDownLevel(node) { + var updated = ts.visitFunctionBody(node.body, functionBodyVisitor, context); + return ts.updateBlock(updated, ts.createNodeArray(prependCaptureNewTargetIfNeeded(updated.statements, node, /*copyOnWrite*/ true), + /*location*/ updated.statements)); + } + function visitBlock(node, isFunctionBody) { + if (isFunctionBody) { + // A function body is not a block scope. + return ts.visitEachChild(node, visitor, context); + } + var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */ + ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */) + : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } /** * Visits an ExpressionStatement that contains a destructuring assignment. * @@ -50511,9 +51080,12 @@ var ts; if (ts.isDestructuringAssignment(node)) { return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, needsDestructuringValue); } + return ts.visitEachChild(node, visitor, context); } function visitVariableStatement(node) { - if (convertedLoopState && (ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */) == 0) { + var ancestorFacts = enterSubtree(0 /* None */, ts.hasModifier(node, 1 /* Export */) ? 32 /* ExportedVariableStatement */ : 0 /* None */); + var updated; + if (convertedLoopState && (node.declarationList.flags & 3 /* BlockScoped */) === 0) { // we are inside a converted loop - hoist variable declarations var assignments = void 0; for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { @@ -50531,14 +51103,18 @@ var ts; } } if (assignments) { - return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); + updated = ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); } else { // none of declarations has initializer - the entire variable statement can be deleted - return undefined; + updated = undefined; } } - return ts.visitEachChild(node, visitor, context); + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } /** * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`). @@ -50546,25 +51122,28 @@ var ts; * @param node A VariableDeclarationList node. */ function visitVariableDeclarationList(node) { - if (node.flags & 3 /* BlockScoped */) { - enableSubstitutionsForBlockScopedBindings(); + if (node.transformFlags & 64 /* ES2015 */) { + if (node.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + if (node.transformFlags & 8388608 /* ContainsBindingPattern */ + && (ts.isBindingPattern(node.declarations[0].name) + || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + // If the first or last declaration is a binding pattern, we need to modify + // the source map range for the declaration list. + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; } - var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ - ? visitVariableDeclarationInLetDeclarationList - : visitVariableDeclaration)); - var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); - ts.setOriginalNode(declarationList, node); - ts.setCommentRange(declarationList, node); - if (node.transformFlags & 8388608 /* ContainsBindingPattern */ - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { - // If the first or last declaration is a binding pattern, we need to modify - // the source map range for the declaration list. - var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); - } - return declarationList; + return ts.visitEachChild(node, visitor, context); } /** * Gets a value indicating whether we should emit an explicit initializer for a variable @@ -50615,18 +51194,16 @@ var ts; var flags = resolver.getNodeCheckFlags(node); var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + var emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || (isCapturedInFunction && isDeclaredInLoop - && ts.isBlock(enclosingBlockScopeContainer) - && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0); var emitExplicitInitializer = !emittedAsTopLevel - && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */ - && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */ + && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction - && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0)); return emitExplicitInitializer; } /** @@ -50655,55 +51232,52 @@ var ts; * @param node A VariableDeclaration node. */ function visitVariableDeclaration(node) { - // If we are here it is because the name contains a binding pattern. + var ancestorFacts = enterSubtree(32 /* ExportedVariableStatement */, 0 /* None */); + var updated; if (ts.isBindingPattern(node.name)) { - var hoistTempVariables = enclosingVariableStatement - && ts.hasModifier(enclosingVariableStatement, 1 /* Export */); - return ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, - /*value*/ undefined, hoistTempVariables); - } - return ts.visitEachChild(node, visitor, context); - } - function visitLabeledStatement(node) { - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); - } - convertedLoopState.labels[node.label.text] = node.label.text; - } - var result; - if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { - result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + updated = ts.flattenDestructuringBinding(node, visitor, context, 0 /* All */, + /*value*/ undefined, (ancestorFacts & 32 /* ExportedVariableStatement */) !== 0); } else { - result = ts.visitEachChild(node, visitor, context); + updated = ts.visitEachChild(node, visitor, context); } - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; + } + function recordLabel(node) { + convertedLoopState.labels[node.label.text] = node.label.text; + } + function resetLabel(node) { + convertedLoopState.labels[node.label.text] = undefined; + } + function visitLabeledStatement(node) { + if (convertedLoopState && !convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); } - return result; + var statement = ts.unwrapInnermostStatmentOfLabel(node, convertedLoopState && recordLabel); + return ts.isIterationStatement(statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(statement) + ? visitIterationStatement(statement, /*outermostLabeledStatement*/ node) + : ts.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement), node, convertedLoopState && resetLabel); } - function visitDoStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) { + var ancestorFacts = enterSubtree(excludeFacts, includeFacts); + var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } - function visitWhileStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitDoOrWhileStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement); } - function visitForStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement); } - function visitForInStatement(node) { - return convertIterationStatementBodyIfNecessary(node); + function visitForInStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement); } - /** - * Visits a ForOfStatement and converts it into a compatible ForStatement. - * - * @param node A ForOfStatement. - */ - function visitForOfStatement(node) { - return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + function visitForOfStatement(node, outermostLabeledStatement) { + return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, convertForOfToFor); } - function convertForOfToFor(node, convertedLoopBodyStatements) { + function convertForOfToFor(node, outermostLabeledStatement, convertedLoopBodyStatements) { // The following ES6 code: // // for (let v of expr) { } @@ -50815,7 +51389,20 @@ var ts; /*location*/ node); // Disable trailing source maps for the OpenParenToken to align source map emit with the old emitter. ts.setEmitFlags(forStatement, 256 /* NoTokenTrailingSourceMaps */); - return forStatement; + return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); + } + function visitIterationStatement(node, outermostLabeledStatement) { + switch (node.kind) { + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 212 /* ForStatement */: + return visitForStatement(node, outermostLabeledStatement); + case 213 /* ForInStatement */: + return visitForInStatement(node, outermostLabeledStatement); + case 214 /* ForOfStatement */: + return visitForOfStatement(node, outermostLabeledStatement); + } } /** * Visits an ObjectLiteralExpression with computed propety names. @@ -50829,31 +51416,40 @@ var ts; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. var numInitialProperties = numProperties; + var numInitialPropertiesWithoutYield = numProperties; for (var i = 0; i < numProperties; i++) { var property = properties[i]; - if (property.transformFlags & 16777216 /* ContainsYield */ - || property.name.kind === 142 /* ComputedPropertyName */) { + if ((property.transformFlags & 16777216 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */) + && i < numInitialPropertiesWithoutYield) { + numInitialPropertiesWithoutYield = i; + } + if (property.name.kind === 142 /* ComputedPropertyName */) { numInitialProperties = i; break; } } - ts.Debug.assert(numInitialProperties !== numProperties); - // 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 temp = ts.createTempVariable(hoistVariableDeclaration); - // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. - var expressions = []; - var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), - /*location*/ undefined, node.multiLine), 32768 /* Indented */)); - if (node.multiLine) { - assignment.startsOnNewLine = true; + if (numInitialProperties !== numProperties) { + if (numInitialPropertiesWithoutYield < numInitialProperties) { + numInitialProperties = numInitialPropertiesWithoutYield; + } + // 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 temp = ts.createTempVariable(hoistVariableDeclaration); + // Write out the first non-computed properties, then emit the rest through indexing on the temp variable. + var expressions = []; + var assignment = ts.createAssignment(temp, ts.setEmitFlags(ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), + /*location*/ undefined, node.multiLine), 32768 /* Indented */)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); } - expressions.push(assignment); - addObjectLiteralMembers(expressions, node, temp, numInitialProperties); - // We need to clone the temporary identifier so that we can write it on a - // new line - expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); - return ts.inlineExpressions(expressions); + return ts.visitEachChild(node, visitor, context); } function shouldConvertIterationStatementBody(node) { return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; @@ -50880,7 +51476,7 @@ var ts; } } } - function convertIterationStatementBodyIfNecessary(node, convert) { + function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) { if (!shouldConvertIterationStatementBody(node)) { var saveAllowedNonLabeledJumps = void 0; if (convertedLoopState) { @@ -50889,7 +51485,9 @@ var ts; saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; } - var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context); + var result = convert + ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined) + : ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel); if (convertedLoopState) { convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; } @@ -50898,11 +51496,11 @@ var ts; var functionName = ts.createUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 224 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 225 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -50939,7 +51537,7 @@ var ts; } } startLexicalEnvironment(); - var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock); var lexicalEnvironment = endLexicalEnvironment(); var currentState = convertedLoopState; convertedLoopState = outerConvertedLoopState; @@ -50951,11 +51549,13 @@ var ts; ts.addRange(statements_4, lexicalEnvironment); loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); } - if (!ts.isBlock(loopBody)) { + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); } - var isAsyncBlockContainingAwait = enclosingNonArrowFunction - && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + var isAsyncBlockContainingAwait = hierarchyFacts & 4 /* AsyncFunctionBody */ && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; var loopBodyFlags = 0; if (currentState.containsLexicalThis) { @@ -51038,25 +51638,24 @@ var ts; var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); var loop; if (convert) { - loop = convert(node, convertedLoopBodyStatements); + loop = convert(node, outermostLabeledStatement, convertedLoopBodyStatements); } else { - loop = ts.getMutableClone(node); + var clone_4 = ts.getMutableClone(node); // clean statement part - loop.statement = undefined; + clone_4.statement = undefined; // visit childnodes to transform initializer/condition/incrementor parts - loop = ts.visitEachChild(loop, visitor, context); + clone_4 = ts.visitEachChild(clone_4, visitor, context); // set loop statement - loop.statement = ts.createBlock(convertedLoopBodyStatements, + clone_4.statement = ts.createBlock(convertedLoopBodyStatements, /*location*/ undefined, /*multiline*/ true); // reset and re-aggregate the transform flags - loop.transformFlags = 0; - ts.aggregateTransformFlags(loop); + clone_4.transformFlags = 0; + ts.aggregateTransformFlags(clone_4); + loop = ts.restoreEnclosingLabel(clone_4, outermostLabeledStatement, convertedLoopState && resetLabel); } - statements.push(currentParent.kind === 219 /* LabeledStatement */ - ? ts.createLabel(currentParent.label, loop) - : loop); + statements.push(loop); return statements; } function copyOutParameter(outParam, copyDirection) { @@ -51186,18 +51785,18 @@ var ts; case 152 /* SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { - expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + expressions.push(transformAccessorsToExpression(receiver, accessors, node, node.multiLine)); } break; - case 257 /* PropertyAssignment */: + case 149 /* MethodDeclaration */: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); + break; + case 258 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 149 /* MethodDeclaration */: - expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); - break; default: ts.Debug.failBadSyntaxKind(node); break; @@ -51241,22 +51840,32 @@ var ts; * @param method The MethodDeclaration node. * @param receiver The receiver for the assignment. */ - function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { - var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, container, startsOnNewLine) { + var ancestorFacts = enterSubtree(0 /* None */, 0 /* None */); + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined, container), /*location*/ method); if (startsOnNewLine) { expression.startsOnNewLine = true; } + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 16384 /* NewTarget */ : 0 /* None */); return expression; } function visitCatchClause(node) { - ts.Debug.assert(ts.isBindingPattern(node.variableDeclaration.name)); - var temp = ts.createTempVariable(undefined); - var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); - var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); - var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); - var destructure = ts.createVariableStatement(undefined, list); - return ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */); + var updated; + if (ts.isBindingPattern(node.variableDeclaration.name)) { + var temp = ts.createTempVariable(undefined); + var newVariableDeclaration = ts.createVariableDeclaration(temp, undefined, undefined, node.variableDeclaration); + var vars = ts.flattenDestructuringBinding(node.variableDeclaration, visitor, context, 0 /* All */, temp); + var list = ts.createVariableDeclarationList(vars, /*location*/ node.variableDeclaration, /*flags*/ node.variableDeclaration.flags); + var destructure = ts.createVariableStatement(undefined, list); + updated = ts.updateCatchClause(node, newVariableDeclaration, addStatementToStartOfBlock(node.block, destructure)); + } + else { + updated = ts.visitEachChild(node, visitor, context); + } + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return updated; } function addStatementToStartOfBlock(block, statement) { var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); @@ -51273,11 +51882,26 @@ var ts; // Methods on classes are handled in visitClassDeclaration/visitClassExpression. // Methods with computed property names are handled in visitObjectLiteralExpression. ts.Debug.assert(!ts.isComputedPropertyName(node.name)); - var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined); + var functionExpression = transformFunctionLikeToExpression(node, /*location*/ ts.moveRangePos(node, -1), /*name*/ undefined, /*container*/ undefined); ts.setEmitFlags(functionExpression, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); return ts.createPropertyAssignment(node.name, functionExpression, /*location*/ node); } + /** + * Visits an AccessorDeclaration of an ObjectLiteralExpression. + * + * @param node An AccessorDeclaration node. + */ + function visitAccessorDeclaration(node) { + ts.Debug.assert(!ts.isComputedPropertyName(node.name)); + var savedConvertedLoopState = convertedLoopState; + convertedLoopState = undefined; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, 0 /* None */); + convertedLoopState = savedConvertedLoopState; + return updated; + } /** * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. * @@ -51287,6 +51911,12 @@ var ts; return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), /*location*/ node); } + function visitComputedPropertyName(node) { + var ancestorFacts = enterSubtree(0 /* ComputedPropertyNameExcludes */, 8192 /* ComputedPropertyNameIncludes */); + var updated = ts.visitEachChild(node, visitor, context); + exitSubtree(ancestorFacts, 49152 /* PropagateNewTargetMask */, hierarchyFacts & 49152 /* PropagateNewTargetMask */ ? 32768 /* NewTargetInComputedPropertyName */ : 0 /* None */); + return updated; + } /** * Visits a YieldExpression node. * @@ -51302,8 +51932,11 @@ var ts; * @param node An ArrayLiteralExpression node. */ function visitArrayLiteralExpression(node) { - // We are here because we contain a SpreadElementExpression. - return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + if (node.transformFlags & 64 /* ES2015 */) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + return ts.visitEachChild(node, visitor, context); } /** * Visits a CallExpression that contains either a spread element or `super`. @@ -51311,7 +51944,11 @@ var ts; * @param node a CallExpression. */ function visitCallExpression(node) { - return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + if (node.transformFlags & 64 /* ES2015 */) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitImmediateSuperCallInBody(node) { return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); @@ -51338,7 +51975,7 @@ var ts; // _super.apply(this, a.concat([b])) // _super.m.apply(this, a.concat([b])) // _super.prototype.m.apply(this, a.concat([b])) - resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); } else { // [source] @@ -51350,18 +51987,18 @@ var ts; // _super.call(this, a) // _super.m.call(this, a) // _super.prototype.m.call(this, a) - resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), /*location*/ node); } if (node.expression.kind === 96 /* SuperKeyword */) { var actualThis = ts.createThis(); ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); var initializer = ts.createLogicalOr(resultingCall, actualThis); - return assignToCapturedThis + resultingCall = assignToCapturedThis ? ts.createAssignment(ts.createIdentifier("_this"), initializer) : initializer; } - return resultingCall; + return ts.setOriginalNode(resultingCall, node); } /** * Visits a NewExpression that contains a spread element. @@ -51369,16 +52006,18 @@ var ts; * @param node A NewExpression node. */ function visitNewExpression(node) { - // We are here because we contain a SpreadElementExpression. - ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); - // [source] - // new C(...a) - // - // [output] - // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() - var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; - return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), - /*typeArguments*/ undefined, []); + if (node.transformFlags & 524288 /* ContainsSpread */) { + // We are here because we contain a SpreadElementExpression. + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() + var _a = ts.createCallBinding(ts.createPropertyAccess(node.expression, "bind"), hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg; + return ts.createNew(ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), thisArg, transformAndSpreadElements(ts.createNodeArray([ts.createVoidZero()].concat(node.arguments)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), + /*typeArguments*/ undefined, []); + } + return ts.visitEachChild(node, visitor, context); } /** * Transforms an array of Expression nodes that contains a SpreadExpression. @@ -51581,27 +52220,40 @@ var ts; /** * Visits the `super` keyword */ - function visitSuperKeyword() { - return enclosingNonAsyncFunctionBody - && ts.isClassElement(enclosingNonAsyncFunctionBody) - && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */) - && currentParent.kind !== 179 /* CallExpression */ + function visitSuperKeyword(isExpressionOfCall) { + return hierarchyFacts & 8 /* NonStaticClassElement */ + && !isExpressionOfCall ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") : ts.createIdentifier("_super"); } + function visitMetaProperty(node) { + if (node.keywordToken === 93 /* NewKeyword */ && node.name.text === "target") { + if (hierarchyFacts & 8192 /* ComputedPropertyName */) { + hierarchyFacts |= 32768 /* NewTargetInComputedPropertyName */; + } + else { + hierarchyFacts |= 16384 /* NewTarget */; + } + return ts.createIdentifier("_newTarget"); + } + return node; + } /** * Called by the printer just before a node is printed. * * @param node The node to be printed. */ function onEmitNode(emitContext, node, emitCallback) { - var savedEnclosingFunction = enclosingFunction; if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { // If we are tracking a captured `this`, keep track of the enclosing function. - enclosingFunction = node; + var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */ + ? 65 /* FunctionIncludes */ | 16 /* CapturesThis */ + : 65 /* FunctionIncludes */); + previousOnEmitNode(emitContext, node, emitCallback); + exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */); + return; } previousOnEmitNode(emitContext, node, emitCallback); - enclosingFunction = savedEnclosingFunction; } /** * Enables a more costly code path for substitutions when we determine a source file @@ -51627,7 +52279,7 @@ var ts; context.enableEmitNotification(152 /* SetAccessor */); context.enableEmitNotification(185 /* ArrowFunction */); context.enableEmitNotification(184 /* FunctionExpression */); - context.enableEmitNotification(225 /* FunctionDeclaration */); + context.enableEmitNotification(226 /* FunctionDeclaration */); } } /** @@ -51670,9 +52322,9 @@ var ts; var parent = node.parent; switch (parent.kind) { case 174 /* BindingElement */: - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 223 /* VariableDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 224 /* VariableDeclaration */: return parent.name === node && resolver.isDeclarationWithCollidingName(parent); } @@ -51713,8 +52365,7 @@ var ts; */ function substituteThisKeyword(node) { if (enabledSubstitutions & 1 /* CapturedThis */ - && enclosingFunction - && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { + && hierarchyFacts & 16 /* CapturesThis */) { return ts.createIdentifier("_this", /*location*/ node); } return node; @@ -51731,7 +52382,7 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 208 /* ExpressionStatement */) { return false; } var statementExpression = statement.expression; @@ -51763,7 +52414,7 @@ var ts; name: "typescript:extends", scoped: false, priority: 0, - text: "\n var __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };" + text: "\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();" }; })(ts || (ts = {})); /// @@ -52036,13 +52687,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitWhileStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -52055,24 +52706,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); case 151 /* GetAccessor */: case 152 /* SetAccessor */: return visitAccessorDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitForInStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return visitBreakStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return visitContinueStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 16777216 /* ContainsYield */) { @@ -52120,7 +52771,7 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); case 184 /* FunctionExpression */: return visitFunctionExpression(node); @@ -52405,10 +53056,10 @@ var ts; // _a = a(); // .yield resumeLabel // _a + %sent% + c() - var clone_4 = ts.getMutableClone(node); - clone_4.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); - clone_4.right = ts.visitNode(node.right, visitor, ts.isExpression); - return clone_4; + var clone_5 = ts.getMutableClone(node); + clone_5.left = cacheExpression(ts.visitNode(node.left, visitor, ts.isExpression)); + clone_5.right = ts.visitNode(node.right, visitor, ts.isExpression); + return clone_5; } return ts.visitEachChild(node, visitor, context); } @@ -52553,7 +53204,7 @@ var ts; emitYield(expression, /*location*/ node); } markLabel(resumeLabel); - return createGeneratorResume(); + return createGeneratorResume(/*location*/ node); } /** * Visits an ArrayLiteralExpression that contains a YieldExpression. @@ -52667,10 +53318,10 @@ var ts; // .yield resumeLabel // .mark resumeLabel // a = _a[%sent%] - var clone_5 = ts.getMutableClone(node); - clone_5.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); - clone_5.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); - return clone_5; + var clone_6 = ts.getMutableClone(node); + clone_6.expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression)); + clone_6.argumentExpression = ts.visitNode(node.argumentExpression, visitor, ts.isExpression); + return clone_6; } return ts.visitEachChild(node, visitor, context); } @@ -52737,35 +53388,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 204 /* Block */: + case 205 /* Block */: return transformAndEmitBlock(node); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return transformAndEmitIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return transformAndEmitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return transformAndEmitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return transformAndEmitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); @@ -52785,7 +53436,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - hoistVariableDeclaration(variable.name); + var name_37 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_37, variable.name); + hoistVariableDeclaration(name_37); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -52828,7 +53481,7 @@ var ts; if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { var endLabel = defineLabel(); var elseLabel = node.elseStatement ? defineLabel() : undefined; - emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node.expression); transformAndEmitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { emitBreak(endLabel); @@ -53185,7 +53838,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 255 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -53198,7 +53851,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 253 /* CaseClause */) { + if (clause.kind === 254 /* CaseClause */) { var caseClause = clause; if (containsYield(caseClause.expression) && pendingClauses.length > 0) { break; @@ -53359,12 +54012,12 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_37 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_37) { - var clone_6 = ts.getMutableClone(name_37); - ts.setSourceMapRange(clone_6, node); - ts.setCommentRange(clone_6, node); - return clone_6; + var name_38 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_38) { + var clone_7 = ts.getMutableClone(name_38); + ts.setSourceMapRange(clone_7, node); + ts.setCommentRange(clone_7, node); + return clone_7; } } } @@ -54249,9 +54902,9 @@ var ts; function writeReturn(expression, operationLocation) { lastOperationWasAbrupt = true; lastOperationWasCompletion = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(2 /* Return */), expression] - : [createInstruction(2 /* Return */)]), operationLocation)); + : [createInstruction(2 /* Return */)]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a Break operation to the current label's statement list. @@ -54261,10 +54914,10 @@ var ts; */ function writeBreak(label, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation)); + ]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a BreakWhenTrue operation to the current label's statement list. @@ -54274,10 +54927,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenTrue(label, condition, operationLocation) { - writeStatement(ts.createIf(condition, ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a BreakWhenFalse operation to the current label's statement list. @@ -54287,10 +54940,10 @@ var ts; * @param operationLocation The source map location for the operation. */ function writeBreakWhenFalse(label, condition, operationLocation) { - writeStatement(ts.createIf(ts.createLogicalNot(condition), ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(3 /* Break */), createLabel(label) - ]), operationLocation))); + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); } /** * Writes a Yield operation to the current label's statement list. @@ -54300,9 +54953,9 @@ var ts; */ function writeYield(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral(expression + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression ? [createInstruction(4 /* Yield */), expression] - : [createInstruction(4 /* Yield */)]), operationLocation)); + : [createInstruction(4 /* Yield */)]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes a YieldStar instruction to the current label's statement list. @@ -54312,10 +54965,10 @@ var ts; */ function writeYieldStar(expression, operationLocation) { lastOperationWasAbrupt = true; - writeStatement(ts.createReturn(ts.createArrayLiteral([ + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ createInstruction(5 /* YieldStar */), expression - ]), operationLocation)); + ]), operationLocation), 384 /* NoTokenSourceMaps */)); } /** * Writes an Endfinally instruction to the current label's statement list. @@ -54411,10 +55064,22 @@ var ts; * @param context Context and state information for the transformation. */ function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + // enable emit notification only if using --jsx preserve + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 /* Preserve */) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(249 /* JsxOpeningElement */); + context.enableEmitNotification(250 /* JsxClosingElement */); + context.enableEmitNotification(248 /* JsxSelfClosingElement */); + noSubstitution = []; + } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; context.enableSubstitution(177 /* PropertyAccessExpression */); - context.enableSubstitution(257 /* PropertyAssignment */); + context.enableSubstitution(258 /* PropertyAssignment */); return transformSourceFile; /** * Transforms an ES5 source file to ES3. @@ -54424,6 +55089,22 @@ var ts; function transformSourceFile(node) { return node; } + /** + * Called by the printer just before a node is printed. + * + * @param node The node to be printed. + */ + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 249 /* JsxOpeningElement */: + case 250 /* JsxClosingElement */: + case 248 /* JsxSelfClosingElement */: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } /** * Hooks node substitutions. * @@ -54431,6 +55112,9 @@ var ts; * @param node The node to substitute. */ function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } node = previousOnSubstituteNode(emitContext, node); if (ts.isPropertyAccessExpression(node)) { return substitutePropertyAccessExpression(node); @@ -54490,7 +55174,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(261 /* SourceFile */); + context.enableEmitNotification(262 /* SourceFile */); context.enableSubstitution(70 /* Identifier */); var currentSourceFile; return transformSourceFile; @@ -54517,10 +55201,10 @@ var ts; } function visitor(node) { switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // Elide `import=` as it is not legal with --module ES6 return undefined; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); } return node; @@ -54595,7 +55279,7 @@ var ts; context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. @@ -54815,7 +55499,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 242 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -54840,7 +55524,7 @@ var ts; } for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { var externalImport = _e[_d]; - if (externalImport.kind !== 241 /* ExportDeclaration */) { + if (externalImport.kind !== 242 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -54921,19 +55605,19 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); switch (entry.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -54983,15 +55667,15 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // ExportDeclarations are elided as they are handled via // `appendExportsOfDeclaration`. return undefined; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); default: return nestedElementVisitor(node); @@ -55169,7 +55853,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ + && (enclosingBlockScopedContainer.kind === 262 /* SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } /** @@ -55233,7 +55917,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -55289,10 +55973,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 239 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -55471,43 +56155,43 @@ var ts; */ function nestedElementVisitor(node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return visitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return visitForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return visitForOfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return visitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return visitWhileStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return visitLabeledStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return visitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return visitSwitchStatement(node); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return visitCaseBlock(node); - case 253 /* CaseClause */: + case 254 /* CaseClause */: return visitCaseClause(node); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return visitDefaultClause(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return visitTryStatement(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return visitCatchClause(node); - case 204 /* Block */: + case 205 /* Block */: return visitBlock(node); - case 295 /* MergeDeclarationMarker */: + case 296 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: + case 297 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return destructuringVisitor(node); @@ -55735,7 +56419,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 261 /* SourceFile */; + return container !== undefined && container.kind === 262 /* SourceFile */; } else { return false; @@ -55768,7 +56452,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -55941,7 +56625,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -55997,8 +56681,8 @@ var ts; context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. - context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(259 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(262 /* SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -56052,26 +56736,6 @@ var ts; function transformAMDModule(node) { var define = ts.createIdentifier("define"); var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); - return transformAsynchronousModule(node, define, moduleName, /*includeNonAmdDependencies*/ true); - } - /** - * Transforms a SourceFile into a UMD module. - * - * @param node The SourceFile node. - */ - function transformUMDModule(node) { - var define = ts.createRawExpression(umdHelper); - return transformAsynchronousModule(node, define, /*moduleName*/ undefined, /*includeNonAmdDependencies*/ false); - } - /** - * Transforms a SourceFile into an AMD or UMD module. - * - * @param node The SourceFile node. - * @param define The expression used to define the module. - * @param moduleName An expression for the module name, if available. - * @param includeNonAmdDependencies A value indicating whether to incldue any non-AMD dependencies. - */ - function transformAsynchronousModule(node, define, moduleName, includeNonAmdDependencies) { // An AMD define function has the following shape: // // define(id?, dependencies?, factory); @@ -56092,7 +56756,7 @@ var ts; // /// // // we need to add modules without alias names to the end of the dependencies list - var _a = collectAsynchronousDependencies(node, includeNonAmdDependencies), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; // Create an updated SourceFile: // // define(moduleName?, ["module1", "module2"], function ... @@ -56122,6 +56786,73 @@ var ts; ], /*location*/ node.statements)); } + /** + * Transforms a SourceFile into a UMD module. + * + * @param node The SourceFile node. + */ + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, [ + ts.createVariableDeclaration("v", + /*type*/ undefined, ts.createCall(ts.createIdentifier("factory"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1 /* SingleLine */) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], + /*location*/ undefined, + /*multiLine*/ true)); + // Create an updated SourceFile: + // + // (function (factory) { + // if (typeof module === "object" && typeof module.exports === "object") { + // var v = factory(require, exports); + // if (v !== undefined) module.exports = v; + // } + // else if (typeof define === 'function' && define.amd) { + // define(["require", "exports"], factory); + // } + // })(function ...) + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, + /*typeArguments*/ undefined, [ + // Add the module body function argument: + // + // function (require, exports) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ])) + ], + /*location*/ node.statements)); + } /** * Collect the additional asynchronous dependencies for the module. * @@ -56226,23 +56957,23 @@ var ts; */ function sourceElementVisitor(node) { switch (node.kind) { - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return visitImportDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return visitExportDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return visitExportAssignment(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return visitVariableStatement(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return visitClassDeclaration(node); - case 295 /* MergeDeclarationMarker */: + case 296 /* MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 296 /* EndOfDeclarationMarker */: + case 297 /* EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: // This visitor does not descend into the tree, as export/import statements @@ -56554,7 +57285,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 206 /* VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -56609,10 +57340,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 238 /* NamedImports */: + case 239 /* NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -56811,7 +57542,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(emitContext, node, emitCallback) { - if (node.kind === 261 /* SourceFile */) { + if (node.kind === 262 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; noSubstitution = ts.createMap(); @@ -56899,7 +57630,7 @@ var ts; } if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 262 /* SourceFile */) { return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), /*location*/ node); } @@ -56910,8 +57641,8 @@ var ts; /*location*/ node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_38 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_38), + var name_39 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), /*location*/ node); } } @@ -57013,8 +57744,6 @@ var ts; scoped: true, text: "\n function __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n }" }; - // emit output for the UMD helper function. - var umdHelper = "\n (function (dependencies, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(dependencies, factory);\n }\n })"; })(ts || (ts = {})); /// /// @@ -57521,7 +58250,7 @@ var ts; var emitNode = node.emitNode; var emitFlags = emitNode && emitNode.flags; var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 && pos >= 0) { emitPos(ts.skipTrivia(currentSourceText, pos)); @@ -57534,7 +58263,7 @@ var ts; else { emitCallback(emitContext, node); } - if (node.kind !== 293 /* NotEmittedStatement */ + if (node.kind !== 294 /* NotEmittedStatement */ && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 && end >= 0) { emitPos(end); @@ -57713,7 +58442,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 293 /* NotEmittedStatement */; + var isEmittedNode = node.kind !== 294 /* NotEmittedStatement */; var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0; var skipTrailingComments = end < 0 || (emitFlags & 1024 /* NoTrailingComments */) !== 0; // Emit leading comments if the position is not synthesized and the node @@ -57732,7 +58461,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 225 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -58045,7 +58774,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 236 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -58120,10 +58849,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 223 /* VariableDeclaration */) { + if (declaration.kind === 224 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) { + else if (declaration.kind === 239 /* NamedImports */ || declaration.kind === 240 /* ImportSpecifier */ || declaration.kind === 237 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -58141,7 +58870,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 236 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -58151,12 +58880,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 231 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -58334,7 +59063,7 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 235 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); @@ -58456,9 +59185,9 @@ var ts; var count = 0; while (true) { count++; - var name_39 = baseName + "_" + count; - if (!(name_39 in currentIdentifiers)) { - return name_39; + var name_40 = baseName + "_" + count; + if (!(name_40 in currentIdentifiers)) { + return name_40; } } } @@ -58505,10 +59234,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 234 /* ImportEqualsDeclaration */ || - (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 235 /* ImportEqualsDeclaration */ || + (node.parent.kind === 262 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 262 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -58518,7 +59247,7 @@ var ts; }); } else { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -58536,23 +59265,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return writeVariableStatement(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return writeClassDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -58560,7 +59289,7 @@ var ts; } function emitModuleElementDeclarationFlags(node) { // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 261 /* SourceFile */) { + if (node.parent.kind === 262 /* SourceFile */) { var modifiers = ts.getModifierFlags(node); // If the node is exported if (modifiers & 1 /* Export */) { @@ -58569,7 +59298,7 @@ var ts; if (modifiers & 512 /* Default */) { write("default "); } - else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 228 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -58621,7 +59350,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 238 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -58645,7 +59374,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 238 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -58666,13 +59395,13 @@ var ts; // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 231 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 234 /* ImportEqualsDeclaration */) { + if (parent.kind === 235 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 230 /* ModuleDeclaration */) { + else if (parent.kind === 231 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -58742,7 +59471,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body && node.body.kind !== 231 /* ModuleBlock */) { + while (node.body && node.body.kind !== 232 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -58842,10 +59571,10 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; case 154 /* ConstructSignature */: @@ -58859,17 +59588,17 @@ var ts; if (ts.hasModifier(node.parent, 32 /* Static */)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 227 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -58907,7 +59636,7 @@ var ts; function getHeritageClauseVisibilityError() { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + if (node.parent.parent.kind === 227 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -58994,7 +59723,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 224 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -59022,7 +59751,7 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 223 /* VariableDeclaration */) { + if (node.kind === 224 /* VariableDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59038,7 +59767,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59212,13 +59941,13 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 226 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - if (node.kind === 225 /* FunctionDeclaration */) { + if (node.kind === 226 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } @@ -59323,7 +60052,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.kind === 227 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59337,7 +60066,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -59420,7 +60149,7 @@ var ts; 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 === 226 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 227 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59433,7 +60162,7 @@ var ts; 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; } - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -59509,20 +60238,20 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 227 /* InterfaceDeclaration */: - case 226 /* ClassDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: + case 226 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 228 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return emitExportDeclaration(node); case 150 /* Constructor */: case 149 /* MethodDeclaration */: @@ -59538,11 +60267,11 @@ var ts; case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return emitPropertyDeclaration(node); - case 260 /* EnumMember */: + case 261 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return emitExportAssignment(node); - case 261 /* SourceFile */: + case 262 /* SourceFile */: return emitSourceFile(node); } } @@ -59835,7 +60564,7 @@ var ts; var kind = node.kind; switch (kind) { // Top-level nodes - case 261 /* SourceFile */: + case 262 /* SourceFile */: return emitSourceFile(node); } } @@ -59983,126 +60712,126 @@ var ts; case 174 /* BindingElement */: return emitBindingElement(node); // Misc - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return emitTemplateSpan(node); - case 203 /* SemicolonClassElement */: + case 204 /* SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 204 /* Block */: + case 205 /* Block */: return emitBlock(node); - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: return emitVariableStatement(node); - case 206 /* EmptyStatement */: + case 207 /* EmptyStatement */: return emitEmptyStatement(); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return emitExpressionStatement(node); - case 208 /* IfStatement */: + case 209 /* IfStatement */: return emitIfStatement(node); - case 209 /* DoStatement */: + case 210 /* DoStatement */: return emitDoStatement(node); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: return emitWhileStatement(node); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return emitForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: return emitForInStatement(node); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return emitForOfStatement(node); - case 214 /* ContinueStatement */: + case 215 /* ContinueStatement */: return emitContinueStatement(node); - case 215 /* BreakStatement */: + case 216 /* BreakStatement */: return emitBreakStatement(node); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: return emitReturnStatement(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: return emitWithStatement(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return emitSwitchStatement(node); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: return emitLabeledStatement(node); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: return emitThrowStatement(node); - case 221 /* TryStatement */: + case 222 /* TryStatement */: return emitTryStatement(node); - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 224 /* VariableDeclarationList */: + case 225 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: return emitClassDeclaration(node); - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return emitModuleBlock(node); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return emitCaseBlock(node); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: return emitImportDeclaration(node); - case 236 /* ImportClause */: + case 237 /* ImportClause */: return emitImportClause(node); - case 237 /* NamespaceImport */: + case 238 /* NamespaceImport */: return emitNamespaceImport(node); - case 238 /* NamedImports */: + case 239 /* NamedImports */: return emitNamedImports(node); - case 239 /* ImportSpecifier */: + case 240 /* ImportSpecifier */: return emitImportSpecifier(node); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: return emitExportAssignment(node); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: return emitExportDeclaration(node); - case 242 /* NamedExports */: + case 243 /* NamedExports */: return emitNamedExports(node); - case 243 /* ExportSpecifier */: + case 244 /* ExportSpecifier */: return emitExportSpecifier(node); - case 244 /* MissingDeclaration */: + case 245 /* MissingDeclaration */: return; // Module references - case 245 /* ExternalModuleReference */: + case 246 /* ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 10 /* JsxText */: return emitJsxText(node); - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: return emitJsxOpeningElement(node); - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: return emitJsxClosingElement(node); - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: return emitJsxAttribute(node); - case 251 /* JsxSpreadAttribute */: + case 252 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 252 /* JsxExpression */: + case 253 /* JsxExpression */: return emitJsxExpression(node); // Clauses - case 253 /* CaseClause */: + case 254 /* CaseClause */: return emitCaseClause(node); - case 254 /* DefaultClause */: + case 255 /* DefaultClause */: return emitDefaultClause(node); - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: return emitHeritageClause(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return emitCatchClause(node); // Property assignments - case 257 /* PropertyAssignment */: + case 258 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 258 /* ShorthandPropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 259 /* SpreadAssignment */: + case 260 /* SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 260 /* EnumMember */: + case 261 /* EnumMember */: return emitEnumMember(node); } // If the node is an expression, try to emit it as an expression with @@ -60191,16 +60920,16 @@ var ts; return emitAsExpression(node); case 201 /* NonNullExpression */: return emitNonNullExpression(node); + case 202 /* MetaProperty */: + return emitMetaProperty(node); // JSX - case 246 /* JsxElement */: + case 247 /* JsxElement */: return emitJsxElement(node); - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); // Transformation nodes - case 294 /* PartiallyEmittedExpression */: + case 295 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 297 /* RawExpression */: - return writeLines(node.text); } } // @@ -60693,6 +61422,11 @@ var ts; emitExpression(node.expression); write("!"); } + function emitMetaProperty(node) { + writeToken(node.keywordToken, node.pos); + write("."); + emit(node.name); + } // // Misc // @@ -60741,27 +61475,27 @@ var ts; writeToken(18 /* OpenParenToken */, openParenPos, node); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end, node); - emitEmbeddedStatement(node.thenStatement); + emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { - writeLine(); + writeLineOrSpace(node); writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); - if (node.elseStatement.kind === 208 /* IfStatement */) { + if (node.elseStatement.kind === 209 /* IfStatement */) { write(" "); emit(node.elseStatement); } else { - emitEmbeddedStatement(node.elseStatement); + emitEmbeddedStatement(node, node.elseStatement); } } } function emitDoStatement(node) { write("do"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); if (ts.isBlock(node.statement)) { write(" "); } else { - writeLine(); + writeLineOrSpace(node); } write("while ("); emitExpression(node.expression); @@ -60771,7 +61505,7 @@ var ts; write("while ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60783,7 +61517,7 @@ var ts; write(";"); emitExpressionWithPrefix(" ", node.incrementor); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60793,7 +61527,7 @@ var ts; write(" in "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { var openParenPos = writeToken(87 /* ForKeyword */, node.pos); @@ -60803,11 +61537,11 @@ var ts; write(" of "); emitExpression(node.expression); writeToken(19 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 224 /* VariableDeclarationList */) { + if (node.kind === 225 /* VariableDeclarationList */) { emit(node); } else { @@ -60834,7 +61568,7 @@ var ts; write("with ("); emitExpression(node.expression); write(")"); - emitEmbeddedStatement(node.statement); + emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos); @@ -60858,9 +61592,12 @@ var ts; function emitTryStatement(node) { write("try "); emit(node.tryBlock); - emit(node.catchClause); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } if (node.finallyBlock) { - writeLine(); + writeLineOrSpace(node); write("finally "); emit(node.finallyBlock); } @@ -61046,7 +61783,7 @@ var ts; write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); emit(node.name); var body = node.body; - while (body.kind === 230 /* ModuleDeclaration */) { + while (body.kind === 231 /* ModuleDeclaration */) { write("."); emit(body.name); body = body.body; @@ -61203,6 +61940,9 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); + if (node.dotDotDotToken) { + write("..."); + } emitExpression(node.expression); write("}"); } @@ -61438,8 +62178,8 @@ var ts; write(suffix); } } - function emitEmbeddedStatement(node) { - if (ts.isBlock(node)) { + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1 /* SingleLine */) { write(" "); emit(node); } @@ -61580,6 +62320,14 @@ var ts; write(getClosingBracket(format)); } } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + write(" "); + } + else { + writeLine(); + } + } function writeIfAny(nodes, text) { if (nodes && nodes.length > 0) { write(text); @@ -61771,10 +62519,10 @@ var ts; */ function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_40 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_40)) { + var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_41)) { tempFlags |= flags; - return name_40; + return name_41; } } while (true) { @@ -61782,11 +62530,11 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_41 = count < 26 + var name_42 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_41)) { - return name_41; + if (isUniqueName(name_42)) { + return name_42; } } } @@ -61826,6 +62574,12 @@ var ts; function generateNameForClassExpression() { return makeUniqueName("class"); } + function generateNameForMethodOrAccessor(node) { + if (ts.isIdentifier(node.name)) { + return generateNameForNodeCached(node.name); + } + return makeTempVariableName(0 /* Auto */); + } /** * Generates a unique name from a node. * @@ -61835,18 +62589,22 @@ var ts; switch (node.kind) { case 70 /* Identifier */: return makeUniqueName(getTextOfNode(node)); - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 235 /* ImportDeclaration */: - case 241 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: + case 242 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 225 /* FunctionDeclaration */: - case 226 /* ClassDeclaration */: - case 240 /* ExportAssignment */: + case 226 /* FunctionDeclaration */: + case 227 /* ClassDeclaration */: + case 241 /* ExportAssignment */: return generateNameForExportDefault(); case 197 /* ClassExpression */: return generateNameForClassExpression(); + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return generateNameForMethodOrAccessor(node); default: return makeTempVariableName(0 /* Auto */); } @@ -61890,6 +62648,10 @@ var ts; // otherwise, return the original node for the source; return node; } + function generateNameForNodeCached(node) { + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } /** * Gets the generated identifier text from a generated identifier. * @@ -61900,8 +62662,7 @@ var ts; // Generated names generate unique names based on their original node // and are cached based on that node's id var node = getNodeForGeneratedName(name); - var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return generateNameForNodeCached(node); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -62046,7 +62807,8 @@ var ts; commonPathComponents = sourcePathComponents; return; } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + var n = Math.min(commonPathComponents.length, sourcePathComponents.length); + for (var i = 0; i < n; i++) { if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component @@ -62237,10 +62999,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_42 = names_1[_i]; - var result = name_42 in cache - ? cache[name_42] - : cache[name_42] = loader(name_42, containingFile); + var name_43 = names_1[_i]; + var result = name_43 in cache + ? cache[name_43] + : cache[name_43] = loader(name_43, containingFile); resolutions.push(result); } return resolutions; @@ -62276,6 +63038,7 @@ var ts; var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { @@ -62289,7 +63052,8 @@ var ts; }); }; } else { - var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -62335,6 +63099,8 @@ var ts; } } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; program = { @@ -62600,7 +63366,7 @@ var ts; newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; } // update fileName -> file mapping - for (var i = 0, len = newSourceFiles.length; i < len; i++) { + for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; @@ -62787,10 +63553,10 @@ var ts; case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: - case 223 /* VariableDeclaration */: + case 226 /* FunctionDeclaration */: + case 224 /* VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -62798,32 +63564,32 @@ var ts; } } switch (node.kind) { - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return; - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return; } break; - case 255 /* HeritageClause */: + case 256 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 107 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return; } break; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return; - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; case 182 /* TypeAssertionExpression */: @@ -62841,26 +63607,26 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); } switch (parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; } // pass through - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */); + return checkModifiers(nodes, parent.kind === 206 /* VariableStatement */); } break; case 147 /* PropertyDeclaration */: @@ -62983,7 +63749,7 @@ var ts; // synthesize 'import "tslib"' declaration var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; - var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */); + var importDecl = ts.createSynthesizedNode(236 /* ImportDeclaration */); importDecl.parent = file; externalHelpersModuleReference.parent = importDecl; imports = [externalHelpersModuleReference]; @@ -63001,9 +63767,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 235 /* ImportDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 241 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 242 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -63018,7 +63784,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -64281,11 +65047,11 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_43 in options) { - if (ts.hasProperty(options, name_43)) { + for (var name_44 in options) { + if (ts.hasProperty(options, name_44)) { // tsconfig only options cannot be specified via command line, // so we can assume that only types that can appear here string | number | boolean - switch (name_43) { + switch (name_44) { case "init": case "watch": case "version": @@ -64293,14 +65059,14 @@ var ts; case "project": break; default: - var value = options[name_43]; - var optionDefinition = optionsNameMap[name_43.toLowerCase()]; + var value = options[name_44]; + var optionDefinition = optionsNameMap[name_44.toLowerCase()]; if (optionDefinition) { var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); if (!customTypeMap) { // There is no map associated with this compiler option then use the value as-is // This is the case if the value is expect to be string, number, boolean or list of string - result[name_43] = value; + result[name_44] = value; } else { if (optionDefinition.type === "list") { @@ -64309,11 +65075,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_43] = convertedValue; + result[name_44] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_43] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -64361,6 +65127,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -65130,32 +65897,32 @@ var ts; function getMeaningFromDeclaration(node) { switch (node.kind) { case 144 /* Parameter */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: - case 260 /* EnumMember */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: + case 261 /* EnumMember */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 256 /* CatchClause */: + case 257 /* CatchClause */: return 1 /* Value */; case 143 /* TypeParameter */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: case 161 /* TypeLiteral */: return 2 /* Type */; - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -65165,22 +65932,22 @@ var ts; else { return 4 /* Namespace */; } - case 238 /* NamedImports */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 235 /* ImportDeclaration */: - case 240 /* ExportAssignment */: - case 241 /* ExportDeclaration */: + case 239 /* NamedImports */: + case 240 /* ImportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 236 /* ImportDeclaration */: + case 241 /* ExportAssignment */: + case 242 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 261 /* SourceFile */: + case 262 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } ts.getMeaningFromDeclaration = getMeaningFromDeclaration; function getMeaningFromLocation(node) { - if (node.parent.kind === 240 /* ExportAssignment */) { + if (node.parent.kind === 241 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -65207,7 +65974,7 @@ var ts; // import a = |b.c|.d; // Namespace if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 235 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; @@ -65241,10 +66008,10 @@ var ts; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 256 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || - (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + return (decl.kind === 227 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 228 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); } return false; } @@ -65275,7 +66042,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 220 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -65285,13 +66052,13 @@ var ts; ts.getTargetLabel = getTargetLabel; function isJumpStatementTarget(node) { return node.kind === 70 /* Identifier */ && - (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) && + (node.parent.kind === 216 /* BreakStatement */ || node.parent.kind === 215 /* ContinueStatement */) && node.parent.label === node; } ts.isJumpStatementTarget = isJumpStatementTarget; function isLabelOfLabeledStatement(node) { return node.kind === 70 /* Identifier */ && - node.parent.kind === 219 /* LabeledStatement */ && + node.parent.kind === 220 /* LabeledStatement */ && node.parent.label === node; } function isLabelName(node) { @@ -65307,7 +66074,7 @@ var ts; } ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; function isNameOfModuleDeclaration(node) { - return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 231 /* ModuleDeclaration */ && node.parent.name === node; } ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; function isNameOfFunctionDeclaration(node) { @@ -65320,13 +66087,13 @@ var ts; switch (node.parent.kind) { case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: - case 257 /* PropertyAssignment */: - case 260 /* EnumMember */: + case 258 /* PropertyAssignment */: + case 261 /* EnumMember */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return node.parent.name === node; case 178 /* ElementAccessExpression */: return node.parent.argumentExpression === node; @@ -65379,17 +66146,17 @@ var ts; return undefined; } switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return node; } } @@ -65397,22 +66164,22 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return ts.ScriptElementKind.moduleElement; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: return ts.ScriptElementKind.classElement; - case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; - case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; - case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; - case 223 /* VariableDeclaration */: + case 228 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 229 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 230 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 224 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); case 174 /* BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return ts.ScriptElementKind.functionElement; case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; @@ -65428,15 +66195,15 @@ var ts; case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; - case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 261 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; - case 234 /* ImportEqualsDeclaration */: - case 239 /* ImportSpecifier */: - case 236 /* ImportClause */: - case 243 /* ExportSpecifier */: - case 237 /* NamespaceImport */: + case 235 /* ImportEqualsDeclaration */: + case 240 /* ImportSpecifier */: + case 237 /* ImportClause */: + case 244 /* ExportSpecifier */: + case 238 /* NamespaceImport */: return ts.ScriptElementKind.alias; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return ts.ScriptElementKind.typeElement; default: return ts.ScriptElementKind.unknown; @@ -65511,19 +66278,19 @@ var ts; return false; } switch (n.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: case 172 /* ObjectBindingPattern */: case 161 /* TypeLiteral */: - case 204 /* Block */: - case 231 /* ModuleBlock */: - case 232 /* CaseBlock */: - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 205 /* Block */: + case 232 /* ModuleBlock */: + case 233 /* CaseBlock */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return isCompletedNode(n.block, sourceFile); case 180 /* NewExpression */: if (!n.arguments) { @@ -65540,7 +66307,7 @@ var ts; case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -65556,14 +66323,14 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 208 /* IfStatement */: + case 209 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 24 /* SemicolonToken */); case 175 /* ArrayLiteralExpression */: @@ -65577,16 +66344,16 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 209 /* DoStatement */: + case 210 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { @@ -65607,10 +66374,10 @@ var ts; case 194 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 202 /* TemplateSpan */: + case 203 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 241 /* ExportDeclaration */: - case 235 /* ImportDeclaration */: + case 242 /* ExportDeclaration */: + case 236 /* ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); case 190 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); @@ -65672,7 +66439,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 293 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -65739,8 +66506,8 @@ var ts; } } // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); + for (var _a = 0, _b = current.getChildren(); _a < _b.length; _a++) { + var child = _b[_a]; // all jsDocComment nodes were already visited if (ts.isJSDocNode(child)) { continue; @@ -65819,7 +66586,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + for (var i = 0; i < children.length; i++) { var child = children[i]; // condition 'position < child.end' checks if child node end after the position // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' @@ -65844,7 +66611,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 262 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -65903,17 +66670,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 253 /* JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) { + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 253 /* JsxExpression */) { return true; } //
|
- if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) { + if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 250 /* JsxClosingElement */) { return true; } return false; @@ -66028,7 +66795,7 @@ var ts; if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 227 /* ClassDeclaration */ || node.kind === 228 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -66105,7 +66872,7 @@ var ts; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 213 /* ForOfStatement */ && + if (node.parent.kind === 214 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -66113,7 +66880,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 258 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -66339,7 +67106,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) && + (location.parent.kind === 240 /* ImportSpecifier */ || location.parent.kind === 244 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -66406,6 +67173,11 @@ var ts; }; } ts.sanitizeConfigFile = sanitizeConfigFile; + function getOpenBraceEnd(constructor, sourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile).getEnd(); + } + ts.getOpenBraceEnd = getOpenBraceEnd; })(ts || (ts = {})); var ts; (function (ts) { @@ -66473,7 +67245,7 @@ var ts; var entries = []; var dense = classifications.spans; var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; var length_4 = dense[i + 1]; var type = dense[i + 2]; @@ -66845,10 +67617,10 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 230 /* ModuleDeclaration */: - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 231 /* ModuleDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -66899,7 +67671,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 230 /* ModuleDeclaration */ && + return declaration.kind === 231 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -66960,7 +67732,7 @@ var ts; ts.Debug.assert(classifications.spans.length % 3 === 0); var dense = classifications.spans; var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { + for (var i = 0; i < dense.length; i += 3) { result.push({ textSpan: ts.createTextSpan(dense[i], dense[i + 1]), classificationType: getClassificationTypeName(dense[i + 2]) @@ -67063,16 +67835,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 281 /* JSDocParameterTag */: + case 282 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 284 /* JSDocTemplateTag */: + case 285 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 283 /* JSDocTypeTag */: + case 284 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 282 /* JSDocReturnTag */: + case 283 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -67159,22 +67931,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 248 /* JsxOpeningElement */: + case 249 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 249 /* JsxClosingElement */: + case 250 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 247 /* JsxSelfClosingElement */: + case 248 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 250 /* JsxAttribute */: + case 251 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -67202,10 +67974,10 @@ var ts; if (token) { if (tokenKind === 57 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 223 /* VariableDeclaration */ || + if (token.parent.kind === 224 /* VariableDeclaration */ || token.parent.kind === 147 /* PropertyDeclaration */ || token.parent.kind === 144 /* Parameter */ || - token.parent.kind === 250 /* JsxAttribute */) { + token.parent.kind === 251 /* JsxAttribute */) { return 5 /* operator */; } } @@ -67222,7 +67994,7 @@ var ts; return 4 /* numericLiteral */; } else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + return token.parent.kind === 251 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 11 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -67238,7 +68010,7 @@ var ts; else if (tokenKind === 70 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } @@ -67248,17 +68020,17 @@ var ts; return 15 /* typeParameterName */; } return; - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } @@ -67280,9 +68052,8 @@ var ts; // Ignore nodes that don't intersect the original span to classify. if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { checkForClassificationCancellation(cancellationToken, element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0, _a = element.getChildren(sourceFile); _i < _a.length; _i++) { + var child = _a[_i]; if (!tryClassifyNode(child)) { // Recurse into our child nodes. processElement(child); @@ -67323,7 +68094,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 249 /* JsxClosingElement */) { + location.parent && location.parent.kind === 250 /* JsxClosingElement */) { // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. // For example: @@ -67350,14 +68121,14 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_44 in nameTable) { + for (var name_45 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_44] === position) { + if (nameTable[name_45] === position) { continue; } - if (!uniqueNames[name_44]) { - uniqueNames[name_44] = name_44; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_44), compilerOptions.target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -67417,7 +68188,7 @@ var ts; if (!node || node.kind !== 9 /* StringLiteral */) { return undefined; } - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && node.parent.name === node) { // Get quoted name of properties of the object literal expression @@ -67443,7 +68214,7 @@ var ts; // a['/*completion position*/'] return getStringLiteralCompletionEntriesFromElementAccess(node.parent); } - else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + else if (node.parent.kind === 236 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // import x = require("/*completion position*/"); @@ -67512,6 +68283,9 @@ var ts; return undefined; } function addStringLiteralCompletionsFromType(type, result) { + if (type && type.flags & 16384 /* TypeParameter */) { + type = typeChecker.getApparentType(type); + } if (!type) { return; } @@ -67870,11 +68644,11 @@ var ts; if (currentConfigPath) { paths.push(currentConfigPath); currentDir = ts.getDirectoryPath(currentConfigPath); - var parent_13 = ts.getDirectoryPath(currentDir); - if (currentDir === parent_13) { + var parent_14 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_14) { break; } - currentDir = parent_13; + currentDir = parent_14; } else { break; @@ -68026,9 +68800,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 283 /* JSDocTypeTag */: - case 281 /* JSDocParameterTag */: - case 282 /* JSDocReturnTag */: + case 284 /* JSDocTypeTag */: + case 282 /* JSDocParameterTag */: + case 283 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -68073,13 +68847,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_14 = contextToken.parent, kind = contextToken.kind; + var parent_15 = contextToken.parent, kind = contextToken.kind; if (kind === 22 /* DotToken */) { - if (parent_14.kind === 177 /* PropertyAccessExpression */) { + if (parent_15.kind === 177 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_14.kind === 141 /* QualifiedName */) { + else if (parent_15.kind === 141 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -68094,7 +68868,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) { + else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 250 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -68199,7 +68973,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 248 /* JsxSelfClosingElement */) || (jsxContainer.kind === 249 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -68247,9 +69021,9 @@ var ts; var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; if (scopeNode) { isGlobalCompletion = - scopeNode.kind === 261 /* SourceFile */ || + scopeNode.kind === 262 /* SourceFile */ || scopeNode.kind === 194 /* TemplateExpression */ || - scopeNode.kind === 252 /* JsxExpression */ || + scopeNode.kind === 253 /* JsxExpression */ || ts.isStatement(scopeNode); } /// TODO filter meaning based on the current context @@ -68282,11 +69056,11 @@ var ts; return true; } if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 248 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 249 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */; + if (contextToken.parent.kind === 250 /* JsxClosingElement */ || contextToken.parent.kind === 248 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 247 /* JsxElement */; } } return false; @@ -68316,16 +69090,16 @@ var ts; case 128 /* NamespaceKeyword */: return true; case 22 /* DotToken */: - return containingNodeKind === 230 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 231 /* ModuleDeclaration */; // module A.| case 16 /* OpenBraceToken */: - return containingNodeKind === 226 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 227 /* ClassDeclaration */; // class A{ | case 57 /* EqualsToken */: - return containingNodeKind === 223 /* VariableDeclaration */ // const x = a| + return containingNodeKind === 224 /* VariableDeclaration */ // const x = a| || containingNodeKind === 192 /* BinaryExpression */; // x = a| case 13 /* TemplateHead */: return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| case 14 /* TemplateMiddle */: - return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 203 /* TemplateSpan */; // `aa ${10} dd ${| case 113 /* PublicKeyword */: case 111 /* PrivateKeyword */: case 112 /* ProtectedKeyword */: @@ -68439,9 +69213,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ? - 235 /* ImportDeclaration */ : - 241 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 239 /* NamedImports */ ? + 236 /* ImportDeclaration */ : + 242 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -68466,9 +69240,9 @@ var ts; switch (contextToken.kind) { case 16 /* OpenBraceToken */: // const x = { | case 25 /* CommaToken */: - var parent_15 = contextToken.parent; - if (parent_15 && (parent_15.kind === 176 /* ObjectLiteralExpression */ || parent_15.kind === 172 /* ObjectBindingPattern */)) { - return parent_15; + var parent_16 = contextToken.parent; + if (parent_16 && (parent_16.kind === 176 /* ObjectLiteralExpression */ || parent_16.kind === 172 /* ObjectBindingPattern */)) { + return parent_16; } break; } @@ -68485,8 +69259,8 @@ var ts; case 16 /* OpenBraceToken */: // import { | case 25 /* CommaToken */: switch (contextToken.parent.kind) { - case 238 /* NamedImports */: - case 242 /* NamedExports */: + case 239 /* NamedImports */: + case 243 /* NamedExports */: return contextToken.parent; } } @@ -68495,37 +69269,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_16 = contextToken.parent; + var parent_17 = contextToken.parent; switch (contextToken.kind) { case 27 /* LessThanSlashToken */: case 40 /* SlashToken */: case 70 /* Identifier */: - case 250 /* JsxAttribute */: - case 251 /* JsxSpreadAttribute */: - if (parent_16 && (parent_16.kind === 247 /* JsxSelfClosingElement */ || parent_16.kind === 248 /* JsxOpeningElement */)) { - return parent_16; + case 251 /* JsxAttribute */: + case 252 /* JsxSpreadAttribute */: + if (parent_17 && (parent_17.kind === 248 /* JsxSelfClosingElement */ || parent_17.kind === 249 /* JsxOpeningElement */)) { + return parent_17; } - else if (parent_16.kind === 250 /* JsxAttribute */) { - return parent_16.parent; + else if (parent_17.kind === 251 /* JsxAttribute */) { + return parent_17.parent; } break; // The context token is the closing } or " of an attribute, which means // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 9 /* StringLiteral */: - if (parent_16 && ((parent_16.kind === 250 /* JsxAttribute */) || (parent_16.kind === 251 /* JsxSpreadAttribute */))) { - return parent_16.parent; + if (parent_17 && ((parent_17.kind === 251 /* JsxAttribute */) || (parent_17.kind === 252 /* JsxSpreadAttribute */))) { + return parent_17.parent; } break; case 17 /* CloseBraceToken */: - if (parent_16 && - parent_16.kind === 252 /* JsxExpression */ && - parent_16.parent && - (parent_16.parent.kind === 250 /* JsxAttribute */)) { - return parent_16.parent.parent; + if (parent_17 && + parent_17.kind === 253 /* JsxExpression */ && + parent_17.parent && + (parent_17.parent.kind === 251 /* JsxAttribute */)) { + return parent_17.parent.parent; } - if (parent_16 && parent_16.kind === 251 /* JsxSpreadAttribute */) { - return parent_16.parent; + if (parent_17 && parent_17.kind === 252 /* JsxSpreadAttribute */) { + return parent_17.parent; } break; } @@ -68536,7 +69310,7 @@ var ts; switch (kind) { case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -68555,16 +69329,16 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 25 /* CommaToken */: - return containingNodeKind === 223 /* VariableDeclaration */ || - containingNodeKind === 224 /* VariableDeclarationList */ || - containingNodeKind === 205 /* VariableStatement */ || - containingNodeKind === 229 /* EnumDeclaration */ || + return containingNodeKind === 224 /* VariableDeclaration */ || + containingNodeKind === 225 /* VariableDeclarationList */ || + containingNodeKind === 206 /* VariableStatement */ || + containingNodeKind === 230 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 226 /* ClassDeclaration */ || + containingNodeKind === 227 /* ClassDeclaration */ || containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || containingNodeKind === 173 /* ArrayBindingPattern */ || - containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 229 /* TypeAliasDeclaration */; // type Map, K, | case 22 /* DotToken */: return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| case 55 /* ColonToken */: @@ -68572,22 +69346,22 @@ var ts; case 20 /* OpenBracketToken */: return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| case 18 /* OpenParenToken */: - return containingNodeKind === 256 /* CatchClause */ || + return containingNodeKind === 257 /* CatchClause */ || isFunction(containingNodeKind); case 16 /* OpenBraceToken */: - return containingNodeKind === 229 /* EnumDeclaration */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || + return containingNodeKind === 230 /* EnumDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || containingNodeKind === 161 /* TypeLiteral */; // const x : { | case 24 /* SemicolonToken */: return containingNodeKind === 146 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ || + (contextToken.parent.parent.kind === 228 /* InterfaceDeclaration */ || contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | case 26 /* LessThanToken */: - return containingNodeKind === 226 /* ClassDeclaration */ || + return containingNodeKind === 227 /* ClassDeclaration */ || containingNodeKind === 197 /* ClassExpression */ || - containingNodeKind === 227 /* InterfaceDeclaration */ || - containingNodeKind === 228 /* TypeAliasDeclaration */ || + containingNodeKind === 228 /* InterfaceDeclaration */ || + containingNodeKind === 229 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 114 /* StaticKeyword */: return containingNodeKind === 147 /* PropertyDeclaration */; @@ -68600,9 +69374,9 @@ var ts; case 112 /* ProtectedKeyword */: return containingNodeKind === 144 /* Parameter */; case 117 /* AsKeyword */: - return containingNodeKind === 239 /* ImportSpecifier */ || - containingNodeKind === 243 /* ExportSpecifier */ || - containingNodeKind === 237 /* NamespaceImport */; + return containingNodeKind === 240 /* ImportSpecifier */ || + containingNodeKind === 244 /* ExportSpecifier */ || + containingNodeKind === 238 /* NamespaceImport */; case 74 /* ClassKeyword */: case 82 /* EnumKeyword */: case 108 /* InterfaceKeyword */: @@ -68662,8 +69436,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_45 = element.propertyName || element.name; - existingImportsOrExports[name_45.text] = true; + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -68684,8 +69458,8 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 257 /* PropertyAssignment */ && - m.kind !== 258 /* ShorthandPropertyAssignment */ && + if (m.kind !== 258 /* PropertyAssignment */ && + m.kind !== 259 /* ShorthandPropertyAssignment */ && m.kind !== 174 /* BindingElement */ && m.kind !== 149 /* MethodDeclaration */ && m.kind !== 151 /* GetAccessor */ && @@ -68727,7 +69501,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 250 /* JsxAttribute */) { + if (attr.kind === 251 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -68908,58 +69682,58 @@ var ts; switch (node.kind) { case 89 /* IfKeyword */: case 81 /* ElseKeyword */: - if (hasKind(node.parent, 208 /* IfStatement */)) { + if (hasKind(node.parent, 209 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 95 /* ReturnKeyword */: - if (hasKind(node.parent, 216 /* ReturnStatement */)) { + if (hasKind(node.parent, 217 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 99 /* ThrowKeyword */: - if (hasKind(node.parent, 220 /* ThrowStatement */)) { + if (hasKind(node.parent, 221 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 73 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 221 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 222 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 101 /* TryKeyword */: case 86 /* FinallyKeyword */: - if (hasKind(parent(node), 221 /* TryStatement */)) { + if (hasKind(parent(node), 222 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 97 /* SwitchKeyword */: - if (hasKind(node.parent, 218 /* SwitchStatement */)) { + if (hasKind(node.parent, 219 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 72 /* CaseKeyword */: case 78 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 218 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 219 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 71 /* BreakKeyword */: case 76 /* ContinueKeyword */: - if (hasKind(node.parent, 215 /* BreakStatement */) || hasKind(node.parent, 214 /* ContinueStatement */)) { + if (hasKind(node.parent, 216 /* BreakStatement */) || hasKind(node.parent, 215 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 87 /* ForKeyword */: - if (hasKind(node.parent, 211 /* ForStatement */) || - hasKind(node.parent, 212 /* ForInStatement */) || - hasKind(node.parent, 213 /* ForOfStatement */)) { + if (hasKind(node.parent, 212 /* ForStatement */) || + hasKind(node.parent, 213 /* ForInStatement */) || + hasKind(node.parent, 214 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 105 /* WhileKeyword */: case 80 /* DoKeyword */: - if (hasKind(node.parent, 210 /* WhileStatement */) || hasKind(node.parent, 209 /* DoStatement */)) { + if (hasKind(node.parent, 211 /* WhileStatement */) || hasKind(node.parent, 210 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -68976,7 +69750,7 @@ var ts; break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 205 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 206 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -68992,10 +69766,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 220 /* ThrowStatement */) { + if (node.kind === 221 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 221 /* TryStatement */) { + else if (node.kind === 222 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -69022,19 +69796,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_17 = child.parent; - if (ts.isFunctionBlock(parent_17) || parent_17.kind === 261 /* SourceFile */) { - return parent_17; + var parent_18 = child.parent; + if (ts.isFunctionBlock(parent_18) || parent_18.kind === 262 /* SourceFile */) { + return parent_18; } // 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_17.kind === 221 /* TryStatement */) { - var tryStatement = parent_17; + if (parent_18.kind === 222 /* TryStatement */) { + var tryStatement = parent_18; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_17; + child = parent_18; } return undefined; } @@ -69043,7 +69817,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 215 /* BreakStatement */ || node.kind === 214 /* ContinueStatement */) { + if (node.kind === 216 /* BreakStatement */ || node.kind === 215 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -69056,25 +69830,25 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 218 /* SwitchStatement */: - if (statement.kind === 214 /* ContinueStatement */) { + for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { + switch (node_2.kind) { + case 219 /* SwitchStatement */: + if (statement.kind === 215 /* ContinueStatement */) { continue; } // Fall through. - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: + if (!statement.label || isLabeledBy(node_2, statement.label.text)) { + return node_2; } break; default: // Don't cross function boundaries. - if (ts.isFunctionLike(node_1)) { + if (ts.isFunctionLike(node_2)) { return undefined; } break; @@ -69086,24 +69860,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 226 /* ClassDeclaration */ || + if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */ || (declaration.kind === 144 /* Parameter */ && hasKind(container, 150 /* Constructor */)))) { return undefined; } } else if (modifier === 114 /* StaticKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { + if (!(container.kind === 227 /* ClassDeclaration */ || container.kind === 197 /* ClassExpression */)) { return undefined; } } else if (modifier === 83 /* ExportKeyword */ || modifier === 123 /* DeclareKeyword */) { - if (!(container.kind === 231 /* ModuleBlock */ || container.kind === 261 /* SourceFile */)) { + if (!(container.kind === 232 /* ModuleBlock */ || container.kind === 262 /* SourceFile */)) { return undefined; } } else if (modifier === 116 /* AbstractKeyword */) { - if (!(container.kind === 226 /* ClassDeclaration */ || declaration.kind === 226 /* ClassDeclaration */)) { + if (!(container.kind === 227 /* ClassDeclaration */ || declaration.kind === 227 /* ClassDeclaration */)) { return undefined; } } @@ -69115,8 +69889,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: + case 232 /* ModuleBlock */: + case 262 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -69128,7 +69902,7 @@ var ts; case 150 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search @@ -69212,7 +69986,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 87 /* ForKeyword */, 105 /* WhileKeyword */, 80 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 209 /* DoStatement */) { + if (loopNode.kind === 210 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { @@ -69233,13 +70007,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 209 /* DoStatement */: - case 210 /* WhileStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -69293,7 +70067,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 204 /* Block */))) { + if (!(func && hasKind(func.body, 205 /* Block */))) { return undefined; } var keywords = []; @@ -69309,7 +70083,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 209 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -69322,7 +70096,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 209 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -69365,7 +70139,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 220 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -69599,12 +70373,12 @@ var ts; function getAliasSymbolForPropertyNameSymbol(symbol, location) { if (symbol.flags & 8388608 /* Alias */) { // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */); + var defaultImport = ts.getDeclarationOfKind(symbol, 237 /* ImportClause */); if (defaultImport) { return typeChecker.getAliasedSymbol(symbol); } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ || - declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; }); + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 240 /* ImportSpecifier */ || + declaration.kind === 244 /* ExportSpecifier */) ? declaration : undefined; }); if (importOrExportSpecifier && // export { a } (!importOrExportSpecifier.propertyName || @@ -69612,7 +70386,7 @@ var ts; importOrExportSpecifier.propertyName === location)) { // If Import specifier -> get alias // else Export specifier -> get local target - return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ? + return importOrExportSpecifier.kind === 240 /* ImportSpecifier */ ? typeChecker.getAliasedSymbol(symbol) : typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); } @@ -69671,7 +70445,7 @@ var ts; if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 227 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -69702,7 +70476,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -69978,7 +70752,7 @@ var ts; result.push(getReferenceEntryFromNode(refNode.parent)); } else if (refNode.kind === 70 /* Identifier */) { - if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 259 /* ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); } @@ -69991,24 +70765,24 @@ var ts; // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface var containingTypeReference = getContainingTypeReference(refNode); if (containingTypeReference) { - var parent_18 = containingTypeReference.parent; - if (ts.isVariableLike(parent_18) && parent_18.type === containingTypeReference && parent_18.initializer && isImplementationExpression(parent_18.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent_18.initializer)); + var parent_19 = containingTypeReference.parent; + if (ts.isVariableLike(parent_19) && parent_19.type === containingTypeReference && parent_19.initializer && isImplementationExpression(parent_19.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent_19.initializer)); } - else if (ts.isFunctionLike(parent_18) && parent_18.type === containingTypeReference && parent_18.body) { - if (parent_18.body.kind === 204 /* Block */) { - ts.forEachReturnStatement(parent_18.body, function (returnStatement) { + else if (ts.isFunctionLike(parent_19) && parent_19.type === containingTypeReference && parent_19.body) { + if (parent_19.body.kind === 205 /* Block */) { + ts.forEachReturnStatement(parent_19.body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); } }); } - else if (isImplementationExpression(parent_18.body)) { - maybeAdd(getReferenceEntryFromNode(parent_18.body)); + else if (isImplementationExpression(parent_19.body)) { + maybeAdd(getReferenceEntryFromNode(parent_19.body)); } } - else if (ts.isAssertionExpression(parent_18) && isImplementationExpression(parent_18.expression)) { - maybeAdd(getReferenceEntryFromNode(parent_18.expression)); + else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_19.expression)); } } } @@ -70049,7 +70823,7 @@ var ts; function getContainingClassIfInHeritageClause(node) { if (node && node.parent) { if (node.kind === 199 /* ExpressionWithTypeArguments */ - && node.parent.kind === 255 /* HeritageClause */ + && node.parent.kind === 256 /* HeritageClause */ && ts.isClassLike(node.parent.parent)) { return node.parent.parent; } @@ -70120,7 +70894,7 @@ var ts; } return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 228 /* InterfaceDeclaration */) { if (parentIsInterface) { return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); } @@ -70200,12 +70974,12 @@ var ts; staticFlag &= ts.getModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 261 /* SourceFile */: + case 262 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, @@ -70215,7 +70989,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 261 /* SourceFile */) { + if (searchSpaceNode.kind === 262 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -70250,7 +71024,7 @@ var ts; var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } @@ -70262,15 +71036,15 @@ var ts; } break; case 197 /* ClassExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 261 /* SourceFile */: - if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + case 262 /* SourceFile */: + if (container.kind === 262 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -70306,13 +71080,13 @@ var ts; for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { var position = possiblePositions_1[_i]; cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + var node_3 = ts.getTouchingWord(sourceFile, position); + if (!node_3 || node_3.kind !== 9 /* StringLiteral */) { return; } - var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + var type_1 = ts.getStringLiteralTypeForNode(node_3, typeChecker); if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); + references.push(getReferenceEntryFromNode(node_3)); } } } @@ -70324,7 +71098,7 @@ var ts; // Search the property symbol // for ( { property: p2 } of elems) { } var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) { + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 259 /* ShorthandPropertyAssignment */) { var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); if (propertySymbol) { result.push(propertySymbol); @@ -70427,7 +71201,7 @@ var ts; getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 227 /* InterfaceDeclaration */) { + else if (declaration.kind === 228 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -70593,7 +71367,7 @@ var ts; if (node.initializer) { return true; } - else if (node.kind === 223 /* VariableDeclaration */) { + else if (node.kind === 224 /* VariableDeclaration */) { var parentStatement = getParentStatementOfVariableDeclaration(node); return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); } @@ -70603,18 +71377,18 @@ var ts; } else { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: return true; } } return false; } function getParentStatementOfVariableDeclaration(node) { - if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) { - ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */); + if (node.parent && node.parent.parent && node.parent.parent.kind === 206 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 225 /* VariableDeclarationList */); return node.parent.parent; } } @@ -70689,8 +71463,8 @@ var ts; } function isObjectLiteralPropertyDeclaration(node) { switch (node.kind) { - case 257 /* PropertyAssignment */: - case 258 /* ShorthandPropertyAssignment */: + case 258 /* PropertyAssignment */: + case 259 /* ShorthandPropertyAssignment */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: @@ -70768,7 +71542,7 @@ var ts; // if (node.kind === 70 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) { + (declaration.kind === 240 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 239 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -70777,7 +71551,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // 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 === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -70861,7 +71635,7 @@ var ts; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 150 /* Constructor */) || - (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + (!selectConstructors && (d.kind === 226 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -70941,7 +71715,7 @@ var ts; function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 259 /* ShorthandPropertyAssignment */) { var result = []; ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); return result.length > 0 ? result : undefined; @@ -71048,7 +71822,7 @@ var ts; */ function forEachUnique(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (ts.indexOf(array, array[i]) === i) { var result = callback(array[i], i); if (result) { @@ -71108,19 +71882,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 150 /* Constructor */: - case 226 /* ClassDeclaration */: - case 205 /* VariableStatement */: + case 227 /* ClassDeclaration */: + case 206 /* VariableStatement */: break findOwner; - case 261 /* SourceFile */: + case 262 /* SourceFile */: return undefined; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 231 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -71135,7 +71909,7 @@ var ts; var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { + for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 70 /* Identifier */ ? currentName.text : @@ -71167,7 +71941,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 205 /* VariableStatement */) { + if (commentOwner.kind === 206 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -71287,9 +72061,9 @@ var ts; } } // Add the cached typing locations for inferred typings that are already installed - for (var name_46 in packageNameToTypingLocation) { - if (name_46 in inferredTypings && !inferredTypings[name_46]) { - inferredTypings[name_46] = packageNameToTypingLocation[name_46]; + for (var name_47 in packageNameToTypingLocation) { + if (name_47 in inferredTypings && !inferredTypings[name_47]) { + inferredTypings[name_47] = packageNameToTypingLocation[name_47]; } } // Remove typings that the user has added to the exclude list @@ -71427,12 +72201,12 @@ var ts; return; } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_47 in nameToDeclarations) { - var declarations = nameToDeclarations[name_47]; + for (var name_48 in nameToDeclarations) { + var declarations = nameToDeclarations[name_48]; if (declarations) { // 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_47); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); if (!matches) { continue; } @@ -71445,14 +72219,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_47); + matches = patternMatcher.getMatches(containers, name_48); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_47, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -71460,7 +72234,7 @@ var ts; // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) { + if (decl.kind === 237 /* ImportClause */ || decl.kind === 240 /* ImportSpecifier */ || decl.kind === 235 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -71715,7 +72489,7 @@ var ts; addLeafNode(node); } break; - case 236 /* ImportClause */: + case 237 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -71727,7 +72501,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings.kind === 238 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -71739,11 +72513,11 @@ var ts; } break; case 174 /* BindingElement */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: var decl = node; - var name_48 = decl.name; - if (ts.isBindingPattern(name_48)) { - addChildrenRecursively(name_48); + var name_49 = decl.name; + if (ts.isBindingPattern(name_49)) { + addChildrenRecursively(name_49); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -71754,11 +72528,11 @@ var ts; } break; case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -71768,9 +72542,9 @@ var ts; } endNode(); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -71778,21 +72552,21 @@ var ts; } endNode(); break; - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 243 /* ExportSpecifier */: - case 234 /* ImportEqualsDeclaration */: + case 244 /* ExportSpecifier */: + case 235 /* ImportEqualsDeclaration */: case 155 /* IndexSignature */: case 153 /* CallSignature */: case 154 /* ConstructSignature */: - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: addLeafNode(node); break; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 285 /* JSDocTypedefTag */) { + if (tag.kind === 286 /* JSDocTypedefTag */) { addLeafNode(tag); } }); @@ -71843,14 +72617,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 231 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 230 /* ModuleDeclaration */) { + if (a.body.kind !== 231 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -71910,7 +72684,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 231 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -71922,14 +72696,14 @@ var ts; case 185 /* ArrowFunction */: case 197 /* ClassExpression */: return getFunctionOrClassName(node); - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 230 /* ModuleDeclaration */) { + if (node.kind === 231 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -71940,15 +72714,15 @@ var ts; } } switch (node.kind) { - case 261 /* SourceFile */: + case 262 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; @@ -71965,7 +72739,7 @@ var ts; return "()"; case 155 /* IndexSignature */: return "[]"; - case 285 /* JSDocTypedefTag */: + case 286 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -71977,7 +72751,7 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 205 /* VariableStatement */) { + if (parentNode && parentNode.kind === 206 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; if (nameIdentifier.kind === 70 /* Identifier */) { @@ -72006,23 +72780,23 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 229 /* EnumDeclaration */: - case 227 /* InterfaceDeclaration */: - case 230 /* ModuleDeclaration */: - case 261 /* SourceFile */: - case 228 /* TypeAliasDeclaration */: - case 285 /* JSDocTypedefTag */: + case 230 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 231 /* ModuleDeclaration */: + case 262 /* SourceFile */: + case 229 /* TypeAliasDeclaration */: + case 286 /* JSDocTypedefTag */: return true; case 150 /* Constructor */: case 149 /* MethodDeclaration */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: return hasSomeImportantChild(item); case 185 /* ArrowFunction */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: @@ -72033,8 +72807,8 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 231 /* ModuleBlock */: - case 261 /* SourceFile */: + case 232 /* ModuleBlock */: + case 262 /* SourceFile */: case 149 /* MethodDeclaration */: case 150 /* Constructor */: return true; @@ -72045,7 +72819,7 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; + return childKind !== 224 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; }); } } @@ -72103,7 +72877,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 231 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -72114,13 +72888,13 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 231 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { return !member.name || member.name.kind === 142 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 261 /* SourceFile */ + return node.kind === 262 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); } @@ -72128,14 +72902,14 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 223 /* VariableDeclaration */) { + else if (node.parent.kind === 224 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } else if (node.parent.kind === 192 /* BinaryExpression */ && node.parent.operatorToken.kind === 57 /* EqualsToken */) { return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } else if (ts.getModifierFlags(node) & 512 /* Default */) { @@ -72248,30 +73022,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 204 /* Block */: + case 205 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_19 = n.parent; + var parent_20 = n.parent; var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_19.kind === 209 /* DoStatement */ || - parent_19.kind === 212 /* ForInStatement */ || - parent_19.kind === 213 /* ForOfStatement */ || - parent_19.kind === 211 /* ForStatement */ || - parent_19.kind === 208 /* IfStatement */ || - parent_19.kind === 210 /* WhileStatement */ || - parent_19.kind === 217 /* WithStatement */ || - parent_19.kind === 256 /* CatchClause */) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + if (parent_20.kind === 210 /* DoStatement */ || + parent_20.kind === 213 /* ForInStatement */ || + parent_20.kind === 214 /* ForOfStatement */ || + parent_20.kind === 212 /* ForStatement */ || + parent_20.kind === 209 /* IfStatement */ || + parent_20.kind === 211 /* WhileStatement */ || + parent_20.kind === 218 /* WithStatement */ || + parent_20.kind === 257 /* CatchClause */) { + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_19.kind === 221 /* TryStatement */) { + if (parent_20.kind === 222 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_19; + var tryStatement = parent_20; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_19, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -72294,17 +73068,17 @@ var ts; break; } // Fallthrough. - case 231 /* ModuleBlock */: { + case 232 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 176 /* ObjectLiteralExpression */: - case 232 /* CaseBlock */: { + case 233 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -72690,7 +73464,8 @@ var ts; } // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string, value) { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + var n = string.length - value.length; + for (var i = 0; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -72699,7 +73474,7 @@ var ts; } // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string, value, start) { - for (var i = 0, n = value.length; i < n; i++) { + for (var i = 0; i < value.length; i++) { var ch1 = toLowerCase(string.charCodeAt(i + start)); var ch2 = value.charCodeAt(i); if (ch1 !== ch2) { @@ -72771,7 +73546,7 @@ var ts; function breakIntoSpans(identifier, word) { var result = []; var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { + for (var i = 1; i < identifier.length; i++) { var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); @@ -73597,7 +74372,7 @@ var ts; var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 203 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; @@ -73728,7 +74503,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 262 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -74124,7 +74899,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 231 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -74161,7 +74936,7 @@ var ts; } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 228 /* TypeAliasDeclaration */) { + else if (declaration.kind === 229 /* TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path @@ -74177,7 +74952,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 260 /* EnumMember */) { + if (declaration.kind === 261 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -74189,7 +74964,7 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) { + if (symbol.declarations[0].kind === 234 /* NamespaceExportDeclaration */) { displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); @@ -74200,7 +74975,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 234 /* ImportEqualsDeclaration */) { + if (declaration.kind === 235 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -74273,7 +75048,7 @@ var ts; // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) { + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 262 /* SourceFile */; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { @@ -74360,13 +75135,13 @@ var ts; if (declaration.kind === 184 /* FunctionExpression */) { return true; } - if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) { + if (declaration.kind !== 224 /* VariableDeclaration */ && declaration.kind !== 226 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_20 = declaration.parent; !ts.isFunctionBlock(parent_20); parent_20 = parent_20.parent) { + for (var parent_21 = declaration.parent; !ts.isFunctionBlock(parent_21); parent_21 = parent_21.parent) { // Reached source file or module block - if (parent_20.kind === 261 /* SourceFile */ || parent_20.kind === 231 /* ModuleBlock */) { + if (parent_21.kind === 262 /* SourceFile */ || parent_21.kind === 232 /* ModuleBlock */) { return false; } } @@ -74604,10 +75379,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 250 /* JsxAttribute */: - case 248 /* JsxOpeningElement */: - case 249 /* JsxClosingElement */: - case 247 /* JsxSelfClosingElement */: + case 251 /* JsxAttribute */: + case 249 /* JsxOpeningElement */: + case 250 /* JsxClosingElement */: + case 248 /* JsxSelfClosingElement */: return node.kind === 70 /* Identifier */; } } @@ -75019,11 +75794,11 @@ var ts; this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromRange(0 /* FirstToken */, 140 /* LastToken */, [19 /* CloseParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -75040,10 +75815,10 @@ var ts; this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 2 /* Space */)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsBraceWrappedContext), 8 /* Delete */)); this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); @@ -75073,6 +75848,7 @@ var ts; this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2 /* Space */)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); @@ -75089,11 +75865,12 @@ var ts; this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -75130,6 +75907,8 @@ var ts; this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + // No space before non-null assertion operator + this.NoSpaceBeforeNonNullAssertionOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50 /* ExclamationToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonNullAssertionContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -75160,7 +75939,7 @@ var ts; this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -75175,6 +75954,7 @@ var ts; this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, + this.NoSpaceBeforeNonNullAssertionOperator ]; // These rules are lower in priority than user-configurable rules. this.LowPriorityCommonRules = [ @@ -75184,7 +75964,6 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; /// @@ -75242,9 +76021,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_49 in o) { - if (o[name_49] === rule) { - return name_49; + for (var name_50 in o) { + if (o[name_50] === rule) { + return name_50; } } throw new Error("Unknown rule"); @@ -75253,7 +76032,7 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 211 /* ForStatement */; + return context.contextNode.kind === 212 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); @@ -75263,8 +76042,8 @@ var ts; case 192 /* BinaryExpression */: case 193 /* ConditionalExpression */: case 200 /* AsExpression */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: case 156 /* TypePredicate */: case 164 /* UnionType */: case 165 /* IntersectionType */: @@ -75272,22 +76051,24 @@ var ts; // equals in binding elements: function foo([[x, y] = [1, 2]]) case 174 /* BindingElement */: // equals in type X = ... - case 228 /* TypeAliasDeclaration */: + case 229 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: // equal in p = 0; case 144 /* Parameter */: - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: + // "in" keyword in [P in keyof T]: T[P] + case 143 /* TypeParameter */: return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; } return false; @@ -75317,6 +76098,9 @@ var ts; //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; + Rules.IsBraceWrappedContext = function (context) { + return context.contextNode.kind === 172 /* ObjectBindingPattern */ || Rules.IsSingleLineBlockContext(context); + }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration Rules.IsBeforeMultilineBlockContext = function (context) { return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -75340,17 +76124,17 @@ var ts; return true; } switch (node.kind) { - case 204 /* Block */: - case 232 /* CaseBlock */: + case 205 /* Block */: + case 233 /* CaseBlock */: case 176 /* ObjectLiteralExpression */: - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: @@ -75364,60 +76148,66 @@ var ts; // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 227 /* InterfaceDeclaration */: + case 228 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; + return context.contextNode.kind === 226 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: case 161 /* TypeLiteral */: - case 230 /* ModuleDeclaration */: - case 241 /* ExportDeclaration */: - case 242 /* NamedExports */: - case 235 /* ImportDeclaration */: - case 238 /* NamedImports */: + case 231 /* ModuleDeclaration */: + case 242 /* ExportDeclaration */: + case 243 /* NamedExports */: + case 236 /* ImportDeclaration */: + case 239 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 226 /* ClassDeclaration */: - case 230 /* ModuleDeclaration */: - case 229 /* EnumDeclaration */: - case 204 /* Block */: - case 256 /* CatchClause */: - case 231 /* ModuleBlock */: - case 218 /* SwitchStatement */: + case 227 /* ClassDeclaration */: + case 231 /* ModuleDeclaration */: + case 230 /* EnumDeclaration */: + case 257 /* CatchClause */: + case 232 /* ModuleBlock */: + case 219 /* SwitchStatement */: return true; + case 205 /* Block */: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 185 /* ArrowFunction */ && + blockParent.kind !== 184 /* FunctionExpression */) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 208 /* IfStatement */: - case 218 /* SwitchStatement */: - case 211 /* ForStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 210 /* WhileStatement */: - case 221 /* TryStatement */: - case 209 /* DoStatement */: - case 217 /* WithStatement */: + case 209 /* IfStatement */: + case 219 /* SwitchStatement */: + case 212 /* ForStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 222 /* TryStatement */: + case 210 /* DoStatement */: + case 218 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 256 /* CatchClause */: + case 257 /* CatchClause */: return true; default: return false; @@ -75448,19 +76238,19 @@ var ts; return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 246 /* JsxElement */; + return context.contextNode.kind !== 247 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 252 /* JsxExpression */; + return context.contextNode.kind === 253 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 250 /* JsxAttribute */; + return context.nextTokenParent.kind === 251 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 250 /* JsxAttribute */; + return context.contextNode.kind === 251 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 247 /* JsxSelfClosingElement */; + return context.contextNode.kind === 248 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -75478,14 +76268,14 @@ var ts; return node.kind === 145 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 225 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 230 /* ModuleDeclaration */; + return context.contextNode.kind === 231 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; @@ -75497,10 +76287,11 @@ var ts; switch (parent.kind) { case 157 /* TypeReference */: case 182 /* TypeAssertionExpression */: - case 226 /* ClassDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 225 /* FunctionDeclaration */: + case 228 /* InterfaceDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: @@ -75528,6 +76319,9 @@ var ts; Rules.IsYieldOrYieldStarWithOperand = function (context) { return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; }; + Rules.IsNonNullAssertionContext = function (context) { + return context.contextNode.kind === 201 /* NonNullExpression */; + }; return Rules; }()); formatting.Rules = Rules; @@ -75846,6 +76640,12 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } @@ -75926,6 +76726,12 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } @@ -76058,17 +76864,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 226 /* ClassDeclaration */: - case 227 /* InterfaceDeclaration */: + case 227 /* ClassDeclaration */: + case 228 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 261 /* SourceFile */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + return body && body.kind === 232 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 262 /* SourceFile */: + case 205 /* Block */: + case 232 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -76273,10 +77079,10 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */; - case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; - case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; - case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */; + case 227 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 228 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 226 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 230 /* EnumDeclaration */: return 230 /* EnumDeclaration */; case 151 /* GetAccessor */: return 124 /* GetKeyword */; case 152 /* SetAccessor */: return 133 /* SetKeyword */; case 149 /* MethodDeclaration */: @@ -76316,18 +77122,31 @@ var ts; // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent case 16 /* OpenBraceToken */: case 17 /* CloseBraceToken */: - case 20 /* OpenBracketToken */: - case 21 /* CloseBracketToken */: case 18 /* OpenParenToken */: case 19 /* CloseParenToken */: case 81 /* ElseKeyword */: case 105 /* WhileKeyword */: case 56 /* AtToken */: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40 /* SlashToken */: + case 28 /* GreaterThanToken */: { + if (container.kind === 249 /* JsxOpeningElement */ || + container.kind === 250 /* JsxClosingElement */ || + container.kind === 248 /* JsxSelfClosingElement */) { + return indentation; + } + break; + } + case 20 /* OpenBracketToken */: + case 21 /* CloseBracketToken */: { + if (container.kind !== 170 /* MappedType */) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, @@ -76383,7 +77202,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -76417,7 +77236,7 @@ var ts; // stop when formatting scanner advances past the beginning of the child break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; @@ -76457,11 +77276,11 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -76479,7 +77298,7 @@ var ts; // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -76686,7 +77505,7 @@ var ts; } // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; i++, startLine++) { + for (var i = startIndex; i < parts.length; i++, startLine++) { var startLinePos_1 = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -76792,7 +77611,7 @@ var ts; function getOpenTokenForList(node, list) { switch (node.kind) { case 150 /* Constructor */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -77052,7 +77871,7 @@ var ts; // - 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 = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 262 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -77085,7 +77904,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 209 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -77107,7 +77926,7 @@ var ts; return node.parent.properties; case 175 /* ArrayLiteralExpression */: return node.parent.elements; - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: @@ -77241,35 +78060,36 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 207 /* ExpressionStatement */: - case 226 /* ClassDeclaration */: + case 208 /* ExpressionStatement */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 229 /* EnumDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 230 /* EnumDeclaration */: + case 229 /* TypeAliasDeclaration */: case 175 /* ArrayLiteralExpression */: - case 204 /* Block */: - case 231 /* ModuleBlock */: + case 205 /* Block */: + case 232 /* ModuleBlock */: case 176 /* ObjectLiteralExpression */: case 161 /* TypeLiteral */: + case 170 /* MappedType */: case 163 /* TupleType */: - case 232 /* CaseBlock */: - case 254 /* DefaultClause */: - case 253 /* CaseClause */: + case 233 /* CaseBlock */: + case 255 /* DefaultClause */: + case 254 /* CaseClause */: case 183 /* ParenthesizedExpression */: case 177 /* PropertyAccessExpression */: case 179 /* CallExpression */: case 180 /* NewExpression */: - case 205 /* VariableStatement */: - case 223 /* VariableDeclaration */: - case 240 /* ExportAssignment */: - case 216 /* ReturnStatement */: + case 206 /* VariableStatement */: + case 224 /* VariableDeclaration */: + case 241 /* ExportAssignment */: + case 217 /* ReturnStatement */: case 193 /* ConditionalExpression */: case 173 /* ArrayBindingPattern */: case 172 /* ObjectBindingPattern */: - case 248 /* JsxOpeningElement */: - case 247 /* JsxSelfClosingElement */: - case 252 /* JsxExpression */: + case 249 /* JsxOpeningElement */: + case 248 /* JsxSelfClosingElement */: + case 253 /* JsxExpression */: case 148 /* MethodSignature */: case 153 /* CallSignature */: case 154 /* ConstructSignature */: @@ -77279,10 +78099,10 @@ var ts; case 166 /* ParenthesizedType */: case 181 /* TaggedTemplateExpression */: case 189 /* AwaitExpression */: - case 242 /* NamedExports */: - case 238 /* NamedImports */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: + case 243 /* NamedExports */: + case 239 /* NamedImports */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: return true; } return false; @@ -77291,27 +78111,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 209 /* DoStatement */: - case 210 /* WhileStatement */: - case 212 /* ForInStatement */: - case 213 /* ForOfStatement */: - case 211 /* ForStatement */: - case 208 /* IfStatement */: - case 225 /* FunctionDeclaration */: + case 210 /* DoStatement */: + case 211 /* WhileStatement */: + case 213 /* ForInStatement */: + case 214 /* ForOfStatement */: + case 212 /* ForStatement */: + case 209 /* IfStatement */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 185 /* ArrowFunction */: case 150 /* Constructor */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: - return childKind !== 204 /* Block */; - case 241 /* ExportDeclaration */: - return childKind !== 242 /* NamedExports */; - case 235 /* ImportDeclaration */: - return childKind !== 236 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */); - case 246 /* JsxElement */: - return childKind !== 249 /* JsxClosingElement */; + return childKind !== 205 /* Block */; + case 242 /* ExportDeclaration */: + return childKind !== 243 /* NamedExports */; + case 236 /* ImportDeclaration */: + return childKind !== 237 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 239 /* NamedImports */); + case 247 /* JsxElement */: + return childKind !== 250 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -77367,25 +78187,128 @@ var ts; (function (ts) { var codefix; (function (codefix) { - function getOpenBraceEnd(constructor, sourceFile) { - // First token is the open curly, this is where we want to put the 'super' call. - return constructor.body.getFirstToken(sourceFile).getEnd(); - } codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var token = ts.getTokenAtPosition(sourceFile, context.span.start); - if (token.kind !== 122 /* ConstructorKeyword */) { - return undefined; - } - var newPosition = getOpenBraceEnd(token.parent, sourceFile); - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), - changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] - }]; - } + errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], + getCodeActions: getActionForClassLikeIncorrectImplementsInterface }); + function getActionForClassLikeIncorrectImplementsInterface(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + var classDecl = ts.getContainingClass(token); + if (!classDecl) { + return undefined; + } + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(classDecl); + var hasNumericIndexSignature = !!checker.getIndexTypeOfType(classType, 1 /* Number */); + var hasStringIndexSignature = !!checker.getIndexTypeOfType(classType, 0 /* String */); + var result = []; + for (var _i = 0, implementedTypeNodes_2 = implementedTypeNodes; _i < implementedTypeNodes_2.length; _i++) { + var implementedTypeNode = implementedTypeNodes_2[_i]; + var implementedType = checker.getTypeFromTypeNode(implementedTypeNode); + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var implementedTypeSymbols = checker.getPropertiesOfType(implementedType); + var nonPrivateMembers = implementedTypeSymbols.filter(function (symbol) { return !(ts.getModifierFlags(symbol.valueDeclaration) & 8 /* Private */); }); + var insertion = getMissingIndexSignatureInsertion(implementedType, 1 /* Number */, classDecl, hasNumericIndexSignature); + insertion += getMissingIndexSignatureInsertion(implementedType, 0 /* String */, classDecl, hasStringIndexSignature); + insertion += codefix.getMissingMembersInsertion(classDecl, nonPrivateMembers, checker, context.newLineCharacter); + var message = ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_interface_0), [implementedTypeNode.getText()]); + if (insertion) { + pushAction(result, insertion, message); + } + } + return result; + function getMissingIndexSignatureInsertion(type, kind, enclosingDeclaration, hasIndexSigOfKind) { + if (!hasIndexSigOfKind) { + var IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); + if (IndexInfoOfKind) { + var writer = ts.getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + var result_7 = writer.string(); + ts.releaseStringWriter(writer); + return result_7; + } + } + return ""; + } + function pushAction(result, insertion, description) { + var newAction = { + description: description, + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }; + result.push(newAction); + } + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code], + getCodeActions: getActionForClassLikeMissingAbstractMember + }); + function getActionForClassLikeMissingAbstractMember(context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + // This is the identifier in the case of a class declaration + // or the class keyword token in the case of a class expression. + var token = ts.getTokenAtPosition(sourceFile, start); + var checker = context.program.getTypeChecker(); + if (ts.isClassLike(token.parent)) { + var classDecl = token.parent; + var startPos = classDecl.members.pos; + var classType = checker.getTypeAtLocation(classDecl); + var instantiatedExtendsType = checker.getBaseTypes(classType)[0]; + // Note that this is ultimately derived from a map indexed by symbol names, + // so duplicates cannot occur. + var extendsSymbols = checker.getPropertiesOfType(instantiatedExtendsType); + var abstractAndNonPrivateExtendsSymbols = extendsSymbols.filter(symbolPointsToNonPrivateAndAbstractMember); + var insertion = codefix.getMissingMembersInsertion(classDecl, abstractAndNonPrivateExtendsSymbols, checker, context.newLineCharacter); + if (insertion.length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Implement_inherited_abstract_class), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ + span: { start: startPos, length: 0 }, + newText: insertion + }] + }] + }]; + } + } + return undefined; + } + function symbolPointsToNonPrivateAndAbstractMember(symbol) { + var decls = symbol.getDeclarations(); + ts.Debug.assert(!!(decls && decls.length > 0)); + var flags = ts.getModifierFlags(decls[0]); + return !(flags & 8 /* Private */) && !!(flags & 128 /* Abstract */); + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], getCodeActions: function (context) { @@ -77409,7 +78332,7 @@ var ts; } } } - var newPosition = getOpenBraceEnd(constructor, sourceFile); + var newPosition = ts.getOpenBraceEnd(constructor, sourceFile); var changes = [{ fileName: sourceFile.fileName, textChanges: [{ newText: superCall.getText(sourceFile), @@ -77425,7 +78348,7 @@ var ts; changes: changes }]; function findSuperCall(n) { - if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + if (n.kind === 208 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { return n; } if (ts.isFunctionLike(n)) { @@ -77439,6 +78362,227 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122 /* ConstructorKeyword */) { + return undefined; + } + var newPosition = ts.getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + var classDeclNode = ts.getContainingClass(token); + if (!(token.kind === 70 /* Identifier */ && ts.isClassLike(classDeclNode))) { + return undefined; + } + var heritageClauses = classDeclNode.heritageClauses; + if (!(heritageClauses && heritageClauses.length > 0)) { + return undefined; + } + var extendsToken = heritageClauses[0].getFirstToken(); + if (!(extendsToken && extendsToken.kind === 84 /* ExtendsKeyword */)) { + return undefined; + } + var changeStart = extendsToken.getStart(sourceFile); + var changeEnd = extendsToken.getEnd(); + var textChanges = [{ newText: " implements", span: { start: changeStart, length: changeEnd - changeStart } }]; + // We replace existing keywords with commas. + for (var i = 1; i < heritageClauses.length; i++) { + var keywordToken = heritageClauses[i].getFirstToken(); + if (keywordToken) { + changeStart = keywordToken.getStart(sourceFile); + changeEnd = keywordToken.getEnd(); + textChanges.push({ newText: ",", span: { start: changeStart, length: changeEnd - changeStart } }); + } + } + var result = [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Change_extends_to_implements), + changes: [{ + fileName: sourceFile.fileName, + textChanges: textChanges + }] + }]; + return result; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ + errorCodes: [ + ts.Diagnostics._0_is_declared_but_never_used.code, + ts.Diagnostics.Property_0_is_declared_but_never_used.code + ], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var start = context.span.start; + var token = ts.getTokenAtPosition(sourceFile, start); + // this handles var ["computed"] = 12; + if (token.kind === 20 /* OpenBracketToken */) { + token = ts.getTokenAtPosition(sourceFile, start + 1); + } + switch (token.kind) { + case 70 /* Identifier */: + switch (token.parent.kind) { + case 224 /* VariableDeclaration */: + switch (token.parent.parent.parent.kind) { + case 212 /* ForStatement */: + var forStatement = token.parent.parent.parent; + var forInitializer = forStatement.initializer; + if (forInitializer.declarations.length === 1) { + return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); + } + else { + return removeSingleItem(forInitializer.declarations, token); + } + case 214 /* ForOfStatement */: + var forOfStatement = token.parent.parent.parent; + if (forOfStatement.initializer.kind === 225 /* VariableDeclarationList */) { + var forOfInitializer = forOfStatement.initializer; + return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); + } + break; + case 213 /* ForInStatement */: + // There is no valid fix in the case of: + // for .. in + return undefined; + case 257 /* CatchClause */: + var catchClause = token.parent.parent; + var parameter = catchClause.variableDeclaration.getChildren()[0]; + return createCodeFix("", parameter.pos, parameter.end - parameter.pos); + default: + var variableStatement = token.parent.parent.parent; + if (variableStatement.declarationList.declarations.length === 1) { + return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); + } + else { + var declarations = variableStatement.declarationList.declarations; + return removeSingleItem(declarations, token); + } + } + case 143 /* TypeParameter */: + var typeParameters = token.parent.parent.typeParameters; + if (typeParameters.length === 1) { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); + } + else { + return removeSingleItem(typeParameters, token); + } + case 144 /* Parameter */: + var functionDeclaration = token.parent.parent; + if (functionDeclaration.parameters.length === 1) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else { + return removeSingleItem(functionDeclaration.parameters, token); + } + // handle case where 'import a = A;' + case 235 /* ImportEqualsDeclaration */: + var importEquals = findImportDeclaration(token); + return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); + case 240 /* ImportSpecifier */: + var namedImports = token.parent.parent; + if (namedImports.elements.length === 1) { + // Only 1 import and it is unused. So the entire declaration should be removed. + var importSpec = findImportDeclaration(token); + return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); + } + else { + return removeSingleItem(namedImports.elements, token); + } + // handle case where "import d, * as ns from './file'" + // or "'import {a, b as ns} from './file'" + case 237 /* ImportClause */: + var importClause = token.parent; + if (!importClause.namedBindings) { + var importDecl = findImportDeclaration(importClause); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); + } + case 238 /* NamespaceImport */: + var namespaceImport = token.parent; + if (namespaceImport.name == token && !namespaceImport.parent.name) { + var importDecl = findImportDeclaration(namespaceImport); + return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); + } + else { + var start_4 = namespaceImport.parent.name.end; + return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); + } + } + break; + case 147 /* PropertyDeclaration */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + case 238 /* NamespaceImport */: + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + if (ts.isDeclarationName(token)) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); + } + else if (ts.isLiteralComputedPropertyDeclarationName(token)) { + return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); + } + else { + return undefined; + } + function findImportDeclaration(token) { + var importDecl = token; + while (importDecl.kind != 236 /* ImportDeclaration */ && importDecl.parent) { + importDecl = importDecl.parent; + } + return importDecl; + } + function createCodeFix(newText, start, length) { + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), + changes: [{ + fileName: sourceFile.fileName, + textChanges: [{ newText: newText, span: { start: start, length: length } }] + }] + }]; + } + function removeSingleItem(elements, token) { + if (elements[0] === token.parent) { + return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + } + else { + return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + } + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -77538,7 +78682,10 @@ var ts; return ImportCodeActionMap; }()); codefix.registerCodeFix({ - errorCodes: [ts.Diagnostics.Cannot_find_name_0.code], + errorCodes: [ + ts.Diagnostics.Cannot_find_name_0.code, + ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code + ], getCodeActions: function (context) { var sourceFile = context.sourceFile; var checker = context.program.getTypeChecker(); @@ -77550,6 +78697,11 @@ var ts; // this is a module id -> module import declaration map var cachedImportDeclarations = ts.createMap(); var cachedNewImportInsertPosition; + var currentTokenMeaning = ts.getMeaningFromLocation(token); + if (context.errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { + var symbol = checker.getAliasedSymbol(checker.getSymbolAtLocation(token)); + return getCodeActionForImport(symbol, /*isDefault*/ false, /*isNamespaceImport*/ true); + } var allPotentialModules = checker.getAmbientModules(); for (var _i = 0, allSourceFiles_1 = allSourceFiles; _i < allSourceFiles_1.length; _i++) { var otherSourceFile = allSourceFiles_1[_i]; @@ -77557,7 +78709,6 @@ var ts; allPotentialModules.push(otherSourceFile.symbol); } } - var currentTokenMeaning = ts.getMeaningFromLocation(token); for (var _a = 0, allPotentialModules_1 = allPotentialModules; _a < allPotentialModules_1.length; _a++) { var moduleSymbol = allPotentialModules_1[_a]; context.cancellationToken.throwIfCancellationRequested(); @@ -77597,10 +78748,10 @@ var ts; function getImportDeclaration(moduleSpecifier) { var node = moduleSpecifier; while (node) { - if (node.kind === 235 /* ImportDeclaration */) { + if (node.kind === 236 /* ImportDeclaration */) { return node; } - if (node.kind === 234 /* ImportEqualsDeclaration */) { + if (node.kind === 235 /* ImportEqualsDeclaration */) { return node; } node = node.parent; @@ -77618,7 +78769,7 @@ var ts; var declarations = symbol.getDeclarations(); return declarations ? ts.some(symbol.declarations, function (decl) { return !!(ts.getMeaningFromDeclaration(decl) & meaning); }) : false; } - function getCodeActionForImport(moduleSymbol, isDefault) { + function getCodeActionForImport(moduleSymbol, isDefault, isNamespaceImport) { var existingDeclarations = getImportDeclarations(moduleSymbol); if (existingDeclarations.length > 0) { // With an existing import statement, there are more than one actions the user can do. @@ -77646,9 +78797,9 @@ var ts; var existingModuleSpecifier; for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { var declaration = declarations_11[_i]; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 236 /* ImportDeclaration */) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 237 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 238 /* NamespaceImport */) { // case: // import * as ns from "foo" namespaceImportDeclaration = declaration; @@ -77672,7 +78823,7 @@ var ts; if (namespaceImportDeclaration) { actions.push(getCodeActionForNamespaceImport(namespaceImportDeclaration)); } - if (namedImportDeclaration && namedImportDeclaration.importClause && + if (!isNamespaceImport && namedImportDeclaration && namedImportDeclaration.importClause && (namedImportDeclaration.importClause.name || namedImportDeclaration.importClause.namedBindings)) { /** * If the existing import declaration already has a named import list, just @@ -77688,7 +78839,7 @@ var ts; } return actions; function getModuleSpecifierFromImportEqualsDeclaration(declaration) { - if (declaration.moduleReference && declaration.moduleReference.kind === 245 /* ExternalModuleReference */) { + if (declaration.moduleReference && declaration.moduleReference.kind === 246 /* ExternalModuleReference */) { return declaration.moduleReference.expression.getText(); } return declaration.moduleReference.getText(); @@ -77736,7 +78887,7 @@ var ts; } function getCodeActionForNamespaceImport(declaration) { var namespacePrefix; - if (declaration.kind === 235 /* ImportDeclaration */) { + if (declaration.kind === 236 /* ImportDeclaration */) { namespacePrefix = declaration.importClause.namedBindings.name.getText(); } else { @@ -77773,7 +78924,9 @@ var ts; var moduleSpecifierWithoutQuotes = ts.stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); var importStatementText = isDefault ? "import " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" - : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; + : isNamespaceImport + ? "import * as " + name + " from \"" + moduleSpecifierWithoutQuotes + "\"" + : "import { " + name + " } from \"" + moduleSpecifierWithoutQuotes + "\""; // if this file doesn't have any import statements, insert an import statement and then insert a new line // between the only import statement and user code. Otherwise just insert the statement because chances // are there are already a new line seperating code and import statements. @@ -77793,7 +78946,7 @@ var ts; tryGetModuleNameAsNodeModule() || ts.removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule() { - if (moduleSymbol.valueDeclaration.kind !== 261 /* SourceFile */) { + if (moduleSymbol.valueDeclaration.kind !== 262 /* SourceFile */) { return moduleSymbol.name; } } @@ -77806,6 +78959,7 @@ var ts; if (!relativeName) { return undefined; } + var relativeNameWithIndex = ts.removeFileExtension(relativeName); relativeName = removeExtensionAndIndexPostFix(relativeName); if (options.paths) { for (var key in options.paths) { @@ -77825,7 +78979,7 @@ var ts; return key.replace("\*", matchedStar); } } - else if (pattern === relativeName) { + else if (pattern === relativeName || pattern === relativeNameWithIndex) { return key; } } @@ -77947,156 +79101,149 @@ var ts; (function (ts) { var codefix; (function (codefix) { - codefix.registerCodeFix({ - errorCodes: [ - ts.Diagnostics._0_is_declared_but_never_used.code, - ts.Diagnostics.Property_0_is_declared_but_never_used.code - ], - getCodeActions: function (context) { - var sourceFile = context.sourceFile; - var start = context.span.start; - var token = ts.getTokenAtPosition(sourceFile, start); - // this handles var ["computed"] = 12; - if (token.kind === 20 /* OpenBracketToken */) { - token = ts.getTokenAtPosition(sourceFile, start + 1); - } - switch (token.kind) { - case 70 /* Identifier */: - switch (token.parent.kind) { - case 223 /* VariableDeclaration */: - switch (token.parent.parent.parent.kind) { - case 211 /* ForStatement */: - var forStatement = token.parent.parent.parent; - var forInitializer = forStatement.initializer; - if (forInitializer.declarations.length === 1) { - return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); - } - else { - return removeSingleItem(forInitializer.declarations, token); - } - case 213 /* ForOfStatement */: - var forOfStatement = token.parent.parent.parent; - if (forOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { - var forOfInitializer = forOfStatement.initializer; - return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); - } - break; - case 212 /* ForInStatement */: - // There is no valid fix in the case of: - // for .. in - return undefined; - case 256 /* CatchClause */: - var catchClause = token.parent.parent; - var parameter = catchClause.variableDeclaration.getChildren()[0]; - return createCodeFix("", parameter.pos, parameter.end - parameter.pos); - default: - var variableStatement = token.parent.parent.parent; - if (variableStatement.declarationList.declarations.length === 1) { - return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); - } - else { - var declarations = variableStatement.declarationList.declarations; - return removeSingleItem(declarations, token); - } - } - case 143 /* TypeParameter */: - var typeParameters = token.parent.parent.typeParameters; - if (typeParameters.length === 1) { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 2); - } - else { - return removeSingleItem(typeParameters, token); - } - case 144 /* Parameter */: - var functionDeclaration = token.parent.parent; - if (functionDeclaration.parameters.length === 1) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else { - return removeSingleItem(functionDeclaration.parameters, token); - } - // handle case where 'import a = A;' - case 234 /* ImportEqualsDeclaration */: - var importEquals = findImportDeclaration(token); - return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); - case 239 /* ImportSpecifier */: - var namedImports = token.parent.parent; - if (namedImports.elements.length === 1) { - // Only 1 import and it is unused. So the entire declaration should be removed. - var importSpec = findImportDeclaration(token); - return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos); - } - else { - return removeSingleItem(namedImports.elements, token); - } - // handle case where "import d, * as ns from './file'" - // or "'import {a, b as ns} from './file'" - case 236 /* ImportClause */: - var importClause = token.parent; - if (!importClause.namedBindings) { - var importDecl = findImportDeclaration(importClause); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); - } - case 237 /* NamespaceImport */: - var namespaceImport = token.parent; - if (namespaceImport.name == token && !namespaceImport.parent.name) { - var importDecl = findImportDeclaration(namespaceImport); - return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); - } - else { - var start_4 = namespaceImport.parent.name.end; - return createCodeFix("", start_4, namespaceImport.parent.namedBindings.end - start_4); - } - } - break; - case 147 /* PropertyDeclaration */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - case 237 /* NamespaceImport */: - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - if (ts.isDeclarationName(token)) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); - } - else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); - } - else { - return undefined; - } - function findImportDeclaration(token) { - var importDecl = token; - while (importDecl.kind != 235 /* ImportDeclaration */ && importDecl.parent) { - importDecl = importDecl.parent; + /** + * Finds members of the resolved type that are missing in the class pointed to by class decl + * and generates source code for the missing members. + * @param possiblyMissingSymbols The collection of symbols to filter and then get insertions for. + * @returns Empty string iff there are no member insertions. + */ + function getMissingMembersInsertion(classDeclaration, possiblyMissingSymbols, checker, newlineChar) { + var classMembers = classDeclaration.symbol.members; + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !(symbol.getName() in classMembers); }); + var insertion = ""; + for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { + var symbol = missingMembers_1[_i]; + insertion = insertion.concat(getInsertionForMemberSymbol(symbol, classDeclaration, checker, newlineChar)); + } + return insertion; + } + codefix.getMissingMembersInsertion = getMissingMembersInsertion; + /** + * @returns Empty string iff there we can't figure out a representation for `symbol` in `enclosingDeclaration`. + */ + function getInsertionForMemberSymbol(symbol, enclosingDeclaration, checker, newlineChar) { + // const name = symbol.getName(); + var type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration); + var declarations = symbol.getDeclarations(); + if (!(declarations && declarations.length)) { + return ""; + } + var declaration = declarations[0]; + var name = declaration.name ? declaration.name.getText() : undefined; + var visibility = getVisibilityPrefix(ts.getModifierFlags(declaration)); + switch (declaration.kind) { + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 146 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + var typeString = checker.typeToString(type, enclosingDeclaration, 0 /* None */); + return "" + visibility + name + ": " + typeString + ";" + newlineChar; + case 148 /* MethodSignature */: + case 149 /* MethodDeclaration */: + // The signature for the implementation appears as an entry in `signatures` iff + // there is only one signature. + // If there are overloads and an implementation signature, it appears as an + // extra declaration that isn't a signature for `type`. + // If there is more than one overload but no implementation signature + // (eg: an abstract method or interface declaration), there is a 1-1 + // correspondence of declarations and signatures. + var signatures = checker.getSignaturesOfType(type, 0 /* Call */); + if (!(signatures && signatures.length > 0)) { + return ""; } - return importDecl; - } - function createCodeFix(newText, start, length) { - return [{ - description: ts.getLocaleSpecificMessage(ts.Diagnostics.Remove_unused_identifiers), - changes: [{ - fileName: sourceFile.fileName, - textChanges: [{ newText: newText, span: { start: start, length: length } }] - }] - }]; - } - function removeSingleItem(elements, token) { - if (elements[0] === token.parent) { - return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos + 1); + if (declarations.length === 1) { + ts.Debug.assert(signatures.length === 1); + var sigString_1 = checker.signatureToString(signatures[0], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + return "" + visibility + name + sigString_1 + getMethodBodyStub(newlineChar); + } + var result = ""; + for (var i = 0; i < signatures.length; i++) { + var sigString_2 = checker.signatureToString(signatures[i], enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + result += "" + visibility + name + sigString_2 + ";" + newlineChar; + } + // If there is a declaration with a body, it is the last declaration, + // and it isn't caught by `getSignaturesOfType`. + var bodySig = undefined; + if (declarations.length > signatures.length) { + bodySig = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); } else { - return createCodeFix("", token.parent.pos - 1, token.parent.end - token.parent.pos + 1); + ts.Debug.assert(declarations.length === signatures.length); + bodySig = createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker); } + var sigString = checker.signatureToString(bodySig, enclosingDeclaration, 2048 /* SuppressAnyReturnType */, 0 /* Call */); + result += "" + visibility + name + sigString + getMethodBodyStub(newlineChar); + return result; + default: + return ""; + } + } + function createBodySignatureWithAnyTypes(signatures, enclosingDeclaration, checker) { + var newSignatureDeclaration = ts.createNode(153 /* CallSignature */); + newSignatureDeclaration.parent = enclosingDeclaration; + newSignatureDeclaration.name = signatures[0].getDeclaration().name; + var maxNonRestArgs = -1; + var maxArgsIndex = 0; + var minArgumentCount = signatures[0].minArgumentCount; + var hasRestParameter = false; + for (var i = 0; i < signatures.length; i++) { + var sig = signatures[i]; + minArgumentCount = Math.min(sig.minArgumentCount, minArgumentCount); + hasRestParameter = hasRestParameter || sig.hasRestParameter; + var nonRestLength = sig.parameters.length - (sig.hasRestParameter ? 1 : 0); + if (nonRestLength > maxNonRestArgs) { + maxNonRestArgs = nonRestLength; + maxArgsIndex = i; } } - }); + var maxArgsParameterSymbolNames = signatures[maxArgsIndex].getParameters().map(function (symbol) { return symbol.getName(); }); + var optionalToken = ts.createToken(54 /* QuestionToken */); + newSignatureDeclaration.parameters = ts.createNodeArray(); + for (var i = 0; i < maxNonRestArgs; i++) { + var newParameter = createParameterDeclarationWithoutType(i, minArgumentCount, newSignatureDeclaration); + newSignatureDeclaration.parameters.push(newParameter); + } + if (hasRestParameter) { + var restParameter = createParameterDeclarationWithoutType(maxNonRestArgs, minArgumentCount, newSignatureDeclaration); + restParameter.dotDotDotToken = ts.createToken(23 /* DotDotDotToken */); + newSignatureDeclaration.parameters.push(restParameter); + } + return checker.getSignatureFromDeclaration(newSignatureDeclaration); + function createParameterDeclarationWithoutType(index, minArgCount, enclosingSignatureDeclaration) { + var newParameter = ts.createNode(144 /* Parameter */); + newParameter.symbol = new SymbolConstructor(1 /* FunctionScopedVariable */, maxArgsParameterSymbolNames[index] || "rest"); + newParameter.symbol.valueDeclaration = newParameter; + newParameter.symbol.declarations = [newParameter]; + newParameter.parent = enclosingSignatureDeclaration; + if (index >= minArgCount) { + newParameter.questionToken = optionalToken; + } + return newParameter; + } + } + function getMethodBodyStub(newLineChar) { + return " {" + newLineChar + "throw new Error('Method not implemented.');" + newLineChar + "}" + newLineChar; + } + function getVisibilityPrefix(flags) { + if (flags & 4 /* Public */) { + return "public "; + } + else if (flags & 16 /* Protected */) { + return "protected "; + } + return ""; + } + var SymbolConstructor = ts.objectAllocator.getSymbolConstructor(); })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); -/// -/// -/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// /// @@ -78122,7 +79269,7 @@ var ts; /// /// /// -/// +/// /// var ts; (function (ts) { @@ -78187,7 +79334,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(292 /* SyntaxList */, nodes.pos, nodes.end, this); + var list = createNode(293 /* SyntaxList */, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { @@ -78210,7 +79357,7 @@ var ts; ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 278 /* FirstJSDocTagNode */ && this.kind <= 291 /* LastJSDocTagNode */; + var useJSDocScanner_1 = this.kind >= 279 /* FirstJSDocTagNode */ && this.kind <= 292 /* LastJSDocTagNode */; var processNode = function (node) { var isJSDocTagNode = ts.isJSDocTag(node); if (!isJSDocTagNode && pos_3 < node.pos) { @@ -78489,9 +79636,9 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_7 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_7 !== undefined) { - return result_7; + var result_8 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_8 !== undefined) { + return result_8; } if (declaration.name.kind === 142 /* ComputedPropertyName */) { var expr = declaration.name.expression; @@ -78515,7 +79662,7 @@ var ts; } function visit(node) { switch (node.kind) { - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 184 /* FunctionExpression */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: @@ -78538,18 +79685,18 @@ var ts; } ts.forEachChild(node, visit); break; - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: case 197 /* ClassExpression */: - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: - case 229 /* EnumDeclaration */: - case 230 /* ModuleDeclaration */: - case 234 /* ImportEqualsDeclaration */: - case 243 /* ExportSpecifier */: - case 239 /* ImportSpecifier */: - case 234 /* ImportEqualsDeclaration */: - case 236 /* ImportClause */: - case 237 /* NamespaceImport */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: + case 230 /* EnumDeclaration */: + case 231 /* ModuleDeclaration */: + case 235 /* ImportEqualsDeclaration */: + case 244 /* ExportSpecifier */: + case 240 /* ImportSpecifier */: + case 235 /* ImportEqualsDeclaration */: + case 237 /* ImportClause */: + case 238 /* NamespaceImport */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 161 /* TypeLiteral */: @@ -78562,7 +79709,7 @@ var ts; break; } // fall through - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 174 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { @@ -78572,19 +79719,19 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 260 /* EnumMember */: + case 261 /* EnumMember */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: addDeclaration(node); break; - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -78596,7 +79743,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 238 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -79297,7 +80444,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 231 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -79529,7 +80676,7 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + for (var i = 0; i < descriptors.length; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -79683,7 +80830,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 245 /* ExternalModuleReference */ || + node.parent.kind === 246 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; @@ -79787,16 +80934,16 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 205 /* VariableStatement */: + case 206 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 223 /* VariableDeclaration */: + case 224 /* VariableDeclaration */: case 147 /* PropertyDeclaration */: case 146 /* PropertySignature */: return spanInVariableDeclaration(node); case 144 /* Parameter */: return spanInParameterDeclaration(node); - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: @@ -79805,85 +80952,85 @@ var ts; case 184 /* FunctionExpression */: case 185 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 204 /* Block */: + case 205 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: return spanInBlock(node); - case 256 /* CatchClause */: + case 257 /* CatchClause */: return spanInBlock(node.block); - case 207 /* ExpressionStatement */: + case 208 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 216 /* ReturnStatement */: + case 217 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 210 /* WhileStatement */: + case 211 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 209 /* DoStatement */: + case 210 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 222 /* DebuggerStatement */: + case 223 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 208 /* IfStatement */: + case 209 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 219 /* LabeledStatement */: + case 220 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 215 /* BreakStatement */: - case 214 /* ContinueStatement */: + case 216 /* BreakStatement */: + case 215 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 211 /* ForStatement */: + case 212 /* ForStatement */: return spanInForStatement(node); - case 212 /* ForInStatement */: + case 213 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 213 /* ForOfStatement */: + case 214 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 218 /* SwitchStatement */: + case 219 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 253 /* CaseClause */: - case 254 /* DefaultClause */: + case 254 /* CaseClause */: + case 255 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 221 /* TryStatement */: + case 222 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 220 /* ThrowStatement */: + case 221 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 240 /* ExportAssignment */: + case 241 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 235 /* ImportDeclaration */: + case 236 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 241 /* ExportDeclaration */: + case 242 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 226 /* ClassDeclaration */: - case 229 /* EnumDeclaration */: - case 260 /* EnumMember */: + case 227 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 261 /* EnumMember */: case 174 /* BindingElement */: // span on complete node return textSpan(node); - case 217 /* WithStatement */: + case 218 /* WithStatement */: // span in statement return spanInNode(node.statement); case 145 /* Decorator */: @@ -79892,8 +81039,8 @@ var ts; case 173 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 227 /* InterfaceDeclaration */: - case 228 /* TypeAliasDeclaration */: + case 228 /* InterfaceDeclaration */: + case 229 /* TypeAliasDeclaration */: return undefined; // Tokens: case 24 /* SemicolonToken */: @@ -79937,8 +81084,8 @@ var ts; // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern if ((node.kind === 70 /* Identifier */ || node.kind == 196 /* SpreadElement */ || - node.kind === 257 /* PropertyAssignment */ || - node.kind === 258 /* ShorthandPropertyAssignment */) && + node.kind === 258 /* PropertyAssignment */ || + node.kind === 259 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } @@ -79965,14 +81112,14 @@ var ts; } if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 209 /* DoStatement */: + case 210 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); case 145 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: return textSpan(node); case 192 /* BinaryExpression */: if (node.parent.operatorToken.kind === 25 /* CommaToken */) { @@ -79989,7 +81136,7 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 257 /* PropertyAssignment */ && + if (node.parent.kind === 258 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); @@ -80003,7 +81150,7 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 223 /* VariableDeclaration */ || + if ((node.parent.kind === 224 /* VariableDeclaration */ || node.parent.kind === 144 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || @@ -80038,7 +81185,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 213 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -80049,7 +81196,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || ts.hasModifier(variableDeclaration, 1 /* Export */) || - variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 214 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -80089,7 +81236,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasModifier(functionDeclaration, 1 /* Export */) || - (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); + (functionDeclaration.parent.kind === 227 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -80112,25 +81259,25 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 230 /* ModuleDeclaration */: + case 231 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 210 /* WhileStatement */: - case 208 /* IfStatement */: - case 212 /* ForInStatement */: + case 211 /* WhileStatement */: + case 209 /* IfStatement */: + case 213 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 225 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -80184,13 +81331,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 229 /* EnumDeclaration */: + case 230 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 226 /* ClassDeclaration */: + case 227 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -80198,24 +81345,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 231 /* ModuleBlock */: + case 232 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 229 /* EnumDeclaration */: - case 226 /* ClassDeclaration */: + case 230 /* EnumDeclaration */: + case 227 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 204 /* Block */: + case 205 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through - case 256 /* CatchClause */: + case 257 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 232 /* CaseBlock */: + case 233 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -80254,7 +81401,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 209 /* DoStatement */ || + if (node.parent.kind === 210 /* DoStatement */ || node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { return spanInPreviousNode(node); @@ -80269,17 +81416,17 @@ var ts; // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { case 184 /* FunctionExpression */: - case 225 /* FunctionDeclaration */: + case 226 /* FunctionDeclaration */: case 185 /* ArrowFunction */: case 149 /* MethodDeclaration */: case 148 /* MethodSignature */: case 151 /* GetAccessor */: case 152 /* SetAccessor */: case 150 /* Constructor */: - case 210 /* WhileStatement */: - case 209 /* DoStatement */: - case 211 /* ForStatement */: - case 213 /* ForOfStatement */: + case 211 /* WhileStatement */: + case 210 /* DoStatement */: + case 212 /* ForStatement */: + case 214 /* ForOfStatement */: case 179 /* CallExpression */: case 180 /* NewExpression */: case 183 /* ParenthesizedExpression */: @@ -80292,7 +81439,7 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 257 /* PropertyAssignment */ || + node.parent.kind === 258 /* PropertyAssignment */ || node.parent.kind === 144 /* Parameter */) { return spanInPreviousNode(node); } @@ -80305,7 +81452,7 @@ var ts; return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 209 /* DoStatement */) { + if (node.parent.kind === 210 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -80313,7 +81460,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 213 /* ForOfStatement */) { + if (node.parent.kind === 214 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -81102,7 +82249,7 @@ var ts; this._shims.push(shim); }; TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { - for (var i = 0, n = this._shims.length; i < n; i++) { + for (var i = 0; i < this._shims.length; i++) { if (this._shims[i] === shim) { delete this._shims[i]; return; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index d8cd324a8d2..47b04ae9e58 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -13,11 +13,16 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; +var __extends = (this && this.__extends) || (function () { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var ts; (function (ts) { var OperationCanceledException = (function () { @@ -206,7 +211,7 @@ var ts; ts.toPath = toPath; function forEach(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -225,7 +230,7 @@ var ts; ts.zipWith = zipWith; function every(array, callback) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (!callback(array[i], i)) { return false; } @@ -235,7 +240,7 @@ var ts; } ts.every = every; function find(array, predicate) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var value = array[i]; if (predicate(value, i)) { return value; @@ -245,7 +250,7 @@ var ts; } ts.find = find; function findMap(array, callback) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { var result = callback(array[i], i); if (result) { return result; @@ -268,7 +273,7 @@ var ts; ts.contains = contains; function indexOf(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (var i = 0; i < array.length; i++) { if (array[i] === value) { return i; } @@ -278,7 +283,7 @@ var ts; } ts.indexOf = indexOf; function indexOfAnyCharCode(text, charCodes, start) { - for (var i = start || 0, len = text.length; i < len; i++) { + for (var i = start || 0; i < text.length; i++) { if (contains(charCodes, text.charCodeAt(i))) { return i; } @@ -981,6 +986,7 @@ var ts; baseIndex = baseIndex || 0; return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } + ts.formatStringFromArgs = formatStringFromArgs; ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message; @@ -2475,7 +2481,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -2632,6 +2638,7 @@ var ts; Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -2861,6 +2868,8 @@ var ts; Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -2870,6 +2879,7 @@ var ts; Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property" }, + JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot_emit_namespaced_JSX_elements_in_React_2650", message: "Cannot emit namespaced JSX elements in React" }, A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, @@ -2921,6 +2931,8 @@ var ts; Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, + The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference" }, + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "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: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -3089,6 +3101,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -3102,10 +3115,10 @@ var ts; Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, + Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, @@ -3154,6 +3167,8 @@ var ts; Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, + Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3210,22 +3225,25 @@ var ts; super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." }, Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." }, super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{0}'?" }, + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" }, A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." }, The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." }, No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, - Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, - Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, - Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class" }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers." }, + Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, + Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig" }, Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}" }, Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}" }, Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, }; })(ts || (ts = {})); var ts; @@ -3606,7 +3624,7 @@ var ts; if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { var ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -3792,7 +3810,7 @@ var ts; if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } - for (var i = 1, n = name.length; i < n; i++) { + for (var i = 1; i < name.length; i++) { if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { return false; } @@ -5539,6 +5557,7 @@ var ts; if (resolutionStack === void 0) { resolutionStack = []; } if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; + basePath = ts.normalizeSlashes(basePath); var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -6102,6 +6121,12 @@ var ts; return compilerOptions.traceResolution && host.trace !== undefined; } ts.isTraceEnabled = isTraceEnabled; + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); function resolvedTypeScriptOnly(resolved) { if (!resolved) { return undefined; @@ -6109,9 +6134,6 @@ var ts; ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); return resolved.path; } - function resolvedFromAnyFile(path) { - return { path: path, extension: ts.extensionFromPath(path) }; - } function resolvedModuleFromResolved(_a, isExternalLibraryImport) { var path = _a.path, extension = _a.extension; return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; @@ -6123,13 +6145,13 @@ var ts; return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); } ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadTypesSection(extensions, packageJsonPath, baseDirectory, state) { + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { var jsonContent = readJson(packageJsonPath, state.host); switch (extensions) { - case 2: - case 0: + case Extensions.DtsOnly: + case Extensions.TypeScript: return tryReadFromField("typings") || tryReadFromField("types"); - case 1: + case Extensions.JavaScript: if (typeof jsonContent.main === "string") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_so_returning_main_value_of_0, jsonContent.main); @@ -6191,6 +6213,7 @@ var ts; if (host.directoryExists(atTypes)) { (typeRoots || (typeRoots = [])).push(atTypes); } + return undefined; }); return typeRoots; } @@ -6245,7 +6268,11 @@ var ts; return ts.forEach(typeRoots, function (typeRoot) { var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); var candidateDirectory = ts.getDirectoryPath(candidate); - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); }); } else { @@ -6261,7 +6288,8 @@ var ts; if (traceEnabled) { trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); } - resolvedFile = resolvedTypeScriptOnly(loadModuleFromNodeModules(2, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState)); + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); if (!resolvedFile && traceEnabled) { trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } @@ -6302,31 +6330,115 @@ var ts; return result; } ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_1 = ts.getDirectoryPath(current); + if (parent_1 === current || directoryPathMap.contains(parent_1)) { + break; + } + directoryPathMap.set(parent_1, result); + current = parent_1; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); } } else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; } if (traceEnabled) { if (result.resolvedModule) { @@ -6451,33 +6563,33 @@ var ts; return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); } } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var containingDirectory = ts.getDirectoryPath(containingFile); var traceEnabled = isTraceEnabled(compilerOptions, host); var failedLookupLocations = []; var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = tryResolve(0) || tryResolve(1); - if (result) { - var resolved = result.resolved, isExternalLibraryImport = result.isExternalLibraryImport; + var result = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); } return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; function tryResolve(extensions) { var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); if (resolved) { - return { resolved: resolved, isExternalLibraryImport: false }; + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); } if (moduleHasNonRelativeName(moduleName)) { if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state); - return resolved_1 && { resolved: { path: realpath(resolved_1.path, host, traceEnabled), extension: resolved_1.extension }, isExternalLibraryImport: true }; + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state); - return resolved_2 && { resolved: resolved_2, isExternalLibraryImport: false }; + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); } } } @@ -6494,10 +6606,33 @@ var ts; } function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); } - var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return resolvedFromFile; + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); } function directoryProbablyExists(directoryName, host) { return !host.directoryExists || host.directoryExists(directoryName); @@ -6525,11 +6660,11 @@ var ts; } } switch (extensions) { - case 2: + case Extensions.DtsOnly: return tryExtension(".d.ts", ts.Extension.Dts); - case 0: + case Extensions.TypeScript: return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case 1: + case Extensions.JavaScript: return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); } function tryExtension(ext, extension) { @@ -6538,19 +6673,21 @@ var ts; } } function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } } - failedLookupLocations.push(fileName); - return undefined; } + failedLookupLocations.push(fileName); + return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { var packageJsonPath = pathToPackageJson(candidate); @@ -6559,16 +6696,22 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var typesFile = tryReadTypesSection(extensions, packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - var fromFile = tryFile(typesFile, failedLookupLocations, onlyRecordFailures_1, state); - if (fromFile) { - return resolvedFromAnyFile(fromFile); + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } } - var x = tryAddingExtensions(typesFile, 0, failedLookupLocations, onlyRecordFailures_1, state); - if (x) { - return x; + var resolved = tryAddingExtensions(mainOrTypesFile, Extensions.TypeScript, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; } } else { @@ -6578,73 +6721,117 @@ var ts; } } else { - if (state.traceEnabled) { + if (directoryExists && state.traceEnabled) { trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); } failedLookupLocations.push(packageJsonPath); } return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); } + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case Extensions.TypeScript: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case Extensions.DtsOnly: + return extension === ts.Extension.Dts; + } + } function pathToPackageJson(directory) { return ts.combinePaths(directory, "package.json"); } - function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false); + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); } function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(2, moduleName, directory, failedLookupLocations, state, true); + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - return loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly); + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); } }); } function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { if (typesOnly === void 0) { typesOnly = false; } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); if (packageResult) { return packageResult; } - if (extensions !== 1) { - return loadModuleFromNodeModulesFolder(2, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, moduleName, nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); } } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { var traceEnabled = isTraceEnabled(compilerOptions, host); var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(0) || tryResolve(1); - return createResolvedModuleWithFailedLookupLocations(resolved, false, failedLookupLocations); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); function tryResolve(extensions) { var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); if (resolvedUsingSettings) { - return resolvedUsingSettings; + return { value: resolvedUsingSettings }; } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolved_4 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); }); - if (resolved_3) { - return resolved_3; + if (resolved_4) { + return resolved_4; } - if (extensions === 0) { + if (extensions === Extensions.TypeScript) { return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); } } else { var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); } } } @@ -6656,10 +6843,13 @@ var ts; } var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(2, moduleName, globalCache, failedLookupLocations, state); + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); } ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } function forEachAncestorDirectory(directory, callback) { while (true) { var result = callback(directory); From 32b3436286d7d8ab323a674258df04d2a7d67c60 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 5 Jan 2017 11:35:33 -0800 Subject: [PATCH 224/289] Add builder.ts to server sources --- Jakefile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Jakefile.js b/Jakefile.js index 093d6f16893..a786fb16ed3 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -184,6 +184,7 @@ var servicesSources = [ })); var baseServerCoreSources = [ + "builder.ts", "editorServices.ts", "lsHost.ts", "project.ts", From 1978c5b07dffd3ba57e2644de4f9f1288c1f624c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 5 Jan 2017 11:58:24 -0800 Subject: [PATCH 225/289] Update LKG --- lib/tsserver.js | 2082 ++++---- lib/tsserverlibrary.d.ts | 10509 ++++++------------------------------- lib/tsserverlibrary.js | 3332 ++++++------ 3 files changed, 4186 insertions(+), 11737 deletions(-) diff --git a/lib/tsserver.js b/lib/tsserver.js index 2d477ca2dcf..10cfa276fec 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -6112,200 +6112,6 @@ var ts; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; -(function (ts) { - var server; - (function (server) { - var LogLevel; - (function (LogLevel) { - LogLevel[LogLevel["terse"] = 0] = "terse"; - LogLevel[LogLevel["normal"] = 1] = "normal"; - LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; - LogLevel[LogLevel["verbose"] = 3] = "verbose"; - })(LogLevel = server.LogLevel || (server.LogLevel = {})); - server.emptyArray = []; - var Msg; - (function (Msg) { - Msg.Err = "Err"; - Msg.Info = "Info"; - Msg.Perf = "Perf"; - })(Msg = server.Msg || (server.Msg = {})); - function getProjectRootPath(project) { - switch (project.projectKind) { - case server.ProjectKind.Configured: - return ts.getDirectoryPath(project.getProjectName()); - case server.ProjectKind.Inferred: - return ""; - case server.ProjectKind.External: - var projectName = ts.normalizeSlashes(project.getProjectName()); - return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; - } - } - function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { - return { - projectName: project.getProjectName(), - fileNames: project.getFileNames(true), - compilerOptions: project.getCompilerOptions(), - typeAcquisition: typeAcquisition, - unresolvedImports: unresolvedImports, - projectRootPath: getProjectRootPath(project), - cachePath: cachePath, - kind: "discover" - }; - } - server.createInstallTypingsRequest = createInstallTypingsRequest; - var Errors; - (function (Errors) { - function ThrowNoProject() { - throw new Error("No Project."); - } - Errors.ThrowNoProject = ThrowNoProject; - function ThrowProjectLanguageServiceDisabled() { - throw new Error("The project's language service is disabled."); - } - Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; - function ThrowProjectDoesNotContainDocument(fileName, project) { - throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); - } - Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; - })(Errors = server.Errors || (server.Errors = {})); - function getDefaultFormatCodeSettings(host) { - return { - indentSize: 4, - tabSize: 4, - newLineCharacter: host.newLine || "\n", - convertTabsToSpaces: true, - indentStyle: ts.IndentStyle.Smart, - insertSpaceAfterConstructor: false, - insertSpaceAfterCommaDelimiter: true, - insertSpaceAfterSemicolonInForStatements: true, - insertSpaceBeforeAndAfterBinaryOperators: true, - insertSpaceAfterKeywordsInControlFlowStatements: true, - insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, - insertSpaceBeforeFunctionParenthesis: false, - placeOpenBraceOnNewLineForFunctions: false, - placeOpenBraceOnNewLineForControlBlocks: false, - }; - } - server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { - for (var key in source) { - if (ts.hasProperty(source, key)) { - target[key] = source[key]; - } - } - } - server.mergeMaps = mergeMaps; - function removeItemFromSet(items, itemToRemove) { - if (items.length === 0) { - return; - } - var index = items.indexOf(itemToRemove); - if (index < 0) { - return; - } - if (index === items.length - 1) { - items.pop(); - } - else { - items[index] = items.pop(); - } - } - server.removeItemFromSet = removeItemFromSet; - function toNormalizedPath(fileName) { - return ts.normalizePath(fileName); - } - server.toNormalizedPath = toNormalizedPath; - function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { - var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); - return getCanonicalFileName(f); - } - server.normalizedPathToPath = normalizedPathToPath; - function asNormalizedPath(fileName) { - return fileName; - } - server.asNormalizedPath = asNormalizedPath; - function createNormalizedPathMap() { - var map = Object.create(null); - return { - get: function (path) { - return map[path]; - }, - set: function (path, value) { - map[path] = value; - }, - contains: function (path) { - return ts.hasProperty(map, path); - }, - remove: function (path) { - delete map[path]; - } - }; - } - server.createNormalizedPathMap = createNormalizedPathMap; - function isInferredProjectName(name) { - return /dev\/null\/inferredProject\d+\*/.test(name); - } - server.isInferredProjectName = isInferredProjectName; - function makeInferredProjectName(counter) { - return "/dev/null/inferredProject" + counter + "*"; - } - server.makeInferredProjectName = makeInferredProjectName; - function toSortedReadonlyArray(arr) { - arr.sort(); - return arr; - } - server.toSortedReadonlyArray = toSortedReadonlyArray; - var ThrottledOperations = (function () { - function ThrottledOperations(host) { - this.host = host; - this.pendingTimeouts = ts.createMap(); - } - ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); - } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); - }; - ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; - cb(); - }; - return ThrottledOperations; - }()); - server.ThrottledOperations = ThrottledOperations; - var GcTimer = (function () { - function GcTimer(host, delay, logger) { - this.host = host; - this.delay = delay; - this.logger = logger; - } - GcTimer.prototype.scheduleCollect = function () { - if (!this.host.gc || this.timerId != undefined) { - return; - } - this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); - }; - GcTimer.run = function (self) { - self.timerId = undefined; - var log = self.logger.hasLevel(LogLevel.requestTime); - var before = log && self.host.getMemoryUsage(); - self.host.gc(); - if (log) { - var after = self.host.getMemoryUsage(); - self.logger.perftrc("GC::before " + before + ", after " + after); - } - }; - return GcTimer; - }()); - server.GcTimer = GcTimer; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; (function (ts) { function trace(host) { host.trace(ts.formatMessage.apply(undefined, arguments)); @@ -65709,6 +65515,1047 @@ var ts; initializeServices(); })(ts || (ts = {})); var ts; +(function (ts) { + var server; + (function (server) { + var LogLevel; + (function (LogLevel) { + LogLevel[LogLevel["terse"] = 0] = "terse"; + LogLevel[LogLevel["normal"] = 1] = "normal"; + LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; + LogLevel[LogLevel["verbose"] = 3] = "verbose"; + })(LogLevel = server.LogLevel || (server.LogLevel = {})); + server.emptyArray = []; + var Msg; + (function (Msg) { + Msg.Err = "Err"; + Msg.Info = "Info"; + Msg.Perf = "Perf"; + })(Msg = server.Msg || (server.Msg = {})); + function getProjectRootPath(project) { + switch (project.projectKind) { + case server.ProjectKind.Configured: + return ts.getDirectoryPath(project.getProjectName()); + case server.ProjectKind.Inferred: + return ""; + case server.ProjectKind.External: + var projectName = ts.normalizeSlashes(project.getProjectName()); + return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; + } + } + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { + return { + projectName: project.getProjectName(), + fileNames: project.getFileNames(true), + compilerOptions: project.getCompilerOptions(), + typeAcquisition: typeAcquisition, + unresolvedImports: unresolvedImports, + projectRootPath: getProjectRootPath(project), + cachePath: cachePath, + kind: "discover" + }; + } + server.createInstallTypingsRequest = createInstallTypingsRequest; + var Errors; + (function (Errors) { + function ThrowNoProject() { + throw new Error("No Project."); + } + Errors.ThrowNoProject = ThrowNoProject; + function ThrowProjectLanguageServiceDisabled() { + throw new Error("The project's language service is disabled."); + } + Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; + function ThrowProjectDoesNotContainDocument(fileName, project) { + throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); + } + Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; + })(Errors = server.Errors || (server.Errors = {})); + function getDefaultFormatCodeSettings(host) { + return { + indentSize: 4, + tabSize: 4, + newLineCharacter: host.newLine || "\n", + convertTabsToSpaces: true, + indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, + insertSpaceAfterCommaDelimiter: true, + insertSpaceAfterSemicolonInForStatements: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterKeywordsInControlFlowStatements: true, + insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, + placeOpenBraceOnNewLineForFunctions: false, + placeOpenBraceOnNewLineForControlBlocks: false, + }; + } + server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; + function mergeMaps(target, source) { + for (var key in source) { + if (ts.hasProperty(source, key)) { + target[key] = source[key]; + } + } + } + server.mergeMaps = mergeMaps; + function removeItemFromSet(items, itemToRemove) { + if (items.length === 0) { + return; + } + var index = items.indexOf(itemToRemove); + if (index < 0) { + return; + } + if (index === items.length - 1) { + items.pop(); + } + else { + items[index] = items.pop(); + } + } + server.removeItemFromSet = removeItemFromSet; + function toNormalizedPath(fileName) { + return ts.normalizePath(fileName); + } + server.toNormalizedPath = toNormalizedPath; + function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { + var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); + return getCanonicalFileName(f); + } + server.normalizedPathToPath = normalizedPathToPath; + function asNormalizedPath(fileName) { + return fileName; + } + server.asNormalizedPath = asNormalizedPath; + function createNormalizedPathMap() { + var map = Object.create(null); + return { + get: function (path) { + return map[path]; + }, + set: function (path, value) { + map[path] = value; + }, + contains: function (path) { + return ts.hasProperty(map, path); + }, + remove: function (path) { + delete map[path]; + } + }; + } + server.createNormalizedPathMap = createNormalizedPathMap; + function isInferredProjectName(name) { + return /dev\/null\/inferredProject\d+\*/.test(name); + } + server.isInferredProjectName = isInferredProjectName; + function makeInferredProjectName(counter) { + return "/dev/null/inferredProject" + counter + "*"; + } + server.makeInferredProjectName = makeInferredProjectName; + function toSortedReadonlyArray(arr) { + arr.sort(); + return arr; + } + server.toSortedReadonlyArray = toSortedReadonlyArray; + var ThrottledOperations = (function () { + function ThrottledOperations(host) { + this.host = host; + this.pendingTimeouts = ts.createMap(); + } + ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { + if (ts.hasProperty(this.pendingTimeouts, operationId)) { + this.host.clearTimeout(this.pendingTimeouts[operationId]); + } + this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); + }; + ThrottledOperations.run = function (self, operationId, cb) { + delete self.pendingTimeouts[operationId]; + cb(); + }; + return ThrottledOperations; + }()); + server.ThrottledOperations = ThrottledOperations; + var GcTimer = (function () { + function GcTimer(host, delay, logger) { + this.host = host; + this.delay = delay; + this.logger = logger; + } + GcTimer.prototype.scheduleCollect = function () { + if (!this.host.gc || this.timerId != undefined) { + return; + } + this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); + }; + GcTimer.run = function (self) { + self.timerId = undefined; + var log = self.logger.hasLevel(LogLevel.requestTime); + var before = log && self.host.getMemoryUsage(); + self.host.gc(); + if (log) { + var after = self.host.getMemoryUsage(); + self.logger.perftrc("GC::before " + before + ", after " + after); + } + }; + return GcTimer; + }()); + server.GcTimer = GcTimer; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var lineCollectionCapacity = 4; + var CharRangeSection; + (function (CharRangeSection) { + CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; + CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; + CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; + CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; + CharRangeSection[CharRangeSection["End"] = 4] = "End"; + CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; + })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); + var BaseLineIndexWalker = (function () { + function BaseLineIndexWalker() { + this.goSubtree = true; + this.done = false; + } + BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { + }; + return BaseLineIndexWalker; + }()); + var EditWalker = (function (_super) { + __extends(EditWalker, _super); + function EditWalker() { + var _this = _super.call(this) || this; + _this.lineIndex = new LineIndex(); + _this.endBranch = []; + _this.state = CharRangeSection.Entire; + _this.initialText = ""; + _this.trailingText = ""; + _this.suppressTrailingText = false; + _this.lineIndex.root = new LineNode(); + _this.startPath = [_this.lineIndex.root]; + _this.stack = [_this.lineIndex.root]; + return _this; + } + EditWalker.prototype.insertLines = function (insertedText) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent; + var lastZeroCount; + for (var k = this.endBranch.length - 1; k >= 0; k--) { + this.endBranch[k].updateCounts(); + if (this.endBranch[k].charCount() === 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + if (len > 0) { + leafNode.text = lines[0]; + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1; i < lines.length; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + } + else { + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + return this.lineIndex; + }; + EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { + if (lineCollection === this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + this.stack.length--; + return undefined; + }; + EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { + var currentNode = this.stack[this.stack.length - 1]; + if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + var child; + function fresh(node) { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else + return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state !== CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state === CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state !== CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state !== CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state !== CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + }; + EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { + if (this.state === CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state === CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + }; + return EditWalker; + }(BaseLineIndexWalker)); + var TextChange = (function () { + function TextChange(pos, deleteLen, insertedText) { + this.pos = pos; + this.deleteLen = deleteLen; + this.insertedText = insertedText; + } + TextChange.prototype.getTextChangeRange = function () { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); + }; + return TextChange; + }()); + server.TextChange = TextChange; + var ScriptVersionCache = (function () { + function ScriptVersionCache() { + this.changes = []; + this.versions = new Array(ScriptVersionCache.maxVersions); + this.minVersion = 0; + this.currentVersion = 0; + } + ScriptVersionCache.prototype.versionToIndex = function (version) { + if (version < this.minVersion || version > this.currentVersion) { + return undefined; + } + return version % ScriptVersionCache.maxVersions; + }; + ScriptVersionCache.prototype.currentVersionToIndex = function () { + return this.currentVersion % ScriptVersionCache.maxVersions; + }; + 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))) { + this.getSnapshot(); + } + }; + ScriptVersionCache.prototype.latest = function () { + return this.versions[this.currentVersionToIndex()]; + }; + ScriptVersionCache.prototype.latestVersion = function () { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + }; + ScriptVersionCache.prototype.reloadFromFile = function (filename) { + var content = this.host.readFile(filename); + if (!content) { + content = ""; + } + this.reload(content); + }; + ScriptVersionCache.prototype.reload = function (script) { + this.currentVersion++; + this.changes = []; + var snap = new LineIndexSnapshot(this.currentVersion, this); + for (var i = 0; i < this.versions.length; i++) { + this.versions[i] = undefined; + } + this.versions[this.currentVersionToIndex()] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + this.minVersion = this.currentVersion; + }; + ScriptVersionCache.prototype.getSnapshot = function () { + var snap = this.versions[this.currentVersionToIndex()]; + if (this.changes.length > 0) { + var snapIndex = snap.index; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[this.currentVersionToIndex()] = snap; + this.changes = []; + if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { + this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; + } + } + return snap; + }; + ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[this.versionToIndex(i)]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + }; + ScriptVersionCache.fromString = function (host, script) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + svc.host = host; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + }; + return ScriptVersionCache; + }()); + ScriptVersionCache.changeNumberThreshold = 8; + ScriptVersionCache.changeLengthThreshold = 256; + ScriptVersionCache.maxVersions = 8; + server.ScriptVersionCache = ScriptVersionCache; + var LineIndexSnapshot = (function () { + function LineIndexSnapshot(version, cache) { + this.version = version; + this.cache = cache; + this.changesSincePreviousVersion = []; + } + LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + }; + LineIndexSnapshot.prototype.getLength = function () { + return this.index.root.charCount(); + }; + LineIndexSnapshot.prototype.getLineStartPositions = function () { + var starts = [-1]; + var count = 1; + var pos = 0; + this.index.every(function (ll) { + starts[count] = pos; + count++; + pos += ll.text.length; + return true; + }, 0); + return starts; + }; + LineIndexSnapshot.prototype.getLineMapper = function () { + var _this = this; + return function (line) { + return _this.index.lineNumberToInfo(line).offset; + }; + }; + LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + }; + LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } + }; + return LineIndexSnapshot; + }()); + server.LineIndexSnapshot = LineIndexSnapshot; + var LineIndex = (function () { + function LineIndex() { + this.checkEdits = false; + } + LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + }; + LineIndex.prototype.lineNumberToInfo = function (lineNumber) { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + offset: this.root.charCount() + }; + } + }; + LineIndex.prototype.load = function (lines) { + if (lines.length > 0) { + var leaves = []; + for (var i = 0; i < lines.length; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + }; + LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { + this.root.walk(rangeStart, rangeLength, walkFns); + }; + LineIndex.prototype.getText = function (rangeStart, rangeLength) { + var accum = ""; + if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + }; + LineIndex.prototype.getLength = function () { + return this.root.charCount(); + }; + LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + }; + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + }; + LineIndex.prototype.edit = function (pos, deleteLength, newText) { + function editFlat(source, s, dl, nt) { + if (nt === void 0) { nt = ""; } + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() === 0) { + if (newText !== undefined) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + var checkText = void 0; + if (this.checkEdits) { + checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (pos >= this.root.charCount()) { + pos = this.root.charCount() - 1; + var endString = this.getText(pos, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + deleteLength = 0; + walker.suppressTrailingText = true; + } + else if (deleteLength > 0) { + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.offset === 0))) { + deleteLength += lineInfo.text.length; + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + if (pos < this.root.charCount()) { + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + } + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + }; + LineIndex.buildTreeFromBottom = function (nodes) { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length === 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + }; + LineIndex.linesFromText = function (text) { + var lineStarts = ts.computeLineStarts(text); + if (lineStarts.length === 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + }; + return LineIndex; + }()); + server.LineIndex = LineIndex; + var LineNode = (function () { + function LineNode() { + this.totalChars = 0; + this.totalLines = 0; + this.children = []; + } + LineNode.prototype.isLeaf = function () { + return false; + }; + LineNode.prototype.updateCounts = function () { + this.totalChars = 0; + this.totalLines = 0; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + }; + LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + }; + LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + }; + LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + }; + LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset, + }; + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; + } + }; + LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + }; + LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { + var child; + var relativeLineNumber = lineNumber; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + }; + LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { + var child; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + }; + }; + LineNode.prototype.splitAfter = function (childIndex) { + var splitNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex]); + childIndex++; + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + }; + LineNode.prototype.remove = function (child) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + }; + LineNode.prototype.findChildIndex = function (child) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] !== child) && (childIndex < clen)) + childIndex++; + return childIndex; + }; + LineNode.prototype.insertAt = function (child, nodes) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; + } + var splitNodes = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex]); + nodeIndex++; + if (splitNode.children.length === lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (var i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length === 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i].updateCounts(); + } + return splitNodes; + } + }; + LineNode.prototype.add = function (collection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + }; + LineNode.prototype.charCount = function () { + return this.totalChars; + }; + LineNode.prototype.lineCount = function () { + return this.totalLines; + }; + return LineNode; + }()); + server.LineNode = LineNode; + var LineLeaf = (function () { + function LineLeaf(text) { + this.text = text; + } + LineLeaf.prototype.isLeaf = function () { + return true; + }; + LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { + walkFns.leaf(rangeStart, rangeLength, this); + }; + LineLeaf.prototype.charCount = function () { + return this.text.length; + }; + LineLeaf.prototype.lineCount = function () { + return 1; + }; + return LineLeaf; + }()); + server.LineLeaf = LineLeaf; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var server; (function (server) { @@ -69910,853 +70757,6 @@ var ts; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; -(function (ts) { - var server; - (function (server) { - var lineCollectionCapacity = 4; - var CharRangeSection; - (function (CharRangeSection) { - CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; - CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; - CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; - CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; - CharRangeSection[CharRangeSection["End"] = 4] = "End"; - CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; - })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); - var BaseLineIndexWalker = (function () { - function BaseLineIndexWalker() { - this.goSubtree = true; - this.done = false; - } - BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { - }; - return BaseLineIndexWalker; - }()); - var EditWalker = (function (_super) { - __extends(EditWalker, _super); - function EditWalker() { - var _this = _super.call(this) || this; - _this.lineIndex = new LineIndex(); - _this.endBranch = []; - _this.state = CharRangeSection.Entire; - _this.initialText = ""; - _this.trailingText = ""; - _this.suppressTrailingText = false; - _this.lineIndex.root = new LineNode(); - _this.startPath = [_this.lineIndex.root]; - _this.stack = [_this.lineIndex.root]; - return _this; - } - EditWalker.prototype.insertLines = function (insertedText) { - if (this.suppressTrailingText) { - this.trailingText = ""; - } - if (insertedText) { - insertedText = this.initialText + insertedText + this.trailingText; - } - else { - insertedText = this.initialText + this.trailingText; - } - var lm = LineIndex.linesFromText(insertedText); - var lines = lm.lines; - if (lines.length > 1) { - if (lines[lines.length - 1] == "") { - lines.length--; - } - } - var branchParent; - var lastZeroCount; - for (var k = this.endBranch.length - 1; k >= 0; k--) { - this.endBranch[k].updateCounts(); - if (this.endBranch[k].charCount() === 0) { - lastZeroCount = this.endBranch[k]; - if (k > 0) { - branchParent = this.endBranch[k - 1]; - } - else { - branchParent = this.branchNode; - } - } - } - if (lastZeroCount) { - branchParent.remove(lastZeroCount); - } - var insertionNode = this.startPath[this.startPath.length - 2]; - var leafNode = this.startPath[this.startPath.length - 1]; - var len = lines.length; - if (len > 0) { - leafNode.text = lines[0]; - if (len > 1) { - var insertedNodes = new Array(len - 1); - var startNode = leafNode; - for (var i = 1; i < lines.length; i++) { - insertedNodes[i - 1] = new LineLeaf(lines[i]); - } - var pathIndex = this.startPath.length - 2; - while (pathIndex >= 0) { - insertionNode = this.startPath[pathIndex]; - insertedNodes = insertionNode.insertAt(startNode, insertedNodes); - pathIndex--; - startNode = insertionNode; - } - var insertedNodesLen = insertedNodes.length; - while (insertedNodesLen > 0) { - var newRoot = new LineNode(); - newRoot.add(this.lineIndex.root); - insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); - insertedNodesLen = insertedNodes.length; - this.lineIndex.root = newRoot; - } - this.lineIndex.root.updateCounts(); - } - else { - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); - } - } - } - else { - insertionNode.remove(leafNode); - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); - } - } - return this.lineIndex; - }; - EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { - if (lineCollection === this.lineCollectionAtBranch) { - this.state = CharRangeSection.End; - } - this.stack.length--; - return undefined; - }; - EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { - var currentNode = this.stack[this.stack.length - 1]; - if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { - this.state = CharRangeSection.Start; - this.branchNode = currentNode; - this.lineCollectionAtBranch = lineCollection; - } - var child; - function fresh(node) { - if (node.isLeaf()) { - return new LineLeaf(""); - } - else - return new LineNode(); - } - switch (nodeType) { - case CharRangeSection.PreStart: - this.goSubtree = false; - if (this.state !== CharRangeSection.End) { - currentNode.add(lineCollection); - } - break; - case CharRangeSection.Start: - if (this.state === CharRangeSection.End) { - this.goSubtree = false; - } - else { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - break; - case CharRangeSection.Entire: - if (this.state !== CharRangeSection.End) { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.Mid: - this.goSubtree = false; - break; - case CharRangeSection.End: - if (this.state !== CharRangeSection.End) { - this.goSubtree = false; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.PostEnd: - this.goSubtree = false; - if (this.state !== CharRangeSection.Start) { - currentNode.add(lineCollection); - } - break; - } - if (this.goSubtree) { - this.stack[this.stack.length] = child; - } - return lineCollection; - }; - EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { - if (this.state === CharRangeSection.Start) { - this.initialText = ll.text.substring(0, relativeStart); - } - else if (this.state === CharRangeSection.Entire) { - this.initialText = ll.text.substring(0, relativeStart); - this.trailingText = ll.text.substring(relativeStart + relativeLength); - } - else { - this.trailingText = ll.text.substring(relativeStart + relativeLength); - } - }; - return EditWalker; - }(BaseLineIndexWalker)); - var TextChange = (function () { - function TextChange(pos, deleteLen, insertedText) { - this.pos = pos; - this.deleteLen = deleteLen; - this.insertedText = insertedText; - } - TextChange.prototype.getTextChangeRange = function () { - return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); - }; - return TextChange; - }()); - server.TextChange = TextChange; - var ScriptVersionCache = (function () { - function ScriptVersionCache() { - this.changes = []; - this.versions = new Array(ScriptVersionCache.maxVersions); - this.minVersion = 0; - this.currentVersion = 0; - } - ScriptVersionCache.prototype.versionToIndex = function (version) { - if (version < this.minVersion || version > this.currentVersion) { - return undefined; - } - return version % ScriptVersionCache.maxVersions; - }; - ScriptVersionCache.prototype.currentVersionToIndex = function () { - return this.currentVersion % ScriptVersionCache.maxVersions; - }; - 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))) { - this.getSnapshot(); - } - }; - ScriptVersionCache.prototype.latest = function () { - return this.versions[this.currentVersionToIndex()]; - }; - ScriptVersionCache.prototype.latestVersion = function () { - if (this.changes.length > 0) { - this.getSnapshot(); - } - return this.currentVersion; - }; - ScriptVersionCache.prototype.reloadFromFile = function (filename) { - var content = this.host.readFile(filename); - if (!content) { - content = ""; - } - this.reload(content); - }; - ScriptVersionCache.prototype.reload = function (script) { - this.currentVersion++; - this.changes = []; - var snap = new LineIndexSnapshot(this.currentVersion, this); - for (var i = 0; i < this.versions.length; i++) { - this.versions[i] = undefined; - } - this.versions[this.currentVersionToIndex()] = snap; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - this.minVersion = this.currentVersion; - }; - ScriptVersionCache.prototype.getSnapshot = function () { - var snap = this.versions[this.currentVersionToIndex()]; - if (this.changes.length > 0) { - var snapIndex = snap.index; - for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { - var change = _a[_i]; - snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); - } - snap = new LineIndexSnapshot(this.currentVersion + 1, this); - snap.index = snapIndex; - snap.changesSincePreviousVersion = this.changes; - this.currentVersion = snap.version; - this.versions[this.currentVersionToIndex()] = snap; - this.changes = []; - if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { - this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; - } - } - return snap; - }; - ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { - if (oldVersion < newVersion) { - if (oldVersion >= this.minVersion) { - var textChangeRanges = []; - for (var i = oldVersion + 1; i <= newVersion; i++) { - var snap = this.versions[this.versionToIndex(i)]; - for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { - var textChange = _a[_i]; - textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); - } - } - return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); - } - else { - return undefined; - } - } - else { - return ts.unchangedTextChangeRange; - } - }; - ScriptVersionCache.fromString = function (host, script) { - var svc = new ScriptVersionCache(); - var snap = new LineIndexSnapshot(0, svc); - svc.versions[svc.currentVersion] = snap; - svc.host = host; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - return svc; - }; - return ScriptVersionCache; - }()); - ScriptVersionCache.changeNumberThreshold = 8; - ScriptVersionCache.changeLengthThreshold = 256; - ScriptVersionCache.maxVersions = 8; - server.ScriptVersionCache = ScriptVersionCache; - var LineIndexSnapshot = (function () { - function LineIndexSnapshot(version, cache) { - this.version = version; - this.cache = cache; - this.changesSincePreviousVersion = []; - } - LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { - return this.index.getText(rangeStart, rangeEnd - rangeStart); - }; - LineIndexSnapshot.prototype.getLength = function () { - return this.index.root.charCount(); - }; - LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [-1]; - var count = 1; - var pos = 0; - this.index.every(function (ll) { - starts[count] = pos; - count++; - pos += ll.text.length; - return true; - }, 0); - return starts; - }; - LineIndexSnapshot.prototype.getLineMapper = function () { - var _this = this; - return function (line) { - return _this.index.lineNumberToInfo(line).offset; - }; - }; - LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - if (this.version <= scriptVersion) { - return ts.unchangedTextChangeRange; - } - else { - return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); - } - }; - LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { - return this.getTextChangeRangeSinceVersion(oldSnapshot.version); - } - }; - return LineIndexSnapshot; - }()); - server.LineIndexSnapshot = LineIndexSnapshot; - var LineIndex = (function () { - function LineIndex() { - this.checkEdits = false; - } - LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { - return this.root.charOffsetToLineNumberAndPos(1, charOffset); - }; - LineIndex.prototype.lineNumberToInfo = function (lineNumber) { - var lineCount = this.root.lineCount(); - if (lineNumber <= lineCount) { - var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); - lineInfo.line = lineNumber; - return lineInfo; - } - else { - return { - line: lineNumber, - offset: this.root.charCount() - }; - } - }; - LineIndex.prototype.load = function (lines) { - if (lines.length > 0) { - var leaves = []; - for (var i = 0; i < lines.length; i++) { - leaves[i] = new LineLeaf(lines[i]); - } - this.root = LineIndex.buildTreeFromBottom(leaves); - } - else { - this.root = new LineNode(); - } - }; - LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { - this.root.walk(rangeStart, rangeLength, walkFns); - }; - LineIndex.prototype.getText = function (rangeStart, rangeLength) { - var accum = ""; - if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { - this.walk(rangeStart, rangeLength, { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); - } - }); - } - return accum; - }; - LineIndex.prototype.getLength = function () { - return this.root.charCount(); - }; - LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { - if (!rangeEnd) { - rangeEnd = this.root.charCount(); - } - var walkFns = { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - if (!f(ll, relativeStart, relativeLength)) { - this.done = true; - } - } - }; - this.walk(rangeStart, rangeEnd - rangeStart, walkFns); - return !walkFns.done; - }; - LineIndex.prototype.edit = function (pos, deleteLength, newText) { - function editFlat(source, s, dl, nt) { - if (nt === void 0) { nt = ""; } - return source.substring(0, s) + nt + source.substring(s + dl, source.length); - } - if (this.root.charCount() === 0) { - if (newText !== undefined) { - this.load(LineIndex.linesFromText(newText).lines); - return this; - } - } - else { - var checkText = void 0; - if (this.checkEdits) { - checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); - } - var walker = new EditWalker(); - if (pos >= this.root.charCount()) { - pos = this.root.charCount() - 1; - var endString = this.getText(pos, 1); - if (newText) { - newText = endString + newText; - } - else { - newText = endString; - } - deleteLength = 0; - walker.suppressTrailingText = true; - } - else if (deleteLength > 0) { - var e = pos + deleteLength; - var lineInfo = this.charOffsetToLineNumberAndPos(e); - if ((lineInfo && (lineInfo.offset === 0))) { - deleteLength += lineInfo.text.length; - if (newText) { - newText = newText + lineInfo.text; - } - else { - newText = lineInfo.text; - } - } - } - if (pos < this.root.charCount()) { - this.root.walk(pos, deleteLength, walker); - walker.insertLines(newText); - } - if (this.checkEdits) { - var updatedText = this.getText(0, this.root.charCount()); - ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); - } - return walker.lineIndex; - } - }; - LineIndex.buildTreeFromBottom = function (nodes) { - var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); - var interiorNodes = []; - var nodeIndex = 0; - for (var i = 0; i < nodeCount; i++) { - interiorNodes[i] = new LineNode(); - var charCount = 0; - var lineCount = 0; - for (var j = 0; j < lineCollectionCapacity; j++) { - if (nodeIndex < nodes.length) { - interiorNodes[i].add(nodes[nodeIndex]); - charCount += nodes[nodeIndex].charCount(); - lineCount += nodes[nodeIndex].lineCount(); - } - else { - break; - } - nodeIndex++; - } - interiorNodes[i].totalChars = charCount; - interiorNodes[i].totalLines = lineCount; - } - if (interiorNodes.length === 1) { - return interiorNodes[0]; - } - else { - return this.buildTreeFromBottom(interiorNodes); - } - }; - LineIndex.linesFromText = function (text) { - var lineStarts = ts.computeLineStarts(text); - if (lineStarts.length === 0) { - return { lines: [], lineMap: lineStarts }; - } - var lines = new Array(lineStarts.length); - var lc = lineStarts.length - 1; - for (var lmi = 0; lmi < lc; lmi++) { - lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); - } - var endText = text.substring(lineStarts[lc]); - if (endText.length > 0) { - lines[lc] = endText; - } - else { - lines.length--; - } - return { lines: lines, lineMap: lineStarts }; - }; - return LineIndex; - }()); - server.LineIndex = LineIndex; - var LineNode = (function () { - function LineNode() { - this.totalChars = 0; - this.totalLines = 0; - this.children = []; - } - LineNode.prototype.isLeaf = function () { - return false; - }; - LineNode.prototype.updateCounts = function () { - this.totalChars = 0; - this.totalLines = 0; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - this.totalChars += child.charCount(); - this.totalLines += child.lineCount(); - } - }; - LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { - if (walkFns.pre) { - walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - if (walkFns.goSubtree) { - this.children[childIndex].walk(rangeStart, rangeLength, walkFns); - if (walkFns.post) { - walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - } - else { - walkFns.goSubtree = true; - } - return walkFns.done; - }; - LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { - if (walkFns.pre && (!walkFns.done)) { - walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); - walkFns.goSubtree = true; - } - }; - LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { - var childIndex = 0; - var child = this.children[0]; - var childCharCount = child.charCount(); - var adjustedStart = rangeStart; - while (adjustedStart >= childCharCount) { - this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); - adjustedStart -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if ((adjustedStart + rangeLength) <= childCharCount) { - if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { - return; - } - } - else { - if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { - return; - } - var adjustedLength = rangeLength - (childCharCount - adjustedStart); - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - while (adjustedLength > childCharCount) { - if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { - return; - } - adjustedLength -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if (adjustedLength > 0) { - if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { - return; - } - } - } - if (walkFns.pre) { - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var ej = childIndex + 1; ej < clen; ej++) { - this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); - } - } - } - }; - LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { - var childInfo = this.childFromCharOffset(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset, - }; - } - else if (childInfo.childIndex < this.children.length) { - if (childInfo.child.isLeaf()) { - return { - line: childInfo.lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); - } - } - else { - var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; - } - }; - LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { - var childInfo = this.childFromLineNumber(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset - }; - } - else if (childInfo.child.isLeaf()) { - return { - line: lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); - } - }; - LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { - var child; - var relativeLineNumber = lineNumber; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - var childLineCount = child.lineCount(); - if (childLineCount >= relativeLineNumber) { - break; - } - else { - relativeLineNumber -= childLineCount; - charOffset += child.charCount(); - } - } - return { - child: child, - childIndex: i, - relativeLineNumber: relativeLineNumber, - charOffset: charOffset - }; - }; - LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { - var child; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - if (child.charCount() > charOffset) { - break; - } - else { - charOffset -= child.charCount(); - lineNumber += child.lineCount(); - } - } - return { - child: child, - childIndex: i, - charOffset: charOffset, - lineNumber: lineNumber - }; - }; - LineNode.prototype.splitAfter = function (childIndex) { - var splitNode; - var clen = this.children.length; - childIndex++; - var endLength = childIndex; - if (childIndex < clen) { - splitNode = new LineNode(); - while (childIndex < clen) { - splitNode.add(this.children[childIndex]); - childIndex++; - } - splitNode.updateCounts(); - } - this.children.length = endLength; - return splitNode; - }; - LineNode.prototype.remove = function (child) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var i = childIndex; i < (clen - 1); i++) { - this.children[i] = this.children[i + 1]; - } - } - this.children.length--; - }; - LineNode.prototype.findChildIndex = function (child) { - var childIndex = 0; - var clen = this.children.length; - while ((this.children[childIndex] !== child) && (childIndex < clen)) - childIndex++; - return childIndex; - }; - LineNode.prototype.insertAt = function (child, nodes) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - var nodeCount = nodes.length; - if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { - this.add(nodes[0]); - this.updateCounts(); - return []; - } - else { - var shiftNode = this.splitAfter(childIndex); - var nodeIndex = 0; - childIndex++; - while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { - this.children[childIndex] = nodes[nodeIndex]; - childIndex++; - nodeIndex++; - } - var splitNodes = []; - var splitNodeCount = 0; - if (nodeIndex < nodeCount) { - splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); - splitNodes = new Array(splitNodeCount); - var splitNodeIndex = 0; - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i] = new LineNode(); - } - var splitNode = splitNodes[0]; - while (nodeIndex < nodeCount) { - splitNode.add(nodes[nodeIndex]); - nodeIndex++; - if (splitNode.children.length === lineCollectionCapacity) { - splitNodeIndex++; - splitNode = splitNodes[splitNodeIndex]; - } - } - for (var i = splitNodes.length - 1; i >= 0; i--) { - if (splitNodes[i].children.length === 0) { - splitNodes.length--; - } - } - } - if (shiftNode) { - splitNodes[splitNodes.length] = shiftNode; - } - this.updateCounts(); - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i].updateCounts(); - } - return splitNodes; - } - }; - LineNode.prototype.add = function (collection) { - this.children[this.children.length] = collection; - return (this.children.length < lineCollectionCapacity); - }; - LineNode.prototype.charCount = function () { - return this.totalChars; - }; - LineNode.prototype.lineCount = function () { - return this.totalLines; - }; - return LineNode; - }()); - server.LineNode = LineNode; - var LineLeaf = (function () { - function LineLeaf(text) { - this.text = text; - } - LineLeaf.prototype.isLeaf = function () { - return true; - }; - LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { - walkFns.leaf(rangeStart, rangeLength, this); - }; - LineLeaf.prototype.charCount = function () { - return this.text.length; - }; - LineLeaf.prototype.lineCount = function () { - return 1; - }; - return LineLeaf; - }()); - server.LineLeaf = LineLeaf; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; (function (ts) { var server; (function (server) { diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 25ed333b299..232684eedc6 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -1,875 +1,18 @@ -/// -declare namespace ts.server.protocol { - namespace CommandTypes { - type Brace = "brace"; - type BraceFull = "brace-full"; - type BraceCompletion = "braceCompletion"; - type Change = "change"; - type Close = "close"; - type Completions = "completions"; - type CompletionsFull = "completions-full"; - type CompletionDetails = "completionEntryDetails"; - type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; - type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; - type Configure = "configure"; - type Definition = "definition"; - type DefinitionFull = "definition-full"; - type Implementation = "implementation"; - type ImplementationFull = "implementation-full"; - type Exit = "exit"; - type Format = "format"; - type Formatonkey = "formatonkey"; - type FormatFull = "format-full"; - type FormatonkeyFull = "formatonkey-full"; - type FormatRangeFull = "formatRange-full"; - type Geterr = "geterr"; - type GeterrForProject = "geterrForProject"; - type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; - type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; - type NavBar = "navbar"; - type NavBarFull = "navbar-full"; - type Navto = "navto"; - type NavtoFull = "navto-full"; - type NavTree = "navtree"; - type NavTreeFull = "navtree-full"; - type Occurrences = "occurrences"; - type DocumentHighlights = "documentHighlights"; - type DocumentHighlightsFull = "documentHighlights-full"; - type Open = "open"; - type Quickinfo = "quickinfo"; - type QuickinfoFull = "quickinfo-full"; - type References = "references"; - type ReferencesFull = "references-full"; - type Reload = "reload"; - type Rename = "rename"; - type RenameInfoFull = "rename-full"; - type RenameLocationsFull = "renameLocations-full"; - type Saveto = "saveto"; - type SignatureHelp = "signatureHelp"; - type SignatureHelpFull = "signatureHelp-full"; - type TypeDefinition = "typeDefinition"; - type ProjectInfo = "projectInfo"; - type ReloadProjects = "reloadProjects"; - type Unknown = "unknown"; - type OpenExternalProject = "openExternalProject"; - type OpenExternalProjects = "openExternalProjects"; - type CloseExternalProject = "closeExternalProject"; - type SynchronizeProjectList = "synchronizeProjectList"; - type ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; - type EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; - type Cleanup = "cleanup"; - type OutliningSpans = "outliningSpans"; - type TodoComments = "todoComments"; - type Indentation = "indentation"; - type DocCommentTemplate = "docCommentTemplate"; - type CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; - type NameOrDottedNameSpan = "nameOrDottedNameSpan"; - type BreakpointStatement = "breakpointStatement"; - type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; - type GetCodeFixes = "getCodeFixes"; - type GetCodeFixesFull = "getCodeFixes-full"; - type GetSupportedCodeFixes = "getSupportedCodeFixes"; - } - interface Message { - seq: number; - type: "request" | "response" | "event"; - } - interface Request extends Message { - command: string; - arguments?: any; - } - interface ReloadProjectsRequest extends Message { - command: CommandTypes.ReloadProjects; - } - interface Event extends Message { - event: string; - body?: any; - } - interface Response extends Message { - request_seq: number; - success: boolean; - command: string; - message?: string; - body?: any; - } - interface FileRequestArgs { - file: string; - projectFileName?: string; - } - interface DocCommentTemplateRequest extends FileLocationRequest { - command: CommandTypes.DocCommentTemplate; - } - interface DocCommandTemplateResponse extends Response { - body?: TextInsertion; - } - interface TodoCommentRequest extends FileRequest { - command: CommandTypes.TodoComments; - arguments: TodoCommentRequestArgs; - } - interface TodoCommentRequestArgs extends FileRequestArgs { - descriptors: TodoCommentDescriptor[]; - } - interface TodoCommentsResponse extends Response { - body?: TodoComment[]; - } - interface OutliningSpansRequest extends FileRequest { - command: CommandTypes.OutliningSpans; - } - interface OutliningSpansResponse extends Response { - body?: OutliningSpan[]; - } - interface IndentationRequest extends FileLocationRequest { - command: CommandTypes.Indentation; - arguments: IndentationRequestArgs; - } - interface IndentationResponse extends Response { - body?: IndentationResult; - } - interface IndentationResult { - position: number; - indentation: number; - } - interface IndentationRequestArgs extends FileLocationRequestArgs { - options?: EditorSettings; - } - interface ProjectInfoRequestArgs extends FileRequestArgs { - needFileNameList: boolean; - } - interface ProjectInfoRequest extends Request { - command: CommandTypes.ProjectInfo; - arguments: ProjectInfoRequestArgs; - } - interface CompilerOptionsDiagnosticsRequest extends Request { - arguments: CompilerOptionsDiagnosticsRequestArgs; - } - interface CompilerOptionsDiagnosticsRequestArgs { - projectFileName: string; - } - interface ProjectInfo { - configFileName: string; - fileNames?: string[]; - languageServiceDisabled?: boolean; - } - interface DiagnosticWithLinePosition { - message: string; - start: number; - length: number; - startLocation: Location; - endLocation: Location; - category: string; - code: number; - } - interface ProjectInfoResponse extends Response { - body?: ProjectInfo; - } - interface FileRequest extends Request { - arguments: FileRequestArgs; - } - interface FileLocationRequestArgs extends FileRequestArgs { - line: number; - offset: number; - position?: number; - } - interface CodeFixRequest extends Request { - command: CommandTypes.GetCodeFixes; - arguments: CodeFixRequestArgs; - } - interface CodeFixRequestArgs extends FileRequestArgs { - startLine: number; - startOffset: number; - startPosition?: number; - endLine: number; - endOffset: number; - endPosition?: number; - errorCodes?: number[]; - } - interface GetCodeFixesResponse extends Response { - body?: CodeAction[]; - } - interface FileLocationRequest extends FileRequest { - arguments: FileLocationRequestArgs; - } - interface GetSupportedCodeFixesRequest extends Request { - command: CommandTypes.GetSupportedCodeFixes; - } - interface GetSupportedCodeFixesResponse extends Response { - body?: string[]; - } - interface EncodedSemanticClassificationsRequest extends FileRequest { - arguments: EncodedSemanticClassificationsRequestArgs; - } - interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { - start: number; - length: number; - } - interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { - filesToSearch: string[]; - } - interface DefinitionRequest extends FileLocationRequest { - command: CommandTypes.Definition; - } - interface TypeDefinitionRequest extends FileLocationRequest { - command: CommandTypes.TypeDefinition; - } - interface ImplementationRequest extends FileLocationRequest { - command: CommandTypes.Implementation; - } - interface Location { - line: number; - offset: number; - } - interface TextSpan { - start: Location; - end: Location; - } - interface FileSpan extends TextSpan { - file: string; - } - interface DefinitionResponse extends Response { - body?: FileSpan[]; - } - interface TypeDefinitionResponse extends Response { - body?: FileSpan[]; - } - interface ImplementationResponse extends Response { - body?: FileSpan[]; - } - interface BraceCompletionRequest extends FileLocationRequest { - command: CommandTypes.BraceCompletion; - arguments: BraceCompletionRequestArgs; - } - interface BraceCompletionRequestArgs extends FileLocationRequestArgs { - openingBrace: string; - } - interface OccurrencesRequest extends FileLocationRequest { - command: CommandTypes.Occurrences; - } - interface OccurrencesResponseItem extends FileSpan { - isWriteAccess: boolean; - } - interface OccurrencesResponse extends Response { - body?: OccurrencesResponseItem[]; - } - interface DocumentHighlightsRequest extends FileLocationRequest { - command: CommandTypes.DocumentHighlights; - arguments: DocumentHighlightsRequestArgs; - } - interface HighlightSpan extends TextSpan { - kind: string; - } - interface DocumentHighlightsItem { - file: string; - highlightSpans: HighlightSpan[]; - } - interface DocumentHighlightsResponse extends Response { - body?: DocumentHighlightsItem[]; - } - interface ReferencesRequest extends FileLocationRequest { - command: CommandTypes.References; - } - interface ReferencesResponseItem extends FileSpan { - lineText: string; - isWriteAccess: boolean; - isDefinition: boolean; - } - interface ReferencesResponseBody { - refs: ReferencesResponseItem[]; - symbolName: string; - symbolStartOffset: number; - symbolDisplayString: string; - } - interface ReferencesResponse extends Response { - body?: ReferencesResponseBody; - } - interface RenameRequestArgs extends FileLocationRequestArgs { - findInComments?: boolean; - findInStrings?: boolean; - } - interface RenameRequest extends FileLocationRequest { - command: CommandTypes.Rename; - arguments: RenameRequestArgs; - } - interface RenameInfo { - canRename: boolean; - localizedErrorMessage?: string; - displayName: string; - fullDisplayName: string; - kind: string; - kindModifiers: string; - } - interface SpanGroup { - file: string; - locs: TextSpan[]; - } - interface RenameResponseBody { - info: RenameInfo; - locs: SpanGroup[]; - } - interface RenameResponse extends Response { - body?: RenameResponseBody; - } - interface ExternalFile { - fileName: string; - scriptKind?: ScriptKindName | ts.ScriptKind; - hasMixedContent?: boolean; - content?: string; - } - interface ExternalProject { - projectFileName: string; - rootFiles: ExternalFile[]; - options: ExternalProjectCompilerOptions; - typingOptions?: TypeAcquisition; - typeAcquisition?: TypeAcquisition; - } - interface CompileOnSaveMixin { - compileOnSave?: boolean; - } - type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; - interface ProjectVersionInfo { - projectName: string; - isInferred: boolean; - version: number; - options: ts.CompilerOptions; - languageServiceDisabled: boolean; - } - interface ProjectChanges { - added: string[]; - removed: string[]; - updated: string[]; - } - interface ProjectFiles { - info?: ProjectVersionInfo; - files?: string[]; - changes?: ProjectChanges; - } - interface ProjectFilesWithDiagnostics extends ProjectFiles { - projectErrors: DiagnosticWithLinePosition[]; - } - interface ChangedOpenFile { - fileName: string; - changes: ts.TextChange[]; - } - interface ConfigureRequestArguments { - hostInfo?: string; - file?: string; - formatOptions?: FormatCodeSettings; - extraFileExtensions?: FileExtensionInfo[]; - } - interface ConfigureRequest extends Request { - command: CommandTypes.Configure; - arguments: ConfigureRequestArguments; - } - interface ConfigureResponse extends Response { - } - interface OpenRequestArgs extends FileRequestArgs { - fileContent?: string; - scriptKindName?: ScriptKindName; - } - type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; - interface OpenRequest extends Request { - command: CommandTypes.Open; - arguments: OpenRequestArgs; - } - interface OpenExternalProjectRequest extends Request { - command: CommandTypes.OpenExternalProject; - arguments: OpenExternalProjectArgs; - } - type OpenExternalProjectArgs = ExternalProject; - interface OpenExternalProjectsRequest extends Request { - command: CommandTypes.OpenExternalProjects; - arguments: OpenExternalProjectsArgs; - } - interface OpenExternalProjectsArgs { - projects: ExternalProject[]; - } - interface OpenExternalProjectResponse extends Response { - } - interface OpenExternalProjectsResponse extends Response { - } - interface CloseExternalProjectRequest extends Request { - command: CommandTypes.CloseExternalProject; - arguments: CloseExternalProjectRequestArgs; - } - interface CloseExternalProjectRequestArgs { - projectFileName: string; - } - interface CloseExternalProjectResponse extends Response { - } - interface SynchronizeProjectListRequest extends Request { - arguments: SynchronizeProjectListRequestArgs; - } - interface SynchronizeProjectListRequestArgs { - knownProjects: protocol.ProjectVersionInfo[]; - } - interface ApplyChangedToOpenFilesRequest extends Request { - arguments: ApplyChangedToOpenFilesRequestArgs; - } - interface ApplyChangedToOpenFilesRequestArgs { - openFiles?: ExternalFile[]; - changedFiles?: ChangedOpenFile[]; - closedFiles?: string[]; - } - interface SetCompilerOptionsForInferredProjectsRequest extends Request { - command: CommandTypes.CompilerOptionsForInferredProjects; - arguments: SetCompilerOptionsForInferredProjectsArgs; - } - interface SetCompilerOptionsForInferredProjectsArgs { - options: ExternalProjectCompilerOptions; - } - interface SetCompilerOptionsForInferredProjectsResponse extends Response { - } - interface ExitRequest extends Request { - command: CommandTypes.Exit; - } - interface CloseRequest extends FileRequest { - command: CommandTypes.Close; - } - interface CompileOnSaveAffectedFileListRequest extends FileRequest { - command: CommandTypes.CompileOnSaveAffectedFileList; - } - interface CompileOnSaveAffectedFileListSingleProject { - projectFileName: string; - fileNames: string[]; - } - interface CompileOnSaveAffectedFileListResponse extends Response { - body: CompileOnSaveAffectedFileListSingleProject[]; - } - interface CompileOnSaveEmitFileRequest extends FileRequest { - command: CommandTypes.CompileOnSaveEmitFile; - arguments: CompileOnSaveEmitFileRequestArgs; - } - interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { - forced?: boolean; - } - interface QuickInfoRequest extends FileLocationRequest { - command: CommandTypes.Quickinfo; - } - interface QuickInfoResponseBody { - kind: string; - kindModifiers: string; - start: Location; - end: Location; - displayString: string; - documentation: string; - } - interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; - } - interface FormatRequestArgs extends FileLocationRequestArgs { - endLine: number; - endOffset: number; - endPosition?: number; - options?: FormatCodeSettings; - } - interface FormatRequest extends FileLocationRequest { - command: CommandTypes.Format; - arguments: FormatRequestArgs; - } - interface CodeEdit { - start: Location; - end: Location; - newText: string; - } - interface FileCodeEdits { - fileName: string; - textChanges: CodeEdit[]; - } - interface CodeFixResponse extends Response { - body?: CodeAction[]; - } - interface CodeAction { - description: string; - changes: FileCodeEdits[]; - } - interface FormatResponse extends Response { - body?: CodeEdit[]; - } - interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { - key: string; - options?: FormatCodeSettings; - } - interface FormatOnKeyRequest extends FileLocationRequest { - command: CommandTypes.Formatonkey; - arguments: FormatOnKeyRequestArgs; - } - interface CompletionsRequestArgs extends FileLocationRequestArgs { - prefix?: string; - } - interface CompletionsRequest extends FileLocationRequest { - command: CommandTypes.Completions; - arguments: CompletionsRequestArgs; - } - interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { - entryNames: string[]; - } - interface CompletionDetailsRequest extends FileLocationRequest { - command: CommandTypes.CompletionDetails; - arguments: CompletionDetailsRequestArgs; - } - interface SymbolDisplayPart { - text: string; - kind: string; - } - interface CompletionEntry { - name: string; - kind: string; - kindModifiers: string; - sortText: string; - replacementSpan?: TextSpan; - } - interface CompletionEntryDetails { - name: string; - kind: string; - kindModifiers: string; - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - } - interface CompletionsResponse extends Response { - body?: CompletionEntry[]; - } - interface CompletionDetailsResponse extends Response { - body?: CompletionEntryDetails[]; - } - interface SignatureHelpParameter { - name: string; - documentation: SymbolDisplayPart[]; - displayParts: SymbolDisplayPart[]; - isOptional: boolean; - } - interface SignatureHelpItem { - isVariadic: boolean; - prefixDisplayParts: SymbolDisplayPart[]; - suffixDisplayParts: SymbolDisplayPart[]; - separatorDisplayParts: SymbolDisplayPart[]; - parameters: SignatureHelpParameter[]; - documentation: SymbolDisplayPart[]; - } - interface SignatureHelpItems { - items: SignatureHelpItem[]; - applicableSpan: TextSpan; - selectedItemIndex: number; - argumentIndex: number; - argumentCount: number; - } - interface SignatureHelpRequestArgs extends FileLocationRequestArgs { - } - interface SignatureHelpRequest extends FileLocationRequest { - command: CommandTypes.SignatureHelp; - arguments: SignatureHelpRequestArgs; - } - interface SignatureHelpResponse extends Response { - body?: SignatureHelpItems; - } - interface SemanticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SemanticDiagnosticsSync; - arguments: SemanticDiagnosticsSyncRequestArgs; - } - interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; - } - interface SemanticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; - } - interface SyntacticDiagnosticsSyncRequest extends FileRequest { - command: CommandTypes.SyntacticDiagnosticsSync; - arguments: SyntacticDiagnosticsSyncRequestArgs; - } - interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { - includeLinePosition?: boolean; - } - interface SyntacticDiagnosticsSyncResponse extends Response { - body?: Diagnostic[] | DiagnosticWithLinePosition[]; - } - interface GeterrForProjectRequestArgs { - file: string; - delay: number; - } - interface GeterrForProjectRequest extends Request { - command: CommandTypes.GeterrForProject; - arguments: GeterrForProjectRequestArgs; - } - interface GeterrRequestArgs { - files: string[]; - delay: number; - } - interface GeterrRequest extends Request { - command: CommandTypes.Geterr; - arguments: GeterrRequestArgs; - } - interface Diagnostic { - start: Location; - end: Location; - text: string; - code?: number; - } - interface DiagnosticEventBody { - file: string; - diagnostics: Diagnostic[]; - } - interface DiagnosticEvent extends Event { - body?: DiagnosticEventBody; - } - interface ConfigFileDiagnosticEventBody { - triggerFile: string; - configFile: string; - diagnostics: Diagnostic[]; - } - interface ConfigFileDiagnosticEvent extends Event { - body?: ConfigFileDiagnosticEventBody; - event: "configFileDiag"; - } - type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; - interface ProjectLanguageServiceStateEvent extends Event { - event: ProjectLanguageServiceStateEventName; - body?: ProjectLanguageServiceStateEventBody; - } - interface ProjectLanguageServiceStateEventBody { - projectName: string; - languageServiceEnabled: boolean; - } - interface ReloadRequestArgs extends FileRequestArgs { - tmpfile: string; - } - interface ReloadRequest extends FileRequest { - command: CommandTypes.Reload; - arguments: ReloadRequestArgs; - } - interface ReloadResponse extends Response { - } - interface SavetoRequestArgs extends FileRequestArgs { - tmpfile: string; - } - interface SavetoRequest extends FileRequest { - command: CommandTypes.Saveto; - arguments: SavetoRequestArgs; - } - interface NavtoRequestArgs extends FileRequestArgs { - searchValue: string; - maxResultCount?: number; - currentFileOnly?: boolean; - projectFileName?: string; - } - interface NavtoRequest extends FileRequest { - command: CommandTypes.Navto; - arguments: NavtoRequestArgs; - } - interface NavtoItem { - name: string; - kind: string; - matchKind?: string; - isCaseSensitive?: boolean; - kindModifiers?: string; - file: string; - start: Location; - end: Location; - containerName?: string; - containerKind?: string; - } - interface NavtoResponse extends Response { - body?: NavtoItem[]; - } - interface ChangeRequestArgs extends FormatRequestArgs { - insertString?: string; - } - interface ChangeRequest extends FileLocationRequest { - command: CommandTypes.Change; - arguments: ChangeRequestArgs; - } - interface BraceResponse extends Response { - body?: TextSpan[]; - } - interface BraceRequest extends FileLocationRequest { - command: CommandTypes.Brace; - } - interface NavBarRequest extends FileRequest { - command: CommandTypes.NavBar; - } - interface NavTreeRequest extends FileRequest { - command: CommandTypes.NavTree; - } - interface NavigationBarItem { - text: string; - kind: string; - kindModifiers?: string; - spans: TextSpan[]; - childItems?: NavigationBarItem[]; - indent: number; - } - interface NavigationTree { - text: string; - kind: string; - kindModifiers: string; - spans: TextSpan[]; - childItems?: NavigationTree[]; - } - type TelemetryEventName = "telemetry"; - interface TelemetryEvent extends Event { - event: TelemetryEventName; - body: TelemetryEventBody; - } - interface TelemetryEventBody { - telemetryEventName: string; - payload: any; - } - type TypingsInstalledTelemetryEventName = "typingsInstalled"; - interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { - telemetryEventName: TypingsInstalledTelemetryEventName; - payload: TypingsInstalledTelemetryEventPayload; - } - interface TypingsInstalledTelemetryEventPayload { - installedPackages: string; - installSuccess: boolean; - typingsInstallerVersion: string; - } - type BeginInstallTypesEventName = "beginInstallTypes"; - type EndInstallTypesEventName = "endInstallTypes"; - interface BeginInstallTypesEvent extends Event { - event: BeginInstallTypesEventName; - body: BeginInstallTypesEventBody; - } - interface EndInstallTypesEvent extends Event { - event: EndInstallTypesEventName; - body: EndInstallTypesEventBody; - } - interface InstallTypesEventBody { - eventId: number; - packages: ReadonlyArray; - } - interface BeginInstallTypesEventBody extends InstallTypesEventBody { - } - interface EndInstallTypesEventBody extends InstallTypesEventBody { - success: boolean; - } - interface NavBarResponse extends Response { - body?: NavigationBarItem[]; - } - interface NavTreeResponse extends Response { - body?: NavigationTree; - } - namespace IndentStyle { - type None = "None"; - type Block = "Block"; - type Smart = "Smart"; - } - type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle | ts.IndentStyle; - } - interface FormatCodeSettings extends EditorSettings { - insertSpaceAfterCommaDelimiter?: boolean; - insertSpaceAfterSemicolonInForStatements?: boolean; - insertSpaceBeforeAndAfterBinaryOperators?: boolean; - insertSpaceAfterConstructor?: boolean; - insertSpaceAfterKeywordsInControlFlowStatements?: boolean; - insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - insertSpaceBeforeFunctionParenthesis?: boolean; - placeOpenBraceOnNewLineForFunctions?: boolean; - placeOpenBraceOnNewLineForControlBlocks?: boolean; - } - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - baseUrl?: string; - charset?: string; - declaration?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit | ts.JsxEmit; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind | ts.ModuleKind; - moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; - newLine?: NewLineKind | ts.NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike; - preserveConstEnums?: boolean; - project?: string; - reactNamespace?: string; - removeComments?: boolean; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strictNullChecks?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - target?: ScriptTarget | ts.ScriptTarget; - traceResolution?: boolean; - types?: string[]; - typeRoots?: string[]; - [option: string]: CompilerOptionsValue | undefined; - } - namespace JsxEmit { - type None = "None"; - type Preserve = "Preserve"; - type React = "React"; - } - type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; - namespace ModuleKind { - type None = "None"; - type CommonJS = "CommonJS"; - type AMD = "AMD"; - type UMD = "UMD"; - type System = "System"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; - } - type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; - namespace ModuleResolutionKind { - type Classic = "Classic"; - type Node = "Node"; - } - type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; - namespace NewLineKind { - type Crlf = "Crlf"; - type Lf = "Lf"; - } - type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; - namespace ScriptTarget { - type ES3 = "ES3"; - type ES5 = "ES5"; - type ES6 = "ES6"; - type ES2015 = "ES2015"; - } - type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; -} +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + declare namespace ts { interface MapLike { [index: string]: T; @@ -1276,34 +419,15 @@ declare namespace ts { IntrinsicIndexedElement = 2, IntrinsicElement = 3, } - const enum RelationComparisonResult { - Succeeded = 1, - Failed = 2, - FailedAndReported = 3, - } interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; - modifierFlagsCache?: ModifierFlags; - transformFlags?: TransformFlags; decorators?: NodeArray; modifiers?: ModifiersArray; - id?: number; parent?: Node; - original?: Node; - startsOnNewLine?: boolean; - jsDoc?: JSDoc[]; - jsDocCache?: (JSDoc | JSDocTag)[]; - symbol?: Symbol; - locals?: SymbolTable; - nextContainer?: Node; - localSymbol?: Symbol; - flowNode?: FlowNode; - emitNode?: EmitNode; } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; - transformFlags?: TransformFlags; } interface Token extends Node { kind: TKind; @@ -1319,27 +443,15 @@ declare namespace ts { type ReadonlyToken = Token; type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; type ModifiersArray = NodeArray; - const enum GeneratedIdentifierKind { - None = 0, - Auto = 1, - Loop = 2, - Unique = 3, - Node = 4, - } interface Identifier extends PrimaryExpression { kind: SyntaxKind.Identifier; text: string; originalKeywordKind?: SyntaxKind; - autoGenerateKind?: GeneratedIdentifierKind; - autoGenerateId?: number; isInJSDocNamespace?: boolean; } interface TransientIdentifier extends Identifier { resolvedSymbol: Symbol; } - interface GeneratedIdentifier extends Identifier { - autoGenerateKind: GeneratedIdentifierKind.Auto | GeneratedIdentifierKind.Loop | GeneratedIdentifierKind.Unique | GeneratedIdentifierKind.Node; - } interface QualifiedName extends Node { kind: SyntaxKind.QualifiedName; left: EntityName; @@ -1587,7 +699,6 @@ declare namespace ts { } interface StringLiteral extends LiteralExpression { kind: SyntaxKind.StringLiteral; - textSourceNode?: Identifier | StringLiteral | NumericLiteral; } interface Expression extends Node { _expressionBrand: any; @@ -1596,10 +707,6 @@ declare namespace ts { interface OmittedExpression extends Expression { kind: SyntaxKind.OmittedExpression; } - interface PartiallyEmittedExpression extends LeftHandSideExpression { - kind: SyntaxKind.PartiallyEmittedExpression; - expression: Expression; - } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; } @@ -1729,7 +836,6 @@ declare namespace ts { text: string; isUnterminated?: boolean; hasExtendedUnicodeEscape?: boolean; - isOctalLiteral?: boolean; } interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { _literalExpressionBrand: any; @@ -1771,7 +877,6 @@ declare namespace ts { interface ArrayLiteralExpression extends PrimaryExpression { kind: SyntaxKind.ArrayLiteralExpression; elements: NodeArray; - multiLine?: boolean; } interface SpreadElement extends Expression { kind: SyntaxKind.SpreadElement; @@ -1782,7 +887,6 @@ declare namespace ts { } interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { kind: SyntaxKind.ObjectLiteralExpression; - multiLine?: boolean; } type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; @@ -1897,15 +1001,6 @@ declare namespace ts { interface Statement extends Node { _statementBrand: any; } - interface NotEmittedStatement extends Statement { - kind: SyntaxKind.NotEmittedStatement; - } - interface EndOfDeclarationMarker extends Statement { - kind: SyntaxKind.EndOfDeclarationMarker; - } - interface MergeDeclarationMarker extends Statement { - kind: SyntaxKind.MergeDeclarationMarker; - } interface EmptyStatement extends Statement { kind: SyntaxKind.EmptyStatement; } @@ -1920,7 +1015,6 @@ declare namespace ts { interface Block extends Statement { kind: SyntaxKind.Block; statements: NodeArray; - multiLine?: boolean; } interface VariableStatement extends Statement { kind: SyntaxKind.VariableStatement; @@ -1930,9 +1024,6 @@ declare namespace ts { kind: SyntaxKind.ExpressionStatement; expression: Expression; } - interface PrologueDirective extends ExpressionStatement { - expression: StringLiteral; - } interface IfStatement extends Statement { kind: SyntaxKind.IfStatement; expression: Expression; @@ -2354,27 +1445,8 @@ declare namespace ts { typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; - renamedDependencies?: Map; hasNoDefaultLib: boolean; languageVersion: ScriptTarget; - scriptKind: ScriptKind; - externalModuleIndicator: Node; - commonJsModuleIndicator: Node; - identifiers: Map; - nodeCount: number; - identifierCount: number; - symbolCount: number; - parseDiagnostics: Diagnostic[]; - additionalSyntacticDiagnostics?: Diagnostic[]; - bindDiagnostics: Diagnostic[]; - lineMap: number[]; - classifiableNames?: Map; - resolvedModules: Map; - resolvedTypeReferenceDirectiveNames: Map; - imports: LiteralExpression[]; - moduleAugmentations: LiteralExpression[]; - patternAmbientModules?: PatternAmbientModule[]; - ambientModuleNames: string[]; } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; @@ -2407,18 +1479,6 @@ declare namespace ts { getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getDeclarationDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; getTypeChecker(): TypeChecker; - getCommonSourceDirectory(): string; - getDiagnosticsProducingTypeChecker(): TypeChecker; - dropDiagnosticsProducingTypeChecker(): void; - getClassifiableNames(): Map; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; - getFileProcessingDiagnostics(): DiagnosticCollection; - getResolvedTypeReferenceDirectives(): Map; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - structureIsReused?: boolean; } interface SourceMapSpan { emittedLine: number; @@ -2449,13 +1509,6 @@ declare namespace ts { emitSkipped: boolean; diagnostics: Diagnostic[]; emittedFiles: string[]; - sourceMaps: SourceMapData[]; - } - interface TypeCheckerHost { - getCompilerOptions(): CompilerOptions; - getSourceFiles(): SourceFile[]; - getSourceFile(fileName: string): SourceFile; - getResolvedTypeReferenceDirectives(): Map; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -2500,14 +1553,6 @@ declare namespace ts { getAmbientModules(): Symbol[]; tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined; getApparentType(type: Type): Type; - tryFindAmbientModuleWithoutAugmentations(moduleName: string): Symbol; - getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; - getEmitResolver(sourceFile?: SourceFile, cancellationToken?: CancellationToken): EmitResolver; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -2558,15 +1603,6 @@ declare namespace ts { WriteTypeParametersOrArguments = 1, UseOnlyExternalAliasing = 2, } - const enum SymbolAccessibility { - Accessible = 0, - NotAccessible = 1, - CannotBeNamed = 2, - } - const enum SyntheticSymbolKind { - UnionOrIntersection = 0, - Spread = 1, - } const enum TypePredicateKind { This = 0, Identifier = 1, @@ -2584,61 +1620,6 @@ declare namespace ts { parameterIndex: number; } type TypePredicate = IdentifierTypePredicate | ThisTypePredicate; - type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration; - interface SymbolVisibilityResult { - accessibility: SymbolAccessibility; - aliasesToMakeVisible?: AnyImportSyntax[]; - errorSymbolName?: string; - errorNode?: Node; - } - interface SymbolAccessibilityResult extends SymbolVisibilityResult { - errorModuleName?: string; - } - enum TypeReferenceSerializationKind { - Unknown = 0, - TypeWithConstructSignatureAndValue = 1, - VoidNullableOrNeverType = 2, - NumberLikeType = 3, - StringLikeType = 4, - BooleanType = 5, - ArrayLikeType = 6, - ESSymbolType = 7, - Promise = 8, - TypeWithCallSignature = 9, - ObjectType = 10, - } - interface EmitResolver { - hasGlobalName(name: string): boolean; - getReferencedExportContainer(node: Identifier, prefixLocals?: boolean): SourceFile | ModuleDeclaration | EnumDeclaration; - getReferencedImportDeclaration(node: Identifier): Declaration; - getReferencedDeclarationWithCollidingName(node: Identifier): Declaration; - isDeclarationWithCollidingName(node: Declaration): boolean; - isValueAliasDeclaration(node: Node): boolean; - isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean; - isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; - getNodeCheckFlags(node: Node): NodeCheckFlags; - isDeclarationVisible(node: Declaration): boolean; - collectLinkedAliases(node: Identifier): Node[]; - isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; - writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; - isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags, shouldComputeAliasToMarkVisible: boolean): SymbolAccessibilityResult; - isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult; - getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - getReferencedValueDeclaration(reference: Identifier): Declaration; - getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind; - isOptionalParameter(node: ParameterDeclaration): boolean; - moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; - isArgumentsLocalBinding(node: Identifier): boolean; - getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile; - getTypeReferenceDirectivesForEntityName(name: EntityNameOrEntityNameExpression): string[]; - getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; - isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean; - writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, writer: SymbolWriter): void; - getJsxFactoryEntity(): EntityName; - } const enum SymbolFlags { None = 0, FunctionScopedVariable = 1, @@ -2705,7 +1686,6 @@ declare namespace ts { PropertyOrAccessor = 98308, Export = 7340032, ClassMember = 106500, - Classifiable = 788448, } interface Symbol { flags: SymbolFlags; @@ -2715,87 +1695,8 @@ declare namespace ts { members?: SymbolTable; exports?: SymbolTable; globalExports?: SymbolTable; - isReadonly?: boolean; - id?: number; - mergeId?: number; - parent?: Symbol; - exportSymbol?: Symbol; - constEnumOnlyModule?: boolean; - isReferenced?: boolean; - isReplaceableByMethod?: boolean; - isAssigned?: boolean; - } - interface SymbolLinks { - target?: Symbol; - type?: Type; - declaredType?: Type; - typeParameters?: TypeParameter[]; - inferredClassType?: Type; - instantiations?: Map; - mapper?: TypeMapper; - referenced?: boolean; - containingType?: UnionOrIntersectionType; - leftSpread?: Symbol; - rightSpread?: Symbol; - hasNonUniformType?: boolean; - isPartial?: boolean; - isDiscriminantProperty?: boolean; - resolvedExports?: SymbolTable; - exportsChecked?: boolean; - isDeclarationWithCollidingName?: boolean; - bindingElement?: BindingElement; - exportsSomeValue?: boolean; - } - interface TransientSymbol extends Symbol, SymbolLinks { } type SymbolTable = Map; - interface Pattern { - prefix: string; - suffix: string; - } - interface PatternAmbientModule { - pattern: Pattern; - symbol: Symbol; - } - const enum NodeCheckFlags { - TypeChecked = 1, - LexicalThis = 2, - CaptureThis = 4, - CaptureNewTarget = 8, - SuperInstance = 256, - SuperStatic = 512, - ContextChecked = 1024, - AsyncMethodWithSuper = 2048, - AsyncMethodWithSuperBinding = 4096, - CaptureArguments = 8192, - EnumValuesComputed = 16384, - LexicalModuleMergesWithClass = 32768, - LoopWithCapturedBlockScopedBinding = 65536, - CapturedBlockScopedBinding = 131072, - BlockScopedBindingInLoop = 262144, - ClassWithBodyScopedClassBinding = 524288, - BodyScopedClassBinding = 1048576, - NeedsLoopOutParameter = 2097152, - AssignmentsMarked = 4194304, - ClassWithConstructorReference = 8388608, - ConstructorReferenceInClass = 16777216, - } - interface NodeLinks { - flags?: NodeCheckFlags; - resolvedType?: Type; - resolvedSignature?: Signature; - resolvedSymbol?: Symbol; - resolvedIndexInfo?: IndexInfo; - maybeTypePredicate?: boolean; - enumMemberValue?: number; - isVisible?: boolean; - hasReportedStatementInAmbientContext?: boolean; - jsxFlags?: JsxFlags; - resolvedJsxType?: Type; - hasSuperCall?: boolean; - superCall?: ExpressionStatement; - switchTypes?: Type[]; - } const enum TypeFlags { Any = 1, String = 2, @@ -2817,17 +1718,9 @@ declare namespace ts { Intersection = 131072, Index = 262144, IndexedAccess = 524288, - FreshLiteral = 1048576, - ContainsWideningType = 2097152, - ContainsObjectLiteral = 4194304, - ContainsAnyFunctionType = 8388608, - Nullable = 6144, Literal = 480, StringOrNumberLiteral = 96, - DefinitelyFalsy = 7392, PossiblyFalsy = 7406, - Intrinsic = 16015, - Primitive = 8190, StringLike = 262178, NumberLike = 340, BooleanLike = 136, @@ -2838,21 +1731,15 @@ declare namespace ts { TypeVariable = 540672, Narrowable = 1033215, NotUnionOrUnit = 33281, - RequiresWidening = 6291456, - PropagatingFlags = 14680064, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { flags: TypeFlags; - id: number; symbol?: Symbol; pattern?: DestructuringPattern; aliasSymbol?: Symbol; aliasTypeArguments?: Type[]; } - interface IntrinsicType extends Type { - intrinsicName: string; - } interface LiteralType extends Type { text: string; freshType?: LiteralType; @@ -2885,8 +1772,6 @@ declare namespace ts { outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; thisType: TypeParameter; - resolvedBaseConstructorType?: Type; - resolvedBaseTypes: ObjectType[]; } interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; @@ -2900,59 +1785,23 @@ declare namespace ts { typeArguments: Type[]; } interface GenericType extends InterfaceType, TypeReference { - instantiations: Map; } interface UnionOrIntersectionType extends Type { types: Type[]; - resolvedProperties: SymbolTable; - resolvedIndexType: IndexType; - couldContainTypeVariables: boolean; } interface UnionType extends UnionOrIntersectionType { } interface IntersectionType extends UnionOrIntersectionType { } type StructuredType = ObjectType | UnionType | IntersectionType; - interface AnonymousType extends ObjectType { - target?: AnonymousType; - mapper?: TypeMapper; - } - interface MappedType extends ObjectType { - declaration: MappedTypeNode; - typeParameter?: TypeParameter; - constraintType?: Type; - templateType?: Type; - modifiersType?: Type; - mapper?: TypeMapper; - } interface EvolvingArrayType extends ObjectType { elementType: Type; finalArrayType?: Type; } - interface ResolvedType extends ObjectType, UnionOrIntersectionType { - members: SymbolTable; - properties: Symbol[]; - callSignatures: Signature[]; - constructSignatures: Signature[]; - stringIndexInfo?: IndexInfo; - numberIndexInfo?: IndexInfo; - } - interface FreshObjectLiteralType extends ResolvedType { - regularType: ResolvedType; - } - interface IterableOrIteratorType extends ObjectType, UnionType { - iterableElementType?: Type; - iteratorElementType?: Type; - } interface TypeVariable extends Type { - resolvedApparentType: Type; - resolvedIndexType: IndexType; } interface TypeParameter extends TypeVariable { constraint: Type; - target?: TypeParameter; - mapper?: TypeMapper; - isThisType?: boolean; } interface IndexedAccessType extends TypeVariable { objectType: Type; @@ -2970,18 +1819,6 @@ declare namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; - thisParameter?: Symbol; - resolvedReturnType: Type; - minArgumentCount: number; - hasRestParameter: boolean; - hasLiteralTypes: boolean; - target?: Signature; - mapper?: TypeMapper; - unionSignatures?: Signature[]; - erasedSignatureCache?: Signature; - isolatedSignatureType?: ObjectType; - typePredicate?: TypePredicate; - instantiations?: Map; } const enum IndexKind { String = 0, @@ -2992,33 +1829,6 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } - interface TypeMapper { - (t: TypeParameter): Type; - mappedTypes?: Type[]; - instantiations?: Type[]; - context?: InferenceContext; - } - interface TypeInferences { - primary: Type[]; - secondary: Type[]; - topLevel: boolean; - isFixed: boolean; - } - interface InferenceContext { - signature: Signature; - inferUnionTypes: boolean; - inferences: TypeInferences[]; - inferredTypes: Type[]; - mapper?: TypeMapper; - failedTypeParameterIndex?: number; - } - const enum SpecialPropertyAssignmentKind { - None = 0, - ExportsProperty = 1, - ModuleExports = 2, - PrototypeProperty = 3, - ThisProperty = 4, - } interface FileExtensionInfo { extension: string; scriptKind: ScriptKind; @@ -3056,33 +1866,25 @@ declare namespace ts { type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; interface CompilerOptions { allowJs?: boolean; - allowNonTsExtensions?: boolean; allowSyntheticDefaultImports?: boolean; allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; alwaysStrict?: boolean; baseUrl?: string; charset?: string; - configFilePath?: string; declaration?: boolean; declarationDir?: string; - diagnostics?: boolean; - extendedDiagnostics?: boolean; disableSizeLimit?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; - help?: boolean; importHelpers?: boolean; - init?: boolean; inlineSourceMap?: boolean; inlineSources?: boolean; isolatedModules?: boolean; jsx?: JsxEmit; lib?: string[]; - listEmittedFiles?: boolean; - listFiles?: boolean; locale?: string; mapRoot?: string; maxNodeModuleJsDepth?: number; @@ -3090,7 +1892,6 @@ declare namespace ts { moduleResolution?: ModuleResolutionKind; newLine?: NewLineKind; noEmit?: boolean; - noEmitForJsFiles?: boolean; noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; @@ -3109,7 +1910,6 @@ declare namespace ts { paths?: MapLike; preserveConstEnums?: boolean; project?: string; - pretty?: DiagnosticStyle; reactNamespace?: string; jsxFactory?: string; removeComments?: boolean; @@ -3120,16 +1920,12 @@ declare namespace ts { sourceMap?: boolean; sourceRoot?: string; strictNullChecks?: boolean; - stripInternal?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; - suppressOutputPathCheck?: boolean; target?: ScriptTarget; traceResolution?: boolean; types?: string[]; typeRoots?: string[]; - version?: boolean; - watch?: boolean; [option: string]: CompilerOptionsValue | undefined; } interface TypeAcquisition { @@ -3189,10 +1985,6 @@ declare namespace ts { Standard = 0, JSX = 1, } - const enum DiagnosticStyle { - Simple = 0, - Pretty = 1, - } interface ParsedCommandLine { options: CompilerOptions; typeAcquisition?: TypeAcquisition; @@ -3210,156 +2002,6 @@ declare namespace ts { fileNames: string[]; wildcardDirectories: MapLike; } - interface CommandLineOptionBase { - name: string; - type: "string" | "number" | "boolean" | "object" | "list" | Map; - isFilePath?: boolean; - shortName?: string; - description?: DiagnosticMessage; - paramType?: DiagnosticMessage; - experimental?: boolean; - isTSConfigOnly?: boolean; - } - interface CommandLineOptionOfPrimitiveType extends CommandLineOptionBase { - type: "string" | "number" | "boolean"; - } - interface CommandLineOptionOfCustomType extends CommandLineOptionBase { - type: Map; - } - interface TsConfigOnlyOption extends CommandLineOptionBase { - type: "object"; - } - interface CommandLineOptionOfListType extends CommandLineOptionBase { - type: "list"; - element: CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType; - } - type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfPrimitiveType | TsConfigOnlyOption | CommandLineOptionOfListType; - const enum CharacterCodes { - nullCharacter = 0, - maxAsciiCharacter = 127, - lineFeed = 10, - carriageReturn = 13, - lineSeparator = 8232, - paragraphSeparator = 8233, - nextLine = 133, - space = 32, - nonBreakingSpace = 160, - enQuad = 8192, - emQuad = 8193, - enSpace = 8194, - emSpace = 8195, - threePerEmSpace = 8196, - fourPerEmSpace = 8197, - sixPerEmSpace = 8198, - figureSpace = 8199, - punctuationSpace = 8200, - thinSpace = 8201, - hairSpace = 8202, - zeroWidthSpace = 8203, - narrowNoBreakSpace = 8239, - ideographicSpace = 12288, - mathematicalSpace = 8287, - ogham = 5760, - _ = 95, - $ = 36, - _0 = 48, - _1 = 49, - _2 = 50, - _3 = 51, - _4 = 52, - _5 = 53, - _6 = 54, - _7 = 55, - _8 = 56, - _9 = 57, - a = 97, - b = 98, - c = 99, - d = 100, - e = 101, - f = 102, - g = 103, - h = 104, - i = 105, - j = 106, - k = 107, - l = 108, - m = 109, - n = 110, - o = 111, - p = 112, - q = 113, - r = 114, - s = 115, - t = 116, - u = 117, - v = 118, - w = 119, - x = 120, - y = 121, - z = 122, - A = 65, - B = 66, - C = 67, - D = 68, - E = 69, - F = 70, - G = 71, - H = 72, - I = 73, - J = 74, - K = 75, - L = 76, - M = 77, - N = 78, - O = 79, - P = 80, - Q = 81, - R = 82, - S = 83, - T = 84, - U = 85, - V = 86, - W = 87, - X = 88, - Y = 89, - Z = 90, - ampersand = 38, - asterisk = 42, - at = 64, - backslash = 92, - backtick = 96, - bar = 124, - caret = 94, - closeBrace = 125, - closeBracket = 93, - closeParen = 41, - colon = 58, - comma = 44, - dot = 46, - doubleQuote = 34, - equals = 61, - exclamation = 33, - greaterThan = 62, - hash = 35, - lessThan = 60, - minus = 45, - openBrace = 123, - openBracket = 91, - openParen = 40, - percent = 37, - plus = 43, - question = 63, - semicolon = 59, - singleQuote = 39, - slash = 47, - tilde = 126, - backspace = 8, - formFeed = 12, - byteOrderMark = 65279, - tab = 9, - verticalTab = 11, - } interface ModuleResolutionHost { fileExists(fileName: string): boolean; readFile(fileName: string): string; @@ -3386,7 +2028,6 @@ declare namespace ts { } interface ResolvedModuleWithFailedLookupLocations { resolvedModule: ResolvedModuleFull | undefined; - failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { primary: boolean; @@ -3412,157 +2053,6 @@ declare namespace ts { resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; getEnvironmentVariable?(name: string): string; } - const enum TransformFlags { - None = 0, - TypeScript = 1, - ContainsTypeScript = 2, - ContainsJsx = 4, - ContainsESNext = 8, - ContainsES2017 = 16, - ContainsES2016 = 32, - ES2015 = 64, - ContainsES2015 = 128, - Generator = 256, - ContainsGenerator = 512, - DestructuringAssignment = 1024, - ContainsDestructuringAssignment = 2048, - ContainsDecorators = 4096, - ContainsPropertyInitializer = 8192, - ContainsLexicalThis = 16384, - ContainsCapturedLexicalThis = 32768, - ContainsLexicalThisInComputedPropertyName = 65536, - ContainsDefaultValueAssignments = 131072, - ContainsParameterPropertyAssignments = 262144, - ContainsSpread = 524288, - ContainsObjectSpread = 1048576, - ContainsRest = 524288, - ContainsObjectRest = 1048576, - ContainsComputedPropertyName = 2097152, - ContainsBlockScopedBinding = 4194304, - ContainsBindingPattern = 8388608, - ContainsYield = 16777216, - ContainsHoistedDeclarationOrCompletion = 33554432, - HasComputedFlags = 536870912, - AssertTypeScript = 3, - AssertJsx = 4, - AssertESNext = 8, - AssertES2017 = 16, - AssertES2016 = 32, - AssertES2015 = 192, - AssertGenerator = 768, - AssertDestructuringAssignment = 3072, - NodeExcludes = 536872257, - ArrowFunctionExcludes = 601249089, - FunctionExcludes = 601281857, - ConstructorExcludes = 601015617, - MethodOrAccessorExcludes = 601015617, - ClassExcludes = 539358529, - ModuleExcludes = 574674241, - TypeExcludes = -3, - ObjectLiteralExcludes = 540087617, - ArrayLiteralOrCallOrNewExcludes = 537396545, - VariableDeclarationListExcludes = 546309441, - ParameterExcludes = 536872257, - CatchClauseExcludes = 537920833, - BindingPatternExcludes = 537396545, - TypeScriptClassSyntaxMask = 274432, - ES2015FunctionSyntaxMask = 163840, - } - interface EmitNode { - annotatedNodes?: Node[]; - flags?: EmitFlags; - commentRange?: TextRange; - sourceMapRange?: TextRange; - tokenSourceMapRanges?: Map; - constantValue?: number; - externalHelpersModuleName?: Identifier; - helpers?: EmitHelper[]; - } - const enum EmitFlags { - SingleLine = 1, - AdviseOnEmitNode = 2, - NoSubstitution = 4, - CapturesThis = 8, - NoLeadingSourceMap = 16, - NoTrailingSourceMap = 32, - NoSourceMap = 48, - NoNestedSourceMaps = 64, - NoTokenLeadingSourceMaps = 128, - NoTokenTrailingSourceMaps = 256, - NoTokenSourceMaps = 384, - NoLeadingComments = 512, - NoTrailingComments = 1024, - NoComments = 1536, - NoNestedComments = 2048, - HelperName = 4096, - ExportName = 8192, - LocalName = 16384, - Indented = 32768, - NoIndentation = 65536, - AsyncFunctionBody = 131072, - ReuseTempVariableScope = 262144, - CustomPrologue = 524288, - NoHoisting = 1048576, - HasEndOfDeclarationMarker = 2097152, - } - interface EmitHelper { - readonly name: string; - readonly scoped: boolean; - readonly text: string; - readonly priority?: number; - } - const enum ExternalEmitHelpers { - Extends = 1, - Assign = 2, - Rest = 4, - Decorate = 8, - Metadata = 16, - Param = 32, - Awaiter = 64, - Generator = 128, - FirstEmitHelper = 1, - LastEmitHelper = 128, - } - const enum EmitContext { - SourceFile = 0, - Expression = 1, - IdentifierName = 2, - Unspecified = 3, - } - interface EmitHost extends ScriptReferenceHost { - getSourceFiles(): SourceFile[]; - isSourceFileFromExternalLibrary(file: SourceFile): boolean; - getCommonSourceDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - isEmitBlocked(emitFileName: string): boolean; - writeFile: WriteFileCallback; - } - interface TransformationContext { - getCompilerOptions(): CompilerOptions; - getEmitResolver(): EmitResolver; - getEmitHost(): EmitHost; - startLexicalEnvironment(): void; - suspendLexicalEnvironment(): void; - resumeLexicalEnvironment(): void; - endLexicalEnvironment(): Statement[]; - hoistFunctionDeclaration(node: FunctionDeclaration): void; - hoistVariableDeclaration(node: Identifier): void; - requestEmitHelper(helper: EmitHelper): void; - readEmitHelpers(): EmitHelper[] | undefined; - enableSubstitution(kind: SyntaxKind): void; - isSubstitutionEnabled(node: Node): boolean; - onSubstituteNode?: (emitContext: EmitContext, node: Node) => Node; - enableEmitNotification(kind: SyntaxKind): void; - isEmitNotificationEnabled(node: Node): boolean; - onEmitNode?: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void; - } - interface TransformationResult { - transformed: SourceFile[]; - emitNodeWithSubstitution(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitNodeWithNotification(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - } - type Transformer = (context: TransformationContext) => (node: SourceFile) => SourceFile; interface TextSpan { start: number; length: number; @@ -3571,238 +2061,13 @@ declare namespace ts { span: TextSpan; newLength: number; } - interface DiagnosticCollection { - add(diagnostic: Diagnostic): void; - getGlobalDiagnostics(): Diagnostic[]; - getDiagnostics(fileName?: string): Diagnostic[]; - getModificationCount(): number; - reattachFileDiagnostics(newFile: SourceFile): void; - } interface SyntaxList extends Node { _children: Node[]; } } -declare namespace ts { - const timestamp: () => number; -} -declare namespace ts.performance { - function mark(markName: string): void; - function measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - function getCount(markName: string): number; - function getDuration(measureName: string): number; - function forEachMeasure(cb: (measureName: string, duration: number) => void): void; - function enable(): void; - function disable(): void; -} declare namespace ts { const version = "2.2.0"; } -declare namespace ts { - const enum Ternary { - False = 0, - Maybe = 1, - True = -1, - } - const collator: { - compare(a: string, b: string): number; - }; - function createMap(template?: MapLike): Map; - function createFileMap(keyMapper?: (key: string) => string): FileMap; - function toPath(fileName: string, basePath: string, getCanonicalFileName: (path: string) => string): Path; - const enum Comparison { - LessThan = -1, - EqualTo = 0, - GreaterThan = 1, - } - function forEach(array: T[] | undefined, callback: (element: T, index: number) => U | undefined): U | undefined; - function zipWith(arrayA: T[], arrayB: U[], callback: (a: T, b: U, index: number) => void): void; - function every(array: T[], callback: (element: T, index: number) => boolean): boolean; - function find(array: T[], predicate: (element: T, index: number) => boolean): T | undefined; - function findMap(array: T[], callback: (element: T, index: number) => U | undefined): U; - function contains(array: T[], value: T): boolean; - function indexOf(array: T[], value: T): number; - function indexOfAnyCharCode(text: string, charCodes: number[], start?: number): number; - function countWhere(array: T[], predicate: (x: T, i: number) => boolean): number; - function filter(array: T[], f: (x: T) => x is U): U[]; - function filter(array: T[], f: (x: T) => boolean): T[]; - function removeWhere(array: T[], f: (x: T) => boolean): boolean; - function filterMutate(array: T[], f: (x: T) => boolean): void; - function map(array: T[], f: (x: T, i: number) => U): U[]; - function sameMap(array: T[], f: (x: T, i: number) => T): T[]; - function flatten(array: (T | T[])[]): T[]; - function flatMap(array: T[], mapfn: (x: T, i: number) => U | U[]): U[]; - function span(array: T[], f: (x: T, i: number) => boolean): [T[], T[]]; - function spanMap(array: T[], keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K, start: number, end: number) => U): U[]; - function mapObject(object: MapLike, f: (key: string, x: T) => [string, U]): MapLike; - function some(array: T[], predicate?: (value: T) => boolean): boolean; - function concatenate(array1: T[], array2: T[]): T[]; - function deduplicate(array: T[], areEqual?: (a: T, b: T) => boolean): T[]; - function arrayIsEqualTo(array1: ReadonlyArray, array2: ReadonlyArray, equaler?: (a: T, b: T) => boolean): boolean; - function changesAffectModuleResolution(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean; - function compact(array: T[]): T[]; - function relativeComplement(arrayA: T[] | undefined, arrayB: T[] | undefined, comparer?: (x: T, y: T) => Comparison, offsetA?: number, offsetB?: number): T[] | undefined; - function sum(array: any[], prop: string): number; - function append(to: T[] | undefined, value: T | undefined): T[] | undefined; - function addRange(to: T[] | undefined, from: T[] | undefined): T[] | undefined; - function stableSort(array: T[], comparer?: (x: T, y: T) => Comparison): T[]; - function rangeEquals(array1: T[], array2: T[], pos: number, end: number): boolean; - function firstOrUndefined(array: T[]): T; - function lastOrUndefined(array: T[]): T; - function singleOrUndefined(array: T[]): T; - function singleOrMany(array: T[]): T | T[]; - function replaceElement(array: T[], index: number, value: T): T[]; - function binarySearch(array: T[], value: T, comparer?: (v1: T, v2: T) => number, offset?: number): number; - function reduceLeft(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; - function reduceLeft(array: T[], f: (memo: T, value: T, i: number) => T): T; - function reduceRight(array: T[], f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U; - function reduceRight(array: T[], f: (memo: T, value: T, i: number) => T): T; - function hasProperty(map: MapLike, key: string): boolean; - function getProperty(map: MapLike, key: string): T | undefined; - function getOwnKeys(map: MapLike): string[]; - function forEachProperty(map: Map, callback: (value: T, key: string) => U): U; - function someProperties(map: Map, predicate?: (value: T, key: string) => boolean): boolean; - function copyProperties(source: Map, target: MapLike): void; - function appendProperty(map: Map, key: string | number, value: T): Map; - function assign, T2, T3>(t: T1, arg1: T2, arg2: T3): T1 & T2 & T3; - function assign, T2>(t: T1, arg1: T2): T1 & T2; - function assign>(t: T1, ...args: any[]): any; - function reduceProperties(map: Map, callback: (aggregate: U, value: T, key: string) => U, initial: U): U; - function equalOwnProperties(left: MapLike, right: MapLike, equalityComparer?: (left: T, right: T) => boolean): boolean; - function arrayToMap(array: T[], makeKey: (value: T) => string): Map; - function arrayToMap(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map; - function isEmpty(map: Map): boolean; - function cloneMap(map: Map): Map; - function clone(object: T): T; - function extend(first: T1, second: T2): T1 & T2; - function multiMapAdd(map: Map, key: string | number, value: V): V[]; - function multiMapRemove(map: Map, key: string, value: V): void; - function isArray(value: any): value is any[]; - function noop(): void; - function notImplemented(): never; - function memoize(callback: () => T): () => T; - function chain(...args: ((t: T) => (u: U) => U)[]): (t: T) => (u: U) => U; - function compose(...args: ((t: T) => T)[]): (t: T) => T; - function formatStringFromArgs(text: string, args: { - [index: number]: string; - }, baseIndex?: number): string; - let localizedDiagnosticMessages: Map; - function getLocaleSpecificMessage(message: DiagnosticMessage): string; - function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; - function formatMessage(_dummy: any, message: DiagnosticMessage): string; - function createCompilerDiagnostic(message: DiagnosticMessage, ...args: (string | number)[]): Diagnostic; - function createCompilerDiagnosticFromMessageChain(chain: DiagnosticMessageChain): Diagnostic; - function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; - function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain; - function compareValues(a: T, b: T): Comparison; - function compareStrings(a: string, b: string, ignoreCase?: boolean): Comparison; - function compareStringsCaseInsensitive(a: string, b: string): Comparison; - function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison; - function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; - function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; - function normalizeSlashes(path: string): string; - function getRootLength(path: string): number; - const directorySeparator = "/"; - function normalizePath(path: string): string; - function pathEndsWithDirectorySeparator(path: string): boolean; - function getDirectoryPath(path: Path): Path; - function getDirectoryPath(path: string): string; - function isUrl(path: string): boolean; - function isExternalModuleNameRelative(moduleName: string): boolean; - function getEmitScriptTarget(compilerOptions: CompilerOptions): ScriptTarget; - function getEmitModuleKind(compilerOptions: CompilerOptions): ModuleKind; - function getEmitModuleResolutionKind(compilerOptions: CompilerOptions): ModuleResolutionKind; - function hasZeroOrOneAsteriskCharacter(str: string): boolean; - function isRootedDiskPath(path: string): boolean; - function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string; - function getNormalizedPathComponents(path: string, currentDirectory: string): string[]; - function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string; - function getNormalizedPathFromPathComponents(pathComponents: string[]): string; - function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string; - function getBaseFileName(path: string): string; - function combinePaths(path1: string, path2: string): string; - function removeTrailingDirectorySeparator(path: string): string; - function ensureTrailingDirectorySeparator(path: string): string; - function comparePaths(a: string, b: string, currentDirectory: string, ignoreCase?: boolean): Comparison; - function containsPath(parent: string, child: string, currentDirectory: string, ignoreCase?: boolean): boolean; - function startsWith(str: string, prefix: string): boolean; - function endsWith(str: string, suffix: string): boolean; - function hasExtension(fileName: string): boolean; - function fileExtensionIs(path: string, extension: string): boolean; - function fileExtensionIsAny(path: string, extensions: string[]): boolean; - function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude"): string; - function isImplicitGlob(lastPathComponent: string): boolean; - interface FileSystemEntries { - files: string[]; - directories: string[]; - } - interface FileMatcherPatterns { - includeFilePattern: string; - includeDirectoryPattern: string; - excludePattern: string; - basePaths: string[]; - } - function getFileMatcherPatterns(path: string, excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string): FileMatcherPatterns; - function matchFiles(path: string, extensions: string[], excludes: string[], includes: string[], useCaseSensitiveFileNames: boolean, currentDirectory: string, getFileSystemEntries: (path: string) => FileSystemEntries): string[]; - function ensureScriptKind(fileName: string, scriptKind?: ScriptKind): ScriptKind; - function getScriptKindFromFileName(fileName: string): ScriptKind; - const supportedTypeScriptExtensions: string[]; - const supportedTypescriptExtensionsForExtractExtension: string[]; - const supportedJavascriptExtensions: string[]; - function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[]; - function hasJavaScriptFileExtension(fileName: string): boolean; - function hasTypeScriptFileExtension(fileName: string): boolean; - function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): boolean; - const enum ExtensionPriority { - TypeScriptFiles = 0, - DeclarationAndJavaScriptFiles = 2, - Limit = 5, - Highest = 0, - Lowest = 2, - } - function getExtensionPriority(path: string, supportedExtensions: string[]): ExtensionPriority; - function adjustExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority; - function getNextLowestExtensionPriority(extensionPriority: ExtensionPriority): ExtensionPriority; - function removeFileExtension(path: string): string; - function tryRemoveExtension(path: string, extension: string): string | undefined; - function removeExtension(path: string, extension: string): string; - function changeExtension(path: T, newExtension: string): T; - interface ObjectAllocator { - getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; - getTokenConstructor(): new (kind: TKind, pos?: number, end?: number) => Token; - getIdentifierConstructor(): new (kind: SyntaxKind.Identifier, pos?: number, end?: number) => Identifier; - getSourceFileConstructor(): new (kind: SyntaxKind.SourceFile, pos?: number, end?: number) => SourceFile; - getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; - getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; - getSignatureConstructor(): new (checker: TypeChecker) => Signature; - } - let objectAllocator: ObjectAllocator; - const enum AssertionLevel { - None = 0, - Normal = 1, - Aggressive = 2, - VeryAggressive = 3, - } - namespace Debug { - let currentAssertionLevel: AssertionLevel; - function shouldAssert(level: AssertionLevel): boolean; - function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void; - function fail(message?: string): void; - } - function orderedRemoveItem(array: T[], item: T): boolean; - function orderedRemoveItemAt(array: T[], index: number): void; - function unorderedRemoveItemAt(array: T[], index: number): void; - function unorderedRemoveItem(array: T[], item: T): void; - function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): (fileName: string) => string; - function matchPatternOrExact(patternStrings: string[], candidate: string): string | Pattern | undefined; - function patternText({prefix, suffix}: Pattern): string; - function matchedText(pattern: Pattern, candidate: string): string; - function findBestPatternMatch(values: T[], getPattern: (value: T) => Pattern, candidate: string): T | undefined; - function tryParsePattern(pattern: string): Pattern | undefined; - function positionIsSynthesized(pos: number): boolean; - function extensionIsTypeScript(ext: Extension): boolean; - function extensionFromPath(path: string): Extension; - function tryGetExtensionFromPath(path: string): Extension | undefined; -} declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -3834,8 +2099,6 @@ declare namespace ts { getMemoryUsage?(): number; exit(exitCode?: number): void; realpath?(path: string): string; - getEnvironmentVariable(name: string): string; - tryEnableSourceMapsForHost?(): void; setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; clearTimeout?(timeoutId: any): void; } @@ -3848,4935 +2111,10 @@ declare namespace ts { } let sys: System; } -declare namespace ts { - const Diagnostics: { - Unterminated_string_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_file_cannot_have_a_reference_to_itself: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trailing_comma_not_allowed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Asterisk_Slash_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_cannot_have_question_mark_and_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_required_parameter_cannot_follow_an_optional_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_cannot_have_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_a_question_mark: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_must_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_must_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_parameter_type_must_be_string_or_number: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessibility_modifier_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_must_precede_1_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_class_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_must_be_followed_by_an_argument_list_or_member_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_ambient_modules_can_use_quoted_names: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Statements_are_not_allowed_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializers_are_not_allowed_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_with_a_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_data_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_module_or_namespace_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_0_modifier_cannot_be_used_with_an_interface_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_cannot_be_optional: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_must_have_exactly_one_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_an_optional_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_parameter_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_get_accessor_cannot_have_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_async_function_or_method_must_have_a_valid_awaitable_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Operand_for_await_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_expression_in_async_function_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_member_must_have_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_be_used_in_a_namespace: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_type_member: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_an_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_0_modifier_cannot_be_used_with_an_import_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_reference_directive_syntax: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_appear_on_a_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_accessor_cannot_have_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_set_accessor_cannot_have_a_return_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_signature_must_have_exactly_one_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - with_statements_are_not_allowed_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Jump_target_cannot_cross_function_boundary: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_return_statement_can_only_be_used_within_a_function_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_label_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literals_are_not_allowed_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_tuple_type_element_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_declaration_list_cannot_be_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Hexadecimal_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_end_of_text: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_or_statement_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Statement_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - case_or_default_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_or_signature_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_member_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_expression_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_assignment_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_or_comma_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - String_literal_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Line_break_not_permitted_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - or_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declarations_in_a_namespace_cannot_reference_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_declarations_must_be_initialized: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_declarations_can_only_be_declared_inside_a_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - let_declarations_can_only_be_declared_inside_a_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_template_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_regular_expression_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_object_member_cannot_be_declared_optional: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_yield_expression_is_only_allowed_in_a_generator_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Computed_property_names_are_not_allowed_in_enums: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - extends_clause_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - extends_clause_must_precede_implements_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Classes_can_only_extend_a_single_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - implements_clause_already_seen: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_declaration_cannot_have_implements_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Binary_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_digit_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unexpected_token_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_destructuring_pattern_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Array_element_destructuring_pattern_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_destructuring_declaration_must_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Modifiers_cannot_appear_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Merge_conflict_marker_encountered: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_may_not_be_declared_using_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_declaration_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_no_default_export: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_declaration_cannot_have_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_declarations_are_not_permitted_in_a_namespace: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Catch_clause_variable_cannot_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Catch_clause_variable_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_Unicode_escape_sequence: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Line_terminator_not_permitted_before_arrow: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Decorators_are_not_valid_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_declaration_without_the_default_modifier_must_have_a_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_assignment_is_not_supported_when_module_flag_is_system: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generators_are_not_allowed_in_an_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_overload_signature_cannot_be_declared_as_a_generator: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_tag_already_specified: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Signature_0_must_have_a_type_predicate: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_parameter_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_predicate_0_is_not_assignable_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_is_not_in_the_same_position_as_parameter_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_cannot_reference_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_can_only_be_used_in_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_declaration_can_only_be_used_in_a_namespace_or_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_declaration_can_only_be_used_in_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_modifier_cannot_be_used_with_1_modifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Abstract_methods_can_only_appear_within_an_abstract_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_property_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_literal_property_cannot_have_an_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_member_cannot_have_the_0_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - with_statements_are_not_allowed_in_an_async_function_block: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - await_expression_is_only_allowed_within_an_async_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_body_of_an_if_statement_cannot_be_the_empty_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_in_module_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_in_declaration_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_module_exports_may_only_appear_at_top_level: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_cannot_be_declared_using_a_rest_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_abstract_accessor_cannot_have_an_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Static_members_cannot_reference_class_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Circular_definition_of_import_alias_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_no_exported_member_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_is_not_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_module_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_recursively_references_itself_as_a_base_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_may_only_extend_another_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_may_only_extend_a_class_or_another_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_has_a_circular_constraint: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generic_type_0_requires_1_type_argument_s: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_generic: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_type_0_must_be_a_class_or_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Global_type_0_must_have_1_type_parameter_s: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_global_type_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Named_property_0_of_types_1_and_2_are_not_identical: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Excessive_stack_depth_comparing_types_0_and_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_assignable_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_exported_variable_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_missing_in_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_of_property_0_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_of_parameters_0_and_1_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signature_is_missing_in_type_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signatures_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_module_or_namespace_body: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_current_location: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_constructor_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_static_property_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_can_only_be_referenced_in_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_cannot_be_referenced_in_constructor_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_does_not_exist_on_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_private_and_only_accessible_within_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_does_not_satisfy_the_constraint_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Untyped_function_calls_may_not_accept_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_converted_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_parameter_must_be_of_an_array_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_string_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_number_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructors_for_derived_classes_must_contain_a_super_call: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_get_accessor_must_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - get_and_set_accessor_must_have_the_same_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_exported_or_non_exported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_public_private_or_protected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_optional_or_required: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_overload_must_be_static: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_overload_must_not_be_static: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_implementation_name_must_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_implementation_is_missing: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Multiple_constructor_implementations_are_not_allowed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_function_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signature_is_not_compatible_with_function_implementation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Declaration_name_conflicts_with_built_in_global_identifier_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Setters_cannot_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_incorrectly_extends_base_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_incorrectly_implements_interface_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_may_only_implement_another_class_or_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_0_must_have_identical_type_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Interface_0_incorrectly_extends_interface_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Ambient_module_declaration_cannot_specify_relative_module_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declaration_conflicts_with_local_declaration_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Types_have_separate_declarations_of_a_private_property_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Block_scoped_variable_0_used_before_its_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_block_scoped_variable_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_enum_member_cannot_have_a_numeric_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_is_used_before_being_assigned: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_alias_0_circularly_references_itself: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_alias_name_cannot_be_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_AMD_module_cannot_have_multiple_name_assignments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_property_1_and_no_string_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_property_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_an_array_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_must_be_last_in_a_destructuring_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_cannot_be_referenced_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_cannot_be_referenced_in_a_computed_property_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_global_value_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_0_operator_cannot_be_applied_to_type_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_declarations_must_all_be_const_or_non_const: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - 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: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_does_not_exist_on_const_enum_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_iterator_must_have_a_next_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_redeclare_identifier_0_in_catch_clause: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_an_array_type_or_a_string_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_rest_element_cannot_contain_a_binding_pattern: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_namespace_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_generator_cannot_have_a_void_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_a_constructor_function_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_base_constructor_has_the_specified_number_of_type_arguments: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_constructor_return_type_0_is_not_a_class_or_interface_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_constructors_must_all_have_the_same_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_create_an_instance_of_the_abstract_class_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Overload_signatures_must_all_be_abstract_or_non_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Classes_containing_abstract_methods_must_be_marked_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_an_abstract_method_must_be_consecutive: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - yield_expressions_cannot_be_used_in_a_parameter_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - await_expressions_cannot_be_used_in_a_parameter_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_module_cannot_have_multiple_default_exports: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_incompatible_with_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_null: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_is_possibly_null_or_undefined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_returning_never_cannot_have_a_reachable_end_point: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enum_type_0_has_members_with_initializers_that_are_not_literals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_used_to_index_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_has_no_matching_index_signature_for_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_cannot_be_used_as_an_index_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_to_0_because_it_is_not_a_variable: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Index_signature_in_type_0_only_permits_reading: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_attributes_type_0_may_not_be_a_union_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_in_type_1_is_not_assignable_to_type_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_global_type_JSX_0_may_not_have_more_than_one_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_spread_child_must_be_an_array_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_emit_namespaced_JSX_elements_in_React: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_expressions_must_have_one_parent_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_provides_no_match_for_the_signature_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_module_name_in_augmentation_module_0_cannot_be_found: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Accessors_must_both_be_abstract_or_non_abstract: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_comparable_to_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_this_parameter_must_be_the_first_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_constructor_cannot_have_a_this_parameter: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - get_and_set_accessor_must_have_the_same_this_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_this_types_of_each_signature_are_incompatible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - All_declarations_of_0_must_have_identical_modifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_type_definition_file_for_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_extend_an_interface_0_Did_you_mean_implements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_class_must_be_declared_after_its_base_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Namespace_0_has_no_exported_member_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Spread_types_may_only_be_created_from_object_types: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Rest_types_may_only_be_created_from_object_types: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_operand_of_a_delete_operator_must_be_a_property_reference: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_declaration_0_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_variable_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - 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: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Default_export_of_the_module_has_or_is_using_private_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_current_host_does_not_support_the_0_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_read_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unsupported_file_encoding: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Failed_to_parse_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_compiler_option_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compiler_option_0_requires_a_value_of_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Could_not_write_file_0_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_cannot_be_specified_without_specifying_option_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_cannot_be_specified_with_option_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_tsconfig_json_file_is_already_defined_at_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_write_file_0_because_it_would_overwrite_input_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_specified_path_does_not_exist_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_paths_cannot_be_used_without_specifying_baseUrl_option: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Pattern_0_can_have_at_most_one_Asterisk_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitutions_for_pattern_0_should_be_an_array: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Concatenate_and_emit_output_to_single_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generates_corresponding_d_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Watch_input_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Redirect_output_structure_to_the_directory: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_erase_const_enum_declarations_in_generated_code: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_outputs_if_any_errors_were_reported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_comments_to_output: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_outputs: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Skip_type_checking_of_declaration_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Print_this_message: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Print_the_compiler_s_version: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compile_the_project_in_the_given_directory: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Syntax_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - options: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Examples_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Options_Colon: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Version_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Insert_command_line_options_and_files_from_a_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_change_detected_Starting_incremental_compilation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - KIND: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - FILE: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - VERSION: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - LOCATION: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - DIRECTORY: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - STRATEGY: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compilation_complete_Watching_for_file_changes: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generates_corresponding_map_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Compiler_option_0_expects_an_argument: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unterminated_quoted_string_in_response_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Argument_for_0_option_must_be_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unsupported_locale_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unable_to_open_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Corrupted_locale_file_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_not_found: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - NEWLINE: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_can_only_be_specified_in_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_ES7_decorators: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_emitting_type_metadata_for_decorators: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enables_experimental_support_for_ES7_async_functions: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Successfully_created_a_tsconfig_json_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Suppress_excess_property_checks_for_object_literals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Stylize_errors_and_messages_using_color_and_context_experimental: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_report_errors_on_unused_labels: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_error_when_not_all_code_paths_in_function_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_for_fallthrough_cases_in_switch_statement: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_report_errors_on_unreachable_code: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Disallow_inconsistently_cased_references_to_the_same_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_library_files_to_be_included_in_the_compilation_Colon: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_JSX_code_generation_Colon_preserve_or_react: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_has_an_unsupported_extension_so_skipping_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_amd_and_system_modules_are_supported_alongside_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Base_directory_to_resolve_non_absolute_module_names: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enable_tracing_of_the_name_resolution_process: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_module_0_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Explicitly_specified_module_resolution_kind_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_resolution_kind_is_not_specified_using_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_was_successfully_resolved_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_was_not_resolved: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_name_0_matched_pattern_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trying_substitution_0_candidate_module_location_Colon_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_module_name_0_relative_to_base_url_1_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_does_not_exist: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_0_exist_use_it_as_a_name_resolution_result: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_module_0_from_node_modules_folder_target_file_type_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Found_package_json_at_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - package_json_does_not_have_a_types_or_main_field: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - package_json_has_0_field_1_that_references_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Allow_javascript_files_to_be_compiled: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Option_0_should_have_array_of_strings_as_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Checking_if_0_is_the_longest_matching_prefix_for_1_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expected_type_of_0_field_in_package_json_to_be_string_got_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Longest_matching_prefix_for_0_is_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Loading_0_from_the_root_dir_1_candidate_location_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Trying_other_entries_in_rootDirs: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_resolution_using_rootDirs_has_failed: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Do_not_emit_use_strict_directives_in_module_output: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Enable_strict_null_checks: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_option_excludes_Did_you_mean_exclude: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Raise_error_on_this_expressions_with_an_implied_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_using_primary_search_paths: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_from_node_modules_folder: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_reference_directive_0_was_not_resolved: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_with_primary_search_path_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Root_directory_cannot_be_determined_skipping_primary_search_paths: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_declaration_files_to_be_included_in_compilation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Looking_up_in_node_modules_folder_initial_location_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_config_file_0_found_doesn_t_contain_any_source_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolving_real_path_for_0_result_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - File_name_0_has_a_1_extension_stripping_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_declared_but_never_used: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_on_unused_locals: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Report_errors_on_unused_parameters: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_types_specified_in_package_json_so_returning_main_value_of_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_is_declared_but_never_used: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_emit_helpers_from_tslib: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_to_1_but_jsx_is_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_to_1_but_allowJs_is_not_set: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Resolution_for_module_0_was_found_in_cache: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Directory_0_does_not_exist_skipping_all_lookups_in_it: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Parameter_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Member_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Rest_parameter_0_implicitly_has_an_any_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _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: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - 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: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unreachable_code_detected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unused_label: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Fallthrough_case_in_switch: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Not_all_code_paths_return_a_value: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Binding_element_0_implicitly_has_an_1_type: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - You_cannot_rename_this_element: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - import_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - export_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_parameter_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - implements_clauses_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - interface_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - module_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_aliases_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - types_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_arguments_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - parameter_modifiers_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - enum_declarations_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - type_assertion_expressions_can_only_be_used_in_a_ts_file: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - class_expressions_are_not_currently_supported: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Language_service_is_disabled: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_attributes_must_only_be_assigned_a_non_empty_expression: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Expected_corresponding_JSX_closing_tag_for_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_attribute_expected: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - JSX_element_0_has_no_corresponding_closing_tag: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Unknown_type_acquisition_option_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Circularity_detected_while_resolving_configuration_Colon_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - The_files_list_in_config_file_0_is_empty: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Add_missing_super_call: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Make_super_call_the_first_statement_in_the_constructor: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Change_extends_to_implements: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Remove_unused_identifiers: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_interface_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Implement_inherited_abstract_class: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Import_0_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Change_0_to_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Add_0_to_existing_import_declaration_from_1: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { - code: number; - category: DiagnosticCategory; - key: string; - message: string; - }; - }; -} declare namespace ts { interface ErrorCallback { (message: DiagnosticMessage, length: number): void; } - function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean; interface Scanner { getStartPos(): number; getToken(): SyntaxKind; @@ -8808,24 +2146,13 @@ declare namespace ts { scanRange(start: number, length: number, callback: () => T): T; tryScan(callback: () => T): T; } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget): boolean; function tokenToString(t: SyntaxKind): string; - function stringToToken(s: string): SyntaxKind; - function computeLineStarts(text: string): number[]; function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; - function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { - line: number; - character: number; - }; function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; - function isOctalDigit(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; - function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean, stopAtComments?: boolean): number; function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; @@ -8835,23 +2162,9 @@ declare namespace ts { function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifierText(name: string, languageVersion: ScriptTarget): boolean; function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } declare namespace ts { - const compileOnSaveCommandLineOption: CommandLineOption; - const optionDeclarations: CommandLineOption[]; - let typeAcquisitionDeclarations: CommandLineOption[]; - interface OptionNameMap { - optionNameMap: Map; - shortOptionNames: Map; - } - const defaultInitCompilerOptions: CompilerOptions; - function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition; - function getOptionNameMap(): OptionNameMap; - function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType): Diagnostic; - function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]): string | number; - function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] | undefined; function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; function readConfigFile(fileName: string, readFile: (path: string) => string): { config?: any; @@ -8861,9 +2174,6 @@ declare namespace ts { config?: any; error?: Diagnostic; }; - function generateTSConfig(options: CompilerOptions, fileNames: string[]): { - compilerOptions: Map; - }; function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine; function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { @@ -8875,114 +2185,7 @@ declare namespace ts { errors: Diagnostic[]; }; } -declare namespace ts.JsTyping { - interface TypingResolutionHost { - directoryExists: (path: string) => boolean; - fileExists: (fileName: string) => boolean; - readFile: (path: string, encoding?: string) => string; - readDirectory: (rootDir: string, extensions: string[], excludes: string[], includes: string[], depth?: number) => string[]; - } - const nodeCoreModuleList: ReadonlyArray; - function discoverTypings(host: TypingResolutionHost, fileNames: string[], projectRootPath: Path, safeListPath: Path, packageNameToTypingLocation: Map, typeAcquisition: TypeAcquisition, unresolvedImports: ReadonlyArray): { - cachedTypingPaths: string[]; - newTypingNames: string[]; - filesToWatch: string[]; - }; -} -declare namespace ts.server { - const ActionSet: ActionSet; - const ActionInvalidate: ActionInvalidate; - const EventBeginInstallTypes: EventBeginInstallTypes; - const EventEndInstallTypes: EventEndInstallTypes; - namespace Arguments { - const GlobalCacheLocation = "--globalTypingsCacheLocation"; - const LogFile = "--logFile"; - const EnableTelemetry = "--enableTelemetry"; - } - function hasArgument(argumentName: string): boolean; - function findArgument(argumentName: string): string; -} -declare namespace ts.server { - enum LogLevel { - terse = 0, - normal = 1, - requestTime = 2, - verbose = 3, - } - const emptyArray: ReadonlyArray; - interface Logger { - close(): void; - hasLevel(level: LogLevel): boolean; - loggingEnabled(): boolean; - perftrc(s: string): void; - info(s: string): void; - startGroup(): void; - endGroup(): void; - msg(s: string, type?: Msg.Types): void; - getLogFileName(): string; - } - namespace Msg { - type Err = "Err"; - const Err: Err; - type Info = "Info"; - const Info: Info; - type Perf = "Perf"; - const Perf: Perf; - type Types = Err | Info | Perf; - } - function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; - namespace Errors { - function ThrowNoProject(): never; - function ThrowProjectLanguageServiceDisabled(): never; - function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; - } - function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; - function mergeMaps(target: MapLike, source: MapLike): void; - function removeItemFromSet(items: T[], itemToRemove: T): void; - type NormalizedPath = string & { - __normalizedPathTag: any; - }; - function toNormalizedPath(fileName: string): NormalizedPath; - function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path; - function asNormalizedPath(fileName: string): NormalizedPath; - interface NormalizedPathMap { - get(path: NormalizedPath): T; - set(path: NormalizedPath, value: T): void; - contains(path: NormalizedPath): boolean; - remove(path: NormalizedPath): void; - } - function createNormalizedPathMap(): NormalizedPathMap; - interface ProjectOptions { - configHasFilesProperty?: boolean; - files?: string[]; - wildcardDirectories?: Map; - compilerOptions?: CompilerOptions; - typeAcquisition?: TypeAcquisition; - compileOnSave?: boolean; - } - function isInferredProjectName(name: string): boolean; - function makeInferredProjectName(counter: number): string; - function toSortedReadonlyArray(arr: string[]): SortedReadonlyArray; - class ThrottledOperations { - private readonly host; - private pendingTimeouts; - constructor(host: ServerHost); - schedule(operationId: string, delay: number, cb: () => void): void; - private static run(self, operationId, cb); - } - class GcTimer { - private readonly host; - private readonly delay; - private readonly logger; - private timerId; - constructor(host: ServerHost, delay: number, logger: Logger); - scheduleCollect(): void; - private static run(self); - } -} declare namespace ts { - function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; - function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean; function moduleHasNonRelativeName(moduleName: string): boolean; function getEffectiveTypeRoots(options: CompilerOptions, host: { directoryExists?: (directoryName: string) => boolean; @@ -9003,396 +2206,7 @@ declare namespace ts { function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; - function directoryProbablyExists(directoryName: string, host: { - directoryExists?: (directoryName: string) => boolean; - }): boolean; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; - function loadModuleFromGlobalCache(moduleName: string, projectName: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, globalCache: string): ResolvedModuleWithFailedLookupLocations; -} -declare namespace ts { - const externalHelpersModuleNameText = "tslib"; - interface ReferencePathMatchResult { - fileReference?: FileReference; - diagnosticMessage?: DiagnosticMessage; - isNoDefaultLib?: boolean; - isTypeReferenceDirective?: boolean; - } - function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration; - interface StringSymbolWriter extends SymbolWriter { - string(): string; - } - function getSingleLineStringWriter(): StringSymbolWriter; - function releaseStringWriter(writer: StringSymbolWriter): void; - function getFullWidth(node: Node): number; - function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean; - function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModuleFull; - function setResolvedModule(sourceFile: SourceFile, moduleNameText: string, resolvedModule: ResolvedModuleFull): void; - function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void; - function moduleResolutionIsEqualTo(oldResolution: ResolvedModuleFull, newResolution: ResolvedModuleFull): boolean; - function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean; - function hasChangesInResolutions(names: string[], newResolutions: T[], oldResolutions: Map, comparer: (oldResolution: T, newResolution: T) => boolean): boolean; - function containsParseError(node: Node): boolean; - function getSourceFileOfNode(node: Node): SourceFile; - function isStatementWithLocals(node: Node): boolean; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function nodePosToString(node: Node): string; - function getStartPosOfNode(node: Node): number; - function isDefined(value: any): boolean; - function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function nodeIsMissing(node: Node): boolean; - function nodeIsPresent(node: Node): boolean; - function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number; - function isJSDocNode(node: Node): boolean; - function isJSDocTag(node: Node): boolean; - function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number; - function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node, includeTrivia?: boolean): string; - function getTextOfNodeFromSourceText(sourceText: string, node: Node): string; - function getTextOfNode(node: Node, includeTrivia?: boolean): string; - function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile, languageVersion: ScriptTarget): string; - function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean; - function escapeIdentifier(identifier: string): string; - function unescapeIdentifier(identifier: string): string; - function makeIdentifierFromModuleName(moduleName: string): string; - function isBlockOrCatchScoped(declaration: Declaration): boolean; - function isCatchClauseVariableDeclarationOrBindingElement(declaration: Declaration): boolean; - function isAmbientModule(node: Node): boolean; - function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean; - function isBlockScopedContainerTopLevel(node: Node): boolean; - function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean; - function isExternalModuleAugmentation(node: Node): boolean; - function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions): boolean; - function isBlockScope(node: Node, parentNode: Node): boolean; - function getEnclosingBlockScopeContainer(node: Node): Node; - function declarationNameToString(name: DeclarationName): string; - function getTextOfPropertyName(name: PropertyName): string; - function entityNameToString(name: EntityNameOrEntityNameExpression): string; - function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; - function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic; - function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic; - function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan; - function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan; - function isExternalOrCommonJsModule(file: SourceFile): boolean; - function isDeclarationFile(file: SourceFile): boolean; - function isConstEnumDeclaration(node: Node): boolean; - function isConst(node: Node): boolean; - function isLet(node: Node): boolean; - function isSuperCall(n: Node): n is SuperCall; - function isPrologueDirective(node: Node): node is PrologueDirective; - function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; - function getLeadingCommentRangesOfNodeFromText(node: Node, text: string): CommentRange[]; - function getJSDocCommentRanges(node: Node, text: string): CommentRange[]; - let fullTripleSlashReferencePathRegEx: RegExp; - let fullTripleSlashReferenceTypeReferenceDirectiveRegEx: RegExp; - let fullTripleSlashAMDReferencePathRegEx: RegExp; - function isPartOfTypeNode(node: Node): boolean; - function isChildOfNodeWithKind(node: Node, kind: SyntaxKind): boolean; - function isPrefixUnaryExpression(node: Node): node is PrefixUnaryExpression; - function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; - function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void; - function getRestParameterElementType(node: TypeNode): TypeNode; - function isVariableLike(node: Node): node is VariableLikeDeclaration; - function isAccessor(node: Node): node is AccessorDeclaration; - function isClassLike(node: Node): node is ClassLikeDeclaration; - function isFunctionLike(node: Node): node is FunctionLikeDeclaration; - function isFunctionLikeKind(kind: SyntaxKind): boolean; - function introducesArgumentsExoticObject(node: Node): boolean; - function isIterationStatement(node: Node, lookInLabeledStatements: boolean): node is IterationStatement; - function unwrapInnermostStatmentOfLabel(node: LabeledStatement, beforeUnwrapLabelCallback?: (node: LabeledStatement) => void): Statement; - function isFunctionBlock(node: Node): boolean; - function isObjectLiteralMethod(node: Node): node is MethodDeclaration; - function isObjectLiteralOrClassExpressionMethod(node: Node): node is MethodDeclaration; - function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate; - function isThisTypePredicate(predicate: TypePredicate): predicate is ThisTypePredicate; - function getContainingFunction(node: Node): FunctionLikeDeclaration; - function getContainingClass(node: Node): ClassLikeDeclaration; - function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; - function getNewTargetContainer(node: Node): Node; - function getSuperContainer(node: Node, stopOnFunctions: boolean): Node; - function getImmediatelyInvokedFunctionExpression(func: Node): CallExpression; - function isSuperProperty(node: Node): node is SuperProperty; - function getEntityNameFromTypeNode(node: TypeNode): EntityNameOrEntityNameExpression; - function isCallLikeExpression(node: Node): node is CallLikeExpression; - function getInvokedExpression(node: CallLikeExpression): Expression; - function nodeCanBeDecorated(node: Node): boolean; - function nodeIsDecorated(node: Node): boolean; - function nodeOrChildIsDecorated(node: Node): boolean; - function childIsDecorated(node: Node): boolean; - function isJSXTagName(node: Node): boolean; - function isPartOfExpression(node: Node): boolean; - function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; - function isExternalModuleImportEqualsDeclaration(node: Node): boolean; - function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression; - function isInternalModuleImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; - function isSourceFileJavaScript(file: SourceFile): boolean; - function isInJavaScriptFile(node: Node): boolean; - function isRequireCall(expression: Node, checkArgumentIsStringLiteral: boolean): expression is CallExpression; - function isSingleOrDoubleQuote(charCode: number): boolean; - function isDeclarationOfFunctionExpression(s: Symbol): boolean; - function getSpecialPropertyAssignmentKind(expression: Node): SpecialPropertyAssignmentKind; - function getExternalModuleName(node: Node): Expression; - function getNamespaceDeclarationNode(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): ImportEqualsDeclaration | NamespaceImport; - function isDefaultImport(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean; - function hasQuestionToken(node: Node): boolean; - function isJSDocConstructSignature(node: Node): boolean; - function getCommentsFromJSDoc(node: Node): string[]; - function getJSDocParameterTags(param: Node): JSDocParameterTag[]; - function getJSDocType(node: Node): JSDocType; - function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag; - function getJSDocReturnTag(node: Node): JSDocReturnTag; - function getJSDocTemplateTag(node: Node): JSDocTemplateTag; - function hasRestParameter(s: SignatureDeclaration): boolean; - function hasDeclaredRestParameter(s: SignatureDeclaration): boolean; - function isRestParameter(node: ParameterDeclaration): boolean; - function isDeclaredRestParam(node: ParameterDeclaration): boolean; - const enum AssignmentKind { - None = 0, - Definite = 1, - Compound = 2, - } - function getAssignmentTargetKind(node: Node): AssignmentKind; - function isAssignmentTarget(node: Node): boolean; - function isDeleteTarget(node: Node): boolean; - function isNodeDescendantOf(node: Node, ancestor: Node): boolean; - function isInAmbientContext(node: Node): boolean; - function isDeclarationName(name: Node): boolean; - function isLiteralComputedPropertyDeclarationName(node: Node): boolean; - function isIdentifierName(node: Identifier): boolean; - function isAliasSymbolDeclaration(node: Node): boolean; - function exportAssignmentIsAlias(node: ExportAssignment): boolean; - function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration | InterfaceDeclaration): ExpressionWithTypeArguments; - function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration): NodeArray; - function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray; - function getHeritageClause(clauses: NodeArray, kind: SyntaxKind): HeritageClause; - function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile; - function getAncestor(node: Node | undefined, kind: SyntaxKind): Node; - function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; - function isKeyword(token: SyntaxKind): boolean; - function isTrivia(token: SyntaxKind): boolean; - function isAsyncFunctionLike(node: Node): boolean; - function isStringOrNumericLiteral(node: Node): node is StringLiteral | NumericLiteral; - function hasDynamicName(declaration: Declaration): boolean; - function isDynamicName(name: DeclarationName): boolean; - function isWellKnownSymbolSyntactically(node: Expression): boolean; - function getPropertyNameForPropertyNameNode(name: DeclarationName | ParameterDeclaration): string; - function getPropertyNameForKnownSymbolName(symbolName: string): string; - function isESSymbolIdentifier(node: Node): boolean; - function isPushOrUnshiftIdentifier(node: Identifier): boolean; - function isModifierKind(token: SyntaxKind): boolean; - function isParameterDeclaration(node: VariableLikeDeclaration): boolean; - function getRootDeclaration(node: Node): Node; - function nodeStartsNewLexicalEnvironment(node: Node): boolean; - function nodeIsSynthesized(node: TextRange): boolean; - function getOriginalNode(node: Node): Node; - function getOriginalNode(node: Node, nodeTest: (node: Node) => node is T): T; - function isParseTreeNode(node: Node): boolean; - function getParseTreeNode(node: Node): Node; - function getParseTreeNode(node: Node, nodeTest?: (node: Node) => node is T): T; - function getOriginalSourceFiles(sourceFiles: SourceFile[]): SourceFile[]; - function getOriginalNodeId(node: Node): number; - const enum Associativity { - Left = 0, - Right = 1, - } - function getExpressionAssociativity(expression: Expression): Associativity; - function getOperatorAssociativity(kind: SyntaxKind, operator: SyntaxKind, hasArguments?: boolean): Associativity; - function getExpressionPrecedence(expression: Expression): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function getOperator(expression: Expression): SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.NumericLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.Identifier | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.LetKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.StaticKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AbstractKeyword | SyntaxKind.AsKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.GetKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.NumberKeyword | SyntaxKind.SetKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.TypeKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.FromKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.OfKeyword | SyntaxKind.QualifiedName | SyntaxKind.ComputedPropertyName | SyntaxKind.TypeParameter | SyntaxKind.Parameter | SyntaxKind.Decorator | SyntaxKind.PropertySignature | SyntaxKind.PropertyDeclaration | SyntaxKind.MethodSignature | SyntaxKind.MethodDeclaration | SyntaxKind.Constructor | SyntaxKind.GetAccessor | SyntaxKind.SetAccessor | SyntaxKind.CallSignature | SyntaxKind.ConstructSignature | SyntaxKind.IndexSignature | SyntaxKind.TypePredicate | SyntaxKind.TypeReference | SyntaxKind.FunctionType | SyntaxKind.ConstructorType | SyntaxKind.TypeQuery | SyntaxKind.TypeLiteral | SyntaxKind.ArrayType | SyntaxKind.TupleType | SyntaxKind.UnionType | SyntaxKind.IntersectionType | SyntaxKind.ParenthesizedType | SyntaxKind.ThisType | SyntaxKind.TypeOperator | SyntaxKind.IndexedAccessType | SyntaxKind.MappedType | SyntaxKind.LiteralType | SyntaxKind.ObjectBindingPattern | SyntaxKind.ArrayBindingPattern | SyntaxKind.BindingElement | SyntaxKind.ArrayLiteralExpression | SyntaxKind.ObjectLiteralExpression | SyntaxKind.PropertyAccessExpression | SyntaxKind.ElementAccessExpression | SyntaxKind.CallExpression | SyntaxKind.NewExpression | SyntaxKind.TaggedTemplateExpression | SyntaxKind.TypeAssertionExpression | SyntaxKind.ParenthesizedExpression | SyntaxKind.FunctionExpression | SyntaxKind.ArrowFunction | SyntaxKind.DeleteExpression | SyntaxKind.TypeOfExpression | SyntaxKind.VoidExpression | SyntaxKind.AwaitExpression | SyntaxKind.ConditionalExpression | SyntaxKind.TemplateExpression | SyntaxKind.YieldExpression | SyntaxKind.SpreadElement | SyntaxKind.ClassExpression | SyntaxKind.OmittedExpression | SyntaxKind.ExpressionWithTypeArguments | SyntaxKind.AsExpression | SyntaxKind.NonNullExpression | SyntaxKind.MetaProperty | SyntaxKind.TemplateSpan | SyntaxKind.SemicolonClassElement | SyntaxKind.Block | SyntaxKind.VariableStatement | SyntaxKind.EmptyStatement | SyntaxKind.ExpressionStatement | SyntaxKind.IfStatement | SyntaxKind.DoStatement | SyntaxKind.WhileStatement | SyntaxKind.ForStatement | SyntaxKind.ForInStatement | SyntaxKind.ForOfStatement | SyntaxKind.ContinueStatement | SyntaxKind.BreakStatement | SyntaxKind.ReturnStatement | SyntaxKind.WithStatement | SyntaxKind.SwitchStatement | SyntaxKind.LabeledStatement | SyntaxKind.ThrowStatement | SyntaxKind.TryStatement | SyntaxKind.DebuggerStatement | SyntaxKind.VariableDeclaration | SyntaxKind.VariableDeclarationList | SyntaxKind.FunctionDeclaration | SyntaxKind.ClassDeclaration | SyntaxKind.InterfaceDeclaration | SyntaxKind.TypeAliasDeclaration | SyntaxKind.EnumDeclaration | SyntaxKind.ModuleDeclaration | SyntaxKind.ModuleBlock | SyntaxKind.CaseBlock | SyntaxKind.NamespaceExportDeclaration | SyntaxKind.ImportEqualsDeclaration | SyntaxKind.ImportDeclaration | SyntaxKind.ImportClause | SyntaxKind.NamespaceImport | SyntaxKind.NamedImports | SyntaxKind.ImportSpecifier | SyntaxKind.ExportAssignment | SyntaxKind.ExportDeclaration | SyntaxKind.NamedExports | SyntaxKind.ExportSpecifier | SyntaxKind.MissingDeclaration | SyntaxKind.ExternalModuleReference | SyntaxKind.JsxElement | SyntaxKind.JsxSelfClosingElement | SyntaxKind.JsxOpeningElement | SyntaxKind.JsxClosingElement | SyntaxKind.JsxAttribute | SyntaxKind.JsxSpreadAttribute | SyntaxKind.JsxExpression | SyntaxKind.CaseClause | SyntaxKind.DefaultClause | SyntaxKind.HeritageClause | SyntaxKind.CatchClause | SyntaxKind.PropertyAssignment | SyntaxKind.ShorthandPropertyAssignment | SyntaxKind.SpreadAssignment | SyntaxKind.EnumMember | SyntaxKind.SourceFile | SyntaxKind.JSDocTypeExpression | SyntaxKind.JSDocAllType | SyntaxKind.JSDocUnknownType | SyntaxKind.JSDocArrayType | SyntaxKind.JSDocUnionType | SyntaxKind.JSDocTupleType | SyntaxKind.JSDocNullableType | SyntaxKind.JSDocNonNullableType | SyntaxKind.JSDocRecordType | SyntaxKind.JSDocRecordMember | SyntaxKind.JSDocTypeReference | SyntaxKind.JSDocOptionalType | SyntaxKind.JSDocFunctionType | SyntaxKind.JSDocVariadicType | SyntaxKind.JSDocConstructorType | SyntaxKind.JSDocThisType | SyntaxKind.JSDocComment | SyntaxKind.JSDocTag | SyntaxKind.JSDocAugmentsTag | SyntaxKind.JSDocParameterTag | SyntaxKind.JSDocReturnTag | SyntaxKind.JSDocTypeTag | SyntaxKind.JSDocTemplateTag | SyntaxKind.JSDocTypedefTag | SyntaxKind.JSDocPropertyTag | SyntaxKind.JSDocTypeLiteral | SyntaxKind.JSDocLiteralType | SyntaxKind.JSDocNullKeyword | SyntaxKind.JSDocUndefinedKeyword | SyntaxKind.JSDocNeverKeyword | SyntaxKind.SyntaxList | SyntaxKind.NotEmittedStatement | SyntaxKind.PartiallyEmittedExpression | SyntaxKind.MergeDeclarationMarker | SyntaxKind.EndOfDeclarationMarker | SyntaxKind.Count; - function getOperatorPrecedence(nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean): 0 | 1 | -1 | 2 | 4 | 3 | 16 | 10 | 5 | 6 | 11 | 8 | 19 | 18 | 17 | 15 | 14 | 13 | 12 | 9 | 7; - function createDiagnosticCollection(): DiagnosticCollection; - function escapeString(s: string): string; - function isIntrinsicJsxName(name: string): boolean; - function escapeNonAsciiCharacters(s: string): string; - interface EmitTextWriter { - write(s: string): void; - writeTextOfNode(text: string, node: Node): void; - writeLine(): void; - increaseIndent(): void; - decreaseIndent(): void; - getText(): string; - rawWrite(s: string): void; - writeLiteral(s: string): void; - getTextPos(): number; - getLine(): number; - getColumn(): number; - getIndent(): number; - isAtStartOfLine(): boolean; - reset(): void; - } - function getIndentString(level: number): string; - function getIndentSize(): number; - function createTextWriter(newLine: String): EmitTextWriter; - function getResolvedExternalModuleName(host: EmitHost, file: SourceFile): string; - function getExternalModuleNameFromDeclaration(host: EmitHost, resolver: EmitResolver, declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): string; - function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string; - function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string; - function getDeclarationEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost): string; - interface EmitFileNames { - jsFilePath: string; - sourceMapFilePath: string; - declarationFilePath: string; - } - function getSourceFilesToEmit(host: EmitHost, targetSourceFile?: SourceFile): SourceFile[]; - function filterSourceFilesInDirectory(sourceFiles: SourceFile[], isSourceFileFromExternalLibrary: (file: SourceFile) => boolean): SourceFile[]; - function forEachTransformedEmitFile(host: EmitHost, sourceFiles: SourceFile[], action: (jsFilePath: string, sourceMapFilePath: string, declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) => void, emitOnlyDtsFiles?: boolean): void; - function forEachExpectedEmitFile(host: EmitHost, action: (emitFileNames: EmitFileNames, sourceFiles: SourceFile[], isBundledEmit: boolean, emitOnlyDtsFiles: boolean) => void, targetSourceFile?: SourceFile, emitOnlyDtsFiles?: boolean): void; - function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string; - function writeFile(host: EmitHost, diagnostics: DiagnosticCollection, fileName: string, data: string, writeByteOrderMark: boolean, sourceFiles?: SourceFile[]): void; - function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number; - function getLineOfLocalPositionFromLineMap(lineMap: number[], pos: number): number; - function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration; - function getSetAccessorTypeAnnotationNode(accessor: SetAccessorDeclaration): TypeNode; - function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined; - function parameterIsThisKeyword(parameter: ParameterDeclaration): boolean; - function isThisIdentifier(node: Node | undefined): boolean; - function identifierIsThisKeyword(id: Identifier): boolean; - interface AllAccessorDeclarations { - firstAccessor: AccessorDeclaration; - secondAccessor: AccessorDeclaration; - getAccessor: AccessorDeclaration; - setAccessor: AccessorDeclaration; - } - function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration): AllAccessorDeclarations; - function emitNewLineBeforeLeadingComments(lineMap: number[], writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void; - function emitNewLineBeforeLeadingCommentsOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, leadingComments: CommentRange[]): void; - function emitNewLineBeforeLeadingCommentOfPosition(lineMap: number[], writer: EmitTextWriter, pos: number, commentPos: number): void; - function emitComments(text: string, lineMap: number[], writer: EmitTextWriter, comments: CommentRange[], leadingSeparator: boolean, trailingSeparator: boolean, newLine: string, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void): void; - function emitDetachedComments(text: string, lineMap: number[], writer: EmitTextWriter, writeComment: (text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void, node: TextRange, newLine: string, removeComments: boolean): { - nodePos: number; - detachedCommentEndPos: number; - }; - function writeCommentRange(text: string, lineMap: number[], writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string): void; - function hasModifiers(node: Node): boolean; - function hasModifier(node: Node, flags: ModifierFlags): boolean; - function getModifierFlags(node: Node): ModifierFlags; - function modifierToFlag(token: SyntaxKind): ModifierFlags; - function isLogicalOperator(token: SyntaxKind): boolean; - function isAssignmentOperator(token: SyntaxKind): boolean; - function tryGetClassExtendingExpressionWithTypeArguments(node: Node): ClassLikeDeclaration | undefined; - function isAssignmentExpression(node: Node, excludeCompoundAssignment: true): node is AssignmentExpression; - function isAssignmentExpression(node: Node, excludeCompoundAssignment?: false): node is AssignmentExpression; - function isDestructuringAssignment(node: Node): node is DestructuringAssignment; - function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean; - function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean; - function isEntityNameExpression(node: Expression): node is EntityNameExpression; - function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean; - function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean; - function getLocalSymbolForExportDefault(symbol: Symbol): Symbol; - function tryExtractTypeScriptExtension(fileName: string): string | undefined; - function convertToBase64(input: string): string; - function getNewLineCharacter(options: CompilerOptions): string; - function isSimpleExpression(node: Expression): boolean; - function formatSyntaxKind(kind: SyntaxKind): string; - function movePos(pos: number, value: number): number; - function createRange(pos: number, end: number): TextRange; - function moveRangeEnd(range: TextRange, end: number): TextRange; - function moveRangePos(range: TextRange, pos: number): TextRange; - function moveRangePastDecorators(node: Node): TextRange; - function moveRangePastModifiers(node: Node): TextRange; - function isCollapsedRange(range: TextRange): boolean; - function collapseRangeToStart(range: TextRange): TextRange; - function collapseRangeToEnd(range: TextRange): TextRange; - function createTokenRange(pos: number, token: SyntaxKind): TextRange; - function rangeIsOnSingleLine(range: TextRange, sourceFile: SourceFile): boolean; - function rangeStartPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndPositionsAreOnSameLine(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeStartIsOnSameLineAsRangeEnd(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function rangeEndIsOnSameLineAsRangeStart(range1: TextRange, range2: TextRange, sourceFile: SourceFile): boolean; - function positionsAreOnSameLine(pos1: number, pos2: number, sourceFile: SourceFile): boolean; - function getStartPositionOfRange(range: TextRange, sourceFile: SourceFile): number; - function isDeclarationNameOfEnumOrNamespace(node: Identifier): boolean; - function getInitializedVariables(node: VariableDeclarationList): VariableDeclaration[]; - function isMergedWithClass(node: Node): boolean; - function isFirstDeclarationOfKind(node: Node, kind: SyntaxKind): boolean; - function isNodeArray(array: T[]): array is NodeArray; - function isNoSubstitutionTemplateLiteral(node: Node): node is LiteralExpression; - function isLiteralKind(kind: SyntaxKind): boolean; - function isTextualLiteralKind(kind: SyntaxKind): boolean; - function isLiteralExpression(node: Node): node is LiteralExpression; - function isTemplateLiteralKind(kind: SyntaxKind): boolean; - function isTemplateHead(node: Node): node is TemplateHead; - function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail; - function isIdentifier(node: Node): node is Identifier; - function isVoidExpression(node: Node): node is VoidExpression; - function isGeneratedIdentifier(node: Node): node is GeneratedIdentifier; - function isModifier(node: Node): node is Modifier; - function isQualifiedName(node: Node): node is QualifiedName; - function isComputedPropertyName(node: Node): node is ComputedPropertyName; - function isEntityName(node: Node): node is EntityName; - function isPropertyName(node: Node): node is PropertyName; - function isModuleName(node: Node): node is ModuleName; - function isBindingName(node: Node): node is BindingName; - function isTypeParameter(node: Node): node is TypeParameterDeclaration; - function isParameter(node: Node): node is ParameterDeclaration; - function isDecorator(node: Node): node is Decorator; - function isMethodDeclaration(node: Node): node is MethodDeclaration; - function isClassElement(node: Node): node is ClassElement; - function isObjectLiteralElementLike(node: Node): node is ObjectLiteralElementLike; - function isTypeNode(node: Node): node is TypeNode; - function isArrayBindingPattern(node: Node): node is ArrayBindingPattern; - function isObjectBindingPattern(node: Node): node is ObjectBindingPattern; - function isBindingPattern(node: Node): node is BindingPattern; - function isAssignmentPattern(node: Node): node is AssignmentPattern; - function isBindingElement(node: Node): node is BindingElement; - function isArrayBindingElement(node: Node): node is ArrayBindingElement; - function isDeclarationBindingElement(bindingElement: BindingOrAssignmentElement): bindingElement is VariableDeclaration | ParameterDeclaration | BindingElement; - function isBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is BindingOrAssignmentPattern; - function isObjectBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ObjectBindingOrAssignmentPattern; - function isArrayBindingOrAssignmentPattern(node: BindingOrAssignmentElementTarget): node is ArrayBindingOrAssignmentPattern; - function isArrayLiteralExpression(node: Node): node is ArrayLiteralExpression; - function isObjectLiteralExpression(node: Node): node is ObjectLiteralExpression; - function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression; - function isElementAccessExpression(node: Node): node is ElementAccessExpression; - function isBinaryExpression(node: Node): node is BinaryExpression; - function isConditionalExpression(node: Node): node is ConditionalExpression; - function isCallExpression(node: Node): node is CallExpression; - function isTemplateLiteral(node: Node): node is TemplateLiteral; - function isSpreadExpression(node: Node): node is SpreadElement; - function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; - function isLeftHandSideExpression(node: Node): node is LeftHandSideExpression; - function isUnaryExpression(node: Node): node is UnaryExpression; - function isExpression(node: Node): node is Expression; - function isAssertionExpression(node: Node): node is AssertionExpression; - function isPartiallyEmittedExpression(node: Node): node is PartiallyEmittedExpression; - function isNotEmittedStatement(node: Node): node is NotEmittedStatement; - function isNotEmittedOrPartiallyEmittedNode(node: Node): node is NotEmittedStatement | PartiallyEmittedExpression; - function isOmittedExpression(node: Node): node is OmittedExpression; - function isTemplateSpan(node: Node): node is TemplateSpan; - function isBlock(node: Node): node is Block; - function isConciseBody(node: Node): node is ConciseBody; - function isFunctionBody(node: Node): node is FunctionBody; - function isForInitializer(node: Node): node is ForInitializer; - function isVariableDeclaration(node: Node): node is VariableDeclaration; - function isVariableDeclarationList(node: Node): node is VariableDeclarationList; - function isCaseBlock(node: Node): node is CaseBlock; - function isModuleBody(node: Node): node is ModuleBody; - function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration; - function isImportClause(node: Node): node is ImportClause; - function isNamedImportBindings(node: Node): node is NamedImportBindings; - function isImportSpecifier(node: Node): node is ImportSpecifier; - function isNamedExports(node: Node): node is NamedExports; - function isExportSpecifier(node: Node): node is ExportSpecifier; - function isModuleOrEnumDeclaration(node: Node): node is ModuleDeclaration | EnumDeclaration; - function isDeclaration(node: Node): node is Declaration; - function isDeclarationStatement(node: Node): node is DeclarationStatement; - function isStatementButNotDeclaration(node: Node): node is Statement; - function isStatement(node: Node): node is Statement; - function isModuleReference(node: Node): node is ModuleReference; - function isJsxOpeningElement(node: Node): node is JsxOpeningElement; - function isJsxClosingElement(node: Node): node is JsxClosingElement; - function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression; - function isJsxChild(node: Node): node is JsxChild; - function isJsxAttributeLike(node: Node): node is JsxAttributeLike; - function isJsxSpreadAttribute(node: Node): node is JsxSpreadAttribute; - function isJsxAttribute(node: Node): node is JsxAttribute; - function isStringLiteralOrJsxExpression(node: Node): node is StringLiteral | JsxExpression; - function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause; - function isHeritageClause(node: Node): node is HeritageClause; - function isCatchClause(node: Node): node is CatchClause; - function isPropertyAssignment(node: Node): node is PropertyAssignment; - function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment; - function isEnumMember(node: Node): node is EnumMember; - function isSourceFile(node: Node): node is SourceFile; - function isWatchSet(options: CompilerOptions): boolean; } declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; @@ -9425,317 +2239,6 @@ declare namespace ts { readFile(fileName: string): string; }, errors?: Diagnostic[]): void; } -declare namespace ts { - function updateNode(updated: T, original: T): T; - function createNodeArray(elements?: T[], location?: TextRange, hasTrailingComma?: boolean): NodeArray; - function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; - function createSynthesizedNodeArray(elements?: T[]): NodeArray; - function getSynthesizedClone(node: T): T; - function getMutableClone(node: T): T; - function createLiteral(textSource: StringLiteral | NumericLiteral | Identifier, location?: TextRange): StringLiteral; - function createLiteral(value: string, location?: TextRange): StringLiteral; - function createLiteral(value: number, location?: TextRange): NumericLiteral; - function createLiteral(value: boolean, location?: TextRange): BooleanLiteral; - function createLiteral(value: string | number | boolean, location?: TextRange): PrimaryExpression; - function createIdentifier(text: string, location?: TextRange): Identifier; - function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, location?: TextRange): Identifier; - function createLoopVariable(location?: TextRange): Identifier; - function createUniqueName(text: string, location?: TextRange): Identifier; - function getGeneratedNameForNode(node: Node, location?: TextRange): Identifier; - function createToken(token: TKind): Token; - function createSuper(): PrimaryExpression; - function createThis(location?: TextRange): PrimaryExpression; - function createNull(): PrimaryExpression; - function createComputedPropertyName(expression: Expression, location?: TextRange): ComputedPropertyName; - function updateComputedPropertyName(node: ComputedPropertyName, expression: Expression): ComputedPropertyName; - function createParameter(decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: string | Identifier | BindingPattern, questionToken?: QuestionToken, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): ParameterDeclaration; - function updateParameter(node: ParameterDeclaration, decorators: Decorator[], modifiers: Modifier[], dotDotDotToken: DotDotDotToken, name: BindingName, type: TypeNode, initializer: Expression): ParameterDeclaration; - function createProperty(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, questionToken: QuestionToken, type: TypeNode, initializer: Expression, location?: TextRange): PropertyDeclaration; - function updateProperty(node: PropertyDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, type: TypeNode, initializer: Expression): PropertyDeclaration; - function createMethod(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): MethodDeclaration; - function updateMethod(node: MethodDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): MethodDeclaration; - function createConstructor(decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): ConstructorDeclaration; - function updateConstructor(node: ConstructorDeclaration, decorators: Decorator[], modifiers: Modifier[], parameters: ParameterDeclaration[], body: Block): ConstructorDeclaration; - function createGetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): GetAccessorDeclaration; - function updateGetAccessor(node: GetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], type: TypeNode, body: Block): GetAccessorDeclaration; - function createSetAccessor(decorators: Decorator[], modifiers: Modifier[], name: string | PropertyName, parameters: ParameterDeclaration[], body: Block, location?: TextRange, flags?: NodeFlags): SetAccessorDeclaration; - function updateSetAccessor(node: SetAccessorDeclaration, decorators: Decorator[], modifiers: Modifier[], name: PropertyName, parameters: ParameterDeclaration[], body: Block): SetAccessorDeclaration; - function createObjectBindingPattern(elements: BindingElement[], location?: TextRange): ObjectBindingPattern; - function updateObjectBindingPattern(node: ObjectBindingPattern, elements: BindingElement[]): ObjectBindingPattern; - function createArrayBindingPattern(elements: ArrayBindingElement[], location?: TextRange): ArrayBindingPattern; - function updateArrayBindingPattern(node: ArrayBindingPattern, elements: ArrayBindingElement[]): ArrayBindingPattern; - function createBindingElement(propertyName: string | PropertyName, dotDotDotToken: DotDotDotToken, name: string | BindingName, initializer?: Expression, location?: TextRange): BindingElement; - function updateBindingElement(node: BindingElement, dotDotDotToken: DotDotDotToken, propertyName: PropertyName, name: BindingName, initializer: Expression): BindingElement; - function createArrayLiteral(elements?: Expression[], location?: TextRange, multiLine?: boolean): ArrayLiteralExpression; - function updateArrayLiteral(node: ArrayLiteralExpression, elements: Expression[]): ArrayLiteralExpression; - function createObjectLiteral(properties?: ObjectLiteralElementLike[], location?: TextRange, multiLine?: boolean): ObjectLiteralExpression; - function updateObjectLiteral(node: ObjectLiteralExpression, properties: ObjectLiteralElementLike[]): ObjectLiteralExpression; - function createPropertyAccess(expression: Expression, name: string | Identifier, location?: TextRange, flags?: NodeFlags): PropertyAccessExpression; - function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression; - function createElementAccess(expression: Expression, index: number | Expression, location?: TextRange): ElementAccessExpression; - function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression; - function createCall(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): CallExpression; - function updateCall(node: CallExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): CallExpression; - function createNew(expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[], location?: TextRange, flags?: NodeFlags): NewExpression; - function updateNew(node: NewExpression, expression: Expression, typeArguments: TypeNode[], argumentsArray: Expression[]): NewExpression; - function createTaggedTemplate(tag: Expression, template: TemplateLiteral, location?: TextRange): TaggedTemplateExpression; - function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression; - function createParen(expression: Expression, location?: TextRange): ParenthesizedExpression; - function updateParen(node: ParenthesizedExpression, expression: Expression): ParenthesizedExpression; - function createFunctionExpression(modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionExpression; - function updateFunctionExpression(node: FunctionExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionExpression; - function createArrowFunction(modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, equalsGreaterThanToken: EqualsGreaterThanToken, body: ConciseBody, location?: TextRange, flags?: NodeFlags): ArrowFunction; - function updateArrowFunction(node: ArrowFunction, modifiers: Modifier[], typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: ConciseBody): ArrowFunction; - function createDelete(expression: Expression, location?: TextRange): DeleteExpression; - function updateDelete(node: DeleteExpression, expression: Expression): Expression; - function createTypeOf(expression: Expression, location?: TextRange): TypeOfExpression; - function updateTypeOf(node: TypeOfExpression, expression: Expression): Expression; - function createVoid(expression: Expression, location?: TextRange): VoidExpression; - function updateVoid(node: VoidExpression, expression: Expression): VoidExpression; - function createAwait(expression: Expression, location?: TextRange): AwaitExpression; - function updateAwait(node: AwaitExpression, expression: Expression): AwaitExpression; - function createPrefix(operator: PrefixUnaryOperator, operand: Expression, location?: TextRange): PrefixUnaryExpression; - function updatePrefix(node: PrefixUnaryExpression, operand: Expression): PrefixUnaryExpression; - function createPostfix(operand: Expression, operator: PostfixUnaryOperator, location?: TextRange): PostfixUnaryExpression; - function updatePostfix(node: PostfixUnaryExpression, operand: Expression): PostfixUnaryExpression; - function createBinary(left: Expression, operator: BinaryOperator | BinaryOperatorToken, right: Expression, location?: TextRange): BinaryExpression; - function updateBinary(node: BinaryExpression, left: Expression, right: Expression): BinaryExpression; - function createConditional(condition: Expression, whenTrue: Expression, whenFalse: Expression, location?: TextRange): ConditionalExpression; - function createConditional(condition: Expression, questionToken: QuestionToken, whenTrue: Expression, colonToken: ColonToken, whenFalse: Expression, location?: TextRange): ConditionalExpression; - function updateConditional(node: ConditionalExpression, condition: Expression, whenTrue: Expression, whenFalse: Expression): ConditionalExpression; - function createTemplateExpression(head: TemplateHead, templateSpans: TemplateSpan[], location?: TextRange): TemplateExpression; - function updateTemplateExpression(node: TemplateExpression, head: TemplateHead, templateSpans: TemplateSpan[]): TemplateExpression; - function createYield(asteriskToken: AsteriskToken, expression: Expression, location?: TextRange): YieldExpression; - function updateYield(node: YieldExpression, expression: Expression): YieldExpression; - function createSpread(expression: Expression, location?: TextRange): SpreadElement; - function updateSpread(node: SpreadElement, expression: Expression): SpreadElement; - function createClassExpression(modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassExpression; - function updateClassExpression(node: ClassExpression, modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassExpression; - function createOmittedExpression(location?: TextRange): OmittedExpression; - function createExpressionWithTypeArguments(typeArguments: TypeNode[], expression: Expression, location?: TextRange): ExpressionWithTypeArguments; - function updateExpressionWithTypeArguments(node: ExpressionWithTypeArguments, typeArguments: TypeNode[], expression: Expression): ExpressionWithTypeArguments; - function createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail, location?: TextRange): TemplateSpan; - function updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; - function createBlock(statements: Statement[], location?: TextRange, multiLine?: boolean, flags?: NodeFlags): Block; - function updateBlock(node: Block, statements: Statement[]): Block; - function createVariableStatement(modifiers: Modifier[], declarationList: VariableDeclarationList | VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableStatement; - function updateVariableStatement(node: VariableStatement, modifiers: Modifier[], declarationList: VariableDeclarationList): VariableStatement; - function createVariableDeclarationList(declarations: VariableDeclaration[], location?: TextRange, flags?: NodeFlags): VariableDeclarationList; - function updateVariableDeclarationList(node: VariableDeclarationList, declarations: VariableDeclaration[]): VariableDeclarationList; - function createVariableDeclaration(name: string | BindingPattern | Identifier, type?: TypeNode, initializer?: Expression, location?: TextRange, flags?: NodeFlags): VariableDeclaration; - function updateVariableDeclaration(node: VariableDeclaration, name: BindingName, type: TypeNode, initializer: Expression): VariableDeclaration; - function createEmptyStatement(location: TextRange): EmptyStatement; - function createStatement(expression: Expression, location?: TextRange, flags?: NodeFlags): ExpressionStatement; - function updateStatement(node: ExpressionStatement, expression: Expression): ExpressionStatement; - function createIf(expression: Expression, thenStatement: Statement, elseStatement?: Statement, location?: TextRange): IfStatement; - function updateIf(node: IfStatement, expression: Expression, thenStatement: Statement, elseStatement: Statement): IfStatement; - function createDo(statement: Statement, expression: Expression, location?: TextRange): DoStatement; - function updateDo(node: DoStatement, statement: Statement, expression: Expression): DoStatement; - function createWhile(expression: Expression, statement: Statement, location?: TextRange): WhileStatement; - function updateWhile(node: WhileStatement, expression: Expression, statement: Statement): WhileStatement; - function createFor(initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement, location?: TextRange): ForStatement; - function updateFor(node: ForStatement, initializer: ForInitializer, condition: Expression, incrementor: Expression, statement: Statement): ForStatement; - function createForIn(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForInStatement; - function updateForIn(node: ForInStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForInStatement; - function createForOf(initializer: ForInitializer, expression: Expression, statement: Statement, location?: TextRange): ForOfStatement; - function updateForOf(node: ForOfStatement, initializer: ForInitializer, expression: Expression, statement: Statement): ForOfStatement; - function createContinue(label?: Identifier, location?: TextRange): ContinueStatement; - function updateContinue(node: ContinueStatement, label: Identifier): ContinueStatement; - function createBreak(label?: Identifier, location?: TextRange): BreakStatement; - function updateBreak(node: BreakStatement, label: Identifier): BreakStatement; - function createReturn(expression?: Expression, location?: TextRange): ReturnStatement; - function updateReturn(node: ReturnStatement, expression: Expression): ReturnStatement; - function createWith(expression: Expression, statement: Statement, location?: TextRange): WithStatement; - function updateWith(node: WithStatement, expression: Expression, statement: Statement): WithStatement; - function createSwitch(expression: Expression, caseBlock: CaseBlock, location?: TextRange): SwitchStatement; - function updateSwitch(node: SwitchStatement, expression: Expression, caseBlock: CaseBlock): SwitchStatement; - function createLabel(label: string | Identifier, statement: Statement, location?: TextRange): LabeledStatement; - function updateLabel(node: LabeledStatement, label: Identifier, statement: Statement): LabeledStatement; - function createThrow(expression: Expression, location?: TextRange): ThrowStatement; - function updateThrow(node: ThrowStatement, expression: Expression): ThrowStatement; - function createTry(tryBlock: Block, catchClause: CatchClause, finallyBlock: Block, location?: TextRange): TryStatement; - function updateTry(node: TryStatement, tryBlock: Block, catchClause: CatchClause, finallyBlock: Block): TryStatement; - function createCaseBlock(clauses: CaseOrDefaultClause[], location?: TextRange): CaseBlock; - function updateCaseBlock(node: CaseBlock, clauses: CaseOrDefaultClause[]): CaseBlock; - function createFunctionDeclaration(decorators: Decorator[], modifiers: Modifier[], asteriskToken: AsteriskToken, name: string | Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block, location?: TextRange, flags?: NodeFlags): FunctionDeclaration; - function updateFunctionDeclaration(node: FunctionDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], parameters: ParameterDeclaration[], type: TypeNode, body: Block): FunctionDeclaration; - function createClassDeclaration(decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[], location?: TextRange): ClassDeclaration; - function updateClassDeclaration(node: ClassDeclaration, decorators: Decorator[], modifiers: Modifier[], name: Identifier, typeParameters: TypeParameterDeclaration[], heritageClauses: HeritageClause[], members: ClassElement[]): ClassDeclaration; - function createImportDeclaration(decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier?: Expression, location?: TextRange): ImportDeclaration; - function updateImportDeclaration(node: ImportDeclaration, decorators: Decorator[], modifiers: Modifier[], importClause: ImportClause, moduleSpecifier: Expression): ImportDeclaration; - function createImportClause(name: Identifier, namedBindings: NamedImportBindings, location?: TextRange): ImportClause; - function updateImportClause(node: ImportClause, name: Identifier, namedBindings: NamedImportBindings): ImportClause; - function createNamespaceImport(name: Identifier, location?: TextRange): NamespaceImport; - function updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; - function createNamedImports(elements: ImportSpecifier[], location?: TextRange): NamedImports; - function updateNamedImports(node: NamedImports, elements: ImportSpecifier[]): NamedImports; - function createImportSpecifier(propertyName: Identifier, name: Identifier, location?: TextRange): ImportSpecifier; - function updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier, name: Identifier): ImportSpecifier; - function createExportAssignment(decorators: Decorator[], modifiers: Modifier[], isExportEquals: boolean, expression: Expression, location?: TextRange): ExportAssignment; - function updateExportAssignment(node: ExportAssignment, decorators: Decorator[], modifiers: Modifier[], expression: Expression): ExportAssignment; - function createExportDeclaration(decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier?: Expression, location?: TextRange): ExportDeclaration; - function updateExportDeclaration(node: ExportDeclaration, decorators: Decorator[], modifiers: Modifier[], exportClause: NamedExports, moduleSpecifier: Expression): ExportDeclaration; - function createNamedExports(elements: ExportSpecifier[], location?: TextRange): NamedExports; - function updateNamedExports(node: NamedExports, elements: ExportSpecifier[]): NamedExports; - function createExportSpecifier(name: string | Identifier, propertyName?: string | Identifier, location?: TextRange): ExportSpecifier; - function updateExportSpecifier(node: ExportSpecifier, name: Identifier, propertyName: Identifier): ExportSpecifier; - function createJsxElement(openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement, location?: TextRange): JsxElement; - function updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: JsxChild[], closingElement: JsxClosingElement): JsxElement; - function createJsxSelfClosingElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxSelfClosingElement; - function updateJsxSelfClosingElement(node: JsxSelfClosingElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxSelfClosingElement; - function createJsxOpeningElement(tagName: JsxTagNameExpression, attributes: JsxAttributeLike[], location?: TextRange): JsxOpeningElement; - function updateJsxOpeningElement(node: JsxOpeningElement, tagName: JsxTagNameExpression, attributes: JsxAttributeLike[]): JsxOpeningElement; - function createJsxClosingElement(tagName: JsxTagNameExpression, location?: TextRange): JsxClosingElement; - function updateJsxClosingElement(node: JsxClosingElement, tagName: JsxTagNameExpression): JsxClosingElement; - function createJsxAttribute(name: Identifier, initializer: StringLiteral | JsxExpression, location?: TextRange): JsxAttribute; - function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: StringLiteral | JsxExpression): JsxAttribute; - function createJsxSpreadAttribute(expression: Expression, location?: TextRange): JsxSpreadAttribute; - function updateJsxSpreadAttribute(node: JsxSpreadAttribute, expression: Expression): JsxSpreadAttribute; - function createJsxExpression(expression: Expression, dotDotDotToken: Token, location?: TextRange): JsxExpression; - function updateJsxExpression(node: JsxExpression, expression: Expression): JsxExpression; - function createHeritageClause(token: SyntaxKind, types: ExpressionWithTypeArguments[], location?: TextRange): HeritageClause; - function updateHeritageClause(node: HeritageClause, types: ExpressionWithTypeArguments[]): HeritageClause; - function createCaseClause(expression: Expression, statements: Statement[], location?: TextRange): CaseClause; - function updateCaseClause(node: CaseClause, expression: Expression, statements: Statement[]): CaseClause; - function createDefaultClause(statements: Statement[], location?: TextRange): DefaultClause; - function updateDefaultClause(node: DefaultClause, statements: Statement[]): DefaultClause; - function createCatchClause(variableDeclaration: string | VariableDeclaration, block: Block, location?: TextRange): CatchClause; - function updateCatchClause(node: CatchClause, variableDeclaration: VariableDeclaration, block: Block): CatchClause; - function createPropertyAssignment(name: string | PropertyName, initializer: Expression, location?: TextRange): PropertyAssignment; - function updatePropertyAssignment(node: PropertyAssignment, name: PropertyName, initializer: Expression): PropertyAssignment; - function createShorthandPropertyAssignment(name: string | Identifier, objectAssignmentInitializer: Expression, location?: TextRange): ShorthandPropertyAssignment; - function createSpreadAssignment(expression: Expression, location?: TextRange): SpreadAssignment; - function updateShorthandPropertyAssignment(node: ShorthandPropertyAssignment, name: Identifier, objectAssignmentInitializer: Expression): ShorthandPropertyAssignment; - function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment; - function updateSourceFileNode(node: SourceFile, statements: Statement[]): SourceFile; - function createNotEmittedStatement(original: Node): NotEmittedStatement; - function createEndOfDeclarationMarker(original: Node): EndOfDeclarationMarker; - function createMergeDeclarationMarker(original: Node): MergeDeclarationMarker; - function createPartiallyEmittedExpression(expression: Expression, original?: Node, location?: TextRange): PartiallyEmittedExpression; - function updatePartiallyEmittedExpression(node: PartiallyEmittedExpression, expression: Expression): PartiallyEmittedExpression; - function createComma(left: Expression, right: Expression): Expression; - function createLessThan(left: Expression, right: Expression, location?: TextRange): Expression; - function createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression, location?: TextRange): DestructuringAssignment; - function createAssignment(left: Expression, right: Expression, location?: TextRange): BinaryExpression; - function createStrictEquality(left: Expression, right: Expression): BinaryExpression; - function createStrictInequality(left: Expression, right: Expression): BinaryExpression; - function createAdd(left: Expression, right: Expression): BinaryExpression; - function createSubtract(left: Expression, right: Expression): BinaryExpression; - function createPostfixIncrement(operand: Expression, location?: TextRange): PostfixUnaryExpression; - function createLogicalAnd(left: Expression, right: Expression): BinaryExpression; - function createLogicalOr(left: Expression, right: Expression): BinaryExpression; - function createLogicalNot(operand: Expression): PrefixUnaryExpression; - function createVoidZero(): VoidExpression; - type TypeOfTag = "undefined" | "number" | "boolean" | "string" | "symbol" | "object" | "function"; - function createTypeCheck(value: Expression, tag: TypeOfTag): BinaryExpression; - function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression; - function createFunctionCall(func: Expression, thisArg: Expression, argumentsList: Expression[], location?: TextRange): CallExpression; - function createFunctionApply(func: Expression, thisArg: Expression, argumentsExpression: Expression, location?: TextRange): CallExpression; - function createArraySlice(array: Expression, start?: number | Expression): CallExpression; - function createArrayConcat(array: Expression, values: Expression[]): CallExpression; - function createMathPow(left: Expression, right: Expression, location?: TextRange): CallExpression; - function createExpressionForJsxElement(jsxFactoryEntity: EntityName, reactNamespace: string, tagName: Expression, props: Expression, children: Expression[], parentElement: JsxOpeningLikeElement, location: TextRange): LeftHandSideExpression; - function createExportDefault(expression: Expression): ExportAssignment; - function createExternalModuleExport(exportName: Identifier): ExportDeclaration; - function createLetStatement(name: Identifier, initializer: Expression, location?: TextRange): VariableStatement; - function createLetDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; - function createConstDeclarationList(declarations: VariableDeclaration[], location?: TextRange): VariableDeclarationList; - function getHelperName(name: string): Identifier; - function restoreEnclosingLabel(node: Statement, outermostLabeledStatement: LabeledStatement, afterRestoreLabelCallback?: (node: LabeledStatement) => void): Statement; - interface CallBinding { - target: LeftHandSideExpression; - thisArg: Expression; - } - function createCallBinding(expression: Expression, recordTempVariable: (temp: Identifier) => void, languageVersion?: ScriptTarget, cacheIdentifiers?: boolean): CallBinding; - function inlineExpressions(expressions: Expression[]): Expression; - function createExpressionFromEntityName(node: EntityName | Expression): Expression; - function createExpressionForPropertyName(memberName: PropertyName): Expression; - function createExpressionForObjectLiteralElementLike(node: ObjectLiteralExpression, property: ObjectLiteralElementLike, receiver: Expression): Expression; - function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function isLocalName(node: Identifier): boolean; - function getExportName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function isExportName(node: Identifier): boolean; - function getDeclarationName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier; - function getExternalModuleOrNamespaceExportName(ns: Identifier | undefined, node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean): Identifier | PropertyAccessExpression; - function getNamespaceMemberName(ns: Identifier, name: Identifier, allowComments?: boolean, allowSourceMaps?: boolean): PropertyAccessExpression; - function convertToFunctionBody(node: ConciseBody, multiLine?: boolean): Block; - function addPrologueDirectives(target: Statement[], source: Statement[], ensureUseStrict?: boolean, visitor?: (node: Node) => VisitResult): number; - function startsWithUseStrict(statements: Statement[]): boolean; - function ensureUseStrict(statements: NodeArray): NodeArray; - function parenthesizeBinaryOperand(binaryOperator: SyntaxKind, operand: Expression, isLeftSideOfBinary: boolean, leftOperand?: Expression): Expression; - function parenthesizeForConditionalHead(condition: Expression): Expression; - function parenthesizeForNew(expression: Expression): LeftHandSideExpression; - function parenthesizeForAccess(expression: Expression): LeftHandSideExpression; - function parenthesizePostfixOperand(operand: Expression): LeftHandSideExpression; - function parenthesizePrefixOperand(operand: Expression): UnaryExpression; - function parenthesizeExpressionForList(expression: Expression): Expression; - function parenthesizeExpressionForExpressionStatement(expression: Expression): Expression; - function parenthesizeConciseBody(body: ConciseBody): ConciseBody; - const enum OuterExpressionKinds { - Parentheses = 1, - Assertions = 2, - PartiallyEmittedExpressions = 4, - All = 7, - } - function skipOuterExpressions(node: Expression, kinds?: OuterExpressionKinds): Expression; - function skipOuterExpressions(node: Node, kinds?: OuterExpressionKinds): Node; - function skipParentheses(node: Expression): Expression; - function skipParentheses(node: Node): Node; - function skipAssertions(node: Expression): Expression; - function skipAssertions(node: Node): Node; - function skipPartiallyEmittedExpressions(node: Expression): Expression; - function skipPartiallyEmittedExpressions(node: Node): Node; - function startOnNewLine(node: T): T; - function setOriginalNode(node: T, original: Node): T; - function disposeEmitNodes(sourceFile: SourceFile): void; - function getOrCreateEmitNode(node: Node): EmitNode; - function getEmitFlags(node: Node): EmitFlags; - function setEmitFlags(node: T, emitFlags: EmitFlags): T; - function getSourceMapRange(node: Node): TextRange; - function setSourceMapRange(node: T, range: TextRange): T; - function getTokenSourceMapRange(node: Node, token: SyntaxKind): TextRange; - function setTokenSourceMapRange(node: T, token: SyntaxKind, range: TextRange): T; - function getCommentRange(node: Node): TextRange; - function setCommentRange(node: T, range: TextRange): T; - function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; - function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number): PropertyAccessExpression | ElementAccessExpression; - function getExternalHelpersModuleName(node: SourceFile): Identifier; - function getOrCreateExternalHelpersModuleNameIfNeeded(node: SourceFile, compilerOptions: CompilerOptions): Identifier; - function addEmitHelper(node: T, helper: EmitHelper): T; - function addEmitHelpers(node: T, helpers: EmitHelper[] | undefined): T; - function removeEmitHelper(node: Node, helper: EmitHelper): boolean; - function getEmitHelpers(node: Node): EmitHelper[] | undefined; - function moveEmitHelpers(source: Node, target: Node, predicate: (helper: EmitHelper) => boolean): void; - function compareEmitHelpers(x: EmitHelper, y: EmitHelper): Comparison; - function setTextRange(node: T, location: TextRange): T; - function setNodeFlags(node: T, flags: NodeFlags): T; - function setMultiLine(node: T, multiLine: boolean): T; - function setHasTrailingComma(nodes: NodeArray, hasTrailingComma: boolean): NodeArray; - function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier; - function getExternalModuleNameLiteral(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, compilerOptions: CompilerOptions): StringLiteral; - function tryGetModuleNameFromFile(file: SourceFile, host: EmitHost, options: CompilerOptions): StringLiteral; - function getInitializerOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): Expression | undefined; - function getTargetOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementTarget; - function getRestIndicatorOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): BindingOrAssignmentElementRestIndicator; - function getPropertyNameOfBindingOrAssignmentElement(bindingElement: BindingOrAssignmentElement): PropertyName; - function getElementsOfBindingOrAssignmentPattern(name: BindingOrAssignmentPattern): BindingOrAssignmentElement[]; - function convertToArrayAssignmentElement(element: BindingOrAssignmentElement): Expression; - function convertToObjectAssignmentElement(element: BindingOrAssignmentElement): ObjectLiteralElementLike; - function convertToAssignmentPattern(node: BindingOrAssignmentPattern): AssignmentPattern; - function convertToObjectAssignmentPattern(node: ObjectBindingOrAssignmentPattern): ObjectLiteralExpression; - function convertToArrayAssignmentPattern(node: ArrayBindingOrAssignmentPattern): ArrayLiteralExpression; - function convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression; - interface ExternalModuleInfo { - externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; - externalHelpersImportDeclaration: ImportDeclaration | undefined; - exportSpecifiers: Map; - exportedBindings: Map; - exportedNames: Identifier[]; - exportEquals: ExportAssignment | undefined; - hasExportStarsToExportValues: boolean; - } - function collectExternalModuleInfo(sourceFile: SourceFile, resolver: EmitResolver, compilerOptions: CompilerOptions): ExternalModuleInfo; -} declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; @@ -9743,140 +2246,10 @@ declare namespace ts { function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName; function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function parseIsolatedJSDocComment(content: string, start?: number, length?: number): { - jsDoc: JSDoc; - diagnostics: Diagnostic[]; - }; - function parseJSDocTypeExpressionForTests(content: string, start?: number, length?: number): { - jsDocTypeExpression: JSDocTypeExpression; - diagnostics: Diagnostic[]; - }; -} -declare namespace ts { - const enum ModuleInstanceState { - NonInstantiated = 0, - Instantiated = 1, - ConstEnumOnly = 2, - } - function getModuleInstanceState(node: Node): ModuleInstanceState; - function bindSourceFile(file: SourceFile, options: CompilerOptions): void; - function computeTransformFlagsForNode(node: Node, subtreeFlags: TransformFlags): TransformFlags; - function getTransformFlagsSubtreeExclusions(kind: SyntaxKind): TransformFlags; -} -declare namespace ts { - function getNodeId(node: Node): number; - function getSymbolId(symbol: Symbol): number; - function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; -} -declare namespace ts { - type VisitResult = T | T[]; - function reduceEachChild(node: Node, initial: T, cbNode: (memo: T, node: Node) => T, cbNodeArray?: (memo: T, nodes: Node[]) => T): T; - function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional?: boolean, lift?: (node: NodeArray) => T): T; - function visitNode(node: T, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, optional: boolean, lift: (node: NodeArray) => T, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): T; - function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start?: number, count?: number): NodeArray; - function visitNodes(nodes: NodeArray, visitor: (node: Node) => VisitResult, test: (node: Node) => boolean, start: number, count: number, parenthesize: (node: Node, parentNode: Node) => Node, parentNode: Node): NodeArray; - function visitLexicalEnvironment(statements: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext, start?: number, ensureUseStrict?: boolean): NodeArray; - function visitParameterList(nodes: NodeArray, visitor: (node: Node) => VisitResult, context: TransformationContext): NodeArray; - function visitFunctionBody(node: FunctionBody, visitor: (node: Node) => VisitResult, context: TransformationContext): FunctionBody; - function visitFunctionBody(node: ConciseBody, visitor: (node: Node) => VisitResult, context: TransformationContext): ConciseBody; - function visitEachChild(node: T, visitor: (node: Node) => VisitResult, context: TransformationContext): T; - function mergeLexicalEnvironment(statements: NodeArray, declarations: Statement[]): NodeArray; - function mergeLexicalEnvironment(statements: Statement[], declarations: Statement[]): Statement[]; - function mergeFunctionBodyLexicalEnvironment(body: FunctionBody, declarations: Statement[]): FunctionBody; - function mergeFunctionBodyLexicalEnvironment(body: ConciseBody, declarations: Statement[]): ConciseBody; - function liftToBlock(nodes: Node[]): Statement; - function aggregateTransformFlags(node: T): T; - namespace Debug { - const failNotOptional: typeof noop; - const failBadSyntaxKind: (node: Node, message?: string) => void; - const assertEachNode: (nodes: Node[], test: (node: Node) => boolean, message?: string) => void; - const assertNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; - const assertOptionalNode: (node: Node, test: (node: Node) => boolean, message?: string) => void; - const assertOptionalToken: (node: Node, kind: SyntaxKind, message?: string) => void; - const assertMissingNode: (node: Node, message?: string) => void; - } -} -declare namespace ts { - const enum FlattenLevel { - All = 0, - ObjectRest = 1, - } - function flattenDestructuringAssignment(node: VariableDeclaration | DestructuringAssignment, visitor: ((node: Node) => VisitResult) | undefined, context: TransformationContext, level: FlattenLevel, needsValue?: boolean, createAssignmentCallback?: (name: Identifier, value: Expression, location?: TextRange) => Expression): Expression; - function flattenDestructuringBinding(node: VariableDeclaration | ParameterDeclaration, visitor: (node: Node) => VisitResult, context: TransformationContext, level: FlattenLevel, rval?: Expression, hoistTempVariables?: boolean, skipInitializer?: boolean): VariableDeclaration[]; -} -declare namespace ts { - function transformTypeScript(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformESNext(context: TransformationContext): (node: SourceFile) => SourceFile; - function createAssignHelper(context: TransformationContext, attributesSegments: Expression[]): CallExpression; -} -declare namespace ts { - function transformJsx(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2017(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2016(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2015(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformGenerators(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES5(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformModule(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformSystemModule(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function transformES2015Module(context: TransformationContext): (node: SourceFile) => SourceFile; -} -declare namespace ts { - function getTransformers(compilerOptions: CompilerOptions): Transformer[]; - function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]): TransformationResult; -} -declare namespace ts { - function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[]; - function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection, emitOnlyDtsFiles: boolean): boolean; -} -declare namespace ts { - interface SourceMapWriter { - initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void; - reset(): void; - setSourceFile(sourceFile: SourceFile): void; - emitPos(pos: number): void; - emitNodeWithSourceMap(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitTokenWithSourceMap(node: Node, token: SyntaxKind, tokenStartPos: number, emitCallback: (token: SyntaxKind, tokenStartPos: number) => number): number; - getText(): string; - getSourceMappingURL(): string; - getSourceMapData(): SourceMapData; - } - function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter; -} -declare namespace ts { - interface CommentWriter { - reset(): void; - setSourceFile(sourceFile: SourceFile): void; - emitNodeWithComments(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void; - emitBodyWithDetachedComments(node: Node, detachedRange: TextRange, emitCallback: (node: Node) => void): void; - emitTrailingCommentsOfPosition(pos: number): void; - } - function createCommentWriter(host: EmitHost, writer: EmitTextWriter, sourceMap: SourceMapWriter): CommentWriter; -} -declare namespace ts { - function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitResult; } declare namespace ts { function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName?: string): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; - function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; interface FormatDiagnosticsHost { @@ -9887,7 +2260,6 @@ declare namespace ts { function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; - function getResolutionDiagnostic(options: CompilerOptions, {extension}: ResolvedModuleFull): DiagnosticMessage | undefined; } declare namespace ts { interface Node { @@ -9933,10 +2305,6 @@ declare namespace ts { getDocumentationComment(): SymbolDisplayPart[]; } interface SourceFile { - version: string; - scriptSnapshot: IScriptSnapshot; - nameTable: Map; - getNamedDeclarations(): Map; getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineEndOfPosition(pos: number): number; getLineStarts(): number[]; @@ -10027,8 +2395,6 @@ declare namespace ts { getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; - getNonBoundSourceFile(fileName: string): SourceFile; - getSourceFile(fileName: string): SourceFile; dispose(): void; } interface Classifications { @@ -10424,124 +2790,8 @@ declare namespace ts { jsxAttributeStringLiteralValue = 24, } } -declare namespace ts { - const scanner: Scanner; - const emptyArray: any[]; - const enum SemanticMeaning { - None = 0, - Value = 1, - Type = 2, - Namespace = 4, - All = 7, - } - function getMeaningFromDeclaration(node: Node): SemanticMeaning; - function getMeaningFromLocation(node: Node): SemanticMeaning; - function isCallExpressionTarget(node: Node): boolean; - function isNewExpressionTarget(node: Node): boolean; - function climbPastPropertyAccess(node: Node): Node; - function getTargetLabel(referenceNode: Node, labelName: string): Identifier; - function isJumpStatementTarget(node: Node): boolean; - function isLabelName(node: Node): boolean; - function isRightSideOfQualifiedName(node: Node): boolean; - function isRightSideOfPropertyAccess(node: Node): boolean; - function isNameOfModuleDeclaration(node: Node): boolean; - function isNameOfFunctionDeclaration(node: Node): boolean; - function isLiteralNameOfPropertyDeclarationOrIndexAccess(node: Node): boolean; - function isExpressionOfExternalModuleImportEqualsDeclaration(node: Node): boolean; - function isInsideComment(sourceFile: SourceFile, token: Node, position: number): boolean; - function getContainerNode(node: Node): Declaration; - function getNodeKind(node: Node): string; - function getStringLiteralTypeForNode(node: StringLiteral | LiteralTypeNode, typeChecker: TypeChecker): LiteralType; - function isThis(node: Node): boolean; - interface ListItemInfo { - listItemIndex: number; - list: Node; - } - function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; - function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; - function startEndContainsRange(start: number, end: number, range: TextRange): boolean; - function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; - function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean; - function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean; - function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean; - function isCompletedNode(n: Node, sourceFile: SourceFile): boolean; - function findListItemInfo(node: Node): ListItemInfo; - function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean; - function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node; - function findContainingList(node: Node): Node; - function getTouchingWord(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function getTouchingPropertyName(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean, includeJsDocComment?: boolean): Node; - function getTokenAtPosition(sourceFile: SourceFile, position: number, includeJsDocComment?: boolean): Node; - function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node; - function findNextToken(previousToken: Node, parent: Node): Node; - function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node; - function isInString(sourceFile: SourceFile, position: number): boolean; - function isInComment(sourceFile: SourceFile, position: number): boolean; - function isInsideJsxElementOrAttribute(sourceFile: SourceFile, position: number): boolean; - function isInTemplateString(sourceFile: SourceFile, position: number): boolean; - function isInCommentHelper(sourceFile: SourceFile, position: number, predicate?: (c: CommentRange) => boolean): boolean; - function hasDocComment(sourceFile: SourceFile, position: number): boolean; - function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag; - function getNodeModifiers(node: Node): string; - function getTypeArgumentOrTypeParameterList(node: Node): NodeArray; - function isToken(n: Node): boolean; - function isWord(kind: SyntaxKind): boolean; - function isComment(kind: SyntaxKind): boolean; - function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean; - function isPunctuation(kind: SyntaxKind): boolean; - function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean; - function isAccessibilityModifier(kind: SyntaxKind): boolean; - function compareDataObjects(dst: any, src: any): boolean; - function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node): boolean; - function hasTrailingDirectorySeparator(path: string): boolean; - function isInReferenceComment(sourceFile: SourceFile, position: number): boolean; - function isInNonReferenceComment(sourceFile: SourceFile, position: number): boolean; -} -declare namespace ts { - function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean; - function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart; - function displayPart(text: string, kind: SymbolDisplayPartKind): SymbolDisplayPart; - function spacePart(): SymbolDisplayPart; - function keywordPart(kind: SyntaxKind): SymbolDisplayPart; - function punctuationPart(kind: SyntaxKind): SymbolDisplayPart; - function operatorPart(kind: SyntaxKind): SymbolDisplayPart; - function textOrKeywordPart(text: string): SymbolDisplayPart; - function textPart(text: string): SymbolDisplayPart; - function getNewLineOrDefaultFromHost(host: LanguageServiceHost | LanguageServiceShimHost): string; - function lineBreakPart(): SymbolDisplayPart; - function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[]; - function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[]; - function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[]; - function getDeclaredName(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; - function isImportOrExportSpecifierName(location: Node): boolean; - function stripQuotes(name: string): string; - function scriptKindIs(fileName: string, host: LanguageServiceHost, ...scriptKinds: ScriptKind[]): boolean; - function getScriptKind(fileName: string, host?: LanguageServiceHost): ScriptKind; - function sanitizeConfigFile(configFileName: string, content: string): { - configJsonObject: any; - diagnostics: Diagnostic[]; - }; - function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile): number; -} -declare namespace ts.BreakpointResolver { - function spanInSourceFileAtLocation(sourceFile: SourceFile, position: number): TextSpan; -} declare namespace ts { function createClassifier(): Classifier; - function getSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map, span: TextSpan): ClassifiedSpan[]; - function getEncodedSemanticClassifications(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, classifiableNames: Map, span: TextSpan): Classifications; - function getSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): ClassifiedSpan[]; - function getEncodedSyntacticClassifications(cancellationToken: CancellationToken, sourceFile: SourceFile, span: TextSpan): Classifications; -} -declare namespace ts.Completions { - function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo; - function getCompletionEntryDetails(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): CompletionEntryDetails; - function getCompletionEntrySymbol(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): Symbol; -} -declare namespace ts.DocumentHighlights { - function getDocumentHighlights(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFile: SourceFile, position: number, sourceFilesToSearch: SourceFile[]): DocumentHighlights[]; } declare namespace ts { interface DocumentRegistry { @@ -10559,88 +2809,9 @@ declare namespace ts { }; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; } -declare namespace ts.FindAllReferences { - function findReferencedSymbols(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], sourceFile: SourceFile, position: number, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[]; - function getReferencedSymbolsForNode(typeChecker: TypeChecker, cancellationToken: CancellationToken, node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean, implementations: boolean): ReferencedSymbol[]; - function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[]; - function getReferenceEntriesForShorthandPropertyAssignment(node: Node, typeChecker: TypeChecker, result: ReferenceEntry[]): void; - function getReferenceEntryFromNode(node: Node): ReferenceEntry; -} -declare namespace ts.GoToDefinition { - function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number): DefinitionInfo[]; - function getTypeDefinitionAtPosition(typeChecker: TypeChecker, sourceFile: SourceFile, position: number): DefinitionInfo[]; -} -declare namespace ts.GoToImplementation { - function getImplementationAtPosition(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], node: Node): ImplementationLocation[]; -} -declare namespace ts.JsDoc { - function getJsDocCommentsFromDeclarations(declarations: Declaration[]): SymbolDisplayPart[]; - function getAllJsDocCompletionEntries(): CompletionEntry[]; - function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion; -} -declare namespace ts.NavigateTo { - function getNavigateToItems(sourceFiles: SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[]; -} -declare namespace ts.NavigationBar { - function getNavigationBarItems(sourceFile: SourceFile): NavigationBarItem[]; - function getNavigationTree(sourceFile: SourceFile): NavigationTree; -} -declare namespace ts.OutliningElementsCollector { - function collectElements(sourceFile: SourceFile): OutliningSpan[]; -} -declare namespace ts { - enum PatternMatchKind { - exact = 0, - prefix = 1, - substring = 2, - camelCase = 3, - } - interface PatternMatch { - kind: PatternMatchKind; - camelCaseWeight?: number; - isCaseSensitive: boolean; - punctuationStripped: boolean; - } - interface PatternMatcher { - getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; - getMatches(candidateContainers: string[], candidate: string): PatternMatch[]; - patternContainsDots: boolean; - } - function createPatternMatcher(pattern: string): PatternMatcher; - function breakIntoCharacterSpans(identifier: string): TextSpan[]; - function breakIntoWordSpans(identifier: string): TextSpan[]; -} declare namespace ts { function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; } -declare namespace ts.Rename { - function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: (fileName: string) => string, sourceFile: SourceFile, position: number): RenameInfo; -} -declare namespace ts.SignatureHelp { - const enum ArgumentListKind { - TypeArguments = 0, - CallArguments = 1, - TaggedTemplateArguments = 2, - } - interface ArgumentListInfo { - kind: ArgumentListKind; - invocation: CallLikeExpression; - argumentsSpan: TextSpan; - argumentIndex?: number; - argumentCount: number; - } - function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationToken): SignatureHelpItems; - function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo; -} -declare namespace ts.SymbolDisplay { - function getSymbolKind(typeChecker: TypeChecker, symbol: Symbol, location: Node): string; - function getSymbolModifiers(symbol: Symbol): string; - function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker: TypeChecker, symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node, location: Node, semanticMeaning?: SemanticMeaning): { - displayParts: SymbolDisplayPart[]; - documentation: SymbolDisplayPart[]; - symbolKind: string; - }; -} declare namespace ts { interface TranspileOptions { compilerOptions?: CompilerOptions; @@ -10657,460 +2828,11 @@ declare namespace ts { function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; } -declare namespace ts.formatting { - interface FormattingScanner { - advance(): void; - isOnToken(): boolean; - readTokenInfo(n: Node): TokenInfo; - getCurrentLeadingTrivia(): TextRangeWithKind[]; - lastTrailingTriviaWasNewLine(): boolean; - skipToEndOf(node: Node): void; - close(): void; - } - function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner; -} -declare namespace ts.formatting { - class FormattingContext { - sourceFile: SourceFile; - formattingRequestKind: FormattingRequestKind; - currentTokenSpan: TextRangeWithKind; - nextTokenSpan: TextRangeWithKind; - contextNode: Node; - currentTokenParent: Node; - nextTokenParent: Node; - private contextNodeAllOnSameLine; - private nextNodeAllOnSameLine; - private tokensAreOnSameLine; - private contextNodeBlockIsOnOneLine; - private nextNodeBlockIsOnOneLine; - constructor(sourceFile: SourceFile, formattingRequestKind: FormattingRequestKind); - updateContext(currentRange: TextRangeWithKind, currentTokenParent: Node, nextRange: TextRangeWithKind, nextTokenParent: Node, commonParent: Node): void; - ContextNodeAllOnSameLine(): boolean; - NextNodeAllOnSameLine(): boolean; - TokensAreOnSameLine(): boolean; - ContextNodeBlockIsOnOneLine(): boolean; - NextNodeBlockIsOnOneLine(): boolean; - private NodeIsOnOneLine(node); - private BlockIsOnOneLine(node); - } -} -declare namespace ts.formatting { - const enum FormattingRequestKind { - FormatDocument = 0, - FormatSelection = 1, - FormatOnEnter = 2, - FormatOnSemicolon = 3, - FormatOnClosingCurlyBrace = 4, - } -} -declare namespace ts.formatting { - class Rule { - Descriptor: RuleDescriptor; - Operation: RuleOperation; - Flag: RuleFlags; - constructor(Descriptor: RuleDescriptor, Operation: RuleOperation, Flag?: RuleFlags); - toString(): string; - } -} -declare namespace ts.formatting { - const enum RuleAction { - Ignore = 1, - Space = 2, - NewLine = 4, - Delete = 8, - } -} -declare namespace ts.formatting { - class RuleDescriptor { - LeftTokenRange: Shared.TokenRange; - RightTokenRange: Shared.TokenRange; - constructor(LeftTokenRange: Shared.TokenRange, RightTokenRange: Shared.TokenRange); - toString(): string; - static create1(left: SyntaxKind, right: SyntaxKind): RuleDescriptor; - static create2(left: Shared.TokenRange, right: SyntaxKind): RuleDescriptor; - static create3(left: SyntaxKind, right: Shared.TokenRange): RuleDescriptor; - static create4(left: Shared.TokenRange, right: Shared.TokenRange): RuleDescriptor; - } -} -declare namespace ts.formatting { - const enum RuleFlags { - None = 0, - CanDeleteNewLines = 1, - } -} -declare namespace ts.formatting { - class RuleOperation { - Context: RuleOperationContext; - Action: RuleAction; - constructor(Context: RuleOperationContext, Action: RuleAction); - toString(): string; - static create1(action: RuleAction): RuleOperation; - static create2(context: RuleOperationContext, action: RuleAction): RuleOperation; - } -} -declare namespace ts.formatting { - class RuleOperationContext { - private customContextChecks; - constructor(...funcs: { - (context: FormattingContext): boolean; - }[]); - static Any: RuleOperationContext; - IsAny(): boolean; - InContext(context: FormattingContext): boolean; - } -} -declare namespace ts.formatting { - class Rules { - getRuleName(rule: Rule): string; - [name: string]: any; - IgnoreBeforeComment: Rule; - IgnoreAfterLineComment: Rule; - NoSpaceBeforeSemicolon: Rule; - NoSpaceBeforeColon: Rule; - NoSpaceBeforeQuestionMark: Rule; - SpaceAfterColon: Rule; - SpaceAfterQuestionMarkInConditionalOperator: Rule; - NoSpaceAfterQuestionMark: Rule; - SpaceAfterSemicolon: Rule; - SpaceAfterCloseBrace: Rule; - SpaceBetweenCloseBraceAndElse: Rule; - SpaceBetweenCloseBraceAndWhile: Rule; - NoSpaceAfterCloseBrace: Rule; - NoSpaceBeforeDot: Rule; - NoSpaceAfterDot: Rule; - NoSpaceBeforeOpenBracket: Rule; - NoSpaceAfterCloseBracket: Rule; - SpaceAfterOpenBrace: Rule; - SpaceBeforeCloseBrace: Rule; - NoSpaceAfterOpenBrace: Rule; - NoSpaceBeforeCloseBrace: Rule; - NoSpaceBetweenEmptyBraceBrackets: Rule; - NewLineAfterOpenBraceInBlockContext: Rule; - NewLineBeforeCloseBraceInBlockContext: Rule; - NoSpaceAfterUnaryPrefixOperator: Rule; - NoSpaceAfterUnaryPreincrementOperator: Rule; - NoSpaceAfterUnaryPredecrementOperator: Rule; - NoSpaceBeforeUnaryPostincrementOperator: Rule; - NoSpaceBeforeUnaryPostdecrementOperator: Rule; - SpaceAfterPostincrementWhenFollowedByAdd: Rule; - SpaceAfterAddWhenFollowedByUnaryPlus: Rule; - SpaceAfterAddWhenFollowedByPreincrement: Rule; - SpaceAfterPostdecrementWhenFollowedBySubtract: Rule; - SpaceAfterSubtractWhenFollowedByUnaryMinus: Rule; - SpaceAfterSubtractWhenFollowedByPredecrement: Rule; - NoSpaceBeforeComma: Rule; - SpaceAfterCertainKeywords: Rule; - SpaceAfterLetConstInVariableDeclaration: Rule; - NoSpaceBeforeOpenParenInFuncCall: Rule; - SpaceAfterFunctionInFuncDecl: Rule; - SpaceBeforeOpenParenInFuncDecl: Rule; - NoSpaceBeforeOpenParenInFuncDecl: Rule; - SpaceAfterVoidOperator: Rule; - NoSpaceBetweenReturnAndSemicolon: Rule; - SpaceBetweenStatements: Rule; - SpaceAfterTryFinally: Rule; - SpaceAfterGetSetInMember: Rule; - SpaceBeforeBinaryKeywordOperator: Rule; - SpaceAfterBinaryKeywordOperator: Rule; - SpaceAfterConstructor: Rule; - NoSpaceAfterConstructor: Rule; - NoSpaceAfterModuleImport: Rule; - SpaceAfterCertainTypeScriptKeywords: Rule; - SpaceBeforeCertainTypeScriptKeywords: Rule; - SpaceAfterModuleName: Rule; - SpaceBeforeArrow: Rule; - SpaceAfterArrow: Rule; - NoSpaceAfterEllipsis: Rule; - NoSpaceAfterOptionalParameters: Rule; - NoSpaceBeforeOpenAngularBracket: Rule; - NoSpaceBetweenCloseParenAndAngularBracket: Rule; - NoSpaceAfterOpenAngularBracket: Rule; - NoSpaceBeforeCloseAngularBracket: Rule; - NoSpaceAfterCloseAngularBracket: Rule; - NoSpaceBetweenEmptyInterfaceBraceBrackets: Rule; - HighPriorityCommonRules: Rule[]; - LowPriorityCommonRules: Rule[]; - SpaceAfterComma: Rule; - NoSpaceAfterComma: Rule; - SpaceBeforeBinaryOperator: Rule; - SpaceAfterBinaryOperator: Rule; - NoSpaceBeforeBinaryOperator: Rule; - NoSpaceAfterBinaryOperator: Rule; - SpaceAfterKeywordInControl: Rule; - NoSpaceAfterKeywordInControl: Rule; - FunctionOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInFunction: Rule; - NewLineBeforeOpenBraceInFunction: Rule; - TypeScriptOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; - NewLineBeforeOpenBraceInTypeScriptDeclWithBlock: Rule; - ControlOpenBraceLeftTokenRange: Shared.TokenRange; - SpaceBeforeOpenBraceInControl: Rule; - NewLineBeforeOpenBraceInControl: Rule; - SpaceAfterSemicolonInFor: Rule; - NoSpaceAfterSemicolonInFor: Rule; - SpaceAfterOpenParen: Rule; - SpaceBeforeCloseParen: Rule; - NoSpaceBetweenParens: Rule; - NoSpaceAfterOpenParen: Rule; - NoSpaceBeforeCloseParen: Rule; - SpaceAfterOpenBracket: Rule; - SpaceBeforeCloseBracket: Rule; - NoSpaceBetweenBrackets: Rule; - NoSpaceAfterOpenBracket: Rule; - NoSpaceBeforeCloseBracket: Rule; - SpaceAfterAnonymousFunctionKeyword: Rule; - NoSpaceAfterAnonymousFunctionKeyword: Rule; - SpaceBeforeAt: Rule; - NoSpaceAfterAt: Rule; - SpaceAfterDecorator: Rule; - NoSpaceBetweenFunctionKeywordAndStar: Rule; - SpaceAfterStarInGeneratorDeclaration: Rule; - NoSpaceBetweenYieldKeywordAndStar: Rule; - SpaceBetweenYieldOrYieldStarAndOperand: Rule; - SpaceBetweenAsyncAndOpenParen: Rule; - SpaceBetweenAsyncAndFunctionKeyword: Rule; - NoSpaceBetweenTagAndTemplateString: Rule; - NoSpaceAfterTemplateHeadAndMiddle: Rule; - SpaceAfterTemplateHeadAndMiddle: Rule; - NoSpaceBeforeTemplateMiddleAndTail: Rule; - SpaceBeforeTemplateMiddleAndTail: Rule; - NoSpaceAfterOpenBraceInJsxExpression: Rule; - SpaceAfterOpenBraceInJsxExpression: Rule; - NoSpaceBeforeCloseBraceInJsxExpression: Rule; - SpaceBeforeCloseBraceInJsxExpression: Rule; - SpaceBeforeJsxAttribute: Rule; - SpaceBeforeSlashInJsxOpeningElement: Rule; - NoSpaceBeforeGreaterThanTokenInJsxOpeningElement: Rule; - NoSpaceBeforeEqualInJsxAttribute: Rule; - NoSpaceAfterEqualInJsxAttribute: Rule; - NoSpaceAfterTypeAssertion: Rule; - SpaceAfterTypeAssertion: Rule; - NoSpaceBeforeNonNullAssertionOperator: Rule; - constructor(); - static IsForContext(context: FormattingContext): boolean; - static IsNotForContext(context: FormattingContext): boolean; - static IsBinaryOpContext(context: FormattingContext): boolean; - static IsNotBinaryOpContext(context: FormattingContext): boolean; - static IsConditionalOperatorContext(context: FormattingContext): boolean; - static IsSameLineTokenOrBeforeMultilineBlockContext(context: FormattingContext): boolean; - static IsBraceWrappedContext(context: FormattingContext): boolean; - static IsBeforeMultilineBlockContext(context: FormattingContext): boolean; - static IsMultilineBlockContext(context: FormattingContext): boolean; - static IsSingleLineBlockContext(context: FormattingContext): boolean; - static IsBlockContext(context: FormattingContext): boolean; - static IsBeforeBlockContext(context: FormattingContext): boolean; - static NodeIsBlockContext(node: Node): boolean; - static IsFunctionDeclContext(context: FormattingContext): boolean; - static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean; - static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean; - static NodeIsTypeScriptDeclWithBlockContext(node: Node): boolean; - static IsAfterCodeBlockContext(context: FormattingContext): boolean; - static IsControlDeclContext(context: FormattingContext): boolean; - static IsObjectContext(context: FormattingContext): boolean; - static IsFunctionCallContext(context: FormattingContext): boolean; - static IsNewContext(context: FormattingContext): boolean; - static IsFunctionCallOrNewContext(context: FormattingContext): boolean; - static IsPreviousTokenNotComma(context: FormattingContext): boolean; - static IsNextTokenNotCloseBracket(context: FormattingContext): boolean; - static IsArrowFunctionContext(context: FormattingContext): boolean; - static IsNonJsxSameLineTokenContext(context: FormattingContext): boolean; - static IsNonJsxElementContext(context: FormattingContext): boolean; - static IsJsxExpressionContext(context: FormattingContext): boolean; - static IsNextTokenParentJsxAttribute(context: FormattingContext): boolean; - static IsJsxAttributeContext(context: FormattingContext): boolean; - static IsJsxSelfClosingElementContext(context: FormattingContext): boolean; - static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean; - static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean; - static NodeIsInDecoratorContext(node: Node): boolean; - static IsStartOfVariableDeclarationList(context: FormattingContext): boolean; - static IsNotFormatOnEnter(context: FormattingContext): boolean; - static IsModuleDeclContext(context: FormattingContext): boolean; - static IsObjectTypeContext(context: FormattingContext): boolean; - static IsTypeArgumentOrParameterOrAssertion(token: TextRangeWithKind, parent: Node): boolean; - static IsTypeArgumentOrParameterOrAssertionContext(context: FormattingContext): boolean; - static IsTypeAssertionContext(context: FormattingContext): boolean; - static IsVoidOpContext(context: FormattingContext): boolean; - static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean; - static IsNonNullAssertionContext(context: FormattingContext): boolean; - } -} -declare namespace ts.formatting { - class RulesMap { - map: RulesBucket[]; - mapRowLength: number; - constructor(); - static create(rules: Rule[]): RulesMap; - Initialize(rules: Rule[]): RulesBucket[]; - FillRules(rules: Rule[], rulesBucketConstructionStateList: RulesBucketConstructionState[]): void; - private GetRuleBucketIndex(row, column); - private FillRule(rule, rulesBucketConstructionStateList); - GetRule(context: FormattingContext): Rule; - } - enum RulesPosition { - IgnoreRulesSpecific = 0, - IgnoreRulesAny, - ContextRulesSpecific, - ContextRulesAny, - NoContextRulesSpecific, - NoContextRulesAny, - } - class RulesBucketConstructionState { - private rulesInsertionIndexBitmap; - constructor(); - GetInsertionIndex(maskPosition: RulesPosition): number; - IncreaseInsertionIndex(maskPosition: RulesPosition): void; - } - class RulesBucket { - private rules; - constructor(); - Rules(): Rule[]; - AddRule(rule: Rule, specificTokens: boolean, constructionState: RulesBucketConstructionState[], rulesBucketIndex: number): void; - } -} -declare namespace ts.formatting { - namespace Shared { - interface ITokenAccess { - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenRangeAccess implements ITokenAccess { - private tokens; - constructor(from: SyntaxKind, to: SyntaxKind, except: SyntaxKind[]); - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenValuesAccess implements ITokenAccess { - private tokens; - constructor(tks: SyntaxKind[]); - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - } - class TokenSingleValueAccess implements ITokenAccess { - token: SyntaxKind; - constructor(token: SyntaxKind); - GetTokens(): SyntaxKind[]; - Contains(tokenValue: SyntaxKind): boolean; - } - class TokenAllAccess implements ITokenAccess { - GetTokens(): SyntaxKind[]; - Contains(): boolean; - toString(): string; - } - class TokenRange { - tokenAccess: ITokenAccess; - constructor(tokenAccess: ITokenAccess); - static FromToken(token: SyntaxKind): TokenRange; - static FromTokens(tokens: SyntaxKind[]): TokenRange; - static FromRange(f: SyntaxKind, to: SyntaxKind, except?: SyntaxKind[]): TokenRange; - static AllTokens(): TokenRange; - GetTokens(): SyntaxKind[]; - Contains(token: SyntaxKind): boolean; - toString(): string; - static Any: TokenRange; - static AnyIncludingMultilineComments: TokenRange; - static Keywords: TokenRange; - static BinaryOperators: TokenRange; - static BinaryKeywordOperators: TokenRange; - static UnaryPrefixOperators: TokenRange; - static UnaryPrefixExpressions: TokenRange; - static UnaryPreincrementExpressions: TokenRange; - static UnaryPostincrementExpressions: TokenRange; - static UnaryPredecrementExpressions: TokenRange; - static UnaryPostdecrementExpressions: TokenRange; - static Comments: TokenRange; - static TypeNames: TokenRange; - } - } -} -declare namespace ts.formatting { - class RulesProvider { - private globalRules; - private options; - private activeRules; - private rulesMap; - constructor(); - getRuleName(rule: Rule): string; - getRuleByName(name: string): Rule; - getRulesMap(): RulesMap; - ensureUpToDate(options: ts.FormatCodeSettings): void; - private createActiveRules(options); - } -} -declare namespace ts.formatting { - interface TextRangeWithKind extends TextRange { - kind: SyntaxKind; - } - interface TokenInfo { - leadingTrivia: TextRangeWithKind[]; - token: TextRangeWithKind; - trailingTrivia: TextRangeWithKind[]; - } - function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatOnSemicolon(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatOnClosingCurly(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeSettings): TextChange[]; - function getIndentationString(indentation: number, options: EditorSettings): string; -} -declare namespace ts.formatting { - namespace SmartIndenter { - function getIndentation(position: number, sourceFile: SourceFile, options: EditorSettings): number; - function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: EditorSettings): number; - function getBaseIndentation(options: EditorSettings): number; - function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean; - function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorSettings): { - column: number; - character: number; - }; - function findFirstNonWhitespaceColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorSettings): number; - function nodeWillIndentChild(parent: TextRangeWithKind, child: TextRangeWithKind, indentByDefault: boolean): boolean; - function shouldIndentChildNode(parent: TextRangeWithKind, child?: TextRangeWithKind): boolean; - } -} -declare namespace ts { - interface CodeFix { - errorCodes: number[]; - getCodeActions(context: CodeFixContext): CodeAction[] | undefined; - } - interface CodeFixContext { - errorCode: number; - sourceFile: SourceFile; - span: TextSpan; - program: Program; - newLineCharacter: string; - host: LanguageServiceHost; - cancellationToken: CancellationToken; - } - namespace codefix { - function registerCodeFix(action: CodeFix): void; - function getSupportedErrorCodes(): string[]; - function getFixes(context: CodeFixContext): CodeAction[]; - } -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { -} -declare namespace ts.codefix { - function getMissingMembersInsertion(classDeclaration: ClassLikeDeclaration, possiblyMissingSymbols: Symbol[], checker: TypeChecker, newlineChar: string): string; -} declare namespace ts { const servicesVersion = "0.5"; interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; } - function toEditorSettings(options: FormatCodeOptions | FormatCodeSettings): FormatCodeSettings; function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; function displayPartsToString(displayParts: SymbolDisplayPart[]): string; function getDefaultCompilerOptions(): CompilerOptions; @@ -11119,601 +2841,965 @@ declare namespace ts { let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; - function getNameTable(sourceFile: SourceFile): Map; function getDefaultLibFilePath(options: CompilerOptions): string; } -declare namespace ts.server { - class TextStorage { - private readonly host; - private readonly fileName; - private svc; - private svcVersion; - private text; - private lineMap; - private textVersion; - constructor(host: ServerHost, fileName: NormalizedPath); - getVersion(): string; - hasScriptVersionCache(): boolean; - useScriptVersionCache(newText?: string): void; - useText(newText?: string): void; - edit(start: number, end: number, newText: string): void; - reload(text: string): void; - reloadFromFile(tempFileName?: string): void; - getSnapshot(): IScriptSnapshot; - getLineInfo(line: number): ILineInfo; - lineToTextSpan(line: number): TextSpan; - lineOffsetToPosition(line: number, offset: number): number; - positionToLineOffset(position: number): ILineInfo; - private getFileText(tempFileName?); - private ensureNoScriptVersionCache(); - private switchToScriptVersionCache(newText?); - private getOrLoadText(); - private getLineMap(); - private setText(newText); +declare namespace ts.server.protocol { + namespace CommandTypes { + type Brace = "brace"; + type BraceCompletion = "braceCompletion"; + type Change = "change"; + type Close = "close"; + type Completions = "completions"; + type CompletionDetails = "completionEntryDetails"; + type CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; + type CompileOnSaveEmitFile = "compileOnSaveEmitFile"; + type Configure = "configure"; + type Definition = "definition"; + type Implementation = "implementation"; + type Exit = "exit"; + type Format = "format"; + type Formatonkey = "formatonkey"; + type Geterr = "geterr"; + type GeterrForProject = "geterrForProject"; + type SemanticDiagnosticsSync = "semanticDiagnosticsSync"; + type SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; + type NavBar = "navbar"; + type Navto = "navto"; + type NavTree = "navtree"; + type NavTreeFull = "navtree-full"; + type Occurrences = "occurrences"; + type DocumentHighlights = "documentHighlights"; + type Open = "open"; + type Quickinfo = "quickinfo"; + type References = "references"; + type Reload = "reload"; + type Rename = "rename"; + type Saveto = "saveto"; + type SignatureHelp = "signatureHelp"; + type TypeDefinition = "typeDefinition"; + type ProjectInfo = "projectInfo"; + type ReloadProjects = "reloadProjects"; + type Unknown = "unknown"; + type OpenExternalProject = "openExternalProject"; + type OpenExternalProjects = "openExternalProjects"; + type CloseExternalProject = "closeExternalProject"; + type TodoComments = "todoComments"; + type Indentation = "indentation"; + type DocCommentTemplate = "docCommentTemplate"; + type CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; + type GetCodeFixes = "getCodeFixes"; + type GetSupportedCodeFixes = "getSupportedCodeFixes"; } - class ScriptInfo { - private readonly host; - readonly fileName: NormalizedPath; - readonly scriptKind: ScriptKind; - hasMixedContent: boolean; - readonly containingProjects: Project[]; - private formatCodeSettings; - readonly path: Path; - private fileWatcher; - private textStorage; - private isOpen; - constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent?: boolean); - isScriptOpen(): boolean; - open(newText: string): void; - close(): void; - getSnapshot(): IScriptSnapshot; - getFormatCodeSettings(): FormatCodeSettings; - attachToProject(project: Project): boolean; - isAttached(project: Project): boolean; - detachFromProject(project: Project): void; - detachAllProjects(): void; - getDefaultProject(): Project; - registerFileUpdate(): void; - setFormatOptions(formatSettings: FormatCodeSettings): void; - setWatcher(watcher: FileWatcher): void; - stopWatcher(): void; - getLatestVersion(): string; - reload(script: string): void; - saveTo(fileName: string): void; - reloadFromFile(tempFileName?: NormalizedPath): void; - getLineInfo(line: number): ILineInfo; - editContent(start: number, end: number, newText: string): void; - markContainingProjectsAsDirty(): void; - lineToTextSpan(line: number): TextSpan; - lineOffsetToPosition(line: number, offset: number): number; - positionToLineOffset(position: number): ILineInfo; + interface Message { + seq: number; + type: "request" | "response" | "event"; } -} -declare namespace ts.server { - class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { - private readonly host; - private readonly project; - private readonly cancellationToken; - private compilationSettings; - private readonly resolvedModuleNames; - private readonly resolvedTypeReferenceDirectives; - private readonly getCanonicalFileName; - private filesWithChangedSetOfUnresolvedImports; - private readonly resolveModuleName; - readonly trace: (s: string) => void; - readonly realpath?: (path: string) => string; - constructor(host: ServerHost, project: Project, cancellationToken: HostCancellationToken); - startRecordingFilesWithChangedResolutions(): void; - finishRecordingFilesWithChangedResolutions(): Path[]; - private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); - getNewLine(): string; - getProjectVersion(): string; - getCompilationSettings(): CompilerOptions; - useCaseSensitiveFileNames(): boolean; - getCancellationToken(): HostCancellationToken; - resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; - resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModuleFull[]; - getDefaultLibFileName(): string; - getScriptSnapshot(filename: string): ts.IScriptSnapshot; - getScriptFileNames(): string[]; - getTypeRootsVersion(): number; - getScriptKind(fileName: string): ScriptKind; - getScriptVersion(filename: string): string; - getCurrentDirectory(): string; - resolvePath(path: string): string; - fileExists(path: string): boolean; - readFile(fileName: string): string; - directoryExists(path: string): boolean; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; - getDirectories(path: string): string[]; - notifyFileRemoved(info: ScriptInfo): void; - setCompilationSettings(opt: ts.CompilerOptions): void; + interface Request extends Message { + command: string; + arguments?: any; } -} -declare namespace ts.server { - interface ITypingsInstaller { - enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void; - attach(projectService: ProjectService): void; - onProjectClosed(p: Project): void; - readonly globalTypingsCacheLocation: string; + interface ReloadProjectsRequest extends Message { + command: CommandTypes.ReloadProjects; } - const nullTypingsInstaller: ITypingsInstaller; - class TypingsCache { - private readonly installer; - private readonly perProjectCache; - constructor(installer: ITypingsInstaller); - getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray; - updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; - deleteTypingsForProject(projectName: string): void; - onProjectClosed(project: Project): void; + interface Event extends Message { + event: string; + body?: any; } -} -declare namespace ts.server { - function shouldEmitFile(scriptInfo: ScriptInfo): boolean; - class BuilderFileInfo { - readonly scriptInfo: ScriptInfo; - readonly project: Project; - private lastCheckedShapeSignature; - constructor(scriptInfo: ScriptInfo, project: Project); - isExternalModuleOrHasOnlyAmbientExternalModules(): boolean; - private containsOnlyAmbientModules(sourceFile); - private computeHash(text); - private getSourceFile(); - updateShapeSignature(): boolean; + interface Response extends Message { + request_seq: number; + success: boolean; + command: string; + message?: string; + body?: any; } - interface Builder { - readonly project: Project; - getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; - onProjectUpdateGraph(): void; - emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; - clear(): void; + interface FileRequestArgs { + file: string; + projectFileName?: string; } - function createBuilder(project: Project): Builder; -} -declare namespace ts.server { - enum ProjectKind { - Inferred = 0, - Configured = 1, - External = 2, + interface DocCommentTemplateRequest extends FileLocationRequest { + command: CommandTypes.DocCommentTemplate; } - function allRootFilesAreJsOrDts(project: Project): boolean; - function allFilesAreJsOrDts(project: Project): boolean; - interface ProjectFilesWithTSDiagnostics extends protocol.ProjectFiles { - projectErrors: Diagnostic[]; + interface DocCommandTemplateResponse extends Response { + body?: TextInsertion; } - class UnresolvedImportsMap { - readonly perFileMap: FileMap>; - private version; - clear(): void; - getVersion(): number; - remove(path: Path): void; - get(path: Path): ReadonlyArray; - set(path: Path, value: ReadonlyArray): void; + interface TodoCommentRequest extends FileRequest { + command: CommandTypes.TodoComments; + arguments: TodoCommentRequestArgs; } - abstract class Project { - private readonly projectName; - readonly projectKind: ProjectKind; - readonly projectService: ProjectService; - private documentRegistry; - private compilerOptions; - compileOnSaveEnabled: boolean; - private rootFiles; - private rootFilesMap; - private lsHost; - private program; - private cachedUnresolvedImportsPerFile; - private lastCachedUnresolvedImportsList; - private readonly languageService; - languageServiceEnabled: boolean; - builder: Builder; - private updatedFileNames; - private lastReportedFileNames; - private lastReportedVersion; - private projectStructureVersion; - private projectStateVersion; - private typingFiles; - protected projectErrors: Diagnostic[]; - typesVersion: number; - isNonTsProject(): boolean; - isJsOnlyProject(): boolean; - getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; - constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); - private setInternalCompilerOptionsForEmittingJsFiles(); - getProjectErrors(): Diagnostic[]; - getLanguageService(ensureSynchronized?: boolean): LanguageService; - getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; - getProjectVersion(): string; - enableLanguageService(): void; - disableLanguageService(): void; - getProjectName(): string; - abstract getProjectRootPath(): string | undefined; - abstract getTypeAcquisition(): TypeAcquisition; - getSourceFile(path: Path): SourceFile; - updateTypes(): void; - close(): void; - getCompilerOptions(): CompilerOptions; - hasRoots(): boolean; - getRootFiles(): NormalizedPath[]; - getRootFilesLSHost(): string[]; - getRootScriptInfos(): ScriptInfo[]; - getScriptInfos(): ScriptInfo[]; - getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput; - getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[]; - getAllEmittableFiles(): string[]; - containsScriptInfo(info: ScriptInfo): boolean; - containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean; - isRoot(info: ScriptInfo): boolean; - addRoot(info: ScriptInfo): void; - removeFile(info: ScriptInfo, detachFromProject?: boolean): void; - registerFileUpdate(fileName: string): void; - markAsDirty(): void; - private extractUnresolvedImportsFromSourceFile(file, result); - updateGraph(): boolean; - private setTypings(typings); - private updateGraphWorker(); - getScriptInfoLSHost(fileName: string): ScriptInfo; - getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; - getScriptInfo(uncheckedFileName: string): ScriptInfo; - filesToString(): string; - setCompilerOptions(compilerOptions: CompilerOptions): void; - reloadScript(filename: NormalizedPath, tempFileName?: NormalizedPath): boolean; - getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics; - getReferencedFiles(path: Path): Path[]; - private removeRootFileIfNecessary(info); + interface TodoCommentRequestArgs extends FileRequestArgs { + descriptors: TodoCommentDescriptor[]; } - class InferredProject extends Project { - private static newName; - directoriesWatchedForTsconfig: string[]; - constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); - getProjectRootPath(): string; - close(): void; - getTypeAcquisition(): TypeAcquisition; + interface TodoCommentsResponse extends Response { + body?: TodoComment[]; } - class ConfiguredProject extends Project { - private wildcardDirectories; - compileOnSaveEnabled: boolean; - private typeAcquisition; - private projectFileWatcher; - private directoryWatcher; - private directoriesWatchedForWildcards; - private typeRootsWatchers; - readonly canonicalConfigFilePath: NormalizedPath; - openRefCount: number; - constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean); - getConfigFilePath(): string; - getProjectRootPath(): string; - setProjectErrors(projectErrors: Diagnostic[]): void; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; - getTypeAcquisition(): TypeAcquisition; - watchConfigFile(callback: (project: ConfiguredProject) => void): void; - watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void; - watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void; - watchWildcards(callback: (project: ConfiguredProject, path: string) => void): void; - stopWatchingDirectory(): void; - close(): void; - addOpenRef(): void; - deleteOpenRef(): number; - getEffectiveTypeRoots(): string[]; + interface IndentationRequest extends FileLocationRequest { + command: CommandTypes.Indentation; + arguments: IndentationRequestArgs; } - class ExternalProject extends Project { - compileOnSaveEnabled: boolean; - private readonly projectFilePath; - private typeAcquisition; - constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string); - getProjectRootPath(): string; - getTypeAcquisition(): TypeAcquisition; - setProjectErrors(projectErrors: Diagnostic[]): void; - setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + interface IndentationResponse extends Response { + body?: IndentationResult; } -} -declare namespace ts.server { - const maxProgramSizeForNonTsFiles: number; - const ContextEvent = "context"; - const ConfigFileDiagEvent = "configFileDiag"; - const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; - interface ContextEvent { - eventName: typeof ContextEvent; - data: { - project: Project; - fileName: NormalizedPath; - }; + interface IndentationResult { + position: number; + indentation: number; } - interface ConfigFileDiagEvent { - eventName: typeof ConfigFileDiagEvent; - data: { - triggerFile: string; - configFileName: string; - diagnostics: Diagnostic[]; - }; + interface IndentationRequestArgs extends FileLocationRequestArgs { + options?: EditorSettings; } - interface ProjectLanguageServiceStateEvent { - eventName: typeof ProjectLanguageServiceStateEvent; - data: { - project: Project; - languageServiceEnabled: boolean; - }; + interface ProjectInfoRequestArgs extends FileRequestArgs { + needFileNameList: boolean; } - type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; - interface ProjectServiceEventHandler { - (event: ProjectServiceEvent): void; + interface ProjectInfoRequest extends Request { + command: CommandTypes.ProjectInfo; + arguments: ProjectInfoRequestArgs; } - function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; - function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; - function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; - function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind; - function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[]; - interface HostConfiguration { - formatCodeOptions: FormatCodeSettings; - hostInfo: string; + interface CompilerOptionsDiagnosticsRequest extends Request { + arguments: CompilerOptionsDiagnosticsRequestArgs; + } + interface CompilerOptionsDiagnosticsRequestArgs { + projectFileName: string; + } + interface ProjectInfo { + configFileName: string; + fileNames?: string[]; + languageServiceDisabled?: boolean; + } + interface DiagnosticWithLinePosition { + message: string; + start: number; + length: number; + startLocation: Location; + endLocation: Location; + category: string; + code: number; + } + interface ProjectInfoResponse extends Response { + body?: ProjectInfo; + } + interface FileRequest extends Request { + arguments: FileRequestArgs; + } + interface FileLocationRequestArgs extends FileRequestArgs { + line: number; + offset: number; + } + interface CodeFixRequest extends Request { + command: CommandTypes.GetCodeFixes; + arguments: CodeFixRequestArgs; + } + interface CodeFixRequestArgs extends FileRequestArgs { + startLine: number; + startOffset: number; + endLine: number; + endOffset: number; + errorCodes?: number[]; + } + interface GetCodeFixesResponse extends Response { + body?: CodeAction[]; + } + interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; + } + interface GetSupportedCodeFixesRequest extends Request { + command: CommandTypes.GetSupportedCodeFixes; + } + interface GetSupportedCodeFixesResponse extends Response { + body?: string[]; + } + interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { + start: number; + length: number; + } + interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { + filesToSearch: string[]; + } + interface DefinitionRequest extends FileLocationRequest { + command: CommandTypes.Definition; + } + interface TypeDefinitionRequest extends FileLocationRequest { + command: CommandTypes.TypeDefinition; + } + interface ImplementationRequest extends FileLocationRequest { + command: CommandTypes.Implementation; + } + interface Location { + line: number; + offset: number; + } + interface TextSpan { + start: Location; + end: Location; + } + interface FileSpan extends TextSpan { + file: string; + } + interface DefinitionResponse extends Response { + body?: FileSpan[]; + } + interface TypeDefinitionResponse extends Response { + body?: FileSpan[]; + } + interface ImplementationResponse extends Response { + body?: FileSpan[]; + } + interface BraceCompletionRequest extends FileLocationRequest { + command: CommandTypes.BraceCompletion; + arguments: BraceCompletionRequestArgs; + } + interface BraceCompletionRequestArgs extends FileLocationRequestArgs { + openingBrace: string; + } + interface OccurrencesRequest extends FileLocationRequest { + command: CommandTypes.Occurrences; + } + interface OccurrencesResponseItem extends FileSpan { + isWriteAccess: boolean; + } + interface OccurrencesResponse extends Response { + body?: OccurrencesResponseItem[]; + } + interface DocumentHighlightsRequest extends FileLocationRequest { + command: CommandTypes.DocumentHighlights; + arguments: DocumentHighlightsRequestArgs; + } + interface HighlightSpan extends TextSpan { + kind: string; + } + interface DocumentHighlightsItem { + file: string; + highlightSpans: HighlightSpan[]; + } + interface DocumentHighlightsResponse extends Response { + body?: DocumentHighlightsItem[]; + } + interface ReferencesRequest extends FileLocationRequest { + command: CommandTypes.References; + } + interface ReferencesResponseItem extends FileSpan { + lineText: string; + isWriteAccess: boolean; + isDefinition: boolean; + } + interface ReferencesResponseBody { + refs: ReferencesResponseItem[]; + symbolName: string; + symbolStartOffset: number; + symbolDisplayString: string; + } + interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + interface RenameRequestArgs extends FileLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + interface RenameRequest extends FileLocationRequest { + command: CommandTypes.Rename; + arguments: RenameRequestArgs; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage?: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + } + interface SpanGroup { + file: string; + locs: TextSpan[]; + } + interface RenameResponseBody { + info: RenameInfo; + locs: SpanGroup[]; + } + interface RenameResponse extends Response { + body?: RenameResponseBody; + } + interface ExternalFile { + fileName: string; + scriptKind?: ScriptKindName | ts.ScriptKind; + hasMixedContent?: boolean; + content?: string; + } + interface ExternalProject { + projectFileName: string; + rootFiles: ExternalFile[]; + options: ExternalProjectCompilerOptions; + typingOptions?: TypeAcquisition; + typeAcquisition?: TypeAcquisition; + } + interface CompileOnSaveMixin { + compileOnSave?: boolean; + } + type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin; + interface ProjectChanges { + added: string[]; + removed: string[]; + updated: string[]; + } + interface ConfigureRequestArguments { + hostInfo?: string; + file?: string; + formatOptions?: FormatCodeSettings; extraFileExtensions?: FileExtensionInfo[]; } - interface OpenConfiguredProjectResult { - configFileName?: NormalizedPath; - configFileErrors?: Diagnostic[]; + interface ConfigureRequest extends Request { + command: CommandTypes.Configure; + arguments: ConfigureRequestArguments; } - class ProjectService { - readonly host: ServerHost; - readonly logger: Logger; - readonly cancellationToken: HostCancellationToken; - readonly useSingleInferredProject: boolean; - readonly typingsInstaller: ITypingsInstaller; - private readonly eventHandler; - readonly typingsCache: TypingsCache; - private readonly documentRegistry; - private readonly filenameToScriptInfo; - private readonly externalProjectToConfiguredProjectMap; - readonly externalProjects: ExternalProject[]; - readonly inferredProjects: InferredProject[]; - readonly configuredProjects: ConfiguredProject[]; - readonly openFiles: ScriptInfo[]; - private compilerOptionsForInferredProjects; - private compileOnSaveForInferredProjects; - private readonly directoryWatchers; - private readonly throttledOperations; - private readonly hostConfiguration; - private changedFiles; - readonly toCanonicalFileName: (f: string) => string; - lastDeletedFile: ScriptInfo; - constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler); - getChangedFiles_TestOnly(): ScriptInfo[]; - ensureInferredProjectsUpToDate_TestOnly(): void; - getCompilerOptionsForInferredProjects(): CompilerOptions; - onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; - updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; - setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; - stopWatchingDirectory(directory: string): void; - findProject(projectName: string): Project; - getDefaultProjectForFile(fileName: NormalizedPath, refreshInferredProjects: boolean): Project; - private ensureInferredProjectsUpToDate(); - private findContainingExternalProject(fileName); - getFormatCodeOptions(file?: NormalizedPath): FormatCodeSettings; - private updateProjectGraphs(projects); - private onSourceFileChanged(fileName); - private handleDeletedFile(info); - private onTypeRootFileChanged(project, fileName); - private onSourceFileInDirectoryChangedForConfiguredProject(project, fileName); - private handleChangeInSourceFileForConfiguredProject(project, triggerFile); - private onConfigChangedForConfiguredProject(project); - private onConfigFileAddedForInferredProject(fileName); - private getCanonicalFileName(fileName); - private removeProject(project); - private assignScriptInfoToInferredProjectIfNecessary(info, addToListOfOpenFiles); - private closeOpenFile(info); - private openOrUpdateConfiguredProjectForFile(fileName); - private findConfigFile(searchPath); - private printProjects(); - private findConfiguredProjectByProjectName(configFileName); - private findExternalProjectByProjectName(projectFileName); - private convertConfigFileContentToProjectOptions(configFilename); - private exceededTotalSizeLimitForNonTsFiles(options, fileNames, propertyReader); - private createAndAddExternalProject(projectFileName, files, options, typeAcquisition); - private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); - private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); - private watchConfigDirectoryForProject(project, options); - private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors); - private openConfigFile(configFileName, clientFileName?); - private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors); - private updateConfiguredProject(project); - createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject; - getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; - getScriptInfo(uncheckedFileName: string): ScriptInfo; - getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): ScriptInfo; - getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; - getScriptInfoForPath(fileName: Path): ScriptInfo; - setHostConfiguration(args: protocol.ConfigureRequestArguments): void; - closeLog(): void; - reloadProjects(): void; - refreshInferredProjects(): void; - openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): OpenConfiguredProjectResult; - openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult; - closeClientFile(uncheckedFileName: string): void; - private collectChanges(lastKnownProjectVersions, currentProjects, result); - synchronizeProjectList(knownProjects: protocol.ProjectVersionInfo[]): ProjectFilesWithTSDiagnostics[]; - applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void; - private closeConfiguredProject(configFile); - closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void; - openExternalProjects(projects: protocol.ExternalProject[]): void; - openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects?: boolean): void; + interface ConfigureResponse extends Response { + } + interface OpenRequestArgs extends FileRequestArgs { + fileContent?: string; + scriptKindName?: ScriptKindName; + } + type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; + interface OpenRequest extends Request { + command: CommandTypes.Open; + arguments: OpenRequestArgs; + } + interface OpenExternalProjectRequest extends Request { + command: CommandTypes.OpenExternalProject; + arguments: OpenExternalProjectArgs; + } + type OpenExternalProjectArgs = ExternalProject; + interface OpenExternalProjectsRequest extends Request { + command: CommandTypes.OpenExternalProjects; + arguments: OpenExternalProjectsArgs; + } + interface OpenExternalProjectsArgs { + projects: ExternalProject[]; + } + interface OpenExternalProjectResponse extends Response { + } + interface OpenExternalProjectsResponse extends Response { + } + interface CloseExternalProjectRequest extends Request { + command: CommandTypes.CloseExternalProject; + arguments: CloseExternalProjectRequestArgs; + } + interface CloseExternalProjectRequestArgs { + projectFileName: string; + } + interface CloseExternalProjectResponse extends Response { + } + interface SetCompilerOptionsForInferredProjectsRequest extends Request { + command: CommandTypes.CompilerOptionsForInferredProjects; + arguments: SetCompilerOptionsForInferredProjectsArgs; + } + interface SetCompilerOptionsForInferredProjectsArgs { + options: ExternalProjectCompilerOptions; + } + interface SetCompilerOptionsForInferredProjectsResponse extends Response { + } + interface ExitRequest extends Request { + command: CommandTypes.Exit; + } + interface CloseRequest extends FileRequest { + command: CommandTypes.Close; + } + interface CompileOnSaveAffectedFileListRequest extends FileRequest { + command: CommandTypes.CompileOnSaveAffectedFileList; + } + interface CompileOnSaveAffectedFileListSingleProject { + projectFileName: string; + fileNames: string[]; + } + interface CompileOnSaveAffectedFileListResponse extends Response { + body: CompileOnSaveAffectedFileListSingleProject[]; + } + interface CompileOnSaveEmitFileRequest extends FileRequest { + command: CommandTypes.CompileOnSaveEmitFile; + arguments: CompileOnSaveEmitFileRequestArgs; + } + interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { + forced?: boolean; + } + interface QuickInfoRequest extends FileLocationRequest { + command: CommandTypes.Quickinfo; + } + interface QuickInfoResponseBody { + kind: string; + kindModifiers: string; + start: Location; + end: Location; + displayString: string; + documentation: string; + } + interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + interface FormatRequestArgs extends FileLocationRequestArgs { + endLine: number; + endOffset: number; + options?: FormatCodeSettings; + } + interface FormatRequest extends FileLocationRequest { + command: CommandTypes.Format; + arguments: FormatRequestArgs; + } + interface CodeEdit { + start: Location; + end: Location; + newText: string; + } + interface FileCodeEdits { + fileName: string; + textChanges: CodeEdit[]; + } + interface CodeFixResponse extends Response { + body?: CodeAction[]; + } + interface CodeAction { + description: string; + changes: FileCodeEdits[]; + } + interface FormatResponse extends Response { + body?: CodeEdit[]; + } + interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + key: string; + options?: FormatCodeSettings; + } + interface FormatOnKeyRequest extends FileLocationRequest { + command: CommandTypes.Formatonkey; + arguments: FormatOnKeyRequestArgs; + } + interface CompletionsRequestArgs extends FileLocationRequestArgs { + prefix?: string; + } + interface CompletionsRequest extends FileLocationRequest { + command: CommandTypes.Completions; + arguments: CompletionsRequestArgs; + } + interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + entryNames: string[]; + } + interface CompletionDetailsRequest extends FileLocationRequest { + command: CommandTypes.CompletionDetails; + arguments: CompletionDetailsRequestArgs; + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + sortText: string; + replacementSpan?: TextSpan; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface CompletionsResponse extends Response { + body?: CompletionEntry[]; + } + interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface SignatureHelpRequestArgs extends FileLocationRequestArgs { + } + interface SignatureHelpRequest extends FileLocationRequest { + command: CommandTypes.SignatureHelp; + arguments: SignatureHelpRequestArgs; + } + interface SignatureHelpResponse extends Response { + body?: SignatureHelpItems; + } + interface SemanticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SemanticDiagnosticsSync; + arguments: SemanticDiagnosticsSyncRequestArgs; + } + interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; + } + interface SemanticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; + } + interface SyntacticDiagnosticsSyncRequest extends FileRequest { + command: CommandTypes.SyntacticDiagnosticsSync; + arguments: SyntacticDiagnosticsSyncRequestArgs; + } + interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { + includeLinePosition?: boolean; + } + interface SyntacticDiagnosticsSyncResponse extends Response { + body?: Diagnostic[] | DiagnosticWithLinePosition[]; + } + interface GeterrForProjectRequestArgs { + file: string; + delay: number; + } + interface GeterrForProjectRequest extends Request { + command: CommandTypes.GeterrForProject; + arguments: GeterrForProjectRequestArgs; + } + interface GeterrRequestArgs { + files: string[]; + delay: number; + } + interface GeterrRequest extends Request { + command: CommandTypes.Geterr; + arguments: GeterrRequestArgs; + } + interface Diagnostic { + start: Location; + end: Location; + text: string; + code?: number; + } + interface DiagnosticEventBody { + file: string; + diagnostics: Diagnostic[]; + } + interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; + } + interface ConfigFileDiagnosticEventBody { + triggerFile: string; + configFile: string; + diagnostics: Diagnostic[]; + } + interface ConfigFileDiagnosticEvent extends Event { + body?: ConfigFileDiagnosticEventBody; + event: "configFileDiag"; + } + type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + interface ProjectLanguageServiceStateEvent extends Event { + event: ProjectLanguageServiceStateEventName; + body?: ProjectLanguageServiceStateEventBody; + } + interface ProjectLanguageServiceStateEventBody { + projectName: string; + languageServiceEnabled: boolean; + } + interface ReloadRequestArgs extends FileRequestArgs { + tmpfile: string; + } + interface ReloadRequest extends FileRequest { + command: CommandTypes.Reload; + arguments: ReloadRequestArgs; + } + interface ReloadResponse extends Response { + } + interface SavetoRequestArgs extends FileRequestArgs { + tmpfile: string; + } + interface SavetoRequest extends FileRequest { + command: CommandTypes.Saveto; + arguments: SavetoRequestArgs; + } + interface NavtoRequestArgs extends FileRequestArgs { + searchValue: string; + maxResultCount?: number; + currentFileOnly?: boolean; + projectFileName?: string; + } + interface NavtoRequest extends FileRequest { + command: CommandTypes.Navto; + arguments: NavtoRequestArgs; + } + interface NavtoItem { + name: string; + kind: string; + matchKind?: string; + isCaseSensitive?: boolean; + kindModifiers?: string; + file: string; + start: Location; + end: Location; + containerName?: string; + containerKind?: string; + } + interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + interface ChangeRequestArgs extends FormatRequestArgs { + insertString?: string; + } + interface ChangeRequest extends FileLocationRequest { + command: CommandTypes.Change; + arguments: ChangeRequestArgs; + } + interface BraceResponse extends Response { + body?: TextSpan[]; + } + interface BraceRequest extends FileLocationRequest { + command: CommandTypes.Brace; + } + interface NavBarRequest extends FileRequest { + command: CommandTypes.NavBar; + } + interface NavTreeRequest extends FileRequest { + command: CommandTypes.NavTree; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers?: string; + spans: TextSpan[]; + childItems?: NavigationBarItem[]; + indent: number; + } + interface NavigationTree { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems?: NavigationTree[]; + } + type TelemetryEventName = "telemetry"; + interface TelemetryEvent extends Event { + event: TelemetryEventName; + body: TelemetryEventBody; + } + interface TelemetryEventBody { + telemetryEventName: string; + payload: any; + } + type TypingsInstalledTelemetryEventName = "typingsInstalled"; + interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { + telemetryEventName: TypingsInstalledTelemetryEventName; + payload: TypingsInstalledTelemetryEventPayload; + } + interface TypingsInstalledTelemetryEventPayload { + installedPackages: string; + installSuccess: boolean; + typingsInstallerVersion: string; + } + type BeginInstallTypesEventName = "beginInstallTypes"; + type EndInstallTypesEventName = "endInstallTypes"; + interface BeginInstallTypesEvent extends Event { + event: BeginInstallTypesEventName; + body: BeginInstallTypesEventBody; + } + interface EndInstallTypesEvent extends Event { + event: EndInstallTypesEventName; + body: EndInstallTypesEventBody; + } + interface InstallTypesEventBody { + eventId: number; + packages: ReadonlyArray; + } + interface BeginInstallTypesEventBody extends InstallTypesEventBody { + } + interface EndInstallTypesEventBody extends InstallTypesEventBody { + success: boolean; + } + interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } + interface NavTreeResponse extends Response { + body?: NavigationTree; + } + namespace IndentStyle { + type None = "None"; + type Block = "Block"; + type Smart = "Smart"; + } + type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart; + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle | ts.IndentStyle; + } + interface FormatCodeSettings extends EditorSettings { + insertSpaceAfterCommaDelimiter?: boolean; + insertSpaceAfterSemicolonInForStatements?: boolean; + insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; + insertSpaceAfterKeywordsInControlFlowStatements?: boolean; + insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; + placeOpenBraceOnNewLineForFunctions?: boolean; + placeOpenBraceOnNewLineForControlBlocks?: boolean; + } + interface CompilerOptions { + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + baseUrl?: string; + charset?: string; + declaration?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; + emitBOM?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; + isolatedModules?: boolean; + jsx?: JsxEmit | ts.JsxEmit; + lib?: string[]; + locale?: string; + mapRoot?: string; + maxNodeModuleJsDepth?: number; + module?: ModuleKind | ts.ModuleKind; + moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; + newLine?: NewLineKind | ts.NewLineKind; + noEmit?: boolean; + noEmitHelpers?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; + noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; + noLib?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + outFile?: string; + paths?: MapLike; + preserveConstEnums?: boolean; + project?: string; + reactNamespace?: string; + removeComments?: boolean; + rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + strictNullChecks?: boolean; + suppressExcessPropertyErrors?: boolean; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget | ts.ScriptTarget; + traceResolution?: boolean; + types?: string[]; + typeRoots?: string[]; + [option: string]: CompilerOptionsValue | undefined; + } + namespace JsxEmit { + type None = "None"; + type Preserve = "Preserve"; + type React = "React"; + } + type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React; + namespace ModuleKind { + type None = "None"; + type CommonJS = "CommonJS"; + type AMD = "AMD"; + type UMD = "UMD"; + type System = "System"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; + } + type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015; + namespace ModuleResolutionKind { + type Classic = "Classic"; + type Node = "Node"; + } + type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node; + namespace NewLineKind { + type Crlf = "Crlf"; + type Lf = "Lf"; + } + type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf; + namespace ScriptTarget { + type ES3 = "ES3"; + type ES5 = "ES5"; + type ES6 = "ES6"; + type ES2015 = "ES2015"; + } + type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015; +} +declare namespace ts.server { + interface CompressedData { + length: number; + compressionKind: string; + data: any; + } + interface ServerHost extends System { + setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout(timeoutId: any): void; + setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; + clearImmediate(timeoutId: any): void; + gc?(): void; + trace?(s: string): void; + } + interface SortedReadonlyArray extends ReadonlyArray { + " __sortedReadonlyArrayBrand": any; + } + interface TypingInstallerRequest { + readonly projectName: string; + readonly kind: "discover" | "closeProject"; + } + interface DiscoverTypings extends TypingInstallerRequest { + readonly fileNames: string[]; + readonly projectRootPath: ts.Path; + readonly compilerOptions: ts.CompilerOptions; + readonly typeAcquisition: ts.TypeAcquisition; + readonly unresolvedImports: SortedReadonlyArray; + readonly cachePath?: string; + readonly kind: "discover"; + } + interface CloseProject extends TypingInstallerRequest { + readonly kind: "closeProject"; + } + type ActionSet = "action::set"; + type ActionInvalidate = "action::invalidate"; + type EventBeginInstallTypes = "event::beginInstallTypes"; + type EventEndInstallTypes = "event::endInstallTypes"; + interface TypingInstallerResponse { + readonly kind: ActionSet | ActionInvalidate | EventBeginInstallTypes | EventEndInstallTypes; + } + interface ProjectResponse extends TypingInstallerResponse { + readonly projectName: string; + } + interface SetTypings extends ProjectResponse { + readonly typeAcquisition: ts.TypeAcquisition; + readonly compilerOptions: ts.CompilerOptions; + readonly typings: string[]; + readonly unresolvedImports: SortedReadonlyArray; + readonly kind: ActionSet; + } + interface InvalidateCachedTypings extends ProjectResponse { + readonly kind: ActionInvalidate; + } + interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; + readonly typingsInstallerVersion: string; + readonly packagesToInstall: ReadonlyArray; + } + interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; } } declare namespace ts.server { - interface PendingErrorCheck { - fileName: NormalizedPath; - project: Project; + const ActionSet: ActionSet; + const ActionInvalidate: ActionInvalidate; + const EventBeginInstallTypes: EventBeginInstallTypes; + const EventEndInstallTypes: EventEndInstallTypes; + namespace Arguments { + const GlobalCacheLocation = "--globalTypingsCacheLocation"; + const LogFile = "--logFile"; + const EnableTelemetry = "--enableTelemetry"; } - interface EventSender { - event(payload: any, eventName: string): void; + function hasArgument(argumentName: string): boolean; + function findArgument(argumentName: string): string; +} +declare namespace ts.server { + enum LogLevel { + terse = 0, + normal = 1, + requestTime = 2, + verbose = 3, } - namespace CommandNames { - const Brace: protocol.CommandTypes.Brace; - const BraceFull: protocol.CommandTypes.BraceFull; - const BraceCompletion: protocol.CommandTypes.BraceCompletion; - const Change: protocol.CommandTypes.Change; - const Close: protocol.CommandTypes.Close; - const Completions: protocol.CommandTypes.Completions; - const CompletionsFull: protocol.CommandTypes.CompletionsFull; - const CompletionDetails: protocol.CommandTypes.CompletionDetails; - const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList; - const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile; - const Configure: protocol.CommandTypes.Configure; - const Definition: protocol.CommandTypes.Definition; - const DefinitionFull: protocol.CommandTypes.DefinitionFull; - const Exit: protocol.CommandTypes.Exit; - const Format: protocol.CommandTypes.Format; - const Formatonkey: protocol.CommandTypes.Formatonkey; - const FormatFull: protocol.CommandTypes.FormatFull; - const FormatonkeyFull: protocol.CommandTypes.FormatonkeyFull; - const FormatRangeFull: protocol.CommandTypes.FormatRangeFull; - const Geterr: protocol.CommandTypes.Geterr; - const GeterrForProject: protocol.CommandTypes.GeterrForProject; - const Implementation: protocol.CommandTypes.Implementation; - const ImplementationFull: protocol.CommandTypes.ImplementationFull; - const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync; - const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync; - const NavBar: protocol.CommandTypes.NavBar; - const NavBarFull: protocol.CommandTypes.NavBarFull; - const NavTree: protocol.CommandTypes.NavTree; - const NavTreeFull: protocol.CommandTypes.NavTreeFull; - const Navto: protocol.CommandTypes.Navto; - const NavtoFull: protocol.CommandTypes.NavtoFull; - const Occurrences: protocol.CommandTypes.Occurrences; - const DocumentHighlights: protocol.CommandTypes.DocumentHighlights; - const DocumentHighlightsFull: protocol.CommandTypes.DocumentHighlightsFull; - const Open: protocol.CommandTypes.Open; - const Quickinfo: protocol.CommandTypes.Quickinfo; - const QuickinfoFull: protocol.CommandTypes.QuickinfoFull; - const References: protocol.CommandTypes.References; - const ReferencesFull: protocol.CommandTypes.ReferencesFull; - const Reload: protocol.CommandTypes.Reload; - const Rename: protocol.CommandTypes.Rename; - const RenameInfoFull: protocol.CommandTypes.RenameInfoFull; - const RenameLocationsFull: protocol.CommandTypes.RenameLocationsFull; - const Saveto: protocol.CommandTypes.Saveto; - const SignatureHelp: protocol.CommandTypes.SignatureHelp; - const SignatureHelpFull: protocol.CommandTypes.SignatureHelpFull; - const TypeDefinition: protocol.CommandTypes.TypeDefinition; - const ProjectInfo: protocol.CommandTypes.ProjectInfo; - const ReloadProjects: protocol.CommandTypes.ReloadProjects; - const Unknown: protocol.CommandTypes.Unknown; - const OpenExternalProject: protocol.CommandTypes.OpenExternalProject; - const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects; - const CloseExternalProject: protocol.CommandTypes.CloseExternalProject; - const SynchronizeProjectList: protocol.CommandTypes.SynchronizeProjectList; - const ApplyChangedToOpenFiles: protocol.CommandTypes.ApplyChangedToOpenFiles; - const EncodedSemanticClassificationsFull: protocol.CommandTypes.EncodedSemanticClassificationsFull; - const Cleanup: protocol.CommandTypes.Cleanup; - const OutliningSpans: protocol.CommandTypes.OutliningSpans; - const TodoComments: protocol.CommandTypes.TodoComments; - const Indentation: protocol.CommandTypes.Indentation; - const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate; - const CompilerOptionsDiagnosticsFull: protocol.CommandTypes.CompilerOptionsDiagnosticsFull; - const NameOrDottedNameSpan: protocol.CommandTypes.NameOrDottedNameSpan; - const BreakpointStatement: protocol.CommandTypes.BreakpointStatement; - const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects; - const GetCodeFixes: protocol.CommandTypes.GetCodeFixes; - const GetCodeFixesFull: protocol.CommandTypes.GetCodeFixesFull; - const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes; + const emptyArray: ReadonlyArray; + interface Logger { + close(): void; + hasLevel(level: LogLevel): boolean; + loggingEnabled(): boolean; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: Msg.Types): void; + getLogFileName(): string; } - function formatMessage(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; - class Session implements EventSender { - private host; - protected readonly typingsInstaller: ITypingsInstaller; - private byteLength; - private hrtime; - protected logger: Logger; - protected readonly canUseEvents: boolean; - private readonly gcTimer; - protected projectService: ProjectService; - private errorTimer; - private immediateId; - private changeSeq; - private eventHander; - constructor(host: ServerHost, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller: ITypingsInstaller, byteLength: (buf: string, encoding?: string) => number, hrtime: (start?: number[]) => number[], logger: Logger, canUseEvents: boolean, eventHandler?: ProjectServiceEventHandler); - private defaultEventHandler(event); - logError(err: Error, cmd: string): void; - send(msg: protocol.Message): void; - configFileDiagnosticEvent(triggerFile: string, configFile: string, diagnostics: ts.Diagnostic[]): void; - event(info: any, eventName: string): void; - output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; - private semanticCheck(file, project); - private syntacticCheck(file, project); - private updateProjectStructure(seq, matchSeq, ms?); - private updateErrorCheck(checkList, seq, matchSeq, ms?, followMs?, requireOpen?); - private cleanProjects(caption, projects); - private cleanup(); - private getEncodedSemanticClassifications(args); - private getProject(projectFileName); - private getCompilerOptionsDiagnostics(args); - private convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo); - private getDiagnosticsWorker(args, isSemantic, selector, includeLinePosition); - private getDefinition(args, simplifiedResult); - private getTypeDefinition(args); - private getImplementation(args, simplifiedResult); - private getOccurrences(args); - private getSyntacticDiagnosticsSync(args); - private getSemanticDiagnosticsSync(args); - private getDocumentHighlights(args, simplifiedResult); - private setCompilerOptionsForInferredProjects(args); - private getProjectInfo(args); - private getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList); - private getRenameInfo(args); - private getProjects(args); - private getRenameLocations(args, simplifiedResult); - private getReferences(args, simplifiedResult); - private openClientFile(fileName, fileContent?, scriptKind?); - private getPosition(args, scriptInfo); - private getFileAndProject(args, errorOnMissingProject?); - private getFileAndProjectWithoutRefreshingInferredProjects(args, errorOnMissingProject?); - private getFileAndProjectWorker(uncheckedFileName, projectFileName, refreshInferredProjects, errorOnMissingProject); - private getOutliningSpans(args); - private getTodoComments(args); - private getDocCommentTemplate(args); - private getIndentation(args); - private getBreakpointStatement(args); - private getNameOrDottedNameSpan(args); - private isValidBraceCompletion(args); - private getQuickInfoWorker(args, simplifiedResult); - private getFormattingEditsForRange(args); - private getFormattingEditsForRangeFull(args); - private getFormattingEditsForDocumentFull(args); - private getFormattingEditsAfterKeystrokeFull(args); - private getFormattingEditsAfterKeystroke(args); - private getCompletions(args, simplifiedResult); - private getCompletionEntryDetails(args); - private getCompileOnSaveAffectedFileList(args); - private emitFile(args); - private getSignatureHelpItems(args, simplifiedResult); - private getDiagnostics(delay, fileNames); - private change(args); - private reload(args, reqSeq); - private saveToTmp(fileName, tempFileName); - private closeClientFile(fileName); - private decorateNavigationBarItems(items, scriptInfo); - private getNavigationBarItems(args, simplifiedResult); - private decorateNavigationTree(tree, scriptInfo); - private decorateSpan(span, scriptInfo); - private getNavigationTree(args, simplifiedResult); - private getNavigateToItems(args, simplifiedResult); - private getSupportedCodeFixes(); - private getCodeFixes(args, simplifiedResult); - private mapCodeAction(codeAction, scriptInfo); - private convertTextChangeToCodeEdit(change, scriptInfo); - private getBraceMatching(args, simplifiedResult); - getDiagnosticsForProject(delay: number, fileName: string): void; - getCanonicalFileName(fileName: string): string; - exit(): void; - private notRequired(); - private requiredResponse(response); - private handlers; - addProtocolHandler(command: string, handler: (request: protocol.Request) => { - response?: any; - responseRequired: boolean; - }): void; - executeCommand(request: protocol.Request): { - response?: any; - responseRequired?: boolean; - }; - onMessage(message: string): void; + namespace Msg { + type Err = "Err"; + const Err: Err; + type Info = "Info"; + const Info: Info; + type Perf = "Perf"; + const Perf: Perf; + type Types = Err | Info | Perf; + } + function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, cachePath?: string): DiscoverTypings; + namespace Errors { + function ThrowNoProject(): never; + function ThrowProjectLanguageServiceDisabled(): never; + function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never; + } + function getDefaultFormatCodeSettings(host: ServerHost): FormatCodeSettings; + function mergeMaps(target: MapLike, source: MapLike): void; + function removeItemFromSet(items: T[], itemToRemove: T): void; + type NormalizedPath = string & { + __normalizedPathTag: any; + }; + function toNormalizedPath(fileName: string): NormalizedPath; + function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path; + function asNormalizedPath(fileName: string): NormalizedPath; + interface NormalizedPathMap { + get(path: NormalizedPath): T; + set(path: NormalizedPath, value: T): void; + contains(path: NormalizedPath): boolean; + remove(path: NormalizedPath): void; + } + function createNormalizedPathMap(): NormalizedPathMap; + interface ProjectOptions { + configHasFilesProperty?: boolean; + files?: string[]; + wildcardDirectories?: Map; + compilerOptions?: CompilerOptions; + typeAcquisition?: TypeAcquisition; + compileOnSave?: boolean; + } + function isInferredProjectName(name: string): boolean; + function makeInferredProjectName(counter: number): string; + function toSortedReadonlyArray(arr: string[]): SortedReadonlyArray; + class ThrottledOperations { + private readonly host; + private pendingTimeouts; + constructor(host: ServerHost); + schedule(operationId: string, delay: number, cb: () => void): void; + private static run(self, operationId, cb); + } + class GcTimer { + private readonly host; + private readonly delay; + private readonly logger; + private timerId; + constructor(host: ServerHost, delay: number, logger: Logger); + scheduleCollect(): void; + private static run(self); } } declare namespace ts.server { @@ -11841,178 +3927,541 @@ declare namespace ts.server { lineCount(): number; } } -declare let debugObjectHost: any; -declare namespace ts { - interface ScriptSnapshotShim { - getText(start: number, end: number): string; - getLength(): number; - getChangeRange(oldSnapshot: ScriptSnapshotShim): string; - dispose?(): void; - } - interface Logger { - log(s: string): void; - trace(s: string): void; - error(s: string): void; - } - interface LanguageServiceShimHost extends Logger { - getCompilationSettings(): string; - getScriptFileNames(): string; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): ScriptSnapshotShim; - getLocalizedDiagnosticMessages(): string; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string; - getDefaultLibFileName(options: string): string; - getNewLine?(): string; - getProjectVersion?(): string; - useCaseSensitiveFileNames?(): boolean; - getTypeRootsVersion?(): number; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(path: string, encoding?: string): string; - fileExists(path: string): boolean; - getModuleResolutionsForFile?(fileName: string): string; - getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; - directoryExists(directoryName: string): boolean; - } - interface CoreServicesShimHost extends Logger { - directoryExists(directoryName: string): boolean; - fileExists(fileName: string): boolean; - getCurrentDirectory(): string; - getDirectories(path: string): string; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(fileName: string): string; - realpath?(path: string): string; - trace(s: string): void; - useCaseSensitiveFileNames?(): boolean; - } - interface IFileReference { - path: string; - position: number; - length: number; - } - interface ShimFactory { - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; - } - interface Shim { - dispose(_dummy: any): void; - } - interface LanguageServiceShim extends Shim { - languageService: LanguageService; - dispose(_dummy: any): void; - refresh(throwOnError: boolean): void; - cleanupSemanticCache(): void; - getSyntacticDiagnostics(fileName: string): string; - getSemanticDiagnostics(fileName: string): string; - getCompilerOptionsDiagnostics(): string; - getSyntacticClassifications(fileName: string, start: number, length: number): string; - getSemanticClassifications(fileName: string, start: number, length: number): string; - getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; - getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; - getCompletionsAtPosition(fileName: string, position: number): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string): string; - getQuickInfoAtPosition(fileName: string, position: number): string; - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; - getBreakpointStatementAtPosition(fileName: string, position: number): string; - getSignatureHelpItems(fileName: string, position: number): string; - getRenameInfo(fileName: string, position: number): string; - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): string; - getDefinitionAtPosition(fileName: string, position: number): string; - getTypeDefinitionAtPosition(fileName: string, position: number): string; - getImplementationAtPosition(fileName: string, position: number): string; - getReferencesAtPosition(fileName: string, position: number): string; - findReferences(fileName: string, position: number): string; - getOccurrencesAtPosition(fileName: string, position: number): string; - getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; - getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string; - getNavigationBarItems(fileName: string): string; - getNavigationTree(fileName: string): string; - getOutliningSpans(fileName: string): string; - getTodoComments(fileName: string, todoCommentDescriptors: string): string; - getBraceMatchingAtPosition(fileName: string, position: number): string; - getIndentationAtPosition(fileName: string, position: number, options: string): string; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: string): string; - getFormattingEditsForDocument(fileName: string, options: string): string; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string): string; - getDocCommentTemplateAtPosition(fileName: string, position: number): string; - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string; - getEmitOutput(fileName: string): string; - getEmitOutputObject(fileName: string): EmitOutput; - } - interface ClassifierShim extends Shim { - getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - } - interface CoreServicesShim extends Shim { - getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string; - getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getDefaultCompilationSettings(): string; - discoverTypings(discoverTypingsJson: string): string; - } - class LanguageServiceShimHostAdapter implements LanguageServiceHost { - private shimHost; - private files; - private loggingEnabled; - private tracingEnabled; - resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModuleFull[]; - resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; - directoryExists: (directoryName: string) => boolean; - constructor(shimHost: LanguageServiceShimHost); - log(s: string): void; - trace(s: string): void; - error(s: string): void; - getProjectVersion(): string; - getTypeRootsVersion(): number; - useCaseSensitiveFileNames(): boolean; - getCompilationSettings(): CompilerOptions; - getScriptFileNames(): string[]; - getScriptSnapshot(fileName: string): IScriptSnapshot; - getScriptKind(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getLocalizedDiagnosticMessages(): any; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string[]; - getDefaultLibFileName(options: CompilerOptions): string; - readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[], depth?: number): string[]; - readFile(path: string, encoding?: string): string; - fileExists(path: string): boolean; - } - class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost { - private shimHost; - directoryExists: (directoryName: string) => boolean; - realpath: (path: string) => string; - useCaseSensitiveFileNames: boolean; - constructor(shimHost: CoreServicesShimHost); - readDirectory(rootDir: string, extensions: string[], exclude: string[], include: string[], depth?: number): string[]; - fileExists(fileName: string): boolean; - readFile(fileName: string): string; - private readDirectoryFallback(rootDir, extension, exclude); - getDirectories(path: string): string[]; - } - function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { - message: string; - start: number; - length: number; - category: string; - code: number; - }[]; - class TypeScriptServicesFactory implements ShimFactory { - private _shims; - private documentRegistry; - getServicesVersion(): string; - createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim; - createClassifierShim(logger: Logger): ClassifierShim; - createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim; +declare namespace ts.server { + class ScriptInfo { + private readonly host; + readonly fileName: NormalizedPath; + readonly scriptKind: ScriptKind; + hasMixedContent: boolean; + readonly containingProjects: Project[]; + private formatCodeSettings; + readonly path: Path; + private fileWatcher; + private textStorage; + private isOpen; + constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent?: boolean); + isScriptOpen(): boolean; + open(newText: string): void; close(): void; - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; + getSnapshot(): IScriptSnapshot; + getFormatCodeSettings(): FormatCodeSettings; + attachToProject(project: Project): boolean; + isAttached(project: Project): boolean; + detachFromProject(project: Project): void; + detachAllProjects(): void; + getDefaultProject(): Project; + registerFileUpdate(): void; + setFormatOptions(formatSettings: FormatCodeSettings): void; + setWatcher(watcher: FileWatcher): void; + stopWatcher(): void; + getLatestVersion(): string; + reload(script: string): void; + saveTo(fileName: string): void; + reloadFromFile(tempFileName?: NormalizedPath): void; + getLineInfo(line: number): ILineInfo; + editContent(start: number, end: number, newText: string): void; + markContainingProjectsAsDirty(): void; + lineToTextSpan(line: number): TextSpan; + lineOffsetToPosition(line: number, offset: number): number; + positionToLineOffset(position: number): ILineInfo; } } -declare namespace TypeScript.Services { - const TypeScriptServicesFactory: typeof ts.TypeScriptServicesFactory; +declare namespace ts.server { + class LSHost implements ts.LanguageServiceHost, ModuleResolutionHost { + private readonly host; + private readonly project; + private readonly cancellationToken; + private compilationSettings; + private readonly resolvedModuleNames; + private readonly resolvedTypeReferenceDirectives; + private readonly getCanonicalFileName; + private filesWithChangedSetOfUnresolvedImports; + private readonly resolveModuleName; + readonly trace: (s: string) => void; + readonly realpath?: (path: string) => string; + constructor(host: ServerHost, project: Project, cancellationToken: HostCancellationToken); + startRecordingFilesWithChangedResolutions(): void; + finishRecordingFilesWithChangedResolutions(): Path[]; + private resolveNamesWithLocalCache(names, containingFile, cache, loader, getResult, getResultFileName, logChanges); + getNewLine(): string; + getProjectVersion(): string; + getCompilationSettings(): CompilerOptions; + useCaseSensitiveFileNames(): boolean; + getCancellationToken(): HostCancellationToken; + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModuleFull[]; + getDefaultLibFileName(): string; + getScriptSnapshot(filename: string): ts.IScriptSnapshot; + getScriptFileNames(): string[]; + getTypeRootsVersion(): number; + getScriptKind(fileName: string): ScriptKind; + getScriptVersion(filename: string): string; + getCurrentDirectory(): string; + resolvePath(path: string): string; + fileExists(path: string): boolean; + readFile(fileName: string): string; + directoryExists(path: string): boolean; + readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + getDirectories(path: string): string[]; + notifyFileRemoved(info: ScriptInfo): void; + setCompilationSettings(opt: ts.CompilerOptions): void; + } } -declare const toolsVersion = "2.2"; +declare namespace ts.server { + interface ITypingsInstaller { + enqueueInstallTypingsRequest(p: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray): void; + attach(projectService: ProjectService): void; + onProjectClosed(p: Project): void; + readonly globalTypingsCacheLocation: string; + } + const nullTypingsInstaller: ITypingsInstaller; + class TypingsCache { + private readonly installer; + private readonly perProjectCache; + constructor(installer: ITypingsInstaller); + getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray, forceRefresh: boolean): SortedReadonlyArray; + updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray, newTypings: string[]): void; + deleteTypingsForProject(projectName: string): void; + onProjectClosed(project: Project): void; + } +} +declare namespace ts.server { + enum ProjectKind { + Inferred = 0, + Configured = 1, + External = 2, + } + function allRootFilesAreJsOrDts(project: Project): boolean; + function allFilesAreJsOrDts(project: Project): boolean; + class UnresolvedImportsMap { + readonly perFileMap: FileMap>; + private version; + clear(): void; + getVersion(): number; + remove(path: Path): void; + get(path: Path): ReadonlyArray; + set(path: Path, value: ReadonlyArray): void; + } + abstract class Project { + private readonly projectName; + readonly projectKind: ProjectKind; + readonly projectService: ProjectService; + private documentRegistry; + private compilerOptions; + compileOnSaveEnabled: boolean; + private rootFiles; + private rootFilesMap; + private lsHost; + private program; + private cachedUnresolvedImportsPerFile; + private lastCachedUnresolvedImportsList; + private readonly languageService; + languageServiceEnabled: boolean; + builder: Builder; + private updatedFileNames; + private lastReportedFileNames; + private lastReportedVersion; + private projectStructureVersion; + private projectStateVersion; + private typingFiles; + protected projectErrors: Diagnostic[]; + typesVersion: number; + isNonTsProject(): boolean; + isJsOnlyProject(): boolean; + getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap; + constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, languageServiceEnabled: boolean, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean); + private setInternalCompilerOptionsForEmittingJsFiles(); + getProjectErrors(): Diagnostic[]; + getLanguageService(ensureSynchronized?: boolean): LanguageService; + getCompileOnSaveAffectedFileList(scriptInfo: ScriptInfo): string[]; + getProjectVersion(): string; + enableLanguageService(): void; + disableLanguageService(): void; + getProjectName(): string; + abstract getProjectRootPath(): string | undefined; + abstract getTypeAcquisition(): TypeAcquisition; + getSourceFile(path: Path): SourceFile; + updateTypes(): void; + close(): void; + getCompilerOptions(): CompilerOptions; + hasRoots(): boolean; + getRootFiles(): NormalizedPath[]; + getRootFilesLSHost(): string[]; + getRootScriptInfos(): ScriptInfo[]; + getScriptInfos(): ScriptInfo[]; + getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput; + getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[]; + getAllEmittableFiles(): string[]; + containsScriptInfo(info: ScriptInfo): boolean; + containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean; + isRoot(info: ScriptInfo): boolean; + addRoot(info: ScriptInfo): void; + removeFile(info: ScriptInfo, detachFromProject?: boolean): void; + registerFileUpdate(fileName: string): void; + markAsDirty(): void; + private extractUnresolvedImportsFromSourceFile(file, result); + updateGraph(): boolean; + private setTypings(typings); + private updateGraphWorker(); + getScriptInfoLSHost(fileName: string): ScriptInfo; + getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; + getScriptInfo(uncheckedFileName: string): ScriptInfo; + filesToString(): string; + setCompilerOptions(compilerOptions: CompilerOptions): void; + reloadScript(filename: NormalizedPath, tempFileName?: NormalizedPath): boolean; + getReferencedFiles(path: Path): Path[]; + private removeRootFileIfNecessary(info); + } + class InferredProject extends Project { + private static newName; + directoriesWatchedForTsconfig: string[]; + constructor(projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions); + getProjectRootPath(): string; + close(): void; + getTypeAcquisition(): TypeAcquisition; + } + class ConfiguredProject extends Project { + private wildcardDirectories; + compileOnSaveEnabled: boolean; + private typeAcquisition; + private projectFileWatcher; + private directoryWatcher; + private directoriesWatchedForWildcards; + private typeRootsWatchers; + readonly canonicalConfigFilePath: NormalizedPath; + openRefCount: number; + constructor(configFileName: NormalizedPath, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, hasExplicitListOfFiles: boolean, compilerOptions: CompilerOptions, wildcardDirectories: Map, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean); + getConfigFilePath(): string; + getProjectRootPath(): string; + setProjectErrors(projectErrors: Diagnostic[]): void; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + getTypeAcquisition(): TypeAcquisition; + watchConfigFile(callback: (project: ConfiguredProject) => void): void; + watchTypeRoots(callback: (project: ConfiguredProject, path: string) => void): void; + watchConfigDirectory(callback: (project: ConfiguredProject, path: string) => void): void; + watchWildcards(callback: (project: ConfiguredProject, path: string) => void): void; + stopWatchingDirectory(): void; + close(): void; + addOpenRef(): void; + deleteOpenRef(): number; + getEffectiveTypeRoots(): string[]; + } + class ExternalProject extends Project { + compileOnSaveEnabled: boolean; + private readonly projectFilePath; + private typeAcquisition; + constructor(externalProjectName: string, projectService: ProjectService, documentRegistry: ts.DocumentRegistry, compilerOptions: CompilerOptions, languageServiceEnabled: boolean, compileOnSaveEnabled: boolean, projectFilePath?: string); + getProjectRootPath(): string; + getTypeAcquisition(): TypeAcquisition; + setProjectErrors(projectErrors: Diagnostic[]): void; + setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void; + } +} +declare namespace ts.server { + const maxProgramSizeForNonTsFiles: number; + const ContextEvent = "context"; + const ConfigFileDiagEvent = "configFileDiag"; + const ProjectLanguageServiceStateEvent = "projectLanguageServiceState"; + interface ContextEvent { + eventName: typeof ContextEvent; + data: { + project: Project; + fileName: NormalizedPath; + }; + } + interface ConfigFileDiagEvent { + eventName: typeof ConfigFileDiagEvent; + data: { + triggerFile: string; + configFileName: string; + diagnostics: Diagnostic[]; + }; + } + interface ProjectLanguageServiceStateEvent { + eventName: typeof ProjectLanguageServiceStateEvent; + data: { + project: Project; + languageServiceEnabled: boolean; + }; + } + type ProjectServiceEvent = ContextEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent; + interface ProjectServiceEventHandler { + (event: ProjectServiceEvent): void; + } + function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; + function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; + function tryConvertScriptKindName(scriptKindName: protocol.ScriptKindName | ScriptKind): ScriptKind; + function convertScriptKindName(scriptKindName: protocol.ScriptKindName): ScriptKind; + function combineProjectOutput(projects: Project[], action: (project: Project) => T[], comparer?: (a: T, b: T) => number, areEqual?: (a: T, b: T) => boolean): T[]; + interface HostConfiguration { + formatCodeOptions: FormatCodeSettings; + hostInfo: string; + extraFileExtensions?: FileExtensionInfo[]; + } + interface OpenConfiguredProjectResult { + configFileName?: NormalizedPath; + configFileErrors?: Diagnostic[]; + } + class ProjectService { + readonly host: ServerHost; + readonly logger: Logger; + readonly cancellationToken: HostCancellationToken; + readonly useSingleInferredProject: boolean; + readonly typingsInstaller: ITypingsInstaller; + private readonly eventHandler; + readonly typingsCache: TypingsCache; + private readonly documentRegistry; + private readonly filenameToScriptInfo; + private readonly externalProjectToConfiguredProjectMap; + readonly externalProjects: ExternalProject[]; + readonly inferredProjects: InferredProject[]; + readonly configuredProjects: ConfiguredProject[]; + readonly openFiles: ScriptInfo[]; + private compilerOptionsForInferredProjects; + private compileOnSaveForInferredProjects; + private readonly directoryWatchers; + private readonly throttledOperations; + private readonly hostConfiguration; + private changedFiles; + readonly toCanonicalFileName: (f: string) => string; + lastDeletedFile: ScriptInfo; + constructor(host: ServerHost, logger: Logger, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller?: ITypingsInstaller, eventHandler?: ProjectServiceEventHandler); + ensureInferredProjectsUpToDate_TestOnly(): void; + getCompilerOptionsForInferredProjects(): CompilerOptions; + onUpdateLanguageServiceStateForProject(project: Project, languageServiceEnabled: boolean): void; + updateTypingsForProject(response: SetTypings | InvalidateCachedTypings): void; + setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void; + stopWatchingDirectory(directory: string): void; + findProject(projectName: string): Project; + getDefaultProjectForFile(fileName: NormalizedPath, refreshInferredProjects: boolean): Project; + private ensureInferredProjectsUpToDate(); + private findContainingExternalProject(fileName); + getFormatCodeOptions(file?: NormalizedPath): FormatCodeSettings; + private updateProjectGraphs(projects); + private onSourceFileChanged(fileName); + private handleDeletedFile(info); + private onTypeRootFileChanged(project, fileName); + private onSourceFileInDirectoryChangedForConfiguredProject(project, fileName); + private handleChangeInSourceFileForConfiguredProject(project, triggerFile); + private onConfigChangedForConfiguredProject(project); + private onConfigFileAddedForInferredProject(fileName); + private getCanonicalFileName(fileName); + private removeProject(project); + private assignScriptInfoToInferredProjectIfNecessary(info, addToListOfOpenFiles); + private closeOpenFile(info); + private openOrUpdateConfiguredProjectForFile(fileName); + private findConfigFile(searchPath); + private printProjects(); + private findConfiguredProjectByProjectName(configFileName); + private findExternalProjectByProjectName(projectFileName); + private convertConfigFileContentToProjectOptions(configFilename); + private exceededTotalSizeLimitForNonTsFiles(options, fileNames, propertyReader); + private createAndAddExternalProject(projectFileName, files, options, typeAcquisition); + private reportConfigFileDiagnostics(configFileName, diagnostics, triggerFile); + private createAndAddConfiguredProject(configFileName, projectOptions, configFileErrors, clientFileName?); + private watchConfigDirectoryForProject(project, options); + private addFilesToProjectAndUpdateGraph(project, files, propertyReader, clientFileName, typeAcquisition, configFileErrors); + private openConfigFile(configFileName, clientFileName?); + private updateNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors); + private updateConfiguredProject(project); + createInferredProjectWithRootFileIfNecessary(root: ScriptInfo): InferredProject; + getOrCreateScriptInfo(uncheckedFileName: string, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind): ScriptInfo; + getScriptInfo(uncheckedFileName: string): ScriptInfo; + getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): ScriptInfo; + getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo; + getScriptInfoForPath(fileName: Path): ScriptInfo; + setHostConfiguration(args: protocol.ConfigureRequestArguments): void; + closeLog(): void; + reloadProjects(): void; + refreshInferredProjects(): void; + openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind): OpenConfiguredProjectResult; + openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean): OpenConfiguredProjectResult; + closeClientFile(uncheckedFileName: string): void; + private collectChanges(lastKnownProjectVersions, currentProjects, result); + private closeConfiguredProject(configFile); + closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void; + openExternalProjects(projects: protocol.ExternalProject[]): void; + openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects?: boolean): void; + } +} +declare namespace ts.server { + interface PendingErrorCheck { + fileName: NormalizedPath; + project: Project; + } + interface EventSender { + event(payload: any, eventName: string): void; + } + namespace CommandNames { + const Brace: protocol.CommandTypes.Brace; + const BraceCompletion: protocol.CommandTypes.BraceCompletion; + const Change: protocol.CommandTypes.Change; + const Close: protocol.CommandTypes.Close; + const Completions: protocol.CommandTypes.Completions; + const CompletionDetails: protocol.CommandTypes.CompletionDetails; + const CompileOnSaveAffectedFileList: protocol.CommandTypes.CompileOnSaveAffectedFileList; + const CompileOnSaveEmitFile: protocol.CommandTypes.CompileOnSaveEmitFile; + const Configure: protocol.CommandTypes.Configure; + const Definition: protocol.CommandTypes.Definition; + const Exit: protocol.CommandTypes.Exit; + const Format: protocol.CommandTypes.Format; + const Formatonkey: protocol.CommandTypes.Formatonkey; + const Geterr: protocol.CommandTypes.Geterr; + const GeterrForProject: protocol.CommandTypes.GeterrForProject; + const Implementation: protocol.CommandTypes.Implementation; + const SemanticDiagnosticsSync: protocol.CommandTypes.SemanticDiagnosticsSync; + const SyntacticDiagnosticsSync: protocol.CommandTypes.SyntacticDiagnosticsSync; + const NavBar: protocol.CommandTypes.NavBar; + const NavTree: protocol.CommandTypes.NavTree; + const NavTreeFull: protocol.CommandTypes.NavTreeFull; + const Navto: protocol.CommandTypes.Navto; + const Occurrences: protocol.CommandTypes.Occurrences; + const DocumentHighlights: protocol.CommandTypes.DocumentHighlights; + const Open: protocol.CommandTypes.Open; + const Quickinfo: protocol.CommandTypes.Quickinfo; + const References: protocol.CommandTypes.References; + const Reload: protocol.CommandTypes.Reload; + const Rename: protocol.CommandTypes.Rename; + const Saveto: protocol.CommandTypes.Saveto; + const SignatureHelp: protocol.CommandTypes.SignatureHelp; + const TypeDefinition: protocol.CommandTypes.TypeDefinition; + const ProjectInfo: protocol.CommandTypes.ProjectInfo; + const ReloadProjects: protocol.CommandTypes.ReloadProjects; + const Unknown: protocol.CommandTypes.Unknown; + const OpenExternalProject: protocol.CommandTypes.OpenExternalProject; + const OpenExternalProjects: protocol.CommandTypes.OpenExternalProjects; + const CloseExternalProject: protocol.CommandTypes.CloseExternalProject; + const TodoComments: protocol.CommandTypes.TodoComments; + const Indentation: protocol.CommandTypes.Indentation; + const DocCommentTemplate: protocol.CommandTypes.DocCommentTemplate; + const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects; + const GetCodeFixes: protocol.CommandTypes.GetCodeFixes; + const GetSupportedCodeFixes: protocol.CommandTypes.GetSupportedCodeFixes; + } + function formatMessage(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; + class Session implements EventSender { + private host; + protected readonly typingsInstaller: ITypingsInstaller; + private byteLength; + private hrtime; + protected logger: Logger; + protected readonly canUseEvents: boolean; + private readonly gcTimer; + protected projectService: ProjectService; + private errorTimer; + private immediateId; + private changeSeq; + private eventHander; + constructor(host: ServerHost, cancellationToken: HostCancellationToken, useSingleInferredProject: boolean, typingsInstaller: ITypingsInstaller, byteLength: (buf: string, encoding?: string) => number, hrtime: (start?: number[]) => number[], logger: Logger, canUseEvents: boolean, eventHandler?: ProjectServiceEventHandler); + private defaultEventHandler(event); + logError(err: Error, cmd: string): void; + send(msg: protocol.Message): void; + configFileDiagnosticEvent(triggerFile: string, configFile: string, diagnostics: ts.Diagnostic[]): void; + event(info: any, eventName: string): void; + output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; + private semanticCheck(file, project); + private syntacticCheck(file, project); + private updateProjectStructure(seq, matchSeq, ms?); + private updateErrorCheck(checkList, seq, matchSeq, ms?, followMs?, requireOpen?); + private cleanProjects(caption, projects); + private cleanup(); + private getEncodedSemanticClassifications(args); + private getProject(projectFileName); + private getCompilerOptionsDiagnostics(args); + private convertToDiagnosticsWithLinePosition(diagnostics, scriptInfo); + private getDiagnosticsWorker(args, isSemantic, selector, includeLinePosition); + private getDefinition(args, simplifiedResult); + private getTypeDefinition(args); + private getImplementation(args, simplifiedResult); + private getOccurrences(args); + private getSyntacticDiagnosticsSync(args); + private getSemanticDiagnosticsSync(args); + private getDocumentHighlights(args, simplifiedResult); + private setCompilerOptionsForInferredProjects(args); + private getProjectInfo(args); + private getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList); + private getRenameInfo(args); + private getProjects(args); + private getRenameLocations(args, simplifiedResult); + private getReferences(args, simplifiedResult); + private openClientFile(fileName, fileContent?, scriptKind?); + private getPosition(args, scriptInfo); + private getFileAndProject(args, errorOnMissingProject?); + private getFileAndProjectWithoutRefreshingInferredProjects(args, errorOnMissingProject?); + private getFileAndProjectWorker(uncheckedFileName, projectFileName, refreshInferredProjects, errorOnMissingProject); + private getOutliningSpans(args); + private getTodoComments(args); + private getDocCommentTemplate(args); + private getIndentation(args); + private getBreakpointStatement(args); + private getNameOrDottedNameSpan(args); + private isValidBraceCompletion(args); + private getQuickInfoWorker(args, simplifiedResult); + private getFormattingEditsForRange(args); + private getFormattingEditsForRangeFull(args); + private getFormattingEditsForDocumentFull(args); + private getFormattingEditsAfterKeystrokeFull(args); + private getFormattingEditsAfterKeystroke(args); + private getCompletions(args, simplifiedResult); + private getCompletionEntryDetails(args); + private getCompileOnSaveAffectedFileList(args); + private emitFile(args); + private getSignatureHelpItems(args, simplifiedResult); + private getDiagnostics(delay, fileNames); + private change(args); + private reload(args, reqSeq); + private saveToTmp(fileName, tempFileName); + private closeClientFile(fileName); + private decorateNavigationBarItems(items, scriptInfo); + private getNavigationBarItems(args, simplifiedResult); + private decorateNavigationTree(tree, scriptInfo); + private decorateSpan(span, scriptInfo); + private getNavigationTree(args, simplifiedResult); + private getNavigateToItems(args, simplifiedResult); + private getSupportedCodeFixes(); + private getCodeFixes(args, simplifiedResult); + private mapCodeAction(codeAction, scriptInfo); + private convertTextChangeToCodeEdit(change, scriptInfo); + private getBraceMatching(args, simplifiedResult); + getDiagnosticsForProject(delay: number, fileName: string): void; + getCanonicalFileName(fileName: string): string; + exit(): void; + private notRequired(); + private requiredResponse(response); + private handlers; + addProtocolHandler(command: string, handler: (request: protocol.Request) => { + response?: any; + responseRequired: boolean; + }): void; + executeCommand(request: protocol.Request): { + response?: any; + responseRequired?: boolean; + }; + onMessage(message: string): void; + } +} +declare namespace ts.server { + function shouldEmitFile(scriptInfo: ScriptInfo): boolean; + class BuilderFileInfo { + readonly scriptInfo: ScriptInfo; + readonly project: Project; + private lastCheckedShapeSignature; + constructor(scriptInfo: ScriptInfo, project: Project); + isExternalModuleOrHasOnlyAmbientExternalModules(): boolean; + private containsOnlyAmbientModules(sourceFile); + private computeHash(text); + private getSourceFile(); + updateShapeSignature(): boolean; + } + interface Builder { + readonly project: Project; + getFilesAffectedBy(scriptInfo: ScriptInfo): string[]; + onProjectUpdateGraph(): void; + emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean; + clear(): void; + } + function createBuilder(project: Project): Builder; +} + +export = ts; +export as namespace ts; \ No newline at end of file diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 459706962fb..ab1a5cdfe05 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -5924,388 +5924,6 @@ var ts; } })(ts || (ts = {})); var ts; -(function (ts) { - var JsTyping; - (function (JsTyping) { - ; - ; - var safeList; - var EmptySafeList = ts.createMap(); - JsTyping.nodeCoreModuleList = [ - "buffer", "querystring", "events", "http", "cluster", - "zlib", "os", "https", "punycode", "repl", "readline", - "vm", "child_process", "url", "dns", "net", - "dgram", "fs", "path", "string_decoder", "tls", - "crypto", "stream", "util", "assert", "tty", "domain", - "constants", "process", "v8", "timers", "console" - ]; - var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { - var inferredTypings = ts.createMap(); - if (!typeAcquisition || !typeAcquisition.enable) { - return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; - } - fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { - var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); - return kind === 1 || kind === 2; - }); - if (!safeList) { - var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMap(result.config) : EmptySafeList; - } - var filesToWatch = []; - var searchDirs = []; - var exclude = []; - mergeTypings(typeAcquisition.include); - exclude = typeAcquisition.exclude || []; - var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); - if (projectRootPath) { - possibleSearchDirs.push(projectRootPath); - } - searchDirs = ts.deduplicate(possibleSearchDirs); - for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { - var searchDir = searchDirs_1[_i]; - var packageJsonPath = ts.combinePaths(searchDir, "package.json"); - getTypingNamesFromJson(packageJsonPath, filesToWatch); - var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); - getTypingNamesFromJson(bowerJsonPath, filesToWatch); - var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); - } - getTypingNamesFromSourceFileNames(fileNames); - if (unresolvedImports) { - for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { - var moduleId = unresolvedImports_1[_a]; - var typingName = moduleId in nodeCoreModules ? "node" : moduleId; - if (!(typingName in inferredTypings)) { - inferredTypings[typingName] = undefined; - } - } - } - for (var name_6 in packageNameToTypingLocation) { - if (name_6 in inferredTypings && !inferredTypings[name_6]) { - inferredTypings[name_6] = packageNameToTypingLocation[name_6]; - } - } - for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { - var excludeTypingName = exclude_1[_b]; - delete inferredTypings[excludeTypingName]; - } - var newTypingNames = []; - var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); - } - else { - newTypingNames.push(typing); - } - } - return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; - function mergeTypings(typingNames) { - if (!typingNames) { - return; - } - for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { - var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; - } - } - } - function getTypingNamesFromJson(jsonPath, filesToWatch) { - if (host.fileExists(jsonPath)) { - filesToWatch.push(jsonPath); - } - var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); - if (result.config) { - var jsonConfig = result.config; - if (jsonConfig.dependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); - } - if (jsonConfig.devDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); - } - if (jsonConfig.optionalDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); - } - if (jsonConfig.peerDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); - } - } - } - function getTypingNamesFromSourceFileNames(fileNames) { - var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); - var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); - var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); - if (safeList !== EmptySafeList) { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); - } - var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); - if (hasJsxFile) { - mergeTypings(["react"]); - } - } - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { - if (!host.directoryExists(nodeModulesPath)) { - return; - } - var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2); - for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { - var fileName = fileNames_2[_i]; - var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { - continue; - } - var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); - if (!result.config) { - continue; - } - var packageJson = result.config; - if (packageJson._requiredBy && - ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { - continue; - } - if (!packageJson.name) { - continue; - } - if (packageJson.typings) { - var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; - } - else { - typingNames.push(packageJson.name); - } - } - mergeTypings(typingNames); - } - } - JsTyping.discoverTypings = discoverTypings; - })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - server.ActionSet = "action::set"; - server.ActionInvalidate = "action::invalidate"; - server.EventBeginInstallTypes = "event::beginInstallTypes"; - server.EventEndInstallTypes = "event::endInstallTypes"; - var Arguments; - (function (Arguments) { - Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; - Arguments.LogFile = "--logFile"; - Arguments.EnableTelemetry = "--enableTelemetry"; - })(Arguments = server.Arguments || (server.Arguments = {})); - function hasArgument(argumentName) { - return ts.sys.args.indexOf(argumentName) >= 0; - } - server.hasArgument = hasArgument; - function findArgument(argumentName) { - var index = ts.sys.args.indexOf(argumentName); - return index >= 0 && index < ts.sys.args.length - 1 - ? ts.sys.args[index + 1] - : undefined; - } - server.findArgument = findArgument; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; -(function (ts) { - var server; - (function (server) { - var LogLevel; - (function (LogLevel) { - LogLevel[LogLevel["terse"] = 0] = "terse"; - LogLevel[LogLevel["normal"] = 1] = "normal"; - LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; - LogLevel[LogLevel["verbose"] = 3] = "verbose"; - })(LogLevel = server.LogLevel || (server.LogLevel = {})); - server.emptyArray = []; - var Msg; - (function (Msg) { - Msg.Err = "Err"; - Msg.Info = "Info"; - Msg.Perf = "Perf"; - })(Msg = server.Msg || (server.Msg = {})); - function getProjectRootPath(project) { - switch (project.projectKind) { - case server.ProjectKind.Configured: - return ts.getDirectoryPath(project.getProjectName()); - case server.ProjectKind.Inferred: - return ""; - case server.ProjectKind.External: - var projectName = ts.normalizeSlashes(project.getProjectName()); - return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; - } - } - function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { - return { - projectName: project.getProjectName(), - fileNames: project.getFileNames(true), - compilerOptions: project.getCompilerOptions(), - typeAcquisition: typeAcquisition, - unresolvedImports: unresolvedImports, - projectRootPath: getProjectRootPath(project), - cachePath: cachePath, - kind: "discover" - }; - } - server.createInstallTypingsRequest = createInstallTypingsRequest; - var Errors; - (function (Errors) { - function ThrowNoProject() { - throw new Error("No Project."); - } - Errors.ThrowNoProject = ThrowNoProject; - function ThrowProjectLanguageServiceDisabled() { - throw new Error("The project's language service is disabled."); - } - Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; - function ThrowProjectDoesNotContainDocument(fileName, project) { - throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); - } - Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; - })(Errors = server.Errors || (server.Errors = {})); - function getDefaultFormatCodeSettings(host) { - return { - indentSize: 4, - tabSize: 4, - newLineCharacter: host.newLine || "\n", - convertTabsToSpaces: true, - indentStyle: ts.IndentStyle.Smart, - insertSpaceAfterConstructor: false, - insertSpaceAfterCommaDelimiter: true, - insertSpaceAfterSemicolonInForStatements: true, - insertSpaceBeforeAndAfterBinaryOperators: true, - insertSpaceAfterKeywordsInControlFlowStatements: true, - insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, - insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, - insertSpaceBeforeFunctionParenthesis: false, - placeOpenBraceOnNewLineForFunctions: false, - placeOpenBraceOnNewLineForControlBlocks: false, - }; - } - server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; - function mergeMaps(target, source) { - for (var key in source) { - if (ts.hasProperty(source, key)) { - target[key] = source[key]; - } - } - } - server.mergeMaps = mergeMaps; - function removeItemFromSet(items, itemToRemove) { - if (items.length === 0) { - return; - } - var index = items.indexOf(itemToRemove); - if (index < 0) { - return; - } - if (index === items.length - 1) { - items.pop(); - } - else { - items[index] = items.pop(); - } - } - server.removeItemFromSet = removeItemFromSet; - function toNormalizedPath(fileName) { - return ts.normalizePath(fileName); - } - server.toNormalizedPath = toNormalizedPath; - function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { - var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); - return getCanonicalFileName(f); - } - server.normalizedPathToPath = normalizedPathToPath; - function asNormalizedPath(fileName) { - return fileName; - } - server.asNormalizedPath = asNormalizedPath; - function createNormalizedPathMap() { - var map = Object.create(null); - return { - get: function (path) { - return map[path]; - }, - set: function (path, value) { - map[path] = value; - }, - contains: function (path) { - return ts.hasProperty(map, path); - }, - remove: function (path) { - delete map[path]; - } - }; - } - server.createNormalizedPathMap = createNormalizedPathMap; - function isInferredProjectName(name) { - return /dev\/null\/inferredProject\d+\*/.test(name); - } - server.isInferredProjectName = isInferredProjectName; - function makeInferredProjectName(counter) { - return "/dev/null/inferredProject" + counter + "*"; - } - server.makeInferredProjectName = makeInferredProjectName; - function toSortedReadonlyArray(arr) { - arr.sort(); - return arr; - } - server.toSortedReadonlyArray = toSortedReadonlyArray; - var ThrottledOperations = (function () { - function ThrottledOperations(host) { - this.host = host; - this.pendingTimeouts = ts.createMap(); - } - ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { - if (ts.hasProperty(this.pendingTimeouts, operationId)) { - this.host.clearTimeout(this.pendingTimeouts[operationId]); - } - this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); - }; - ThrottledOperations.run = function (self, operationId, cb) { - delete self.pendingTimeouts[operationId]; - cb(); - }; - return ThrottledOperations; - }()); - server.ThrottledOperations = ThrottledOperations; - var GcTimer = (function () { - function GcTimer(host, delay, logger) { - this.host = host; - this.delay = delay; - this.logger = logger; - } - GcTimer.prototype.scheduleCollect = function () { - if (!this.host.gc || this.timerId != undefined) { - return; - } - this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); - }; - GcTimer.run = function (self) { - self.timerId = undefined; - var log = self.logger.hasLevel(LogLevel.requestTime); - var before = log && self.host.getMemoryUsage(); - self.host.gc(); - if (log) { - var after = self.host.getMemoryUsage(); - self.logger.perftrc("GC::before " + before + ", after " + after); - } - }; - return GcTimer; - }()); - server.GcTimer = GcTimer; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; (function (ts) { function trace(host) { host.trace(ts.formatMessage.apply(undefined, arguments)); @@ -7723,9 +7341,9 @@ var ts; return; default: if (isFunctionLike(node)) { - var name_7 = node.name; - if (name_7 && name_7.kind === 142) { - traverse(name_7.expression); + var name_6 = node.name; + if (name_6 && name_6.kind === 142) { + traverse(name_6.expression); return; } } @@ -8404,8 +8022,8 @@ var ts; } } else if (param.name.kind === 70) { - var name_8 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_8; }); + var name_7 = param.name.text; + return ts.filter(tags, function (tag) { return tag.kind === 282 && tag.parameterName.text === name_7; }); } else { return undefined; @@ -9866,9 +9484,9 @@ var ts; if (syntaxKindCache[kind]) { return syntaxKindCache[kind]; } - for (var name_9 in syntaxKindEnum) { - if (syntaxKindEnum[name_9] === kind) { - return syntaxKindCache[kind] = kind.toString() + " (" + name_9 + ")"; + for (var name_8 in syntaxKindEnum) { + if (syntaxKindEnum[name_8] === kind) { + return syntaxKindCache[kind] = kind.toString() + " (" + name_8 + ")"; } } } @@ -12590,15 +12208,15 @@ var ts; ts.getDeclarationName = getDeclarationName; function getName(node, allowComments, allowSourceMaps, emitFlags) { if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { - var name_10 = getMutableClone(node.name); + var name_9 = getMutableClone(node.name); emitFlags |= getEmitFlags(node.name); if (!allowSourceMaps) emitFlags |= 48; if (!allowComments) emitFlags |= 1536; if (emitFlags) - setEmitFlags(name_10, emitFlags); - return name_10; + setEmitFlags(name_9, emitFlags); + return name_9; } return getGeneratedNameForNode(node); } @@ -13179,8 +12797,8 @@ var ts; function getLocalNameForExternalImport(node, sourceFile) { var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name_11 = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name_11) ? name_11 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + var name_10 = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name_10) ? name_10 : createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); } if (node.kind === 236 && node.importClause) { return getGeneratedNameForNode(node); @@ -13424,10 +13042,10 @@ var ts; for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { var specifier = _c[_b]; if (!uniqueExports[specifier.name.text]) { - var name_12 = specifier.propertyName || specifier.name; - ts.multiMapAdd(exportSpecifiers, name_12.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name_12) - || resolver.getReferencedValueDeclaration(name_12); + var name_11 = specifier.propertyName || specifier.name; + ts.multiMapAdd(exportSpecifiers, name_11.text, specifier); + var decl = resolver.getReferencedImportDeclaration(name_11) + || resolver.getReferencedValueDeclaration(name_11); if (decl) { ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); } @@ -13459,11 +13077,11 @@ var ts; } } else { - var name_13 = node.name; - if (!uniqueExports[name_13.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); - uniqueExports[name_13.text] = true; - exportedNames = ts.append(exportedNames, name_13); + var name_12 = node.name; + if (!uniqueExports[name_12.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_12); + uniqueExports[name_12.text] = true; + exportedNames = ts.append(exportedNames, name_12); } } } @@ -13477,11 +13095,11 @@ var ts; } } else { - var name_14 = node.name; - if (!uniqueExports[name_14.text]) { - ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_14); - uniqueExports[name_14.text] = true; - exportedNames = ts.append(exportedNames, name_14); + var name_13 = node.name; + if (!uniqueExports[name_13.text]) { + ts.multiMapAdd(exportedBindings, ts.getOriginalNodeId(node), name_13); + uniqueExports[name_13.text] = true; + exportedNames = ts.append(exportedNames, name_13); } } } @@ -17275,8 +16893,8 @@ var ts; return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_15 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_15, undefined); + var name_14 = createMissingNode(70, true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_14, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } @@ -18323,8 +17941,8 @@ var ts; if (typeExpression.type.kind === 273) { var jsDocTypeReference = typeExpression.type; if (jsDocTypeReference.name.kind === 70) { - var name_16 = jsDocTypeReference.name; - if (name_16.text === "Object") { + var name_15 = jsDocTypeReference.name; + if (name_15.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -18428,14 +18046,14 @@ var ts; } var typeParameters = createNodeArray(); while (true) { - var name_17 = parseJSDocIdentifierName(); + var name_16 = parseJSDocIdentifierName(); skipWhitespace(); - if (!name_17) { + if (!name_16) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(143, name_17.pos); - typeParameter.name = name_17; + var typeParameter = createNode(143, name_16.pos); + typeParameter.name = name_16; finishNode(typeParameter); typeParameters.push(typeParameter); if (token() === 25) { @@ -22144,28 +21762,28 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_18 = specifier.propertyName || specifier.name; - if (name_18.text) { + var name_17 = specifier.propertyName || specifier.name; + if (name_17.text) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_18.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_17.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_18.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_17.text); } symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_18.text); - if (!symbolFromModule && allowSyntheticDefaultImports && name_18.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name_17.text); + if (!symbolFromModule && allowSyntheticDefaultImports && name_17.text === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol) || resolveSymbol(moduleSymbol); } var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; if (!symbol) { - error(name_18, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_18)); + error(name_17, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_17)); } return symbol; } @@ -23668,8 +23286,8 @@ var ts; var members = ts.createMap(); var names = ts.createMap(); for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { - var name_19 = properties_2[_i]; - names[ts.getTextOfPropertyName(name_19)] = true; + var name_18 = properties_2[_i]; + names[ts.getTextOfPropertyName(name_18)] = true; } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; @@ -23714,19 +23332,19 @@ var ts; type = getRestType(parentType, literalMembers, declaration.symbol); } else { - var name_20 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_20)) { + var name_19 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_19)) { return anyType; } if (declaration.initializer) { getContextualType(declaration.initializer); } - var text = ts.getTextOfPropertyName(name_20); + var text = ts.getTextOfPropertyName(name_19); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name_20, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_20)); + error(name_19, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_19)); return unknownType; } } @@ -30037,11 +29655,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_21 = declaration.propertyName || declaration.name; + var name_20 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_21)) { - var text = ts.getTextOfPropertyName(name_21); + !ts.isBindingPattern(name_20)) { + var text = ts.getTextOfPropertyName(name_20); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -32586,14 +32204,14 @@ var ts; } function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties) { if (property.kind === 258 || property.kind === 259) { - var name_22 = property.name; - if (name_22.kind === 142) { - checkComputedPropertyName(name_22); + var name_21 = property.name; + if (name_21.kind === 142) { + checkComputedPropertyName(name_21); } - if (isComputedNonLiteralName(name_22)) { + if (isComputedNonLiteralName(name_21)) { return undefined; } - var text = ts.getTextOfPropertyName(name_22); + var text = ts.getTextOfPropertyName(name_21); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || @@ -32608,7 +32226,7 @@ var ts; } } else { - error(name_22, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_22)); + error(name_21, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_21)); } } else if (property.kind === 260) { @@ -33286,9 +32904,9 @@ var ts; else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_23 = _a[_i].name; - if (ts.isBindingPattern(name_23) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, parameterName, typePredicate.parameterName)) { + var name_22 = _a[_i].name; + if (ts.isBindingPattern(name_22) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -33320,15 +32938,15 @@ var ts; if (ts.isOmittedExpression(element)) { continue; } - var name_24 = element.name; - if (name_24.kind === 70 && - name_24.text === predicateVariableName) { + var name_23 = element.name; + if (name_23.kind === 70 && + name_23.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_24.kind === 173 || - name_24.kind === 172) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_24, predicateVariableNode, predicateVariableName)) { + else if (name_23.kind === 173 || + name_23.kind === 172) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_23, predicateVariableNode, predicateVariableName)) { return true; } } @@ -34538,8 +34156,8 @@ var ts; container.kind === 231 || container.kind === 262); if (!namesShareScope) { - var name_25 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_25, name_25); + var name_24 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_24, name_24); } } } @@ -34616,8 +34234,8 @@ var ts; } var parent_11 = node.parent.parent; var parentType = getTypeForBindingElementParent(parent_11); - var name_26 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_26)); + var name_25 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, ts.getTextOfPropertyName(name_25)); markPropertyAsReferenced(property); if (parent_11.initializer && property && getParentOfSymbol(property)) { checkClassPropertyAccess(parent_11, parent_11.initializer, parentType, property); @@ -35843,9 +35461,9 @@ var ts; break; case 174: case 224: - var name_27 = node.name; - if (ts.isBindingPattern(name_27)) { - for (var _b = 0, _c = name_27.elements; _b < _c.length; _b++) { + var name_26 = node.name; + if (ts.isBindingPattern(name_26)) { + for (var _b = 0, _c = name_26.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } @@ -36727,9 +36345,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_28 = symbol.name; + var name_27 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_28); + var symbol = getPropertyOfType(t, name_27); if (symbol) { symbols_3.push(symbol); } @@ -37273,10 +36891,10 @@ var ts; var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; for (var helper = 1; helper <= 128; helper <<= 1) { if (uncheckedHelpers & helper) { - var name_29 = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_29), 107455); + var name_28 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_28), 107455); if (!symbol) { - error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_29); + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_28); } } } @@ -37825,9 +37443,9 @@ var ts; if (prop.kind === 260) { continue; } - var name_30 = prop.name; - if (name_30.kind === 142) { - checkGrammarComputedPropertyName(name_30); + var name_29 = prop.name; + if (name_29.kind === 142) { + checkGrammarComputedPropertyName(name_29); } if (prop.kind === 259 && !inDestructuring && prop.objectAssignmentInitializer) { return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); @@ -37843,8 +37461,8 @@ var ts; var currentKind = void 0; if (prop.kind === 258 || prop.kind === 259) { checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_30.kind === 8) { - checkGrammarNumericLiteral(name_30); + if (name_29.kind === 8) { + checkGrammarNumericLiteral(name_29); } currentKind = Property; } @@ -37860,7 +37478,7 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_30); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name_29); if (effectiveName === undefined) { continue; } @@ -37870,18 +37488,18 @@ var ts; else { var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_30, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_30)); + grammarErrorOnNode(name_29, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_29)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { seen[effectiveName] = currentKind | existingKind; } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name_30, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(name_29, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -37894,12 +37512,12 @@ var ts; continue; } var jsxAttr = attr; - var name_31 = jsxAttr.name; - if (!seen[name_31.text]) { - seen[name_31.text] = true; + var name_30 = jsxAttr.name; + if (!seen[name_30.text]) { + seen[name_30.text] = true; } else { - return grammarErrorOnNode(name_31, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_30, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; if (initializer && initializer.kind === 253 && !initializer.expression) { @@ -39238,10 +38856,10 @@ var ts; } } for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { - var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_32 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; - var variable = ts.createVariableDeclaration(name_32, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_31 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_31, undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); variable.original = original; - if (ts.isIdentifier(name_32)) { + if (ts.isIdentifier(name_31)) { ts.setEmitFlags(variable, 64); } ts.aggregateTransformFlags(variable); @@ -39387,8 +39005,8 @@ var ts; return ts.createElementAccess(value, argumentExpression); } else { - var name_33 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); - return ts.createPropertyAccess(value, name_33); + var name_32 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_32); } } function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { @@ -40311,14 +39929,14 @@ var ts; function serializeEntityNameAsExpression(node, useFallback) { switch (node.kind) { case 70: - var name_34 = ts.getMutableClone(node); - name_34.flags &= ~8; - name_34.original = undefined; - name_34.parent = currentScope; + var name_33 = ts.getMutableClone(node); + name_33.flags &= ~8; + name_33.original = undefined; + name_33.parent = currentScope; if (useFallback) { - return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_34), ts.createLiteral("undefined")), name_34); + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_33), ts.createLiteral("undefined")), name_33); } - return name_34; + return name_33; case 141: return serializeQualifiedNameAsExpression(node, useFallback); } @@ -40589,9 +40207,9 @@ var ts; } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name_35 = node.symbol && node.symbol.name; - if (name_35) { - return currentScopeFirstDeclarationsOfName[name_35] === node; + var name_34 = node.symbol && node.symbol.name; + if (name_34) { + return currentScopeFirstDeclarationsOfName[name_34] === node; } } return false; @@ -40880,14 +40498,14 @@ var ts; } function substituteShorthandPropertyAssignment(node) { if (enabledSubstitutions & 2) { - var name_36 = node.name; - var exportedName = trySubstituteNamespaceExportedName(name_36); + var name_35 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_35); if (exportedName) { if (node.objectAssignmentInitializer) { var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); - return ts.createPropertyAssignment(name_36, initializer, node); + return ts.createPropertyAssignment(name_35, initializer, node); } - return ts.createPropertyAssignment(name_36, exportedName, node); + return ts.createPropertyAssignment(name_35, exportedName, node); } } return node; @@ -41411,12 +41029,12 @@ var ts; return getTagName(node.openingElement); } else { - var name_37 = node.tagName; - if (ts.isIdentifier(name_37) && ts.isIntrinsicJsxName(name_37.text)) { - return ts.createLiteral(name_37.text); + var name_36 = node.tagName; + if (ts.isIdentifier(name_36) && ts.isIntrinsicJsxName(name_36.text)) { + return ts.createLiteral(name_36.text); } else { - return ts.createExpressionFromEntityName(name_37); + return ts.createExpressionFromEntityName(name_36); } } } @@ -42505,15 +42123,15 @@ var ts; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { var parameter = _a[_i]; - var name_38 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; + var name_37 = parameter.name, initializer = parameter.initializer, dotDotDotToken = parameter.dotDotDotToken; if (dotDotDotToken) { continue; } - if (ts.isBindingPattern(name_38)) { - addDefaultValueAssignmentForBindingPattern(statements, parameter, name_38, initializer); + if (ts.isBindingPattern(name_37)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_37, initializer); } else if (initializer) { - addDefaultValueAssignmentForInitializer(statements, parameter, name_38, initializer); + addDefaultValueAssignmentForInitializer(statements, parameter, name_37, initializer); } } } @@ -44295,9 +43913,9 @@ var ts; function transformAndEmitVariableDeclarationList(node) { for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { var variable = _a[_i]; - var name_39 = ts.getSynthesizedClone(variable.name); - ts.setCommentRange(name_39, variable.name); - hoistVariableDeclaration(name_39); + var name_38 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_38, variable.name); + hoistVariableDeclaration(name_38); } var variables = ts.getInitializedVariables(node); var numVariables = variables.length; @@ -44692,9 +44310,9 @@ var ts; if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); if (declaration) { - var name_40 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); - if (name_40) { - var clone_7 = ts.getMutableClone(name_40); + var name_39 = ts.getProperty(renamedCatchVariableDeclarations, String(ts.getOriginalNodeId(declaration))); + if (name_39) { + var clone_7 = ts.getMutableClone(name_39); ts.setSourceMapRange(clone_7, node); ts.setCommentRange(clone_7, node); return clone_7; @@ -46024,8 +45642,8 @@ var ts; return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), node); } else if (ts.isImportSpecifier(importDeclaration)) { - var name_41 = importDeclaration.propertyName || importDeclaration.name; - return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_41), node); + var name_40 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_40), node); } } } @@ -47636,9 +47254,9 @@ var ts; var count = 0; while (true) { count++; - var name_42 = baseName + "_" + count; - if (!(name_42 in currentIdentifiers)) { - return name_42; + var name_41 = baseName + "_" + count; + if (!(name_41 in currentIdentifiers)) { + return name_41; } } } @@ -51160,21 +50778,21 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_43 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_43)) { + var name_42 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_42)) { tempFlags |= flags; - return name_43; + return name_42; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_44 = count < 26 + var name_43 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_44)) { - return name_44; + if (isUniqueName(name_43)) { + return name_43; } } } @@ -51524,10 +51142,10 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_45 = names_1[_i]; - var result = name_45 in cache - ? cache[name_45] - : cache[name_45] = loader(name_45, containingFile); + var name_44 = names_1[_i]; + var result = name_44 in cache + ? cache[name_44] + : cache[name_44] = loader(name_44, containingFile); resolutions.push(result); } return resolutions; @@ -55226,13 +54844,13 @@ var ts; function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { var entries = []; var nameTable = ts.getNameTable(sourceFile); - for (var name_46 in nameTable) { - if (nameTable[name_46] === position) { + for (var name_45 in nameTable) { + if (nameTable[name_45] === position) { continue; } - if (!uniqueNames[name_46]) { - uniqueNames[name_46] = name_46; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_46), compilerOptions.target, true); + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, true); if (displayName) { var entry = { name: displayName, @@ -56308,8 +55926,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_47 = element.propertyName || element.name; - existingImportsOrExports[name_47.text] = true; + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; } if (!ts.someProperties(existingImportsOrExports)) { return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); @@ -58439,6 +58057,167 @@ var ts; })(JsDoc = ts.JsDoc || (ts.JsDoc = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + var safeList; + var EmptySafeList = ts.createMap(); + JsTyping.nodeCoreModuleList = [ + "buffer", "querystring", "events", "http", "cluster", + "zlib", "os", "https", "punycode", "repl", "readline", + "vm", "child_process", "url", "dns", "net", + "dgram", "fs", "path", "string_decoder", "tls", + "crypto", "stream", "util", "assert", "tty", "domain", + "constants", "process", "v8", "timers", "console" + ]; + var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { + var inferredTypings = ts.createMap(); + if (!typeAcquisition || !typeAcquisition.enable) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { + var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); + return kind === 1 || kind === 2; + }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + } + var filesToWatch = []; + var searchDirs = []; + var exclude = []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + if (unresolvedImports) { + for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { + var moduleId = unresolvedImports_1[_a]; + var typingName = moduleId in nodeCoreModules ? "node" : moduleId; + if (!(typingName in inferredTypings)) { + inferredTypings[typingName] = undefined; + } + } + } + for (var name_47 in packageNameToTypingLocation) { + if (name_47 in inferredTypings && !inferredTypings[name_47]) { + inferredTypings[name_47] = packageNameToTypingLocation[name_47]; + } + } + for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { + var excludeTypingName = exclude_1[_b]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!(typing in inferredTypings)) { + inferredTypings[typing] = undefined; + } + } + } + function getTypingNamesFromJson(jsonPath, filesToWatch) { + if (host.fileExists(jsonPath)) { + filesToWatch.push(jsonPath); + } + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + if (jsonConfig.dependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); + } + } + } + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList !== EmptySafeList) { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, [".json"], undefined, undefined, 2); + for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { + var fileName = fileNames_2[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var NavigateTo; (function (NavigateTo) { @@ -65709,6 +65488,1074 @@ var ts; initializeServices(); })(ts || (ts = {})); var ts; +(function (ts) { + var server; + (function (server) { + server.ActionSet = "action::set"; + server.ActionInvalidate = "action::invalidate"; + server.EventBeginInstallTypes = "event::beginInstallTypes"; + server.EventEndInstallTypes = "event::endInstallTypes"; + var Arguments; + (function (Arguments) { + Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation"; + Arguments.LogFile = "--logFile"; + Arguments.EnableTelemetry = "--enableTelemetry"; + })(Arguments = server.Arguments || (server.Arguments = {})); + function hasArgument(argumentName) { + return ts.sys.args.indexOf(argumentName) >= 0; + } + server.hasArgument = hasArgument; + function findArgument(argumentName) { + var index = ts.sys.args.indexOf(argumentName); + return index >= 0 && index < ts.sys.args.length - 1 + ? ts.sys.args[index + 1] + : undefined; + } + server.findArgument = findArgument; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var LogLevel; + (function (LogLevel) { + LogLevel[LogLevel["terse"] = 0] = "terse"; + LogLevel[LogLevel["normal"] = 1] = "normal"; + LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; + LogLevel[LogLevel["verbose"] = 3] = "verbose"; + })(LogLevel = server.LogLevel || (server.LogLevel = {})); + server.emptyArray = []; + var Msg; + (function (Msg) { + Msg.Err = "Err"; + Msg.Info = "Info"; + Msg.Perf = "Perf"; + })(Msg = server.Msg || (server.Msg = {})); + function getProjectRootPath(project) { + switch (project.projectKind) { + case server.ProjectKind.Configured: + return ts.getDirectoryPath(project.getProjectName()); + case server.ProjectKind.Inferred: + return ""; + case server.ProjectKind.External: + var projectName = ts.normalizeSlashes(project.getProjectName()); + return project.projectService.host.fileExists(projectName) ? ts.getDirectoryPath(projectName) : projectName; + } + } + function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { + return { + projectName: project.getProjectName(), + fileNames: project.getFileNames(true), + compilerOptions: project.getCompilerOptions(), + typeAcquisition: typeAcquisition, + unresolvedImports: unresolvedImports, + projectRootPath: getProjectRootPath(project), + cachePath: cachePath, + kind: "discover" + }; + } + server.createInstallTypingsRequest = createInstallTypingsRequest; + var Errors; + (function (Errors) { + function ThrowNoProject() { + throw new Error("No Project."); + } + Errors.ThrowNoProject = ThrowNoProject; + function ThrowProjectLanguageServiceDisabled() { + throw new Error("The project's language service is disabled."); + } + Errors.ThrowProjectLanguageServiceDisabled = ThrowProjectLanguageServiceDisabled; + function ThrowProjectDoesNotContainDocument(fileName, project) { + throw new Error("Project '" + project.getProjectName() + "' does not contain document '" + fileName + "'"); + } + Errors.ThrowProjectDoesNotContainDocument = ThrowProjectDoesNotContainDocument; + })(Errors = server.Errors || (server.Errors = {})); + function getDefaultFormatCodeSettings(host) { + return { + indentSize: 4, + tabSize: 4, + newLineCharacter: host.newLine || "\n", + convertTabsToSpaces: true, + indentStyle: ts.IndentStyle.Smart, + insertSpaceAfterConstructor: false, + insertSpaceAfterCommaDelimiter: true, + insertSpaceAfterSemicolonInForStatements: true, + insertSpaceBeforeAndAfterBinaryOperators: true, + insertSpaceAfterKeywordsInControlFlowStatements: true, + insertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true, + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false, + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: false, + insertSpaceBeforeFunctionParenthesis: false, + placeOpenBraceOnNewLineForFunctions: false, + placeOpenBraceOnNewLineForControlBlocks: false, + }; + } + server.getDefaultFormatCodeSettings = getDefaultFormatCodeSettings; + function mergeMaps(target, source) { + for (var key in source) { + if (ts.hasProperty(source, key)) { + target[key] = source[key]; + } + } + } + server.mergeMaps = mergeMaps; + function removeItemFromSet(items, itemToRemove) { + if (items.length === 0) { + return; + } + var index = items.indexOf(itemToRemove); + if (index < 0) { + return; + } + if (index === items.length - 1) { + items.pop(); + } + else { + items[index] = items.pop(); + } + } + server.removeItemFromSet = removeItemFromSet; + function toNormalizedPath(fileName) { + return ts.normalizePath(fileName); + } + server.toNormalizedPath = toNormalizedPath; + function normalizedPathToPath(normalizedPath, currentDirectory, getCanonicalFileName) { + var f = ts.isRootedDiskPath(normalizedPath) ? normalizedPath : ts.getNormalizedAbsolutePath(normalizedPath, currentDirectory); + return getCanonicalFileName(f); + } + server.normalizedPathToPath = normalizedPathToPath; + function asNormalizedPath(fileName) { + return fileName; + } + server.asNormalizedPath = asNormalizedPath; + function createNormalizedPathMap() { + var map = Object.create(null); + return { + get: function (path) { + return map[path]; + }, + set: function (path, value) { + map[path] = value; + }, + contains: function (path) { + return ts.hasProperty(map, path); + }, + remove: function (path) { + delete map[path]; + } + }; + } + server.createNormalizedPathMap = createNormalizedPathMap; + function isInferredProjectName(name) { + return /dev\/null\/inferredProject\d+\*/.test(name); + } + server.isInferredProjectName = isInferredProjectName; + function makeInferredProjectName(counter) { + return "/dev/null/inferredProject" + counter + "*"; + } + server.makeInferredProjectName = makeInferredProjectName; + function toSortedReadonlyArray(arr) { + arr.sort(); + return arr; + } + server.toSortedReadonlyArray = toSortedReadonlyArray; + var ThrottledOperations = (function () { + function ThrottledOperations(host) { + this.host = host; + this.pendingTimeouts = ts.createMap(); + } + ThrottledOperations.prototype.schedule = function (operationId, delay, cb) { + if (ts.hasProperty(this.pendingTimeouts, operationId)) { + this.host.clearTimeout(this.pendingTimeouts[operationId]); + } + this.pendingTimeouts[operationId] = this.host.setTimeout(ThrottledOperations.run, delay, this, operationId, cb); + }; + ThrottledOperations.run = function (self, operationId, cb) { + delete self.pendingTimeouts[operationId]; + cb(); + }; + return ThrottledOperations; + }()); + server.ThrottledOperations = ThrottledOperations; + var GcTimer = (function () { + function GcTimer(host, delay, logger) { + this.host = host; + this.delay = delay; + this.logger = logger; + } + GcTimer.prototype.scheduleCollect = function () { + if (!this.host.gc || this.timerId != undefined) { + return; + } + this.timerId = this.host.setTimeout(GcTimer.run, this.delay, this); + }; + GcTimer.run = function (self) { + self.timerId = undefined; + var log = self.logger.hasLevel(LogLevel.requestTime); + var before = log && self.host.getMemoryUsage(); + self.host.gc(); + if (log) { + var after = self.host.getMemoryUsage(); + self.logger.perftrc("GC::before " + before + ", after " + after); + } + }; + return GcTimer; + }()); + server.GcTimer = GcTimer; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var lineCollectionCapacity = 4; + var CharRangeSection; + (function (CharRangeSection) { + CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; + CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; + CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; + CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; + CharRangeSection[CharRangeSection["End"] = 4] = "End"; + CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; + })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); + var BaseLineIndexWalker = (function () { + function BaseLineIndexWalker() { + this.goSubtree = true; + this.done = false; + } + BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { + }; + return BaseLineIndexWalker; + }()); + var EditWalker = (function (_super) { + __extends(EditWalker, _super); + function EditWalker() { + var _this = _super.call(this) || this; + _this.lineIndex = new LineIndex(); + _this.endBranch = []; + _this.state = CharRangeSection.Entire; + _this.initialText = ""; + _this.trailingText = ""; + _this.suppressTrailingText = false; + _this.lineIndex.root = new LineNode(); + _this.startPath = [_this.lineIndex.root]; + _this.stack = [_this.lineIndex.root]; + return _this; + } + EditWalker.prototype.insertLines = function (insertedText) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent; + var lastZeroCount; + for (var k = this.endBranch.length - 1; k >= 0; k--) { + this.endBranch[k].updateCounts(); + if (this.endBranch[k].charCount() === 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + if (len > 0) { + leafNode.text = lines[0]; + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1; i < lines.length; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + } + else { + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + this.startPath[j].updateCounts(); + } + } + return this.lineIndex; + }; + EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { + if (lineCollection === this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + this.stack.length--; + return undefined; + }; + EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { + var currentNode = this.stack[this.stack.length - 1]; + if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + var child; + function fresh(node) { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else + return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state !== CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state === CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state !== CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state !== CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state !== CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + }; + EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { + if (this.state === CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state === CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + }; + return EditWalker; + }(BaseLineIndexWalker)); + var TextChange = (function () { + function TextChange(pos, deleteLen, insertedText) { + this.pos = pos; + this.deleteLen = deleteLen; + this.insertedText = insertedText; + } + TextChange.prototype.getTextChangeRange = function () { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); + }; + return TextChange; + }()); + server.TextChange = TextChange; + var ScriptVersionCache = (function () { + function ScriptVersionCache() { + this.changes = []; + this.versions = new Array(ScriptVersionCache.maxVersions); + this.minVersion = 0; + this.currentVersion = 0; + } + ScriptVersionCache.prototype.versionToIndex = function (version) { + if (version < this.minVersion || version > this.currentVersion) { + return undefined; + } + return version % ScriptVersionCache.maxVersions; + }; + ScriptVersionCache.prototype.currentVersionToIndex = function () { + return this.currentVersion % ScriptVersionCache.maxVersions; + }; + 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))) { + this.getSnapshot(); + } + }; + ScriptVersionCache.prototype.latest = function () { + return this.versions[this.currentVersionToIndex()]; + }; + ScriptVersionCache.prototype.latestVersion = function () { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + }; + ScriptVersionCache.prototype.reloadFromFile = function (filename) { + var content = this.host.readFile(filename); + if (!content) { + content = ""; + } + this.reload(content); + }; + ScriptVersionCache.prototype.reload = function (script) { + this.currentVersion++; + this.changes = []; + var snap = new LineIndexSnapshot(this.currentVersion, this); + for (var i = 0; i < this.versions.length; i++) { + this.versions[i] = undefined; + } + this.versions[this.currentVersionToIndex()] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + this.minVersion = this.currentVersion; + }; + ScriptVersionCache.prototype.getSnapshot = function () { + var snap = this.versions[this.currentVersionToIndex()]; + if (this.changes.length > 0) { + var snapIndex = snap.index; + for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { + var change = _a[_i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[this.currentVersionToIndex()] = snap; + this.changes = []; + if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { + this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; + } + } + return snap; + }; + ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[this.versionToIndex(i)]; + for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { + var textChange = _a[_i]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + }; + ScriptVersionCache.fromString = function (host, script) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + svc.host = host; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + }; + return ScriptVersionCache; + }()); + ScriptVersionCache.changeNumberThreshold = 8; + ScriptVersionCache.changeLengthThreshold = 256; + ScriptVersionCache.maxVersions = 8; + server.ScriptVersionCache = ScriptVersionCache; + var LineIndexSnapshot = (function () { + function LineIndexSnapshot(version, cache) { + this.version = version; + this.cache = cache; + this.changesSincePreviousVersion = []; + } + LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + }; + LineIndexSnapshot.prototype.getLength = function () { + return this.index.root.charCount(); + }; + LineIndexSnapshot.prototype.getLineStartPositions = function () { + var starts = [-1]; + var count = 1; + var pos = 0; + this.index.every(function (ll) { + starts[count] = pos; + count++; + pos += ll.text.length; + return true; + }, 0); + return starts; + }; + LineIndexSnapshot.prototype.getLineMapper = function () { + var _this = this; + return function (line) { + return _this.index.lineNumberToInfo(line).offset; + }; + }; + LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + }; + LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { + if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { + return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + } + }; + return LineIndexSnapshot; + }()); + server.LineIndexSnapshot = LineIndexSnapshot; + var LineIndex = (function () { + function LineIndex() { + this.checkEdits = false; + } + LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + }; + LineIndex.prototype.lineNumberToInfo = function (lineNumber) { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + offset: this.root.charCount() + }; + } + }; + LineIndex.prototype.load = function (lines) { + if (lines.length > 0) { + var leaves = []; + for (var i = 0; i < lines.length; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + }; + LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { + this.root.walk(rangeStart, rangeLength, walkFns); + }; + LineIndex.prototype.getText = function (rangeStart, rangeLength) { + var accum = ""; + if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + }; + LineIndex.prototype.getLength = function () { + return this.root.charCount(); + }; + LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart, relativeLength, ll) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + }; + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + }; + LineIndex.prototype.edit = function (pos, deleteLength, newText) { + function editFlat(source, s, dl, nt) { + if (nt === void 0) { nt = ""; } + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() === 0) { + if (newText !== undefined) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + var checkText = void 0; + if (this.checkEdits) { + checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (pos >= this.root.charCount()) { + pos = this.root.charCount() - 1; + var endString = this.getText(pos, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + deleteLength = 0; + walker.suppressTrailingText = true; + } + else if (deleteLength > 0) { + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.offset === 0))) { + deleteLength += lineInfo.text.length; + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + if (pos < this.root.charCount()) { + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + } + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + }; + LineIndex.buildTreeFromBottom = function (nodes) { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length === 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + }; + LineIndex.linesFromText = function (text) { + var lineStarts = ts.computeLineStarts(text); + if (lineStarts.length === 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + }; + return LineIndex; + }()); + server.LineIndex = LineIndex; + var LineNode = (function () { + function LineNode() { + this.totalChars = 0; + this.totalLines = 0; + this.children = []; + } + LineNode.prototype.isLeaf = function () { + return false; + }; + LineNode.prototype.updateCounts = function () { + this.totalChars = 0; + this.totalLines = 0; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + }; + LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + }; + LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + }; + LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + childIndex++; + child = this.children[childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + }; + LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset, + }; + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; + } + }; + LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + offset: charOffset + }; + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + offset: childInfo.charOffset, + text: (childInfo.child).text, + leaf: (childInfo.child) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + }; + LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { + var child; + var relativeLineNumber = lineNumber; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + }; + LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { + var child; + var i; + var len; + for (i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + }; + }; + LineNode.prototype.splitAfter = function (childIndex) { + var splitNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex]); + childIndex++; + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + }; + LineNode.prototype.remove = function (child) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + }; + LineNode.prototype.findChildIndex = function (child) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] !== child) && (childIndex < clen)) + childIndex++; + return childIndex; + }; + LineNode.prototype.insertAt = function (child, nodes) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex] = nodes[nodeIndex]; + childIndex++; + nodeIndex++; + } + var splitNodes = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex]); + nodeIndex++; + if (splitNode.children.length === lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (var i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length === 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i].updateCounts(); + } + return splitNodes; + } + }; + LineNode.prototype.add = function (collection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + }; + LineNode.prototype.charCount = function () { + return this.totalChars; + }; + LineNode.prototype.lineCount = function () { + return this.totalLines; + }; + return LineNode; + }()); + server.LineNode = LineNode; + var LineLeaf = (function () { + function LineLeaf(text) { + this.text = text; + } + LineLeaf.prototype.isLeaf = function () { + return true; + }; + LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { + walkFns.leaf(rangeStart, rangeLength, this); + }; + LineLeaf.prototype.charCount = function () { + return this.text.length; + }; + LineLeaf.prototype.lineCount = function () { + return 1; + }; + return LineLeaf; + }()); + server.LineLeaf = LineLeaf; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var server; (function (server) { @@ -66276,314 +67123,6 @@ var ts; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; -(function (ts) { - var server; - (function (server) { - function shouldEmitFile(scriptInfo) { - return !scriptInfo.hasMixedContent; - } - server.shouldEmitFile = shouldEmitFile; - var BuilderFileInfo = (function () { - function BuilderFileInfo(scriptInfo, project) { - this.scriptInfo = scriptInfo; - this.project = project; - } - BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () { - var sourceFile = this.getSourceFile(); - return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile); - }; - BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var statement = _a[_i]; - if (statement.kind !== 231 || statement.name.kind !== 9) { - return false; - } - } - return true; - }; - BuilderFileInfo.prototype.computeHash = function (text) { - return this.project.projectService.host.createHash(text); - }; - BuilderFileInfo.prototype.getSourceFile = function () { - return this.project.getSourceFile(this.scriptInfo.path); - }; - BuilderFileInfo.prototype.updateShapeSignature = function () { - var sourceFile = this.getSourceFile(); - if (!sourceFile) { - return true; - } - var lastSignature = this.lastCheckedShapeSignature; - if (sourceFile.isDeclarationFile) { - this.lastCheckedShapeSignature = this.computeHash(sourceFile.text); - } - else { - var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true); - if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) { - this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text); - } - } - return !lastSignature || this.lastCheckedShapeSignature !== lastSignature; - }; - return BuilderFileInfo; - }()); - server.BuilderFileInfo = BuilderFileInfo; - var AbstractBuilder = (function () { - function AbstractBuilder(project, ctor) { - this.project = project; - this.ctor = ctor; - } - AbstractBuilder.prototype.getFileInfos = function () { - return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); - }; - AbstractBuilder.prototype.clear = function () { - this.fileInfos_doNotAccessDirectly = undefined; - }; - AbstractBuilder.prototype.getFileInfo = function (path) { - return this.getFileInfos().get(path); - }; - AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { - var fileInfo = this.getFileInfo(path); - if (!fileInfo) { - var scriptInfo = this.project.getScriptInfo(path); - fileInfo = new this.ctor(scriptInfo, this.project); - this.setFileInfo(path, fileInfo); - } - return fileInfo; - }; - AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.getFileInfos().getKeys(); - }; - AbstractBuilder.prototype.setFileInfo = function (path, info) { - this.getFileInfos().set(path, info); - }; - AbstractBuilder.prototype.removeFileInfo = function (path) { - this.getFileInfos().remove(path); - }; - AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); - }; - AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { - var fileInfo = this.getFileInfo(scriptInfo.path); - if (!fileInfo) { - return false; - } - var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles; - if (!emitSkipped) { - var projectRootPath = this.project.getProjectRootPath(); - for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) { - var outputFile = outputFiles_1[_i]; - var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName)); - writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark); - } - } - return !emitSkipped; - }; - return AbstractBuilder; - }()); - var NonModuleBuilder = (function (_super) { - __extends(NonModuleBuilder, _super); - function NonModuleBuilder(project) { - var _this = _super.call(this, project, BuilderFileInfo) || this; - _this.project = project; - return _this; - } - NonModuleBuilder.prototype.onProjectUpdateGraph = function () { - }; - NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { - var info = this.getOrCreateFileInfo(scriptInfo.path); - var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; - if (info.updateShapeSignature()) { - var options = this.project.getCompilerOptions(); - if (options && (options.out || options.outFile)) { - return singleFileResult; - } - return this.project.getAllEmittableFiles(); - } - return singleFileResult; - }; - return NonModuleBuilder; - }(AbstractBuilder)); - var ModuleBuilderFileInfo = (function (_super) { - __extends(ModuleBuilderFileInfo, _super); - function ModuleBuilderFileInfo() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.references = []; - _this.referencedBy = []; - return _this; - } - ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) { - var l = lf.scriptInfo.fileName; - var r = rf.scriptInfo.fileName; - return (l < r ? -1 : (l > r ? 1 : 0)); - }; - ; - ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { - if (array.length === 0) { - array.push(fileInfo); - return; - } - var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (insertIndex < 0) { - array.splice(~insertIndex, 0, fileInfo); - } - }; - ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) { - if (!array || array.length === 0) { - return; - } - if (array[0] === fileInfo) { - array.splice(0, 1); - return; - } - var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (removeIndex >= 0) { - array.splice(removeIndex, 1); - } - }; - ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo); - }; - ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo); - }; - ModuleBuilderFileInfo.prototype.removeFileReferences = function () { - for (var _i = 0, _a = this.references; _i < _a.length; _i++) { - var reference = _a[_i]; - reference.removeReferencedBy(this); - } - this.references = []; - }; - return ModuleBuilderFileInfo; - }(BuilderFileInfo)); - var ModuleBuilder = (function (_super) { - __extends(ModuleBuilder, _super); - function ModuleBuilder(project) { - var _this = _super.call(this, project, ModuleBuilderFileInfo) || this; - _this.project = project; - return _this; - } - ModuleBuilder.prototype.clear = function () { - this.projectVersionForDependencyGraph = undefined; - _super.prototype.clear.call(this); - }; - ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { - var _this = this; - if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { - return []; - } - var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path); - if (referencedFilePaths.length > 0) { - return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos); - } - return []; - }; - ModuleBuilder.prototype.onProjectUpdateGraph = function () { - this.ensureProjectDependencyGraphUpToDate(); - }; - ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () { - var _this = this; - if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) { - var currentScriptInfos = this.project.getScriptInfos(); - for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) { - var scriptInfo = currentScriptInfos_1[_i]; - var fileInfo = this.getOrCreateFileInfo(scriptInfo.path); - this.updateFileReferences(fileInfo); - } - this.forEachFileInfo(function (fileInfo) { - if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) { - fileInfo.removeFileReferences(); - _this.removeFileInfo(fileInfo.scriptInfo.path); - } - }); - this.projectVersionForDependencyGraph = this.project.getProjectVersion(); - } - }; - ModuleBuilder.prototype.updateFileReferences = function (fileInfo) { - if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) { - return; - } - var newReferences = this.getReferencedFileInfos(fileInfo); - var oldReferences = fileInfo.references; - var oldIndex = 0; - var newIndex = 0; - while (oldIndex < oldReferences.length && newIndex < newReferences.length) { - var oldReference = oldReferences[oldIndex]; - var newReference = newReferences[newIndex]; - var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference); - if (compare < 0) { - oldReference.removeReferencedBy(fileInfo); - oldIndex++; - } - else if (compare > 0) { - newReference.addReferencedBy(fileInfo); - newIndex++; - } - else { - oldIndex++; - newIndex++; - } - } - for (var i = oldIndex; i < oldReferences.length; i++) { - oldReferences[i].removeReferencedBy(fileInfo); - } - for (var i = newIndex; i < newReferences.length; i++) { - newReferences[i].addReferencedBy(fileInfo); - } - fileInfo.references = newReferences; - fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion(); - }; - ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { - this.ensureProjectDependencyGraphUpToDate(); - var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; - var fileInfo = this.getFileInfo(scriptInfo.path); - if (!fileInfo || !fileInfo.updateShapeSignature()) { - return singleFileResult; - } - if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { - return this.project.getAllEmittableFiles(); - } - var options = this.project.getCompilerOptions(); - if (options && (options.isolatedModules || options.out || options.outFile)) { - return singleFileResult; - } - var queue = fileInfo.referencedBy.slice(0); - var fileNameSet = ts.createMap(); - fileNameSet[scriptInfo.fileName] = scriptInfo; - while (queue.length > 0) { - var processingFileInfo = queue.pop(); - if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { - for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { - var potentialFileInfo = _a[_i]; - if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { - queue.push(potentialFileInfo); - } - } - } - fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; - } - var result = []; - for (var fileName in fileNameSet) { - if (shouldEmitFile(fileNameSet[fileName])) { - result.push(fileName); - } - } - return result; - }; - return ModuleBuilder; - }(AbstractBuilder)); - function createBuilder(project) { - var moduleKind = project.getCompilerOptions().module; - switch (moduleKind) { - case ts.ModuleKind.None: - return new NonModuleBuilder(project); - default: - return new ModuleBuilder(project); - } - } - server.createBuilder = createBuilder; - })(server = ts.server || (ts.server = {})); -})(ts || (ts = {})); -var ts; (function (ts) { var server; (function (server) { @@ -69913,847 +70452,308 @@ var ts; (function (ts) { var server; (function (server) { - var lineCollectionCapacity = 4; - var CharRangeSection; - (function (CharRangeSection) { - CharRangeSection[CharRangeSection["PreStart"] = 0] = "PreStart"; - CharRangeSection[CharRangeSection["Start"] = 1] = "Start"; - CharRangeSection[CharRangeSection["Entire"] = 2] = "Entire"; - CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; - CharRangeSection[CharRangeSection["End"] = 4] = "End"; - CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; - })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); - var BaseLineIndexWalker = (function () { - function BaseLineIndexWalker() { - this.goSubtree = true; - this.done = false; + function shouldEmitFile(scriptInfo) { + return !scriptInfo.hasMixedContent; + } + server.shouldEmitFile = shouldEmitFile; + var BuilderFileInfo = (function () { + function BuilderFileInfo(scriptInfo, project) { + this.scriptInfo = scriptInfo; + this.project = project; } - BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { + BuilderFileInfo.prototype.isExternalModuleOrHasOnlyAmbientExternalModules = function () { + var sourceFile = this.getSourceFile(); + return ts.isExternalModule(sourceFile) || this.containsOnlyAmbientModules(sourceFile); }; - return BaseLineIndexWalker; - }()); - var EditWalker = (function (_super) { - __extends(EditWalker, _super); - function EditWalker() { - var _this = _super.call(this) || this; - _this.lineIndex = new LineIndex(); - _this.endBranch = []; - _this.state = CharRangeSection.Entire; - _this.initialText = ""; - _this.trailingText = ""; - _this.suppressTrailingText = false; - _this.lineIndex.root = new LineNode(); - _this.startPath = [_this.lineIndex.root]; - _this.stack = [_this.lineIndex.root]; - return _this; - } - EditWalker.prototype.insertLines = function (insertedText) { - if (this.suppressTrailingText) { - this.trailingText = ""; - } - if (insertedText) { - insertedText = this.initialText + insertedText + this.trailingText; - } - else { - insertedText = this.initialText + this.trailingText; - } - var lm = LineIndex.linesFromText(insertedText); - var lines = lm.lines; - if (lines.length > 1) { - if (lines[lines.length - 1] == "") { - lines.length--; + BuilderFileInfo.prototype.containsOnlyAmbientModules = function (sourceFile) { + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (statement.kind !== 231 || statement.name.kind !== 9) { + return false; } } - var branchParent; - var lastZeroCount; - for (var k = this.endBranch.length - 1; k >= 0; k--) { - this.endBranch[k].updateCounts(); - if (this.endBranch[k].charCount() === 0) { - lastZeroCount = this.endBranch[k]; - if (k > 0) { - branchParent = this.endBranch[k - 1]; - } - else { - branchParent = this.branchNode; - } - } - } - if (lastZeroCount) { - branchParent.remove(lastZeroCount); - } - var insertionNode = this.startPath[this.startPath.length - 2]; - var leafNode = this.startPath[this.startPath.length - 1]; - var len = lines.length; - if (len > 0) { - leafNode.text = lines[0]; - if (len > 1) { - var insertedNodes = new Array(len - 1); - var startNode = leafNode; - for (var i = 1; i < lines.length; i++) { - insertedNodes[i - 1] = new LineLeaf(lines[i]); - } - var pathIndex = this.startPath.length - 2; - while (pathIndex >= 0) { - insertionNode = this.startPath[pathIndex]; - insertedNodes = insertionNode.insertAt(startNode, insertedNodes); - pathIndex--; - startNode = insertionNode; - } - var insertedNodesLen = insertedNodes.length; - while (insertedNodesLen > 0) { - var newRoot = new LineNode(); - newRoot.add(this.lineIndex.root); - insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); - insertedNodesLen = insertedNodes.length; - this.lineIndex.root = newRoot; - } - this.lineIndex.root.updateCounts(); - } - else { - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); - } - } - } - else { - insertionNode.remove(leafNode); - for (var j = this.startPath.length - 2; j >= 0; j--) { - this.startPath[j].updateCounts(); - } - } - return this.lineIndex; - }; - EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { - if (lineCollection === this.lineCollectionAtBranch) { - this.state = CharRangeSection.End; - } - this.stack.length--; - return undefined; - }; - EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { - var currentNode = this.stack[this.stack.length - 1]; - if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { - this.state = CharRangeSection.Start; - this.branchNode = currentNode; - this.lineCollectionAtBranch = lineCollection; - } - var child; - function fresh(node) { - if (node.isLeaf()) { - return new LineLeaf(""); - } - else - return new LineNode(); - } - switch (nodeType) { - case CharRangeSection.PreStart: - this.goSubtree = false; - if (this.state !== CharRangeSection.End) { - currentNode.add(lineCollection); - } - break; - case CharRangeSection.Start: - if (this.state === CharRangeSection.End) { - this.goSubtree = false; - } - else { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - break; - case CharRangeSection.Entire: - if (this.state !== CharRangeSection.End) { - child = fresh(lineCollection); - currentNode.add(child); - this.startPath[this.startPath.length] = child; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.Mid: - this.goSubtree = false; - break; - case CharRangeSection.End: - if (this.state !== CharRangeSection.End) { - this.goSubtree = false; - } - else { - if (!lineCollection.isLeaf()) { - child = fresh(lineCollection); - currentNode.add(child); - this.endBranch[this.endBranch.length] = child; - } - } - break; - case CharRangeSection.PostEnd: - this.goSubtree = false; - if (this.state !== CharRangeSection.Start) { - currentNode.add(lineCollection); - } - break; - } - if (this.goSubtree) { - this.stack[this.stack.length] = child; - } - return lineCollection; - }; - EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { - if (this.state === CharRangeSection.Start) { - this.initialText = ll.text.substring(0, relativeStart); - } - else if (this.state === CharRangeSection.Entire) { - this.initialText = ll.text.substring(0, relativeStart); - this.trailingText = ll.text.substring(relativeStart + relativeLength); - } - else { - this.trailingText = ll.text.substring(relativeStart + relativeLength); - } - }; - return EditWalker; - }(BaseLineIndexWalker)); - var TextChange = (function () { - function TextChange(pos, deleteLen, insertedText) { - this.pos = pos; - this.deleteLen = deleteLen; - this.insertedText = insertedText; - } - TextChange.prototype.getTextChangeRange = function () { - return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), this.insertedText ? this.insertedText.length : 0); - }; - return TextChange; - }()); - server.TextChange = TextChange; - var ScriptVersionCache = (function () { - function ScriptVersionCache() { - this.changes = []; - this.versions = new Array(ScriptVersionCache.maxVersions); - this.minVersion = 0; - this.currentVersion = 0; - } - ScriptVersionCache.prototype.versionToIndex = function (version) { - if (version < this.minVersion || version > this.currentVersion) { - return undefined; - } - return version % ScriptVersionCache.maxVersions; - }; - ScriptVersionCache.prototype.currentVersionToIndex = function () { - return this.currentVersion % ScriptVersionCache.maxVersions; - }; - 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))) { - this.getSnapshot(); - } - }; - ScriptVersionCache.prototype.latest = function () { - return this.versions[this.currentVersionToIndex()]; - }; - ScriptVersionCache.prototype.latestVersion = function () { - if (this.changes.length > 0) { - this.getSnapshot(); - } - return this.currentVersion; - }; - ScriptVersionCache.prototype.reloadFromFile = function (filename) { - var content = this.host.readFile(filename); - if (!content) { - content = ""; - } - this.reload(content); - }; - ScriptVersionCache.prototype.reload = function (script) { - this.currentVersion++; - this.changes = []; - var snap = new LineIndexSnapshot(this.currentVersion, this); - for (var i = 0; i < this.versions.length; i++) { - this.versions[i] = undefined; - } - this.versions[this.currentVersionToIndex()] = snap; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - this.minVersion = this.currentVersion; - }; - ScriptVersionCache.prototype.getSnapshot = function () { - var snap = this.versions[this.currentVersionToIndex()]; - if (this.changes.length > 0) { - var snapIndex = snap.index; - for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { - var change = _a[_i]; - snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); - } - snap = new LineIndexSnapshot(this.currentVersion + 1, this); - snap.index = snapIndex; - snap.changesSincePreviousVersion = this.changes; - this.currentVersion = snap.version; - this.versions[this.currentVersionToIndex()] = snap; - this.changes = []; - if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { - this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; - } - } - return snap; - }; - ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { - if (oldVersion < newVersion) { - if (oldVersion >= this.minVersion) { - var textChangeRanges = []; - for (var i = oldVersion + 1; i <= newVersion; i++) { - var snap = this.versions[this.versionToIndex(i)]; - for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { - var textChange = _a[_i]; - textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); - } - } - return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); - } - else { - return undefined; - } - } - else { - return ts.unchangedTextChangeRange; - } - }; - ScriptVersionCache.fromString = function (host, script) { - var svc = new ScriptVersionCache(); - var snap = new LineIndexSnapshot(0, svc); - svc.versions[svc.currentVersion] = snap; - svc.host = host; - snap.index = new LineIndex(); - var lm = LineIndex.linesFromText(script); - snap.index.load(lm.lines); - return svc; - }; - return ScriptVersionCache; - }()); - ScriptVersionCache.changeNumberThreshold = 8; - ScriptVersionCache.changeLengthThreshold = 256; - ScriptVersionCache.maxVersions = 8; - server.ScriptVersionCache = ScriptVersionCache; - var LineIndexSnapshot = (function () { - function LineIndexSnapshot(version, cache) { - this.version = version; - this.cache = cache; - this.changesSincePreviousVersion = []; - } - LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { - return this.index.getText(rangeStart, rangeEnd - rangeStart); - }; - LineIndexSnapshot.prototype.getLength = function () { - return this.index.root.charCount(); - }; - LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [-1]; - var count = 1; - var pos = 0; - this.index.every(function (ll) { - starts[count] = pos; - count++; - pos += ll.text.length; - return true; - }, 0); - return starts; - }; - LineIndexSnapshot.prototype.getLineMapper = function () { - var _this = this; - return function (line) { - return _this.index.lineNumberToInfo(line).offset; - }; - }; - LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - if (this.version <= scriptVersion) { - return ts.unchangedTextChangeRange; - } - else { - return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); - } - }; - LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { - if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { - return this.getTextChangeRangeSinceVersion(oldSnapshot.version); - } - }; - return LineIndexSnapshot; - }()); - server.LineIndexSnapshot = LineIndexSnapshot; - var LineIndex = (function () { - function LineIndex() { - this.checkEdits = false; - } - LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { - return this.root.charOffsetToLineNumberAndPos(1, charOffset); - }; - LineIndex.prototype.lineNumberToInfo = function (lineNumber) { - var lineCount = this.root.lineCount(); - if (lineNumber <= lineCount) { - var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); - lineInfo.line = lineNumber; - return lineInfo; - } - else { - return { - line: lineNumber, - offset: this.root.charCount() - }; - } - }; - LineIndex.prototype.load = function (lines) { - if (lines.length > 0) { - var leaves = []; - for (var i = 0; i < lines.length; i++) { - leaves[i] = new LineLeaf(lines[i]); - } - this.root = LineIndex.buildTreeFromBottom(leaves); - } - else { - this.root = new LineNode(); - } - }; - LineIndex.prototype.walk = function (rangeStart, rangeLength, walkFns) { - this.root.walk(rangeStart, rangeLength, walkFns); - }; - LineIndex.prototype.getText = function (rangeStart, rangeLength) { - var accum = ""; - if ((rangeLength > 0) && (rangeStart < this.root.charCount())) { - this.walk(rangeStart, rangeLength, { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); - } - }); - } - return accum; - }; - LineIndex.prototype.getLength = function () { - return this.root.charCount(); - }; - LineIndex.prototype.every = function (f, rangeStart, rangeEnd) { - if (!rangeEnd) { - rangeEnd = this.root.charCount(); - } - var walkFns = { - goSubtree: true, - done: false, - leaf: function (relativeStart, relativeLength, ll) { - if (!f(ll, relativeStart, relativeLength)) { - this.done = true; - } - } - }; - this.walk(rangeStart, rangeEnd - rangeStart, walkFns); - return !walkFns.done; - }; - LineIndex.prototype.edit = function (pos, deleteLength, newText) { - function editFlat(source, s, dl, nt) { - if (nt === void 0) { nt = ""; } - return source.substring(0, s) + nt + source.substring(s + dl, source.length); - } - if (this.root.charCount() === 0) { - if (newText !== undefined) { - this.load(LineIndex.linesFromText(newText).lines); - return this; - } - } - else { - var checkText = void 0; - if (this.checkEdits) { - checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); - } - var walker = new EditWalker(); - if (pos >= this.root.charCount()) { - pos = this.root.charCount() - 1; - var endString = this.getText(pos, 1); - if (newText) { - newText = endString + newText; - } - else { - newText = endString; - } - deleteLength = 0; - walker.suppressTrailingText = true; - } - else if (deleteLength > 0) { - var e = pos + deleteLength; - var lineInfo = this.charOffsetToLineNumberAndPos(e); - if ((lineInfo && (lineInfo.offset === 0))) { - deleteLength += lineInfo.text.length; - if (newText) { - newText = newText + lineInfo.text; - } - else { - newText = lineInfo.text; - } - } - } - if (pos < this.root.charCount()) { - this.root.walk(pos, deleteLength, walker); - walker.insertLines(newText); - } - if (this.checkEdits) { - var updatedText = this.getText(0, this.root.charCount()); - ts.Debug.assert(checkText == updatedText, "buffer edit mismatch"); - } - return walker.lineIndex; - } - }; - LineIndex.buildTreeFromBottom = function (nodes) { - var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); - var interiorNodes = []; - var nodeIndex = 0; - for (var i = 0; i < nodeCount; i++) { - interiorNodes[i] = new LineNode(); - var charCount = 0; - var lineCount = 0; - for (var j = 0; j < lineCollectionCapacity; j++) { - if (nodeIndex < nodes.length) { - interiorNodes[i].add(nodes[nodeIndex]); - charCount += nodes[nodeIndex].charCount(); - lineCount += nodes[nodeIndex].lineCount(); - } - else { - break; - } - nodeIndex++; - } - interiorNodes[i].totalChars = charCount; - interiorNodes[i].totalLines = lineCount; - } - if (interiorNodes.length === 1) { - return interiorNodes[0]; - } - else { - return this.buildTreeFromBottom(interiorNodes); - } - }; - LineIndex.linesFromText = function (text) { - var lineStarts = ts.computeLineStarts(text); - if (lineStarts.length === 0) { - return { lines: [], lineMap: lineStarts }; - } - var lines = new Array(lineStarts.length); - var lc = lineStarts.length - 1; - for (var lmi = 0; lmi < lc; lmi++) { - lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); - } - var endText = text.substring(lineStarts[lc]); - if (endText.length > 0) { - lines[lc] = endText; - } - else { - lines.length--; - } - return { lines: lines, lineMap: lineStarts }; - }; - return LineIndex; - }()); - server.LineIndex = LineIndex; - var LineNode = (function () { - function LineNode() { - this.totalChars = 0; - this.totalLines = 0; - this.children = []; - } - LineNode.prototype.isLeaf = function () { - return false; - }; - LineNode.prototype.updateCounts = function () { - this.totalChars = 0; - this.totalLines = 0; - for (var _i = 0, _a = this.children; _i < _a.length; _i++) { - var child = _a[_i]; - this.totalChars += child.charCount(); - this.totalLines += child.lineCount(); - } - }; - LineNode.prototype.execWalk = function (rangeStart, rangeLength, walkFns, childIndex, nodeType) { - if (walkFns.pre) { - walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - if (walkFns.goSubtree) { - this.children[childIndex].walk(rangeStart, rangeLength, walkFns); - if (walkFns.post) { - walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); - } - } - else { - walkFns.goSubtree = true; - } - return walkFns.done; - }; - LineNode.prototype.skipChild = function (relativeStart, relativeLength, childIndex, walkFns, nodeType) { - if (walkFns.pre && (!walkFns.done)) { - walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); - walkFns.goSubtree = true; - } - }; - LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { - var childIndex = 0; - var child = this.children[0]; - var childCharCount = child.charCount(); - var adjustedStart = rangeStart; - while (adjustedStart >= childCharCount) { - this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); - adjustedStart -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if ((adjustedStart + rangeLength) <= childCharCount) { - if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { - return; - } - } - else { - if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { - return; - } - var adjustedLength = rangeLength - (childCharCount - adjustedStart); - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - while (adjustedLength > childCharCount) { - if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { - return; - } - adjustedLength -= childCharCount; - childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); - } - if (adjustedLength > 0) { - if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { - return; - } - } - } - if (walkFns.pre) { - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var ej = childIndex + 1; ej < clen; ej++) { - this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); - } - } - } - }; - LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { - var childInfo = this.childFromCharOffset(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset, - }; - } - else if (childInfo.childIndex < this.children.length) { - if (childInfo.child.isLeaf()) { - return { - line: childInfo.lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); - } - } - else { - var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; - } - }; - LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { - var childInfo = this.childFromLineNumber(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset - }; - } - else if (childInfo.child.isLeaf()) { - return { - line: lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); - } - }; - LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { - var child; - var relativeLineNumber = lineNumber; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - var childLineCount = child.lineCount(); - if (childLineCount >= relativeLineNumber) { - break; - } - else { - relativeLineNumber -= childLineCount; - charOffset += child.charCount(); - } - } - return { - child: child, - childIndex: i, - relativeLineNumber: relativeLineNumber, - charOffset: charOffset - }; - }; - LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { - var child; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - if (child.charCount() > charOffset) { - break; - } - else { - charOffset -= child.charCount(); - lineNumber += child.lineCount(); - } - } - return { - child: child, - childIndex: i, - charOffset: charOffset, - lineNumber: lineNumber - }; - }; - LineNode.prototype.splitAfter = function (childIndex) { - var splitNode; - var clen = this.children.length; - childIndex++; - var endLength = childIndex; - if (childIndex < clen) { - splitNode = new LineNode(); - while (childIndex < clen) { - splitNode.add(this.children[childIndex]); - childIndex++; - } - splitNode.updateCounts(); - } - this.children.length = endLength; - return splitNode; - }; - LineNode.prototype.remove = function (child) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - if (childIndex < (clen - 1)) { - for (var i = childIndex; i < (clen - 1); i++) { - this.children[i] = this.children[i + 1]; - } - } - this.children.length--; - }; - LineNode.prototype.findChildIndex = function (child) { - var childIndex = 0; - var clen = this.children.length; - while ((this.children[childIndex] !== child) && (childIndex < clen)) - childIndex++; - return childIndex; - }; - LineNode.prototype.insertAt = function (child, nodes) { - var childIndex = this.findChildIndex(child); - var clen = this.children.length; - var nodeCount = nodes.length; - if ((clen < lineCollectionCapacity) && (childIndex === (clen - 1)) && (nodeCount === 1)) { - this.add(nodes[0]); - this.updateCounts(); - return []; - } - else { - var shiftNode = this.splitAfter(childIndex); - var nodeIndex = 0; - childIndex++; - while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { - this.children[childIndex] = nodes[nodeIndex]; - childIndex++; - nodeIndex++; - } - var splitNodes = []; - var splitNodeCount = 0; - if (nodeIndex < nodeCount) { - splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); - splitNodes = new Array(splitNodeCount); - var splitNodeIndex = 0; - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i] = new LineNode(); - } - var splitNode = splitNodes[0]; - while (nodeIndex < nodeCount) { - splitNode.add(nodes[nodeIndex]); - nodeIndex++; - if (splitNode.children.length === lineCollectionCapacity) { - splitNodeIndex++; - splitNode = splitNodes[splitNodeIndex]; - } - } - for (var i = splitNodes.length - 1; i >= 0; i--) { - if (splitNodes[i].children.length === 0) { - splitNodes.length--; - } - } - } - if (shiftNode) { - splitNodes[splitNodes.length] = shiftNode; - } - this.updateCounts(); - for (var i = 0; i < splitNodeCount; i++) { - splitNodes[i].updateCounts(); - } - return splitNodes; - } - }; - LineNode.prototype.add = function (collection) { - this.children[this.children.length] = collection; - return (this.children.length < lineCollectionCapacity); - }; - LineNode.prototype.charCount = function () { - return this.totalChars; - }; - LineNode.prototype.lineCount = function () { - return this.totalLines; - }; - return LineNode; - }()); - server.LineNode = LineNode; - var LineLeaf = (function () { - function LineLeaf(text) { - this.text = text; - } - LineLeaf.prototype.isLeaf = function () { return true; }; - LineLeaf.prototype.walk = function (rangeStart, rangeLength, walkFns) { - walkFns.leaf(rangeStart, rangeLength, this); + BuilderFileInfo.prototype.computeHash = function (text) { + return this.project.projectService.host.createHash(text); }; - LineLeaf.prototype.charCount = function () { - return this.text.length; + BuilderFileInfo.prototype.getSourceFile = function () { + return this.project.getSourceFile(this.scriptInfo.path); }; - LineLeaf.prototype.lineCount = function () { - return 1; + BuilderFileInfo.prototype.updateShapeSignature = function () { + var sourceFile = this.getSourceFile(); + if (!sourceFile) { + return true; + } + var lastSignature = this.lastCheckedShapeSignature; + if (sourceFile.isDeclarationFile) { + this.lastCheckedShapeSignature = this.computeHash(sourceFile.text); + } + else { + var emitOutput = this.project.getFileEmitOutput(this.scriptInfo, true); + if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) { + this.lastCheckedShapeSignature = this.computeHash(emitOutput.outputFiles[0].text); + } + } + return !lastSignature || this.lastCheckedShapeSignature !== lastSignature; }; - return LineLeaf; + return BuilderFileInfo; }()); - server.LineLeaf = LineLeaf; + server.BuilderFileInfo = BuilderFileInfo; + var AbstractBuilder = (function () { + function AbstractBuilder(project, ctor) { + this.project = project; + this.ctor = ctor; + } + AbstractBuilder.prototype.getFileInfos = function () { + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + }; + AbstractBuilder.prototype.clear = function () { + this.fileInfos_doNotAccessDirectly = undefined; + }; + AbstractBuilder.prototype.getFileInfo = function (path) { + return this.getFileInfos().get(path); + }; + AbstractBuilder.prototype.getOrCreateFileInfo = function (path) { + var fileInfo = this.getFileInfo(path); + if (!fileInfo) { + var scriptInfo = this.project.getScriptInfo(path); + fileInfo = new this.ctor(scriptInfo, this.project); + this.setFileInfo(path, fileInfo); + } + return fileInfo; + }; + AbstractBuilder.prototype.getFileInfoPaths = function () { + return this.getFileInfos().getKeys(); + }; + AbstractBuilder.prototype.setFileInfo = function (path, info) { + this.getFileInfos().set(path, info); + }; + AbstractBuilder.prototype.removeFileInfo = function (path) { + this.getFileInfos().remove(path); + }; + AbstractBuilder.prototype.forEachFileInfo = function (action) { + this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); + }; + AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { + var fileInfo = this.getFileInfo(scriptInfo.path); + if (!fileInfo) { + return false; + } + var _a = this.project.getFileEmitOutput(fileInfo.scriptInfo, false), emitSkipped = _a.emitSkipped, outputFiles = _a.outputFiles; + if (!emitSkipped) { + var projectRootPath = this.project.getProjectRootPath(); + for (var _i = 0, outputFiles_1 = outputFiles; _i < outputFiles_1.length; _i++) { + var outputFile = outputFiles_1[_i]; + var outputFileAbsoluteFileName = ts.getNormalizedAbsolutePath(outputFile.name, projectRootPath ? projectRootPath : ts.getDirectoryPath(scriptInfo.fileName)); + writeFile(outputFileAbsoluteFileName, outputFile.text, outputFile.writeByteOrderMark); + } + } + return !emitSkipped; + }; + return AbstractBuilder; + }()); + var NonModuleBuilder = (function (_super) { + __extends(NonModuleBuilder, _super); + function NonModuleBuilder(project) { + var _this = _super.call(this, project, BuilderFileInfo) || this; + _this.project = project; + return _this; + } + NonModuleBuilder.prototype.onProjectUpdateGraph = function () { + }; + NonModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { + var info = this.getOrCreateFileInfo(scriptInfo.path); + var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; + if (info.updateShapeSignature()) { + var options = this.project.getCompilerOptions(); + if (options && (options.out || options.outFile)) { + return singleFileResult; + } + return this.project.getAllEmittableFiles(); + } + return singleFileResult; + }; + return NonModuleBuilder; + }(AbstractBuilder)); + var ModuleBuilderFileInfo = (function (_super) { + __extends(ModuleBuilderFileInfo, _super); + function ModuleBuilderFileInfo() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.references = []; + _this.referencedBy = []; + return _this; + } + ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) { + var l = lf.scriptInfo.fileName; + var r = rf.scriptInfo.fileName; + return (l < r ? -1 : (l > r ? 1 : 0)); + }; + ; + ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { + if (array.length === 0) { + array.push(fileInfo); + return; + } + var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); + if (insertIndex < 0) { + array.splice(~insertIndex, 0, fileInfo); + } + }; + ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) { + if (!array || array.length === 0) { + return; + } + if (array[0] === fileInfo) { + array.splice(0, 1); + return; + } + var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); + if (removeIndex >= 0) { + array.splice(removeIndex, 1); + } + }; + ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) { + ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo); + }; + ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) { + ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo); + }; + ModuleBuilderFileInfo.prototype.removeFileReferences = function () { + for (var _i = 0, _a = this.references; _i < _a.length; _i++) { + var reference = _a[_i]; + reference.removeReferencedBy(this); + } + this.references = []; + }; + return ModuleBuilderFileInfo; + }(BuilderFileInfo)); + var ModuleBuilder = (function (_super) { + __extends(ModuleBuilder, _super); + function ModuleBuilder(project) { + var _this = _super.call(this, project, ModuleBuilderFileInfo) || this; + _this.project = project; + return _this; + } + ModuleBuilder.prototype.clear = function () { + this.projectVersionForDependencyGraph = undefined; + _super.prototype.clear.call(this); + }; + ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { + var _this = this; + if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { + return []; + } + var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path); + if (referencedFilePaths.length > 0) { + return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos); + } + return []; + }; + ModuleBuilder.prototype.onProjectUpdateGraph = function () { + this.ensureProjectDependencyGraphUpToDate(); + }; + ModuleBuilder.prototype.ensureProjectDependencyGraphUpToDate = function () { + var _this = this; + if (!this.projectVersionForDependencyGraph || this.project.getProjectVersion() !== this.projectVersionForDependencyGraph) { + var currentScriptInfos = this.project.getScriptInfos(); + for (var _i = 0, currentScriptInfos_1 = currentScriptInfos; _i < currentScriptInfos_1.length; _i++) { + var scriptInfo = currentScriptInfos_1[_i]; + var fileInfo = this.getOrCreateFileInfo(scriptInfo.path); + this.updateFileReferences(fileInfo); + } + this.forEachFileInfo(function (fileInfo) { + if (!_this.project.containsScriptInfo(fileInfo.scriptInfo)) { + fileInfo.removeFileReferences(); + _this.removeFileInfo(fileInfo.scriptInfo.path); + } + }); + this.projectVersionForDependencyGraph = this.project.getProjectVersion(); + } + }; + ModuleBuilder.prototype.updateFileReferences = function (fileInfo) { + if (fileInfo.scriptVersionForReferences === fileInfo.scriptInfo.getLatestVersion()) { + return; + } + var newReferences = this.getReferencedFileInfos(fileInfo); + var oldReferences = fileInfo.references; + var oldIndex = 0; + var newIndex = 0; + while (oldIndex < oldReferences.length && newIndex < newReferences.length) { + var oldReference = oldReferences[oldIndex]; + var newReference = newReferences[newIndex]; + var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference); + if (compare < 0) { + oldReference.removeReferencedBy(fileInfo); + oldIndex++; + } + else if (compare > 0) { + newReference.addReferencedBy(fileInfo); + newIndex++; + } + else { + oldIndex++; + newIndex++; + } + } + for (var i = oldIndex; i < oldReferences.length; i++) { + oldReferences[i].removeReferencedBy(fileInfo); + } + for (var i = newIndex; i < newReferences.length; i++) { + newReferences[i].addReferencedBy(fileInfo); + } + fileInfo.references = newReferences; + fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion(); + }; + ModuleBuilder.prototype.getFilesAffectedBy = function (scriptInfo) { + this.ensureProjectDependencyGraphUpToDate(); + var singleFileResult = scriptInfo.hasMixedContent ? [] : [scriptInfo.fileName]; + var fileInfo = this.getFileInfo(scriptInfo.path); + if (!fileInfo || !fileInfo.updateShapeSignature()) { + return singleFileResult; + } + if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { + return this.project.getAllEmittableFiles(); + } + var options = this.project.getCompilerOptions(); + if (options && (options.isolatedModules || options.out || options.outFile)) { + return singleFileResult; + } + var queue = fileInfo.referencedBy.slice(0); + var fileNameSet = ts.createMap(); + fileNameSet[scriptInfo.fileName] = scriptInfo; + while (queue.length > 0) { + var processingFileInfo = queue.pop(); + if (processingFileInfo.updateShapeSignature() && processingFileInfo.referencedBy.length > 0) { + for (var _i = 0, _a = processingFileInfo.referencedBy; _i < _a.length; _i++) { + var potentialFileInfo = _a[_i]; + if (!fileNameSet[potentialFileInfo.scriptInfo.fileName]) { + queue.push(potentialFileInfo); + } + } + } + fileNameSet[processingFileInfo.scriptInfo.fileName] = processingFileInfo.scriptInfo; + } + var result = []; + for (var fileName in fileNameSet) { + if (shouldEmitFile(fileNameSet[fileName])) { + result.push(fileName); + } + } + return result; + }; + return ModuleBuilder; + }(AbstractBuilder)); + function createBuilder(project) { + var moduleKind = project.getCompilerOptions().module; + switch (moduleKind) { + case ts.ModuleKind.None: + return new NonModuleBuilder(project); + default: + return new ModuleBuilder(project); + } + } + server.createBuilder = createBuilder; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var debugObjectHost = (function () { return this; })(); From 9221336bf1bd8e1c53ec5f3cef12c829aa4c1328 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 6 Jan 2017 13:13:45 -0800 Subject: [PATCH 226/289] Fix name: `mapEntries` is more accurate --- src/compiler/core.ts | 2 +- src/harness/unittests/configurationExtension.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 3b2197d6efa..b65634565b7 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -506,7 +506,7 @@ namespace ts { return result; } - export function mapValues(map: Map, f: (key: string, value: T) => [string, U]): Map { + export function mapEntries(map: Map, f: (key: string, value: T) => [string, U]): Map { if (!map) { return undefined; } diff --git a/src/harness/unittests/configurationExtension.ts b/src/harness/unittests/configurationExtension.ts index 03eb825811b..c68d07f5123 100644 --- a/src/harness/unittests/configurationExtension.ts +++ b/src/harness/unittests/configurationExtension.ts @@ -89,7 +89,7 @@ namespace ts { }); const caseInsensitiveBasePath = "c:/dev/"; - const caseInsensitiveHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, mapValues(testContents, (key, content) => [`c:${key}`, content])); + const caseInsensitiveHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, mapEntries(testContents, (key, content) => [`c:${key}`, content])); const caseSensitiveBasePath = "/dev/"; const caseSensitiveHost = new Utils.MockParseConfigHost(caseSensitiveBasePath, /*useCaseSensitiveFileNames*/ true, testContents); From 06aa905d2068c77f8e2e9f798ddae4b0174ff115 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Jan 2017 16:47:33 -0800 Subject: [PATCH 227/289] Improve detection and handling of circular generic constraints --- src/compiler/checker.ts | 174 +++++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 74 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 33b3505661a..3769f2493b3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -164,6 +164,7 @@ namespace ts { anyFunctionType.flags |= TypeFlags.ContainsAnyFunctionType; const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + const circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); @@ -4135,9 +4136,6 @@ namespace ts { if (!links.declaredType) { const type = createType(TypeFlags.TypeParameter); type.symbol = symbol; - if (!(getDeclarationOfKind(symbol, SyntaxKind.TypeParameter)).constraint) { - type.constraint = noConstraintType; - } links.declaredType = type; } return links.declaredType; @@ -4754,19 +4752,79 @@ namespace ts { getPropertiesOfObjectType(type); } + function getConstraintOfTypeVariable(type: TypeVariable): Type { + return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : getBaseConstraintOfTypeVariable(type); + } + + function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type { + return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; + } + + function getBaseConstraintOfTypeVariable(type: TypeVariable): Type { + const constraint = getResolvedBaseConstraint(type); + return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; + } + + function hasNonCircularBaseConstraint(type: TypeVariable): boolean { + return getResolvedBaseConstraint(type) !== circularConstraintType; + } + /** - * The apparent type of a type parameter is the base constraint instantiated with the type parameter - * as the type argument for the 'this' type. + * Return the resolved base constraint of a type variable. The noConstraintType singleton is returned if the + * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint + * circularly references the type variable. */ - function getApparentTypeOfTypeVariable(type: TypeVariable) { + function getResolvedBaseConstraint(type: TypeVariable): Type { + let typeStack: Type[]; + let circular: boolean; if (!type.resolvedApparentType) { - let constraintType = getConstraintOfTypeVariable(type); - while (constraintType && constraintType.flags & TypeFlags.TypeParameter) { - constraintType = getConstraintOfTypeVariable(constraintType); - } - type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); + typeStack = []; + const constraint = getBaseConstraint(type); + type.resolvedApparentType = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); } return type.resolvedApparentType; + + function getBaseConstraint(t: Type): Type { + if (contains(typeStack, t)) { + circular = true; + return undefined; + } + typeStack.push(t); + const result = computeBaseConstraint(t); + typeStack.pop(); + return result; + } + + function computeBaseConstraint(t: Type): Type { + if (t.flags & TypeFlags.TypeParameter) { + const constraint = getConstraintFromTypeParameter(t); + return (t).isThisType ? constraint : + constraint ? getBaseConstraint(constraint) : undefined; + } + if (t.flags & TypeFlags.UnionOrIntersection) { + const types = (t).types; + const baseTypes: Type[] = []; + for (const type of types) { + const baseType = getBaseConstraint(type); + if (baseType) { + baseTypes.push(baseType); + } + } + return t.flags & TypeFlags.Union && baseTypes.length === types.length ? getUnionType(baseTypes) : + t.flags & TypeFlags.Intersection && baseTypes.length ? getIntersectionType(baseTypes) : + undefined; + } + if (t.flags & TypeFlags.Index) { + return stringType; + } + if (t.flags & TypeFlags.IndexedAccess) { + const baseObjectType = getBaseConstraint((t).objectType); + const baseIndexType = getBaseConstraint((t).indexType); + const baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; + return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; + } + return t; + } } /** @@ -4775,7 +4833,7 @@ namespace ts { * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - const t = type.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(type) : type; + const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfTypeVariable(type) || emptyObjectType : type; return t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : @@ -5329,20 +5387,7 @@ namespace ts { return (getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint; } - function hasConstraintReferenceTo(type: Type, target: TypeParameter): boolean { - let checked: Type[]; - while (type && type.flags & TypeFlags.TypeParameter && !((type as TypeParameter).isThisType) && !contains(checked, type)) { - if (type === target) { - return true; - } - (checked || (checked = [])).push(type); - const constraintDeclaration = getConstraintDeclaration(type); - type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration); - } - return false; - } - - function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type { + function getConstraintFromTypeParameter(typeParameter: TypeParameter): Type { if (!typeParameter.constraint) { if (typeParameter.target) { const targetConstraint = getConstraintOfTypeParameter(typeParameter.target); @@ -5350,23 +5395,12 @@ namespace ts { } else { const constraintDeclaration = getConstraintDeclaration(typeParameter); - let constraint = getTypeFromTypeNode(constraintDeclaration); - if (hasConstraintReferenceTo(constraint, typeParameter)) { - error(constraintDeclaration, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); - constraint = unknownType; - } - typeParameter.constraint = constraint; + typeParameter.constraint = constraintDeclaration ? getTypeFromTypeNode(constraintDeclaration) : noConstraintType; } } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } - function getConstraintOfTypeVariable(type: TypeVariable): Type { - return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : - type.flags & TypeFlags.IndexedAccess ? (type).constraint : - undefined; - } - function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol { return getSymbolOfNode(getDeclarationOfKind(typeParameter.symbol, SyntaxKind.TypeParameter).parent); } @@ -6042,24 +6076,6 @@ namespace ts { const type = createType(TypeFlags.IndexedAccess); type.objectType = objectType; type.indexType = indexType; - // We eagerly compute the constraint of the indexed access type such that circularity - // errors are immediately caught and reported. For example, class C { x: this["x"] } - // becomes an error only when the constraint is eagerly computed. - if (type.objectType.flags & TypeFlags.StructuredType) { - // The constraint of T[K], where T is an object, union, or intersection type, - // is the type of the string index signature of T, if any. - type.constraint = getIndexTypeOfType(type.objectType, IndexKind.String); - } - else if (type.objectType.flags & TypeFlags.TypeVariable) { - // The constraint of T[K], where T is a type variable, is A[K], where A is the - // apparent type of T. - const apparentType = getApparentTypeOfTypeVariable(type.objectType); - if (apparentType !== emptyObjectType) { - type.constraint = isTypeOfKind((type).indexType, TypeFlags.StringLike) ? - getIndexedAccessType(apparentType, (type).indexType) : - getIndexTypeOfType(apparentType, IndexKind.String); - } - } return type; } @@ -6150,13 +6166,6 @@ namespace ts { if (objectType.flags & TypeFlags.Any) { return objectType; } - // We first check that the index type is assignable to 'keyof T' for the object type. - if (accessNode) { - if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { - error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); - return unknownType; - } - } // If the object type is a mapped type { [P in K]: E }, we instantiate E using a mapper that substitutes // the index type for P. For example, for an index access { [P in K]: Box }[X], we construct the // type Box. @@ -7436,8 +7445,9 @@ namespace ts { } // A type S is related to a type T[K] if S is related to A[K], where K is string-like and // A is the apparent type of S. - if ((target).constraint) { - if (result = isRelatedTo(source, (target).constraint, reportErrors)) { + const constraint = getBaseConstraintOfTypeVariable(target); + if (constraint) { + if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -7475,8 +7485,9 @@ namespace ts { else if (source.flags & TypeFlags.IndexedAccess) { // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and // A is the apparent type of S. - if ((source).constraint) { - if (result = isRelatedTo((source).constraint, target, reportErrors)) { + const constraint = getBaseConstraintOfTypeVariable(source); + if (constraint) { + if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; return result; } @@ -12528,7 +12539,7 @@ namespace ts { return unknownType; } - return getIndexedAccessType(objectType, indexType, node); + return checkIndexedAccessIndexType(getIndexedAccessType(objectType, indexType, node), node); } function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { @@ -15186,14 +15197,14 @@ namespace ts { function isLiteralContextualType(contextualType: Type) { if (contextualType) { if (contextualType.flags & TypeFlags.TypeVariable) { - const apparentType = getApparentTypeOfTypeVariable(contextualType); + const constraint = getBaseConstraintOfTypeVariable(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (apparentType.flags & (TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Enum)) { + if (constraint.flags & (TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Enum)) { return true; } - contextualType = apparentType; + contextualType = constraint; } return maybeTypeOfKind(contextualType, (TypeFlags.Literal | TypeFlags.Index)); } @@ -15391,6 +15402,10 @@ namespace ts { } checkSourceElement(node.constraint); + const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!hasNonCircularBaseConstraint(typeParameter)) { + error(node.constraint, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter)); + } getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node))); if (produceDiagnostics) { checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0); @@ -16014,8 +16029,20 @@ namespace ts { forEach(node.types, checkSourceElement); } + function checkIndexedAccessIndexType(type: Type, accessNode: ElementAccessExpression | IndexedAccessTypeNode) { + if (type.flags & TypeFlags.IndexedAccess) { + // Check that the index type is assignable to 'keyof T' for the object type. + const objectType = (type).objectType; + const indexType = (type).indexType; + if (!isTypeAssignableTo(indexType, getIndexType(objectType))) { + error(accessNode, Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType)); + } + } + return type; + } + function checkIndexedAccessType(node: IndexedAccessTypeNode) { - getTypeFromIndexedAccessTypeNode(node); + checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node: MappedTypeNode) { @@ -16023,8 +16050,7 @@ namespace ts { checkSourceElement(node.type); const type = getTypeFromMappedTypeNode(node); const constraintType = getConstraintTypeFromMappedType(type); - const keyType = constraintType.flags & TypeFlags.TypeVariable ? getApparentTypeOfTypeVariable(constraintType) : constraintType; - checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node: Node): boolean { From ee03c0dc870c1afc7f0e4c0b9efc98bef1ea837d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Jan 2017 17:19:34 -0800 Subject: [PATCH 228/289] Update tests --- .../compiler/typeParameterWithInvalidConstraintType.ts | 1 - .../types/keyof/circularIndexedAccessErrors.ts | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/cases/compiler/typeParameterWithInvalidConstraintType.ts b/tests/cases/compiler/typeParameterWithInvalidConstraintType.ts index 7c92ad4575a..a97876b0ab3 100644 --- a/tests/cases/compiler/typeParameterWithInvalidConstraintType.ts +++ b/tests/cases/compiler/typeParameterWithInvalidConstraintType.ts @@ -1,7 +1,6 @@ class A { foo() { var x: T; - // no error expected below this line var a = x.foo(); var b = new x(123); var c = x[1]; diff --git a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts index c01030c7fa9..2243ee8aaad 100644 --- a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts +++ b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts @@ -13,7 +13,7 @@ declare let x2: T2<"x">; let x2x = x2.x; interface T3> { - x: T["x"]; // Error + x: T["x"]; } interface T4> { @@ -25,7 +25,7 @@ class C1 { } class C2 { - x: this["y"]; // Error - y: this["z"]; // Error - z: this["x"]; // Error + x: this["y"]; + y: this["z"]; + z: this["x"]; } \ No newline at end of file From 33e568465a30a1f75bf0910dfc8f1da1140df914 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Jan 2017 17:20:28 -0800 Subject: [PATCH 229/289] Accept new baselines --- .../circularIndexedAccessErrors.errors.txt | 22 +++++-------------- .../reference/circularIndexedAccessErrors.js | 8 +++---- .../reference/mappedTypeErrors.errors.txt | 4 ++-- .../mappedTypeRelationships.errors.txt | 12 +++++++++- ...erIndirectlyConstrainedToItself.errors.txt | 5 ++++- ...ameterWithInvalidConstraintType.errors.txt | 12 ++++++++-- .../typeParameterWithInvalidConstraintType.js | 2 -- 7 files changed, 36 insertions(+), 29 deletions(-) diff --git a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt index e3076e08b7e..e5eaa08d054 100644 --- a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt @@ -1,14 +1,10 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. -tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(15,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. -tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(27,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. -tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(28,5): error TS2502: 'y' is referenced directly or indirectly in its own type annotation. -tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error TS2502: 'z' is referenced directly or indirectly in its own type annotation. -==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (8 errors) ==== +==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (4 errors) ==== type T1 = { x: T1["x"]; // Error @@ -27,9 +23,7 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error let x2x = x2.x; interface T3> { - x: T["x"]; // Error - ~~~~~~~~~~ -!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + x: T["x"]; } interface T4> { @@ -45,13 +39,7 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(29,5): error } class C2 { - x: this["y"]; // Error - ~~~~~~~~~~~~~ -!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. - y: this["z"]; // Error - ~~~~~~~~~~~~~ -!!! error TS2502: 'y' is referenced directly or indirectly in its own type annotation. - z: this["x"]; // Error - ~~~~~~~~~~~~~ -!!! error TS2502: 'z' is referenced directly or indirectly in its own type annotation. + x: this["y"]; + y: this["z"]; + z: this["x"]; } \ No newline at end of file diff --git a/tests/baselines/reference/circularIndexedAccessErrors.js b/tests/baselines/reference/circularIndexedAccessErrors.js index 46784ae8d18..2e4ae3bd841 100644 --- a/tests/baselines/reference/circularIndexedAccessErrors.js +++ b/tests/baselines/reference/circularIndexedAccessErrors.js @@ -13,7 +13,7 @@ declare let x2: T2<"x">; let x2x = x2.x; interface T3> { - x: T["x"]; // Error + x: T["x"]; } interface T4> { @@ -25,9 +25,9 @@ class C1 { } class C2 { - x: this["y"]; // Error - y: this["z"]; // Error - z: this["x"]; // Error + x: this["y"]; + y: this["z"]; + z: this["x"]; } //// [circularIndexedAccessErrors.js] diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 94644a96af9..c7571295521 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -45,7 +45,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(130,5): error TS2322: T tests/cases/conformance/types/mapped/mappedTypeErrors.ts(131,5): error TS2322: Type '{ a: string; }' is not assignable to type '{ [x: string]: any; a?: number | undefined; }'. Types of property 'a' are incompatible. Type 'string' is not assignable to type 'number | undefined'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,16): error TS2322: Type '{}' is not assignable to type 'string'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,16): error TS2322: Type 'T' is not assignable to type 'string'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,21): error TS2536: Type 'P' cannot be used to index type 'T'. @@ -259,7 +259,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(137,21): error TS2536: pf: {[P in F]?: T[P]}, pt: {[P in T]?: T[P]}, // note: should be in keyof T ~ -!!! error TS2322: Type '{}' is not assignable to type 'string'. +!!! error TS2322: Type 'T' is not assignable to type 'string'. ~~~~ !!! error TS2536: Type 'P' cannot be used to index type 'T'. }; diff --git a/tests/baselines/reference/mappedTypeRelationships.errors.txt b/tests/baselines/reference/mappedTypeRelationships.errors.txt index e8e0371ed9a..ce6ecaa61fa 100644 --- a/tests/baselines/reference/mappedTypeRelationships.errors.txt +++ b/tests/baselines/reference/mappedTypeRelationships.errors.txt @@ -3,8 +3,12 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(12,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(17,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. Type 'T' is not assignable to type 'U'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(22,5): error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. + Type 'T' is not assignable to type 'U'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(22,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,5): error TS2536: Type 'K' cannot be used to index type 'T'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(27,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. + Type 'T' is not assignable to type 'U'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(27,12): error TS2536: Type 'K' cannot be used to index type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(31,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'. Type 'undefined' is not assignable to type 'T[keyof T]'. @@ -28,7 +32,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(71,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2322: Type 'Partial' is not assignable to type 'T'. -==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (18 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (20 errors) ==== function f1(x: T, k: keyof T) { return x[k]; @@ -59,6 +63,9 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2 ~~~~ !!! error TS2536: Type 'keyof U' cannot be used to index type 'T'. y[k] = x[k]; // Error + ~~~~ +!!! error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. ~~~~ !!! error TS2536: Type 'keyof U' cannot be used to index type 'T'. } @@ -68,6 +75,9 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2 ~~~~ !!! error TS2536: Type 'K' cannot be used to index type 'T'. y[k] = x[k]; // Error + ~~~~ +!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. ~~~~ !!! error TS2536: Type 'K' cannot be used to index type 'T'. } diff --git a/tests/baselines/reference/typeParameterIndirectlyConstrainedToItself.errors.txt b/tests/baselines/reference/typeParameterIndirectlyConstrainedToItself.errors.txt index 4cfa9da2133..ac7b58bb846 100644 --- a/tests/baselines/reference/typeParameterIndirectlyConstrainedToItself.errors.txt +++ b/tests/baselines/reference/typeParameterIndirectlyConstrainedToItself.errors.txt @@ -23,11 +23,12 @@ tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterInd tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(16,21): error TS2313: Type parameter 'T' has a circular constraint. tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(16,34): error TS2313: Type parameter 'U' has a circular constraint. tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(16,47): error TS2313: Type parameter 'V' has a circular constraint. +tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(18,19): error TS2313: Type parameter 'U' has a circular constraint. tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(18,32): error TS2313: Type parameter 'T' has a circular constraint. tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts(18,45): error TS2313: Type parameter 'V' has a circular constraint. -==== tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts (27 errors) ==== +==== tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterIndirectlyConstrainedToItself.ts (28 errors) ==== class C { } ~ !!! error TS2313: Type parameter 'U' has a circular constraint. @@ -96,6 +97,8 @@ tests/cases/conformance/types/typeParameters/typeParameterLists/typeParameterInd !!! error TS2313: Type parameter 'V' has a circular constraint. class D { } + ~ +!!! error TS2313: Type parameter 'U' has a circular constraint. ~ !!! error TS2313: Type parameter 'T' has a circular constraint. ~ diff --git a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt index 79af423f917..e9dfb5ba3cd 100644 --- a/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt +++ b/tests/baselines/reference/typeParameterWithInvalidConstraintType.errors.txt @@ -1,16 +1,24 @@ tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(1,19): error TS2313: Type parameter 'T' has a circular constraint. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(4,19): error TS2339: Property 'foo' does not exist on type 'T'. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(5,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/typeParameterWithInvalidConstraintType.ts(7,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. -==== tests/cases/compiler/typeParameterWithInvalidConstraintType.ts (1 errors) ==== +==== tests/cases/compiler/typeParameterWithInvalidConstraintType.ts (4 errors) ==== class A { ~ !!! error TS2313: Type parameter 'T' has a circular constraint. foo() { var x: T; - // no error expected below this line var a = x.foo(); + ~~~ +!!! error TS2339: Property 'foo' does not exist on type 'T'. var b = new x(123); + ~~~~~~~~~~ +!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. var c = x[1]; var d = x(); + ~~~ +!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. } } \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterWithInvalidConstraintType.js b/tests/baselines/reference/typeParameterWithInvalidConstraintType.js index a40056f6a59..40a2aeacf4b 100644 --- a/tests/baselines/reference/typeParameterWithInvalidConstraintType.js +++ b/tests/baselines/reference/typeParameterWithInvalidConstraintType.js @@ -2,7 +2,6 @@ class A { foo() { var x: T; - // no error expected below this line var a = x.foo(); var b = new x(123); var c = x[1]; @@ -16,7 +15,6 @@ var A = (function () { } A.prototype.foo = function () { var x; - // no error expected below this line var a = x.foo(); var b = new x(123); var c = x[1]; From f1da780a5e68ba7f863cf13f25e1c63d37846bb9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Jan 2017 17:20:58 -0800 Subject: [PATCH 230/289] Add regression tests --- .../reference/keyofAndIndexedAccess.js | 68 +- .../reference/keyofAndIndexedAccess.symbols | 623 +++++++++++------- .../reference/keyofAndIndexedAccess.types | 138 ++++ .../types/keyof/keyofAndIndexedAccess.ts | 35 +- 4 files changed, 612 insertions(+), 252 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 4b93897fdc4..3ad7bdd79f8 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -296,6 +296,30 @@ class C1 { } } +type S2 = { + a: string; + b: string; +}; + +function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]) { + x1 = x2; + x1 = x3; + x1 = x4; + x2 = x1; + x2 = x3; + x2 = x4; + x3 = x1; + x3 = x2; + x3 = x4; + x4 = x1; + x4 = x2; + x4 = x3; + x1.length; + x2.length; + x3.length; + x4.length; +} + // Repros from #12011 class Base { @@ -429,7 +453,17 @@ type SomeMethodDescriptor = { returnValue: string[]; } -let result = dispatchMethod("someMethod", ["hello", 35]); +let result = dispatchMethod("someMethod", ["hello", 35]); + +// Repro from #13073 + +type KeyTypes = "a" | "b" +let MyThingy: { [key in KeyTypes]: string[] }; + +function addToMyThingy(key: S) { + MyThingy[key].push("a"); +} + //// [keyofAndIndexedAccess.js] var __extends = (this && this.__extends) || function (d, b) { @@ -644,6 +678,24 @@ var C1 = (function () { }; return C1; }()); +function f90(x1, x2, x3, x4) { + x1 = x2; + x1 = x3; + x1 = x4; + x2 = x1; + x2 = x3; + x2 = x4; + x3 = x1; + x3 = x2; + x3 = x4; + x4 = x1; + x4 = x2; + x4 = x3; + x1.length; + x2.length; + x3.length; + x4.length; +} // Repros from #12011 var Base = (function () { function Base() { @@ -713,6 +765,10 @@ function f(p) { a[p].add; // any } var result = dispatchMethod("someMethod", ["hello", 35]); +var MyThingy; +function addToMyThingy(key) { + MyThingy[key].push("a"); +} //// [keyofAndIndexedAccess.d.ts] @@ -848,6 +904,11 @@ declare class C1 { set(key: K, value: this[K]): void; foo(): void; } +declare type S2 = { + a: string; + b: string; +}; +declare function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]): void; declare class Base { get(prop: K): this[K]; set(prop: K, value: this[K]): void; @@ -920,3 +981,8 @@ declare type SomeMethodDescriptor = { returnValue: string[]; }; declare let result: string[]; +declare type KeyTypes = "a" | "b"; +declare let MyThingy: { + [key in KeyTypes]: string[]; +}; +declare function addToMyThingy(key: S): void; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index 1c69d4959d8..fb8129a5301 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -1139,440 +1139,563 @@ class C1 { } } +type S2 = { +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) + + a: string; +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 297, 11)) + + b: string; +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 298, 14)) + +}; + +function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]) { +>f90 : Symbol(f90, Decl(keyofAndIndexedAccess.ts, 300, 2)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 302, 13)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 302, 26)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 302, 13)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) +>S2 : Symbol(S2, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 302, 26)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 302, 13)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 302, 26)) + + x1 = x2; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) + + x1 = x3; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) + + x1 = x4; +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) + + x2 = x1; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) + + x2 = x3; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) + + x2 = x4; +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) + + x3 = x1; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) + + x3 = x2; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) + + x3 = x4; +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) + + x4 = x1; +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) + + x4 = x2; +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) + + x4 = x3; +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) + + x1.length; +>x1.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 302, 47)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x2.length; +>x2.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 302, 64)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x3.length; +>x3.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 302, 81)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + + x4.length; +>x4.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 302, 92)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) +} + // Repros from #12011 class Base { ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 319, 1)) get(prop: K) { ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 300, 8)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 323, 12)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 324, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 324, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 324, 8)) return this[prop]; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 300, 30)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 319, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 324, 30)) } set(prop: K, value: this[K]) { ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 303, 8)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 326, 5)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 327, 8)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 327, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 327, 8)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 327, 38)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 327, 8)) this[prop] = value; ->this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) ->prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 303, 30)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 303, 38)) +>this : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 319, 1)) +>prop : Symbol(prop, Decl(keyofAndIndexedAccess.ts, 327, 30)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 327, 38)) } } class Person extends Base { ->Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) ->Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>Person : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 330, 1)) +>Base : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 319, 1)) parts: number; ->parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 308, 27)) +>parts : Symbol(Person.parts, Decl(keyofAndIndexedAccess.ts, 332, 27)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 334, 16)) super(); ->super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 295, 1)) +>super : Symbol(Base, Decl(keyofAndIndexedAccess.ts, 319, 1)) this.set("parts", parts); ->this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) ->set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 302, 5)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 310, 16)) +>this.set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 326, 5)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 330, 1)) +>set : Symbol(Base.set, Decl(keyofAndIndexedAccess.ts, 326, 5)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 334, 16)) } getParts() { ->getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 313, 5)) +>getParts : Symbol(Person.getParts, Decl(keyofAndIndexedAccess.ts, 337, 5)) return this.get("parts") ->this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) ->this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 306, 1)) ->get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 299, 12)) +>this.get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 323, 12)) +>this : Symbol(Person, Decl(keyofAndIndexedAccess.ts, 330, 1)) +>get : Symbol(Base.get, Decl(keyofAndIndexedAccess.ts, 323, 12)) } } class OtherPerson { ->OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) +>OtherPerson : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 341, 1)) parts: number; ->parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 319, 19)) +>parts : Symbol(OtherPerson.parts, Decl(keyofAndIndexedAccess.ts, 343, 19)) constructor(parts: number) { ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 345, 16)) setProperty(this, "parts", parts); >setProperty : Symbol(setProperty, Decl(keyofAndIndexedAccess.ts, 81, 1)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) ->parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 321, 16)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 341, 1)) +>parts : Symbol(parts, Decl(keyofAndIndexedAccess.ts, 345, 16)) } getParts() { ->getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 323, 5)) +>getParts : Symbol(OtherPerson.getParts, Decl(keyofAndIndexedAccess.ts, 347, 5)) return getProperty(this, "parts") >getProperty : Symbol(getProperty, Decl(keyofAndIndexedAccess.ts, 77, 26)) ->this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 317, 1)) +>this : Symbol(OtherPerson, Decl(keyofAndIndexedAccess.ts, 341, 1)) } } // Modified repro from #12544 function path(obj: T, key1: K1): T[K1]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 331, 37)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 331, 44)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 331, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 331, 16)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 355, 37)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 355, 44)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 355, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 355, 16)) function path(obj: T, key1: K1, key2: K2): T[K1][K2]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 332, 61)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 332, 68)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 332, 78)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 332, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 332, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 332, 36)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 356, 61)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 356, 68)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 356, 78)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 356, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 356, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 356, 36)) function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 333, 89)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 333, 96)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 333, 106)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) ->key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 333, 116)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 333, 14)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 333, 16)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 333, 36)) ->K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 333, 60)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 357, 16)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 357, 36)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 357, 16)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 357, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 357, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 357, 36)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 357, 89)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 357, 96)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 357, 16)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 357, 106)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 357, 36)) +>key3 : Symbol(key3, Decl(keyofAndIndexedAccess.ts, 357, 116)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 357, 60)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 357, 14)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 357, 16)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 357, 36)) +>K3 : Symbol(K3, Decl(keyofAndIndexedAccess.ts, 357, 60)) function path(obj: any, ...keys: (string | number)[]): any; ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 334, 14)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 334, 23)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 358, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 358, 23)) function path(obj: any, ...keys: (string | number)[]): any { ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 359, 14)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 359, 23)) let result = obj; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 335, 14)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 360, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 359, 14)) for (let k of keys) { ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) ->keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 335, 23)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 361, 12)) +>keys : Symbol(keys, Decl(keyofAndIndexedAccess.ts, 359, 23)) result = result[k]; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) ->k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 337, 12)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 360, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 360, 7)) +>k : Symbol(k, Decl(keyofAndIndexedAccess.ts, 361, 12)) } return result; ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 336, 7)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 360, 7)) } type Thing = { ->Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 365, 1)) a: { x: number, y: string }, ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 343, 14)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 344, 8)) ->y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 344, 19)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 367, 14)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 368, 8)) +>y : Symbol(y, Decl(keyofAndIndexedAccess.ts, 368, 19)) b: boolean ->b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 344, 32)) +>b : Symbol(b, Decl(keyofAndIndexedAccess.ts, 368, 32)) }; function f1(thing: Thing) { ->f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 346, 2)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) ->Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 341, 1)) +>f1 : Symbol(f1, Decl(keyofAndIndexedAccess.ts, 370, 2)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 373, 12)) +>Thing : Symbol(Thing, Decl(keyofAndIndexedAccess.ts, 365, 1)) let x1 = path(thing, 'a'); // { x: number, y: string } ->x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 350, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>x1 : Symbol(x1, Decl(keyofAndIndexedAccess.ts, 374, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 373, 12)) let x2 = path(thing, 'a', 'y'); // string ->x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 351, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>x2 : Symbol(x2, Decl(keyofAndIndexedAccess.ts, 375, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 373, 12)) let x3 = path(thing, 'b'); // boolean ->x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 352, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>x3 : Symbol(x3, Decl(keyofAndIndexedAccess.ts, 376, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 373, 12)) let x4 = path(thing, ...['a', 'x']); // any ->x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 353, 7)) ->path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 327, 1), Decl(keyofAndIndexedAccess.ts, 331, 62), Decl(keyofAndIndexedAccess.ts, 332, 100), Decl(keyofAndIndexedAccess.ts, 333, 142), Decl(keyofAndIndexedAccess.ts, 334, 59)) ->thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 349, 12)) +>x4 : Symbol(x4, Decl(keyofAndIndexedAccess.ts, 377, 7)) +>path : Symbol(path, Decl(keyofAndIndexedAccess.ts, 351, 1), Decl(keyofAndIndexedAccess.ts, 355, 62), Decl(keyofAndIndexedAccess.ts, 356, 100), Decl(keyofAndIndexedAccess.ts, 357, 142), Decl(keyofAndIndexedAccess.ts, 358, 59)) +>thing : Symbol(thing, Decl(keyofAndIndexedAccess.ts, 373, 12)) } // Repro from comment in #12114 const assignTo2 = (object: T, key1: K1, key2: K2) => ->assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 358, 5)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) ->object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) +>assignTo2 : Symbol(assignTo2, Decl(keyofAndIndexedAccess.ts, 382, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 382, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 382, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 382, 19)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 382, 41)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 382, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 382, 21)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 382, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 382, 19)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 382, 76)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 382, 21)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 382, 86)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 382, 41)) (value: T[K1][K2]) => object[key1][key2] = value; ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 358, 19)) ->K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 358, 21)) ->K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 358, 41)) ->object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 358, 66)) ->key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 358, 76)) ->key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 358, 86)) ->value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 359, 5)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 383, 5)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 382, 19)) +>K1 : Symbol(K1, Decl(keyofAndIndexedAccess.ts, 382, 21)) +>K2 : Symbol(K2, Decl(keyofAndIndexedAccess.ts, 382, 41)) +>object : Symbol(object, Decl(keyofAndIndexedAccess.ts, 382, 66)) +>key1 : Symbol(key1, Decl(keyofAndIndexedAccess.ts, 382, 76)) +>key2 : Symbol(key2, Decl(keyofAndIndexedAccess.ts, 382, 86)) +>value : Symbol(value, Decl(keyofAndIndexedAccess.ts, 383, 5)) // Modified repro from #12573 declare function one(handler: (t: T) => void): T ->one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) ->handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 363, 24)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 363, 34)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 363, 21)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 383, 53)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 387, 21)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 387, 24)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 387, 34)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 387, 21)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 387, 21)) var empty = one(() => {}) // inferred as {}, expected ->empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 364, 3)) ->one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 359, 53)) +>empty : Symbol(empty, Decl(keyofAndIndexedAccess.ts, 388, 3)) +>one : Symbol(one, Decl(keyofAndIndexedAccess.ts, 383, 53)) type Handlers = { [K in keyof T]: (t: T[K]) => void } ->Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) ->t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 366, 38)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 366, 14)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 366, 22)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 388, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 390, 22)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 14)) +>t : Symbol(t, Decl(keyofAndIndexedAccess.ts, 390, 38)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 390, 14)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 390, 22)) declare function on(handlerHash: Handlers): T ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) ->handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 367, 23)) ->Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 364, 25)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 367, 20)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 390, 56)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 391, 20)) +>handlerHash : Symbol(handlerHash, Decl(keyofAndIndexedAccess.ts, 391, 23)) +>Handlers : Symbol(Handlers, Decl(keyofAndIndexedAccess.ts, 388, 25)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 391, 20)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 391, 20)) var hashOfEmpty1 = on({ test: () => {} }); // {} ->hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 368, 3)) ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) ->test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 368, 23)) +>hashOfEmpty1 : Symbol(hashOfEmpty1, Decl(keyofAndIndexedAccess.ts, 392, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 390, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 392, 23)) var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } ->hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 369, 3)) ->on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 366, 56)) ->test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 369, 23)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 369, 31)) +>hashOfEmpty2 : Symbol(hashOfEmpty2, Decl(keyofAndIndexedAccess.ts, 393, 3)) +>on : Symbol(on, Decl(keyofAndIndexedAccess.ts, 390, 56)) +>test : Symbol(test, Decl(keyofAndIndexedAccess.ts, 393, 23)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 393, 31)) // Repro from #12624 interface Options1 { ->Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 393, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 397, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 397, 24)) data?: Data ->data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 373, 36)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 373, 19)) +>data : Symbol(Options1.data, Decl(keyofAndIndexedAccess.ts, 397, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 397, 19)) computed?: Computed; ->computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 374, 15)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 373, 24)) +>computed : Symbol(Options1.computed, Decl(keyofAndIndexedAccess.ts, 398, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 397, 24)) } declare class Component1 { ->Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 400, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 402, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 402, 30)) constructor(options: Options1); ->options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 379, 16)) ->Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 369, 52)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 403, 16)) +>Options1 : Symbol(Options1, Decl(keyofAndIndexedAccess.ts, 393, 52)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 402, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 402, 30)) get(key: K): (Data & Computed)[K]; ->get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 380, 43)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 378, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 378, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 380, 8)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 403, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 404, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 402, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 402, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 404, 43)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 404, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 402, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 402, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 404, 8)) } let c1 = new Component1({ ->c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) ->Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 376, 1)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 407, 3)) +>Component1 : Symbol(Component1, Decl(keyofAndIndexedAccess.ts, 400, 1)) data: { ->data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 383, 25)) +>data : Symbol(data, Decl(keyofAndIndexedAccess.ts, 407, 25)) hello: "" ->hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 384, 11)) +>hello : Symbol(hello, Decl(keyofAndIndexedAccess.ts, 408, 11)) } }); c1.get("hello"); ->c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) ->c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 383, 3)) ->get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 379, 51)) +>c1.get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 403, 51)) +>c1 : Symbol(c1, Decl(keyofAndIndexedAccess.ts, 407, 3)) +>get : Symbol(Component1.get, Decl(keyofAndIndexedAccess.ts, 403, 51)) // Repro from #12625 interface Options2 { ->Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 413, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 417, 19)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 417, 24)) data?: Data ->data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 393, 36)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 393, 19)) +>data : Symbol(Options2.data, Decl(keyofAndIndexedAccess.ts, 417, 36)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 417, 19)) computed?: Computed; ->computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 394, 15)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 393, 24)) +>computed : Symbol(Options2.computed, Decl(keyofAndIndexedAccess.ts, 418, 15)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 417, 24)) } declare class Component2 { ->Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 396, 1)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>Component2 : Symbol(Component2, Decl(keyofAndIndexedAccess.ts, 420, 1)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 422, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 422, 30)) constructor(options: Options2); ->options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 399, 16)) ->Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 389, 16)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) +>options : Symbol(options, Decl(keyofAndIndexedAccess.ts, 423, 16)) +>Options2 : Symbol(Options2, Decl(keyofAndIndexedAccess.ts, 413, 16)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 422, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 422, 30)) get(key: K): (Data & Computed)[K]; ->get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 399, 51)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 400, 47)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) ->Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 398, 25)) ->Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 398, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 400, 8)) +>get : Symbol(Component2.get, Decl(keyofAndIndexedAccess.ts, 423, 51)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 424, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 422, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 422, 30)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 424, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 424, 8)) +>Data : Symbol(Data, Decl(keyofAndIndexedAccess.ts, 422, 25)) +>Computed : Symbol(Computed, Decl(keyofAndIndexedAccess.ts, 422, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 424, 8)) } // Repro from #12641 interface R { ->R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 425, 1)) p: number; ->p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 405, 13)) +>p : Symbol(R.p, Decl(keyofAndIndexedAccess.ts, 429, 13)) } function f(p: K) { ->f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 407, 1)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) ->R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 401, 1)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 409, 11)) +>f : Symbol(f, Decl(keyofAndIndexedAccess.ts, 431, 1)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 433, 11)) +>R : Symbol(R, Decl(keyofAndIndexedAccess.ts, 425, 1)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 433, 30)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 433, 11)) let a: any; ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 434, 7)) a[p].add; // any ->a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 410, 7)) ->p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 409, 30)) +>a : Symbol(a, Decl(keyofAndIndexedAccess.ts, 434, 7)) +>p : Symbol(p, Decl(keyofAndIndexedAccess.ts, 433, 30)) } // Repro from #12651 type MethodDescriptor = { ->MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 436, 1)) name: string; ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 416, 25)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 440, 25)) args: any[]; ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 417, 14)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 441, 14)) returnValue: any; ->returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 418, 13)) +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 442, 13)) } declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; ->dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) ->MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 412, 1)) ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 422, 60)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 422, 76)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) ->M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 422, 32)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 444, 1)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 446, 32)) +>MethodDescriptor : Symbol(MethodDescriptor, Decl(keyofAndIndexedAccess.ts, 436, 1)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 446, 60)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 446, 32)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 446, 76)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 446, 32)) +>M : Symbol(M, Decl(keyofAndIndexedAccess.ts, 446, 32)) type SomeMethodDescriptor = { ->SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 446, 112)) name: "someMethod"; ->name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 424, 29)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 448, 29)) args: [string, number]; ->args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 425, 20)) +>args : Symbol(args, Decl(keyofAndIndexedAccess.ts, 449, 20)) returnValue: string[]; ->returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 426, 24)) +>returnValue : Symbol(returnValue, Decl(keyofAndIndexedAccess.ts, 450, 24)) } let result = dispatchMethod("someMethod", ["hello", 35]); ->result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 430, 3)) ->dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 420, 1)) ->SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 422, 112)) +>result : Symbol(result, Decl(keyofAndIndexedAccess.ts, 454, 3)) +>dispatchMethod : Symbol(dispatchMethod, Decl(keyofAndIndexedAccess.ts, 444, 1)) +>SomeMethodDescriptor : Symbol(SomeMethodDescriptor, Decl(keyofAndIndexedAccess.ts, 446, 112)) + +// Repro from #13073 + +type KeyTypes = "a" | "b" +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 454, 79)) + +let MyThingy: { [key in KeyTypes]: string[] }; +>MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 459, 3)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 459, 17)) +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 454, 79)) + +function addToMyThingy(key: S) { +>addToMyThingy : Symbol(addToMyThingy, Decl(keyofAndIndexedAccess.ts, 459, 46)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 461, 23)) +>KeyTypes : Symbol(KeyTypes, Decl(keyofAndIndexedAccess.ts, 454, 79)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 461, 43)) +>S : Symbol(S, Decl(keyofAndIndexedAccess.ts, 461, 23)) + + MyThingy[key].push("a"); +>MyThingy[key].push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>MyThingy : Symbol(MyThingy, Decl(keyofAndIndexedAccess.ts, 459, 3)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 461, 43)) +>push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +} diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index f94249806f6..ccf0bde4e1c 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -1385,6 +1385,117 @@ class C1 { } } +type S2 = { +>S2 : S2 + + a: string; +>a : string + + b: string; +>b : string + +}; + +function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]) { +>f90 : (x1: string, x2: T["a" | "b"], x3: S2[K], x4: T[K]) => void +>T : T +>S2 : S2 +>K : K +>S2 : S2 +>x1 : string +>S2 : S2 +>S2 : S2 +>x2 : T["a" | "b"] +>T : T +>S2 : S2 +>x3 : S2[K] +>S2 : S2 +>K : K +>x4 : T[K] +>T : T +>K : K + + x1 = x2; +>x1 = x2 : T["a" | "b"] +>x1 : string +>x2 : T["a" | "b"] + + x1 = x3; +>x1 = x3 : S2[K] +>x1 : string +>x3 : S2[K] + + x1 = x4; +>x1 = x4 : T[K] +>x1 : string +>x4 : T[K] + + x2 = x1; +>x2 = x1 : string +>x2 : T["a" | "b"] +>x1 : string + + x2 = x3; +>x2 = x3 : S2[K] +>x2 : T["a" | "b"] +>x3 : S2[K] + + x2 = x4; +>x2 = x4 : T[K] +>x2 : T["a" | "b"] +>x4 : T[K] + + x3 = x1; +>x3 = x1 : string +>x3 : S2[K] +>x1 : string + + x3 = x2; +>x3 = x2 : T["a" | "b"] +>x3 : S2[K] +>x2 : T["a" | "b"] + + x3 = x4; +>x3 = x4 : T[K] +>x3 : S2[K] +>x4 : T[K] + + x4 = x1; +>x4 = x1 : string +>x4 : T[K] +>x1 : string + + x4 = x2; +>x4 = x2 : T["a" | "b"] +>x4 : T[K] +>x2 : T["a" | "b"] + + x4 = x3; +>x4 = x3 : S2[K] +>x4 : T[K] +>x3 : S2[K] + + x1.length; +>x1.length : number +>x1 : string +>length : number + + x2.length; +>x2.length : number +>x2 : T["a" | "b"] +>length : number + + x3.length; +>x3.length : number +>x3 : S2[K] +>length : number + + x4.length; +>x4.length : number +>x4 : T[K] +>length : number +} + // Repros from #12011 class Base { @@ -1875,3 +1986,30 @@ let result = dispatchMethod("someMethod", ["hello", 35]); >"hello" : "hello" >35 : 35 +// Repro from #13073 + +type KeyTypes = "a" | "b" +>KeyTypes : "a" | "b" + +let MyThingy: { [key in KeyTypes]: string[] }; +>MyThingy : { a: string[]; b: string[]; } +>key : key +>KeyTypes : "a" | "b" + +function addToMyThingy(key: S) { +>addToMyThingy : (key: S) => void +>S : S +>KeyTypes : "a" | "b" +>key : S +>S : S + + MyThingy[key].push("a"); +>MyThingy[key].push("a") : number +>MyThingy[key].push : (...items: string[]) => number +>MyThingy[key] : { a: string[]; b: string[]; }[S] +>MyThingy : { a: string[]; b: string[]; } +>key : S +>push : (...items: string[]) => number +>"a" : "a" +} + diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index ea6a3c2358a..0ef73c736f4 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -297,6 +297,30 @@ class C1 { } } +type S2 = { + a: string; + b: string; +}; + +function f90(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K], x4: T[K]) { + x1 = x2; + x1 = x3; + x1 = x4; + x2 = x1; + x2 = x3; + x2 = x4; + x3 = x1; + x3 = x2; + x3 = x4; + x4 = x1; + x4 = x2; + x4 = x3; + x1.length; + x2.length; + x3.length; + x4.length; +} + // Repros from #12011 class Base { @@ -430,4 +454,13 @@ type SomeMethodDescriptor = { returnValue: string[]; } -let result = dispatchMethod("someMethod", ["hello", 35]); \ No newline at end of file +let result = dispatchMethod("someMethod", ["hello", 35]); + +// Repro from #13073 + +type KeyTypes = "a" | "b" +let MyThingy: { [key in KeyTypes]: string[] }; + +function addToMyThingy(key: S) { + MyThingy[key].push("a"); +} From 855488fc6d5b9311b463da64f1d32d00ea58cce2 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 6 Jan 2017 17:35:09 -0800 Subject: [PATCH 231/289] Add additional regression test --- .../circularIndexedAccessErrors.errors.txt | 20 +++++++++++++++++-- .../reference/circularIndexedAccessErrors.js | 18 ++++++++++++++++- .../keyof/circularIndexedAccessErrors.ts | 11 +++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt index e5eaa08d054..f76cfca073e 100644 --- a/tests/baselines/reference/circularIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/circularIndexedAccessErrors.errors.txt @@ -2,9 +2,11 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(3,5): error T tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(7,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(19,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(38,24): error TS2313: Type parameter 'T' has a circular constraint. +tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(38,30): error TS2536: Type '"hello"' cannot be used to index type 'T'. -==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (4 errors) ==== +==== tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts (6 errors) ==== type T1 = { x: T1["x"]; // Error @@ -42,4 +44,18 @@ tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts(23,5): error x: this["y"]; y: this["z"]; z: this["x"]; - } \ No newline at end of file + } + + // Repro from #12627 + + interface Foo { + hello: boolean; + } + + function foo() { + ~~~~~~~~~~~~~~~~ +!!! error TS2313: Type parameter 'T' has a circular constraint. + ~~~~~~~~~~ +!!! error TS2536: Type '"hello"' cannot be used to index type 'T'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/circularIndexedAccessErrors.js b/tests/baselines/reference/circularIndexedAccessErrors.js index 2e4ae3bd841..97d059bce19 100644 --- a/tests/baselines/reference/circularIndexedAccessErrors.js +++ b/tests/baselines/reference/circularIndexedAccessErrors.js @@ -28,7 +28,17 @@ class C2 { x: this["y"]; y: this["z"]; z: this["x"]; -} +} + +// Repro from #12627 + +interface Foo { + hello: boolean; +} + +function foo() { +} + //// [circularIndexedAccessErrors.js] var x2x = x2.x; @@ -42,6 +52,8 @@ var C2 = (function () { } return C2; }()); +function foo() { +} //// [circularIndexedAccessErrors.d.ts] @@ -68,3 +80,7 @@ declare class C2 { y: this["z"]; z: this["x"]; } +interface Foo { + hello: boolean; +} +declare function foo(): void; diff --git a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts index 2243ee8aaad..a53fc6fbf72 100644 --- a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts +++ b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts @@ -28,4 +28,13 @@ class C2 { x: this["y"]; y: this["z"]; z: this["x"]; -} \ No newline at end of file +} + +// Repro from #12627 + +interface Foo { + hello: boolean; +} + +function foo() { +} From 54e9ae32e6cee6cb619c07adc4c25d949e1439ac Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Fri, 6 Jan 2017 23:44:17 -0800 Subject: [PATCH 232/289] Fix --project help --- src/compiler/commandLineParser.ts | 6 +++--- src/compiler/diagnosticMessages.json | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2e2c5c0bdb6..9111a72eb2d 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -212,8 +212,8 @@ namespace ts { shortName: "p", type: "string", isFilePath: true, - description: Diagnostics.Compile_the_project_in_the_given_directory, - paramType: Diagnostics.DIRECTORY + description: Diagnostics.Compile_the_project_in_the_given_directory_using_tsconfig_json_or_the_specified_config_file, + paramType: Diagnostics.DIRECTORY_OR_FILE }, { name: "removeComments", @@ -517,7 +517,7 @@ namespace ts { include: typeAcquisition.include || [], exclude: typeAcquisition.exclude || [] }; - return result; + return result; } return typeAcquisition; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index ec5ca292b99..2230ffdbac0 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2513,7 +2513,7 @@ "category": "Message", "code": 6019 }, - "Compile the project in the given directory.": { + "Compile the project in the given directory, using 'tsconfig.json' or the specified config file.": { "category": "Message", "code": 6020 }, @@ -2573,6 +2573,10 @@ "category": "Message", "code": 6039 }, + "DIRECTORY_OR_FILE": { + "category": "Message", + "code": 6040 + }, "Compilation complete. Watching for file changes.": { "category": "Message", "code": 6042 From 9017e0a084975913cbef1e8c69e55e8bf4e4083f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 7 Jan 2017 15:11:41 -0800 Subject: [PATCH 233/289] Allow missing argument for IIFE parameter with no type annotation --- src/compiler/checker.ts | 52 +++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 879be1c6fbf..61b1911261d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5058,9 +5058,10 @@ namespace ts { if (!links.resolvedSignature) { const parameters: Symbol[] = []; let hasLiteralTypes = false; - let minArgumentCount = -1; + let minArgumentCount = 0; let thisParameter: Symbol = undefined; let hasThisParameter: boolean; + const iife = getImmediatelyInvokedFunctionExpression(declaration); const isJSConstructSignature = isJSDocConstructSignature(declaration); // If this is a JSDoc construct signature, then skip the first parameter in the @@ -5087,14 +5088,12 @@ namespace ts { hasLiteralTypes = true; } - if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { - if (minArgumentCount < 0) { - minArgumentCount = i - (hasThisParameter ? 1 : 0); - } - } - else { - // If we see any required parameters, it means the prior ones were not in fact optional. - minArgumentCount = -1; + // Record a new minimum argument count if this is not an optional parameter + const isOptionalParameter = param.initializer || param.questionToken || param.dotDotDotToken || + iife && parameters.length > iife.arguments.length && !param.type || + isJSDocOptionalParameter(param); + if (!isOptionalParameter) { + minArgumentCount = parameters.length; } } @@ -5109,13 +5108,6 @@ namespace ts { } } - if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); - } - if (isJSConstructSignature) { - minArgumentCount--; - } - const classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface(getMergedSymbol((declaration.parent).symbol)) : undefined; @@ -10933,23 +10925,23 @@ namespace ts { const func = parameter.parent; if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { const iife = getImmediatelyInvokedFunctionExpression(func); - if (iife) { + if (iife && iife.arguments) { const indexOfParameter = indexOf(func.parameters, parameter); - if (iife.arguments && indexOfParameter < iife.arguments.length) { - if (parameter.dotDotDotToken) { - const restTypes: Type[] = []; - for (let i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); - } - return createArrayType(getUnionType(restTypes)); + if (parameter.dotDotDotToken) { + const restTypes: Type[] = []; + for (let i = indexOfParameter; i < iife.arguments.length; i++) { + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); } - const links = getNodeLinks(iife); - const cached = links.resolvedSignature; - links.resolvedSignature = anySignature; - const type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); - links.resolvedSignature = cached; - return type; + return restTypes.length ? createArrayType(getUnionType(restTypes)) : undefined; } + const links = getNodeLinks(iife); + const cached = links.resolvedSignature; + links.resolvedSignature = anySignature; + const type = indexOfParameter < iife.arguments.length ? + getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])) : + parameter.initializer ? undefined : undefinedWideningType; + links.resolvedSignature = cached; + return type; } const contextualSignature = getContextualSignature(func); if (contextualSignature) { From d2942b2b563529b9d9e7a5ed2d6b1981536ac17f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 7 Jan 2017 15:16:15 -0800 Subject: [PATCH 234/289] Accept new baselines --- .../reference/fixSignatureCaching.errors.txt | 1003 +---------------- 1 file changed, 2 insertions(+), 1001 deletions(-) diff --git a/tests/baselines/reference/fixSignatureCaching.errors.txt b/tests/baselines/reference/fixSignatureCaching.errors.txt index 6677afc174a..7a5c43c966e 100644 --- a/tests/baselines/reference/fixSignatureCaching.errors.txt +++ b/tests/baselines/reference/fixSignatureCaching.errors.txt @@ -1,4 +1,3 @@ -tests/cases/conformance/fixSignatureCaching.ts(3,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/fixSignatureCaching.ts(9,10): error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. tests/cases/conformance/fixSignatureCaching.ts(284,10): error TS2339: Property 'detectMobileBrowsers' does not exist on type '{}'. tests/cases/conformance/fixSignatureCaching.ts(293,10): error TS2339: Property 'FALLBACK_PHONE' does not exist on type '{}'. @@ -62,7 +61,6 @@ tests/cases/conformance/fixSignatureCaching.ts(961,57): error TS2339: Property ' tests/cases/conformance/fixSignatureCaching.ts(964,22): error TS2339: Property 'isPhoneSized' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. tests/cases/conformance/fixSignatureCaching.ts(968,18): error TS2339: Property '_impl' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. tests/cases/conformance/fixSignatureCaching.ts(970,18): error TS2339: Property 'version' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. -tests/cases/conformance/fixSignatureCaching.ts(974,4): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/fixSignatureCaching.ts(975,16): error TS2304: Cannot find name 'module'. tests/cases/conformance/fixSignatureCaching.ts(975,42): error TS2304: Cannot find name 'module'. tests/cases/conformance/fixSignatureCaching.ts(976,37): error TS2304: Cannot find name 'module'. @@ -73,2128 +71,1131 @@ tests/cases/conformance/fixSignatureCaching.ts(979,23): error TS2304: Cannot fin tests/cases/conformance/fixSignatureCaching.ts(980,37): error TS2304: Cannot find name 'window'. -==== tests/cases/conformance/fixSignatureCaching.ts (73 errors) ==== +==== tests/cases/conformance/fixSignatureCaching.ts (71 errors) ==== // Repro from #10697 (function (define, undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ define(function () { - ~~~~~~~~~~~~~~~~~~~~ 'use strict'; - ~~~~~~~~~~~~~~~~~ - var impl = {}; - ~~~~~~~~~~~~~~~~~~ - impl.mobileDetectRules = { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. "phones": { - ~~~~~~~~~~~~~~~ "iPhone": "\\biPhone\\b|\\biPod\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerry": "BlackBerry|\\bBB10\\b|rim[0-9]+", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "HTC": "HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\bEVO\\b|T-Mobile G1|Z520m", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Nexus": "Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Dell": "Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\\b001DL\\b|\\b101DL\\b|\\bGS01\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Motorola": "Motorola|DROIDX|DROID BIONIC|\\bDroid\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Samsung": "Samsung|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "LG": "\\bLG\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Sony": "SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Asus": "Asus.*Galaxy|PadFone.*Mobile", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NokiaLumia": "Lumia [0-9]{3,4}", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Micromax": "Micromax.*\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Palm": "PalmSource|Palm", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Vertu": "Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Pantech": "PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Fly": "IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Wiko": "KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iMobile": "i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SimValley": "\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Wolfgang": "AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Alcatel": "Alcatel", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Nintendo": "Nintendo 3DS", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Amoi": "Amoi", - ~~~~~~~~~~~~~~~~~~~~~~~ "INQ": "INQ", - ~~~~~~~~~~~~~~~~~~~~~ "GenericPhone": "Tapatalk|PDA;|SAGEM|\\bmmp\\b|pocket|\\bpsp\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\bwap\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~ "tablets": { - ~~~~~~~~~~~~~~~~ "iPad": "iPad|iPad.*Mobile", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NexusTablet": "Android.*Nexus[\\s]+(7|9|10)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SamsungTablet": "SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Kindle": "Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SurfaceTablet": "Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "HPTablet": "HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AsusTablet": "^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K017 |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerryTablet": "PlayBook|RIM Tablet", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "HTCtablet": "HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MotorolaTablet": "xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NookTablet": "Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AcerTablet": "Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ToshibaTablet": "Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "LGTablet": "\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "FujitsuTablet": "Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PrestigioTablet": "PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "LenovoTablet": "Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DellTablet": "Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "YarvikTablet": "Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MedionTablet": "Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ArnovaTablet": "AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IntensoTablet": "INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IRUTablet": "M702pro", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MegafonTablet": "MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "EbodaTablet": "E-Boda (Supreme|Impresspeed|Izzycomm|Essential)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AllViewTablet": "Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ArchosTablet": "\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AinolTablet": "NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NokiaLumiaTablet": "Lumia 2520", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SonyTablet": "Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612|SOT31", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PhilipsTablet": "\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CubeTablet": "Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CobyTablet": "MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MIDTablet": "M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MSITablet": "MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SMiTTablet": "Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "RockChipTablet": "Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "FlyTablet": "IQ310|Fly Vision", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "bqTablet": "Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris E10)|Maxwell.*Lite|Maxwell.*Plus", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "HuaweiTablet": "MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NecTablet": "\\bN-06D|\\bN-08D", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PantechTablet": "Pantech.*P4100", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BronchoTablet": "Broncho.*(N701|N708|N802|a710)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "VersusTablet": "TOUCHPAD.*[78910]|\\bTOUCHTAB\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ZyncTablet": "z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PositivoTablet": "TB07STA|TB10STA|TB07FTA|TB10FTA", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NabiTablet": "Android.*\\bNabi", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "KoboTablet": "Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DanewTablet": "DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TexetTablet": "NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PlaystationTablet": "Playstation.*(Portable|Vita)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TrekstorTablet": "ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PyleAudioTablet": "\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AdvanTablet": "Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DanyTechTablet": "Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "GalapadTablet": "Android.*\\bG1\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MicromaxTablet": "Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "KarbonnTablet": "Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AllFineTablet": "Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PROSCANTablet": "\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "YONESTablet": "BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ChangJiaTablet": "TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "GUTablet": "TX-A1301|TX-M9002|Q702|kf026", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PointOfViewTablet": "TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "OvermaxTablet": "OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "HCLTablet": "HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DPSTablet": "DPS Dream 9|DPS Dual 7", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "VistureTablet": "V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CrestaTablet": "CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MediatekTablet": "\\bMT8125|MT8389|MT8135|MT8377\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ConcordeTablet": "Concorde([ ]+)?Tab|ConCorde ReadMan", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "GoCleverTablet": "GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ModecomTablet": "FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "VoninoTablet": "\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ECSTablet": "V07OT2|TM105A|S10OT1|TR10CS1", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "StorexTablet": "eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "VodafoneTablet": "SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "EssentielBTablet": "Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "RossMoorTablet": "RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iMobileTablet": "i-mobile i-note", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TolinoTablet": "tolino tab [0-9.]+|tolino shine", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AudioSonicTablet": "\\bC-22Q|T7-QC|T-17B|T-17P\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AMPETablet": "Android.* A78 ", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SkkTablet": "Android.* (SKYPAD|PHOENIX|CYCLOPS)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TecnoTablet": "TECNO P9", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "JXDTablet": "Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iJoyTablet": "Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "FX2Tablet": "FX2 PAD7|FX2 PAD10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "XoroTablet": "KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ViewsonicTablet": "ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "OdysTablet": "LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CaptivaTablet": "CAPTIVA PAD", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IconbitTablet": "NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TeclastTablet": "T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "OndaTablet": "\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "JaytechTablet": "TPC-PA762", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlaupunktTablet": "Endeavour 800NG|Endeavour 1010", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DigmaTablet": "\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "EvolioTablet": "ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "LavaTablet": "QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "AocTablet": "MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MpmanTablet": "MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CelkonTablet": "CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "WolderTablet": "miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MiTablet": "\\bMI PAD\\b|\\bHM NOTE 1W\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NibiruTablet": "Nibiru M1|Nibiru Jupiter One", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NexoTablet": "NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "LeaderTablet": "TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "UbislateTablet": "UbiSlate[\\s]?7C", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PocketBookTablet": "Pocketbook", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "KocasoTablet": "\\b(TB-1207)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Hudl": "Hudl HT7S3|Hudl 2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TelstraTablet": "T-Hub2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "GenericTablet": "Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bJolla\\b|\\bTP750\\b" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~ "oss": { - ~~~~~~~~~~~~ "AndroidOS": "Android", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerryOS": "blackberry|\\bBB10\\b|rim tablet os", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PalmOS": "PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "SymbianOS": "Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\bS60\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "WindowsMobileOS": "Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "WindowsPhoneOS": "Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iOS": "\\biPhone.*Mobile|\\biPod|\\biPad", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MeeGoOS": "MeeGo", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MaemoOS": "Maemo", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "JavaOS": "J2ME\/|\\bMIDP\\b|\\bCLDC\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "webOS": "webOS|hpwOS", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "badaOS": "\\bBada\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BREWOS": "BREW" - ~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~ "uas": { - ~~~~~~~~~~~~ "Vivaldi": "Vivaldi", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Chrome": "\\bCrMo\\b|CriOS|Android.*Chrome\/[.0-9]* (Mobile)?", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Dolfin": "\\bDolfin\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Opera": "Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\/[0-9.]+|Coast\/[0-9.]+", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Skyfire": "Skyfire", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Edge": "Mobile Safari\/[.0-9]* Edge", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IE": "IEMobile|MSIEMobile", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Firefox": "fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Bolt": "bolt", - ~~~~~~~~~~~~~~~~~~~~~~~ "TeaShark": "teashark", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Blazer": "Blazer", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Safari": "Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Tizen": "Tizen", - ~~~~~~~~~~~~~~~~~~~~~~~~~ "UCBrowser": "UC.*Browser|UCWEB", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "baiduboxapp": "baiduboxapp", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "baidubrowser": "baidubrowser", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DiigoBrowser": "DiigoBrowser", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Puffin": "Puffin", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Mercury": "\\bMercury\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "ObigoBrowser": "Obigo", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NetFront": "NF-Browser", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "GenericBrowser": "NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PaleMoon": "Android.*PaleMoon|Mobile.*PaleMoon" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~ "props": { - ~~~~~~~~~~~~~~ "Mobile": "Mobile\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Build": "Build\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Version": "Version\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "VendorID": "VendorID\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iPad": "iPad.*CPU[a-z ]+[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iPhone": "iPhone.*CPU[a-z ]+[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iPod": "iPod.*CPU[a-z ]+[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Kindle": "Kindle\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Chrome": [ - ~~~~~~~~~~~~~~~~~~~ "Chrome\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CriOS\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "CrMo\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "Coast": [ - ~~~~~~~~~~~~~~~~~~ "Coast\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "Dolfin": "Dolfin\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Firefox": "Firefox\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Fennec": "Fennec\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Edge": "Edge\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IE": [ - ~~~~~~~~~~~~~~~ "IEMobile\/[VER];", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "IEMobile [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MSIE [VER];", - ~~~~~~~~~~~~~~~~~~~~~~~~~~ "Trident\/[0-9.]+;.*rv:[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "NetFront": "NetFront\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "NokiaBrowser": "NokiaBrowser\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Opera": [ - ~~~~~~~~~~~~~~~~~~ " OPR\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~ "Opera Mini\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Version\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "Opera Mini": "Opera Mini\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Opera Mobi": "Version\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "UC Browser": "UC Browser[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MQQBrowser": "MQQBrowser\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MicroMessenger": "MicroMessenger\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "baiduboxapp": "baiduboxapp\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "baidubrowser": "baidubrowser\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Iron": "Iron\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Safari": [ - ~~~~~~~~~~~~~~~~~~~ "Version\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Safari\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "Skyfire": "Skyfire\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Tizen": "Tizen\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Webkit": "webkit[ \/][VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "PaleMoon": "PaleMoon\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Gecko": "Gecko\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Trident": "Trident\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Presto": "Presto\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Goanna": "Goanna\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "iOS": " \\bi?OS\\b [VER][ ;]{1}", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Android": "Android [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerry": [ - ~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerry[\\w]+\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "BlackBerry.*Version\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Version\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "BREW": "BREW [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Java": "Java\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Windows Phone OS": [ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Windows Phone OS [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Windows Phone [VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "Windows Phone": "Windows Phone [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Windows CE": "Windows CE\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Windows NT": "Windows NT [VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Symbian": [ - ~~~~~~~~~~~~~~~~~~~~ "SymbianOS\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Symbian\/[VER]" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ], - ~~~~~~~~~~ "webOS": [ - ~~~~~~~~~~~~~~~~~~ "webOS\/[VER]", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "hpwOS\/[VER];" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ] - ~~~~~~~~~ }, - ~~~~~~ "utils": { - ~~~~~~~~~~~~~~ "Bot": "Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MobileBot": "Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker\/M1A1-R2D2", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DesktopMode": "WPDesktop", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "TV": "SonyDTV|HbbTV", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "WebKit": "(webkit)[ \/]([\\w.]+)", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Console": "\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|PLAYSTATION|Xbox)\\b", - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Watch": "SM-V700" - ~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ }; - ~~ - // following patterns come from http://detectmobilebrowsers.com/ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ impl.detectMobileBrowsers = { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'detectMobileBrowsers' does not exist on type '{}'. fullPattern: /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ shortPattern: /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tabletPattern: /android|ipad|playbook|silk/i - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - var hasOwnProp = Object.prototype.hasOwnProperty, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ isArray; - ~~~~~~~~~~~~~~~~ - impl.FALLBACK_PHONE = 'UnknownPhone'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_PHONE' does not exist on type '{}'. impl.FALLBACK_TABLET = 'UnknownTablet'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_TABLET' does not exist on type '{}'. impl.FALLBACK_MOBILE = 'UnknownMobile'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_MOBILE' does not exist on type '{}'. - isArray = ('isArray' in Array) ? - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Array.isArray : function (value) { return Object.prototype.toString.call(value) === '[object Array]'; }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - function equalIC(a, b) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return a != null && b != null && a.toLowerCase() === b.toLowerCase(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ - function containsIC(array, value) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var valueLC, i, len = array.length; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (!len || !value) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return false; - ~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ valueLC = value.toLowerCase(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (i = 0; i < len; ++i) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (valueLC === array[i].toLowerCase()) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return true; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ return false; - ~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ - function convertPropsToRegExp(object) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (var key in object) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (hasOwnProp.call(object, key)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ object[key] = new RegExp(object[key], 'i'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ } - ~~~~~ - (function init() { - ~~~~~~~~~~~~~~~~~~~~~~ var key, values, value, i, len, verPos, mobileDetectRules = impl.mobileDetectRules; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. for (key in mobileDetectRules.props) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (hasOwnProp.call(mobileDetectRules.props, key)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ values = mobileDetectRules.props[key]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (!isArray(values)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ values = [values]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~ len = values.length; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (i = 0; i < len; ++i) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ value = values[i]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ verPos = value.indexOf('[VER]'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (verPos >= 0) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ value = value.substring(0, verPos) + '([\\w._\\+]+)' + value.substring(verPos + 5); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~~~~~ values[i] = new RegExp(value, 'i'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~ mobileDetectRules.props[key] = values; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ convertPropsToRegExp(mobileDetectRules.oss); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ convertPropsToRegExp(mobileDetectRules.phones); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ convertPropsToRegExp(mobileDetectRules.tablets); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ convertPropsToRegExp(mobileDetectRules.uas); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ convertPropsToRegExp(mobileDetectRules.utils); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // copy some patterns to oss0 which are tested first (see issue#15) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mobileDetectRules.oss0 = { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WindowsPhoneOS: mobileDetectRules.oss.WindowsPhoneOS, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WindowsMobileOS: mobileDetectRules.oss.WindowsMobileOS - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~~~~~ }()); - ~~~~~~~~~ - /** - ~~~~~~~ * Test userAgent string against a set of rules and find the first matched key. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {Object} rules (key is String, value is RegExp) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent'). - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @returns {String|null} the matched key if found, otherwise null - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @private - ~~~~~~~~~~~~~~~ */ - ~~~~~~~ impl.findMatch = function(rules, userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. for (var key in rules) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (hasOwnProp.call(rules, key)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (rules[key].test(userAgent)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return key; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ return null; - ~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - /** - ~~~~~~~ * Test userAgent string against a set of rules and return an array of matched keys. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {Object} rules (key is String, value is RegExp) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent'). - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @returns {Array} an array of matched keys, may be empty when there is no match, but not null - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @private - ~~~~~~~~~~~~~~~ */ - ~~~~~~~ impl.findMatches = function(rules, userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2339: Property 'findMatches' does not exist on type '{}'. var result = []; - ~~~~~~~~~~~~~~~~~~~~~~~~ for (var key in rules) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (hasOwnProp.call(rules, key)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (rules[key].test(userAgent)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ result.push(key); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ return result; - ~~~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - /** - ~~~~~~~ * Check the version of the given property in the User-Agent. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~ * @param {String} propertyName - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {String} userAgent - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @return {String} version or null if version not found - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @private - ~~~~~~~~~~~~~~~ */ - ~~~~~~~ impl.getVersionStr = function (propertyName, userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ !!! error TS2339: Property 'getVersionStr' does not exist on type '{}'. var props = impl.mobileDetectRules.props, patterns, i, len, match; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. if (hasOwnProp.call(props, propertyName)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ patterns = props[propertyName]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ len = patterns.length; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for (i = 0; i < len; ++i) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ match = patterns[i].exec(userAgent); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (match !== null) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return match[1]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } - ~~~~~~~~~ return null; - ~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - /** - ~~~~~~~ * Check the version of the given property in the User-Agent. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~ * @param {String} propertyName - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {String} userAgent - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @return {Number} version or NaN if version not found - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @private - ~~~~~~~~~~~~~~~ */ - ~~~~~~~ impl.getVersion = function (propertyName, userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ !!! error TS2339: Property 'getVersion' does not exist on type '{}'. var version = impl.getVersionStr(propertyName, userAgent); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ !!! error TS2339: Property 'getVersionStr' does not exist on type '{}'. return version ? impl.prepareVersionNo(version) : NaN; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareVersionNo' does not exist on type '{}'. }; - ~~~~~~ - /** - ~~~~~~~ * Prepare the version number. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~ * @param {String} version - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @return {Number} the version number as a floating number - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @private - ~~~~~~~~~~~~~~~ */ - ~~~~~~~ impl.prepareVersionNo = function (version) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareVersionNo' does not exist on type '{}'. var numbers; - ~~~~~~~~~~~~~~~~~~~~ - numbers = version.split(/[a-z._ \/\-]/i); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (numbers.length === 1) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ version = numbers[0]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ if (numbers.length > 1) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ version = numbers[0] + '.'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ numbers.shift(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ version += numbers.join(''); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ return Number(version); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - impl.isMobileFallback = function (userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'isMobileFallback' does not exist on type '{}'. return impl.detectMobileBrowsers.fullPattern.test(userAgent) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'detectMobileBrowsers' does not exist on type '{}'. impl.detectMobileBrowsers.shortPattern.test(userAgent.substr(0,4)); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'detectMobileBrowsers' does not exist on type '{}'. }; - ~~~~~~ - impl.isTabletFallback = function (userAgent) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'isTabletFallback' does not exist on type '{}'. return impl.detectMobileBrowsers.tabletPattern.test(userAgent); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'detectMobileBrowsers' does not exist on type '{}'. }; - ~~~~~~ - impl.prepareDetectionCache = function (cache, userAgent, maxPhoneWidth) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareDetectionCache' does not exist on type '{}'. if (cache.mobile !== undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return; - ~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ var phone, tablet, phoneSized; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // first check for stronger tablet rules, then phone (see issue#5) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tablet = impl.findMatch(impl.mobileDetectRules.tablets, userAgent); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. if (tablet) { - ~~~~~~~~~~~~~~~~~~~~~ cache.mobile = cache.tablet = tablet; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cache.phone = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return; // unambiguously identified as tablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ - phone = impl.findMatch(impl.mobileDetectRules.phones, userAgent); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. if (phone) { - ~~~~~~~~~~~~~~~~~~~~ cache.mobile = cache.phone = phone; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cache.tablet = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return; // unambiguously identified as phone - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ - // our rules haven't found a match -> try more general fallback rules - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (impl.isMobileFallback(userAgent)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'isMobileFallback' does not exist on type '{}'. phoneSized = MobileDetect.isPhoneSized(maxPhoneWidth); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ !!! error TS2339: Property 'isPhoneSized' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. if (phoneSized === undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cache.mobile = impl.FALLBACK_MOBILE; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_MOBILE' does not exist on type '{}'. cache.tablet = cache.phone = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } else if (phoneSized) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cache.mobile = cache.phone = impl.FALLBACK_PHONE; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_PHONE' does not exist on type '{}'. cache.tablet = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } else { - ~~~~~~~~~~~~~~~~~~~~ cache.mobile = cache.tablet = impl.FALLBACK_TABLET; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_TABLET' does not exist on type '{}'. cache.phone = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ } else if (impl.isTabletFallback(userAgent)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'isTabletFallback' does not exist on type '{}'. cache.mobile = cache.tablet = impl.FALLBACK_TABLET; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'FALLBACK_TABLET' does not exist on type '{}'. cache.phone = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } else { - ~~~~~~~~~~~~~~~~ // not mobile at all! - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cache.mobile = cache.tablet = cache.phone = null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ }; - ~~~~~~ - // t is a reference to a MobileDetect instance - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ impl.mobileGrade = function (t) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2339: Property 'mobileGrade' does not exist on type '{}'. // impl note: - ~~~~~~~~~~~~~~~~~~~~~ // To keep in sync w/ Mobile_Detect.php easily, the following code is tightly aligned to the PHP version. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // When changes are made in Mobile_Detect.php, copy this method and replace: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // $this-> / t. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // self::MOBILE_GRADE_(.) / '$1' - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // , self::VERSION_TYPE_FLOAT / (nothing) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // isIOS() / os('iOS') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // [reg] / (nothing) <-- jsdelivr complaining about unescaped unicode character U+00AE - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var $isMobile = t.mobile() !== null; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if ( - ~~~~~~~~~~~~ // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.os('iOS') && t.version('iPad')>=4.3 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.os('iOS') && t.version('iPhone')>=3.1 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.os('iOS') && t.version('iPod')>=3.1 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.version('Android')>2.1 && t.is('Webkit') ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Windows Phone OS')>=7.0 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Blackberry 7 - Tested on BlackBerry Torch 9810 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('BlackBerry') && t.version('BlackBerry')>=6.0 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Blackberry Playbook (1.0-2.0) - Tested on PlayBook - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.match('Playbook.*Tablet') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.version('webOS')>=1.4 && t.match('Palm|Pre|Pixi') ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Palm WebOS 3.0 - Tested on HP TouchPad - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.match('hp.*TouchPad') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Firefox Mobile (12 Beta) - Tested on Android 2.3 device - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.is('Firefox') && t.version('Firefox')>=12 ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Chrome for Android - Tested on Android 4.0, 4.1 device - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.is('Chrome') && t.is('AndroidOS') && t.version('Android')>=4.0 ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Skyfire 4.1 - Tested on Android 2.3 device - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.is('Skyfire') && t.version('Skyfire')>=4.1 && t.is('AndroidOS') && t.version('Android')>=2.3 ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Opera Mobile 11.5-12: Tested on Android 2.3 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.is('Opera') && t.version('Opera Mobi')>11 && t.is('AndroidOS') ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Meego 1.2 - Tested on Nokia 950 and N9 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('MeeGoOS') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Tizen (pre-release) - Tested on early hardware - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('Tizen') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @todo: more tests here! - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('Dolfin') && t.version('Bada')>=2.0 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // UC Browser - Tested on Android 2.3 device - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( (t.is('UC Browser') || t.is('Dolfin')) && t.version('Android')>=2.3 ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Kindle 3 and Fire - Tested on the built-in WebKit browser for each - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.match('Kindle Fire') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('Kindle') && t.version('Kindle')>=3.0 ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('AndroidOS') && t.is('NookTablet') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Chrome')>=11 && !$isMobile || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Safari')>=5.0 && !$isMobile || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Firefox')>=4.0 && !$isMobile || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('MSIE')>=7.0 && !$isMobile || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @reference: http://my.opera.com/community/openweb/idopera/ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Opera')>=10 && !$isMobile - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ){ - ~~~~~~~~~~~~~~ return 'A'; - ~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ - if ( - ~~~~~~~~~~~~ t.os('iOS') && t.version('iPad')<4.3 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.os('iOS') && t.version('iPhone')<3.1 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.os('iOS') && t.version('iPod')<3.1 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.is('Blackberry') && t.version('BlackBerry')>=5 && t.version('BlackBerry')<6 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( t.version('Opera Mini')>=5.0 && t.version('Opera Mini')<=6.5 && - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (t.version('Android')>=2.3 || t.is('iOS')) ) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // @todo: report this (tested on Nokia N71) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('Opera Mobi')>=11 && t.is('SymbianOS') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ){ - ~~~~~~~~~~~~~~ return 'B'; - ~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ - if ( - ~~~~~~~~~~~~ // Blackberry 4.x - Tested on the Curve 8330 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.version('BlackBerry')<5.0 || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ t.match('MSIEMobile|Windows CE.*Mobile') || t.version('Windows Mobile')<=5.2 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ){ - ~~~~~~~~~~~~~~ return 'C'; - ~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ - //All older smartphone platforms and featurephones - Any device that doesn't support media queries - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //will receive the basic, C grade experience. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return 'C'; - ~~~~~~~~~~~~~~~~~~~ }; - ~~~~~~ - impl.detectOS = function (ua) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ !!! error TS2339: Property 'detectOS' does not exist on type '{}'. return impl.findMatch(impl.mobileDetectRules.oss0, ua) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. impl.findMatch(impl.mobileDetectRules.oss, ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. }; - ~~~~~~ - impl.getDeviceSmallerSide = function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'getDeviceSmallerSide' does not exist on type '{}'. return window.screen.width < window.screen.height ? - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. ~~~~~~ !!! error TS2304: Cannot find name 'window'. window.screen.width : - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. window.screen.height; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. }; - ~~~~~~ - /** - ~~~~~~~ * Constructor for MobileDetect object. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~ * Such an object will keep a reference to the given user-agent string and cache most of the detect queries.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~ * - ~~~~~~ * @example
-    ~~~~~~~~~~~~~~~~~~~~~
          *     var md = new MobileDetect(window.navigator.userAgent);
-    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          *     if (md.mobile()) {
-    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          *         location.href = (md.mobileGrade() === 'A') ? '/mobile/' : '/lynx/';
-    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          *     }
-    ~~~~~~~~~~~~
          * 
- ~~~~~~~~~~~~~ * - ~~~~~~ * @param {string} userAgent typically taken from window.navigator.userAgent or http_header['User-Agent'] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {number} [maxPhoneWidth=600] only for browsers specify a value for the maximum - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * width of smallest device side (in logical "CSS" pixels) until a device detected as mobile will be handled - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * as phone. - ~~~~~~~~~~~~~~~~~~~~~~~ * This is only used in cases where the device cannot be classified as phone or tablet.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * See Declaring Tablet Layouts - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * for Android.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * If you provide a value < 0, then this "fuzzy" check is disabled. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @constructor - ~~~~~~~~~~~~~~~~~~~ * @global - ~~~~~~~~~~~~~~ */ - ~~~~~~~ function MobileDetect(userAgent, maxPhoneWidth) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this.ua = userAgent || ''; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this._cache = {}; - ~~~~~~~~~~~~~~~~~~~~~~~~~ //600dp is typical 7" tablet minimum width - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this.maxPhoneWidth = maxPhoneWidth || 600; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ - MobileDetect.prototype = { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ constructor: MobileDetect, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the detected phone or tablet type or null if it is not a mobile device. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * For a list of possible return values see {@link MobileDetect#phone} and {@link MobileDetect#tablet}.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * the patterns of detectmobilebrowsers.com. If this test - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * is positive, a value of UnknownPhone, UnknownTablet or - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * UnknownMobile is returned.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * When used server-side (node.js), there is no way to tell the difference between UnknownTablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * and UnknownMobile, so you will get UnknownMobile here.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * In most cases you will use the return value just as a boolean. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the key for the phone family or tablet family, e.g. "Nexus". - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#mobile - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ mobile: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareDetectionCache' does not exist on type '{}'. return this._cache.mobile; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the detected phone type/family string or null. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * The returned tablet (family or producer) is one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
iPhone, BlackBerry, HTC, Nexus, Dell, Motorola, Samsung, LG, Sony, Asus, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * NokiaLumia, Micromax, Palm, Vertu, Pantech, Fly, Wiko, iMobile, SimValley, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Wolfgang, Alcatel, Nintendo, Amoi, INQ, GenericPhone
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * the patterns of detectmobilebrowsers.com. If this test - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * is positive, a value of UnknownPhone or UnknownMobile is returned.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * When used server-side (node.js), there is no way to tell the difference between UnknownTablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * and UnknownMobile, so you will get null here, while {@link MobileDetect#mobile} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * will return UnknownMobile.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * In most cases you will use the return value just as a boolean. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the key of the phone family or producer, e.g. "iPhone" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#phone - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ phone: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareDetectionCache' does not exist on type '{}'. return this._cache.phone; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the detected tablet type/family string or null. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * The returned tablet (family or producer) is one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
iPad, NexusTablet, SamsungTablet, Kindle, SurfaceTablet, HPTablet, AsusTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BlackBerryTablet, HTCtablet, MotorolaTablet, NookTablet, AcerTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ToshibaTablet, LGTablet, FujitsuTablet, PrestigioTablet, LenovoTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * DellTablet, YarvikTablet, MedionTablet, ArnovaTablet, IntensoTablet, IRUTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * MegafonTablet, EbodaTablet, AllViewTablet, ArchosTablet, AinolTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * NokiaLumiaTablet, SonyTablet, PhilipsTablet, CubeTablet, CobyTablet, MIDTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * MSITablet, SMiTTablet, RockChipTablet, FlyTablet, bqTablet, HuaweiTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * NecTablet, PantechTablet, BronchoTablet, VersusTablet, ZyncTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * PositivoTablet, NabiTablet, KoboTablet, DanewTablet, TexetTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * PlaystationTablet, TrekstorTablet, PyleAudioTablet, AdvanTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * DanyTechTablet, GalapadTablet, MicromaxTablet, KarbonnTablet, AllFineTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * PROSCANTablet, YONESTablet, ChangJiaTablet, GUTablet, PointOfViewTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * OvermaxTablet, HCLTablet, DPSTablet, VistureTablet, CrestaTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * MediatekTablet, ConcordeTablet, GoCleverTablet, ModecomTablet, VoninoTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ECSTablet, StorexTablet, VodafoneTablet, EssentielBTablet, RossMoorTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * iMobileTablet, TolinoTablet, AudioSonicTablet, AMPETablet, SkkTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * TecnoTablet, JXDTablet, iJoyTablet, FX2Tablet, XoroTablet, ViewsonicTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * OdysTablet, CaptivaTablet, IconbitTablet, TeclastTablet, OndaTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * JaytechTablet, BlaupunktTablet, DigmaTablet, EvolioTablet, LavaTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * AocTablet, MpmanTablet, CelkonTablet, WolderTablet, MiTablet, NibiruTablet, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * NexoTablet, LeaderTablet, UbislateTablet, PocketBookTablet, KocasoTablet, Hudl, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * TelstraTablet, GenericTablet
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * the patterns of detectmobilebrowsers.com. If this test - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * is positive, a value of UnknownTablet or UnknownMobile is returned.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * When used server-side (node.js), there is no way to tell the difference between UnknownTablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * and UnknownMobile, so you will get null here, while {@link MobileDetect#mobile} - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * will return UnknownMobile.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * In most cases you will use the return value just as a boolean. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the key of the tablet family or producer, e.g. "SamsungTablet" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#tablet - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ tablet: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'prepareDetectionCache' does not exist on type '{}'. return this._cache.tablet; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the (first) detected user-agent string or null. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * The returned user-agent is one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
Vivaldi, Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Blazer, Safari, Tizen, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Puffin, Mercury, ObigoBrowser, NetFront, GenericBrowser, PaleMoon
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * cases where a mobile device pretends to be more than one particular browser. You can get the - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * providing one of the defined keys as first argument to {@link MobileDetect#is}. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the key for the detected user-agent or null - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#userAgent - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ userAgent: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (this._cache.userAgent === undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this._cache.userAgent = impl.findMatch(impl.mobileDetectRules.uas, this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ !!! error TS2339: Property 'findMatch' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. } - ~~~~~~~~~~~~~ return this._cache.userAgent; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns all detected user-agent strings. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * The array is empty or contains one or more of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
Vivaldi, Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Blazer, Safari, Tizen, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Puffin, Mercury, ObigoBrowser, NetFront, GenericBrowser, PaleMoon
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * cases where a mobile device pretends to be more than one particular browser. You can get the - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * providing one of the defined keys as first argument to {@link MobileDetect#is}. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {Array} the array of detected user-agent keys or [] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#userAgents - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ userAgents: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (this._cache.userAgents === undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this._cache.userAgents = impl.findMatches(impl.mobileDetectRules.uas, this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2339: Property 'findMatches' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. } - ~~~~~~~~~~~~~ return this._cache.userAgents; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the detected operating system string or null. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * The operating system is one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
AndroidOS, BlackBerryOS, PalmOS, SymbianOS, WindowsMobileOS, WindowsPhoneOS, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * iOS, MeeGoOS, MaemoOS, JavaOS, webOS, badaOS, BREWOS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the key for the detected operating system. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#os - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ os: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~ if (this._cache.os === undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this._cache.os = impl.detectOS(this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ !!! error TS2339: Property 'detectOS' does not exist on type '{}'. } - ~~~~~~~~~~~~~ return this._cache.os; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Get the version (as Number) of the given property in the User-Agent. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @param {String} key a key defining a thing which has a version.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * You can use one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Opera Mobi, UC Browser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon, Gecko, Trident, Presto, Goanna, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * iOS, Android, BlackBerry, BREW, Java, Windows Phone OS, Windows Phone, Windows - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * CE, Windows NT, Symbian, webOS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {Number} the version as float or NaN if User-Agent doesn't contain this version. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Be careful when comparing this value with '==' operator! - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#version - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ version: function (key) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return impl.getVersion(key, this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ !!! error TS2339: Property 'getVersion' does not exist on type '{}'. }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Get the version (as String) of the given property in the User-Agent. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @param {String} key a key defining a thing which has a version.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * You can use one of following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Opera Mobi, UC Browser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon, Gecko, Trident, Presto, Goanna, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * iOS, Android, BlackBerry, BREW, Java, Windows Phone OS, Windows Phone, Windows - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * CE, Windows NT, Symbian, webOS
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} the "raw" version as String or null if User-Agent doesn't contain this version. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @function MobileDetect#versionStr - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ versionStr: function (key) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return impl.getVersionStr(key, this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~ !!! error TS2339: Property 'getVersionStr' does not exist on type '{}'. }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Global test key against userAgent, os, phone, tablet and some other properties of userAgent string. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @param {String} key the key (case-insensitive) of a userAgent, an operating system, phone or - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * tablet family.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * For a complete list of possible values, see {@link MobileDetect#userAgent}, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * {@link MobileDetect#os}, {@link MobileDetect#phone}, {@link MobileDetect#tablet}.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Additionally you have following keys:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
Bot, MobileBot, DesktopMode, TV, WebKit, Console, Watch
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {boolean} true when the given key is one of the defined keys of userAgent, os, phone, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * tablet or one of the listed additional keys, otherwise false - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#is - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ is: function (key) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return containsIC(this.userAgents(), key) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ equalIC(key, this.os()) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ equalIC(key, this.phone()) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ equalIC(key, this.tablet()) || - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2339: Property 'findMatches' does not exist on type '{}'. ~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'mobileDetectRules' does not exist on type '{}'. }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Do a quick test against navigator::userAgent. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @param {String|RegExp} pattern the pattern, either as String or RegExp - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * (a string will be converted to a case-insensitive RegExp). - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @returns {boolean} true when the pattern matches, otherwise false - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#match - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ match: function (pattern) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (!(pattern instanceof RegExp)) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pattern = new RegExp(pattern, 'i'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~~~~~ return pattern.test(this.ua); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Checks whether the mobile device can be considered as phone regarding screen.width. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
- ~~~~~~~~~~~~~~~ * Obviously this method makes sense in browser environments only (not for Node.js)! - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @param {number} [maxPhoneWidth] the maximum logical pixels (aka. CSS-pixels) to be considered as phone.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The argument is optional and if not present or falsy, the value of the constructor is taken. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @returns {boolean|undefined} undefined if screen size wasn't detectable, else true - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * when screen.width is less or equal to maxPhoneWidth, otherwise false.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Will always return undefined server-side. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ isPhoneSized: function (maxPhoneWidth) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ !!! error TS2339: Property 'isPhoneSized' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. }, - ~~~~~~~~~~ - /** - ~~~~~~~~~~~ * Returns the mobile grade ('A', 'B', 'C'). - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - ~~~~~~~~~~ * @returns {String} one of the mobile grades ('A', 'B', 'C'). - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @function MobileDetect#mobileGrade - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ - ~~~~~~~~~~~ mobileGrade: function () { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (this._cache.grade === undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ this._cache.grade = impl.mobileGrade(this); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ !!! error TS2339: Property 'mobileGrade' does not exist on type '{}'. } - ~~~~~~~~~~~~~ return this._cache.grade; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~~~~~ }; - ~~~~~~ - // environment-dependent - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if (typeof window !== 'undefined' && window.screen) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. ~~~~~~ !!! error TS2304: Cannot find name 'window'. MobileDetect.isPhoneSized = function (maxPhoneWidth) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ !!! error TS2339: Property 'isPhoneSized' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. return maxPhoneWidth < 0 ? undefined : impl.getDeviceSmallerSide() <= maxPhoneWidth; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ !!! error TS2339: Property 'getDeviceSmallerSide' does not exist on type '{}'. }; - ~~~~~~~~~~ } else { - ~~~~~~~~~~~~ MobileDetect.isPhoneSized = function () {}; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~ !!! error TS2339: Property 'isPhoneSized' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. } - ~~~~~ - // should not be replaced by a completely new object - just overwrite existing methods - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MobileDetect._impl = impl; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ !!! error TS2339: Property '_impl' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. - ~~~~ MobileDetect.version = '1.3.3 2016-07-31'; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ !!! error TS2339: Property 'version' does not exist on type '(userAgent: any, maxPhoneWidth: any) => void'. - return MobileDetect; - ~~~~~~~~~~~~~~~~~~~~~~~~ }); // end of call of define() - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ })((function (undefined) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~ if (typeof module !== 'undefined' && module.exports) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'module'. ~~~~~~ !!! error TS2304: Cannot find name 'module'. return function (factory) { module.exports = factory(); }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'module'. } else if (typeof define === 'function' && define.amd) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'define'. ~~~~~~ !!! error TS2304: Cannot find name 'define'. return define; - ~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'define'. } else if (typeof window !== 'undefined') { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. return function (factory) { window.MobileDetect = factory(); }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS2304: Cannot find name 'window'. } else { - ~~~~~~~~~~~~ - ~~~~~~~~~~~~ // please file a bug if you get this error! - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ throw new Error('unknown environment'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~~~~~ - ~~~~~ - })()); - ~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - ~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file + })()); \ No newline at end of file From d0aa306961e5c8b4479d180bd2360dd5ac5c0444 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 7 Jan 2017 15:16:26 -0800 Subject: [PATCH 235/289] Add tests --- .../reference/contextuallyTypedIife.js | 6 + .../reference/contextuallyTypedIife.symbols | 11 + .../reference/contextuallyTypedIife.types | 19 ++ .../reference/contextuallyTypedIifeStrict.js | 110 +++++++ .../contextuallyTypedIifeStrict.symbols | 132 +++++++++ .../contextuallyTypedIifeStrict.types | 271 ++++++++++++++++++ .../functions/contextuallyTypedIife.ts | 3 + .../functions/contextuallyTypedIifeStrict.ts | 33 +++ 8 files changed, 585 insertions(+) create mode 100644 tests/baselines/reference/contextuallyTypedIifeStrict.js create mode 100644 tests/baselines/reference/contextuallyTypedIifeStrict.symbols create mode 100644 tests/baselines/reference/contextuallyTypedIifeStrict.types create mode 100644 tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts diff --git a/tests/baselines/reference/contextuallyTypedIife.js b/tests/baselines/reference/contextuallyTypedIife.js index d2eaaf9c2d5..0f3315d66a2 100644 --- a/tests/baselines/reference/contextuallyTypedIife.js +++ b/tests/baselines/reference/contextuallyTypedIife.js @@ -28,6 +28,9 @@ // contextually typed parameters. let twelve = (f => f(12))(i => i); let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +// missing arguments +(function(x, undefined) { return x; })(42); +((x, y, z) => 42)(); //// [contextuallyTypedIife.js] @@ -102,3 +105,6 @@ let eleven = (o => o.a(11))({ a: function(n) { return n; } }); // contextually typed parameters. var twelve = (function (f) { return f(12); })(function (i) { return i; }); var eleven = (function (o) { return o.a(11); })({ a: function (n) { return n; } }); +// missing arguments +(function (x, undefined) { return x; })(42); +(function (x, y, z) { return 42; })(); diff --git a/tests/baselines/reference/contextuallyTypedIife.symbols b/tests/baselines/reference/contextuallyTypedIife.symbols index 4512b4db8a2..7a73beaad16 100644 --- a/tests/baselines/reference/contextuallyTypedIife.symbols +++ b/tests/baselines/reference/contextuallyTypedIife.symbols @@ -119,3 +119,14 @@ let eleven = (o => o.a(11))({ a: function(n) { return n; } }); >n : Symbol(n, Decl(contextuallyTypedIife.ts, 28, 42)) >n : Symbol(n, Decl(contextuallyTypedIife.ts, 28, 42)) +// missing arguments +(function(x, undefined) { return x; })(42); +>x : Symbol(x, Decl(contextuallyTypedIife.ts, 30, 10)) +>undefined : Symbol(undefined, Decl(contextuallyTypedIife.ts, 30, 12)) +>x : Symbol(x, Decl(contextuallyTypedIife.ts, 30, 10)) + +((x, y, z) => 42)(); +>x : Symbol(x, Decl(contextuallyTypedIife.ts, 31, 2)) +>y : Symbol(y, Decl(contextuallyTypedIife.ts, 31, 4)) +>z : Symbol(z, Decl(contextuallyTypedIife.ts, 31, 7)) + diff --git a/tests/baselines/reference/contextuallyTypedIife.types b/tests/baselines/reference/contextuallyTypedIife.types index e6f41265e9a..15038e7dd26 100644 --- a/tests/baselines/reference/contextuallyTypedIife.types +++ b/tests/baselines/reference/contextuallyTypedIife.types @@ -250,3 +250,22 @@ let eleven = (o => o.a(11))({ a: function(n) { return n; } }); >n : any >n : any +// missing arguments +(function(x, undefined) { return x; })(42); +>(function(x, undefined) { return x; })(42) : number +>(function(x, undefined) { return x; }) : (x: number, undefined: any) => number +>function(x, undefined) { return x; } : (x: number, undefined: any) => number +>x : number +>undefined : any +>x : number +>42 : 42 + +((x, y, z) => 42)(); +>((x, y, z) => 42)() : number +>((x, y, z) => 42) : (x: any, y: any, z: any) => number +>(x, y, z) => 42 : (x: any, y: any, z: any) => number +>x : any +>y : any +>z : any +>42 : 42 + diff --git a/tests/baselines/reference/contextuallyTypedIifeStrict.js b/tests/baselines/reference/contextuallyTypedIifeStrict.js new file mode 100644 index 00000000000..c5455ab84c8 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIifeStrict.js @@ -0,0 +1,110 @@ +//// [contextuallyTypedIifeStrict.ts] +// arrow +(jake => { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +((((function (y) { }))))("-"); +// multiple arguments +((a, b, c) => { })("foo", 101, false); +// default parameters +((m = 10) => m + 1)(12); +((n = 10) => n + 1)(); +// optional parameters +((j?) => j + 1)(12); +((k?) => k + 1)(); +((l, o?) => l + o)(12); // o should be any +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +((...noNumbers) => noNumbers.some(n => n > 0))(); +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +(({ p = 14 }) => p)({ p : 15 }); +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +(({ u = 22 } = { u: 23 }) => u)(); +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +// missing arguments +(function(x, undefined) { return x; })(42); +((x, y, z) => 42)(); + + +//// [contextuallyTypedIifeStrict.js] +// arrow +(function (jake) { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { }("!")); +((((function (y) { }))))("-"); +// multiple arguments +(function (a, b, c) { })("foo", 101, false); +// default parameters +(function (m) { + if (m === void 0) { m = 10; } + return m + 1; +})(12); +(function (n) { + if (n === void 0) { n = 10; } + return n + 1; +})(); +// optional parameters +(function (j) { return j + 1; })(12); +(function (k) { return k + 1; })(); +(function (l, o) { return l + o; })(12); // o should be any +// rest parameters +(function () { + var numbers = []; + for (var _i = 0; _i < arguments.length; _i++) { + numbers[_i] = arguments[_i]; + } + return numbers.every(function (n) { return n > 0; }); +})(5, 6, 7); +(function () { + var mixed = []; + for (var _i = 0; _i < arguments.length; _i++) { + mixed[_i] = arguments[_i]; + } + return mixed.every(function (n) { return !!n; }); +})(5, 'oops', 'oh no'); +(function () { + var noNumbers = []; + for (var _i = 0; _i < arguments.length; _i++) { + noNumbers[_i] = arguments[_i]; + } + return noNumbers.some(function (n) { return n > 0; }); +})(); +(function (first) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } + return first ? [] : rest.map(function (n) { return n > 0; }); +})(8, 9, 10); +// destructuring parameters (with defaults too!) +(function (_a) { + var q = _a.q; + return q; +})({ q: 13 }); +(function (_a) { + var _b = _a.p, p = _b === void 0 ? 14 : _b; + return p; +})({ p: 15 }); +(function (_a) { + var _b = (_a === void 0 ? { r: 18 } : _a).r, r = _b === void 0 ? 17 : _b; + return r; +})({ r: 19 }); +(function (_a) { + var _b = (_a === void 0 ? { u: 23 } : _a).u, u = _b === void 0 ? 22 : _b; + return u; +})(); +// contextually typed parameters. +var twelve = (function (f) { return f(12); })(function (i) { return i; }); +var eleven = (function (o) { return o.a(11); })({ a: function (n) { return n; } }); +// missing arguments +(function (x, undefined) { return x; })(42); +(function (x, y, z) { return 42; })(); diff --git a/tests/baselines/reference/contextuallyTypedIifeStrict.symbols b/tests/baselines/reference/contextuallyTypedIifeStrict.symbols new file mode 100644 index 00000000000..f76c9caa104 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIifeStrict.symbols @@ -0,0 +1,132 @@ +=== tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts === +// arrow +(jake => { })("build"); +>jake : Symbol(jake, Decl(contextuallyTypedIifeStrict.ts, 1, 1)) + +// function expression +(function (cats) { })("lol"); +>cats : Symbol(cats, Decl(contextuallyTypedIifeStrict.ts, 3, 11)) + +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +>x : Symbol(x, Decl(contextuallyTypedIifeStrict.ts, 5, 11)) + +((((function (y) { }))))("-"); +>y : Symbol(y, Decl(contextuallyTypedIifeStrict.ts, 6, 14)) + +// multiple arguments +((a, b, c) => { })("foo", 101, false); +>a : Symbol(a, Decl(contextuallyTypedIifeStrict.ts, 8, 2)) +>b : Symbol(b, Decl(contextuallyTypedIifeStrict.ts, 8, 4)) +>c : Symbol(c, Decl(contextuallyTypedIifeStrict.ts, 8, 7)) + +// default parameters +((m = 10) => m + 1)(12); +>m : Symbol(m, Decl(contextuallyTypedIifeStrict.ts, 10, 2)) +>m : Symbol(m, Decl(contextuallyTypedIifeStrict.ts, 10, 2)) + +((n = 10) => n + 1)(); +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 11, 2)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 11, 2)) + +// optional parameters +((j?) => j + 1)(12); +>j : Symbol(j, Decl(contextuallyTypedIifeStrict.ts, 13, 2)) +>j : Symbol(j, Decl(contextuallyTypedIifeStrict.ts, 13, 2)) + +((k?) => k + 1)(); +>k : Symbol(k, Decl(contextuallyTypedIifeStrict.ts, 14, 2)) +>k : Symbol(k, Decl(contextuallyTypedIifeStrict.ts, 14, 2)) + +((l, o?) => l + o)(12); // o should be any +>l : Symbol(l, Decl(contextuallyTypedIifeStrict.ts, 15, 2)) +>o : Symbol(o, Decl(contextuallyTypedIifeStrict.ts, 15, 4)) +>l : Symbol(l, Decl(contextuallyTypedIifeStrict.ts, 15, 2)) +>o : Symbol(o, Decl(contextuallyTypedIifeStrict.ts, 15, 4)) + +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +>numbers : Symbol(numbers, Decl(contextuallyTypedIifeStrict.ts, 17, 2)) +>numbers.every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>numbers : Symbol(numbers, Decl(contextuallyTypedIifeStrict.ts, 17, 2)) +>every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 17, 31)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 17, 31)) + +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +>mixed : Symbol(mixed, Decl(contextuallyTypedIifeStrict.ts, 18, 2)) +>mixed.every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>mixed : Symbol(mixed, Decl(contextuallyTypedIifeStrict.ts, 18, 2)) +>every : Symbol(Array.every, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 18, 27)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 18, 27)) + +((...noNumbers) => noNumbers.some(n => n > 0))(); +>noNumbers : Symbol(noNumbers, Decl(contextuallyTypedIifeStrict.ts, 19, 2)) +>noNumbers.some : Symbol(Array.some, Decl(lib.d.ts, --, --)) +>noNumbers : Symbol(noNumbers, Decl(contextuallyTypedIifeStrict.ts, 19, 2)) +>some : Symbol(Array.some, Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 19, 34)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 19, 34)) + +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +>first : Symbol(first, Decl(contextuallyTypedIifeStrict.ts, 20, 2)) +>rest : Symbol(rest, Decl(contextuallyTypedIifeStrict.ts, 20, 8)) +>first : Symbol(first, Decl(contextuallyTypedIifeStrict.ts, 20, 2)) +>rest.map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>rest : Symbol(rest, Decl(contextuallyTypedIifeStrict.ts, 20, 8)) +>map : Symbol(Array.map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 20, 43)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 20, 43)) + +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +>q : Symbol(q, Decl(contextuallyTypedIifeStrict.ts, 22, 3)) +>q : Symbol(q, Decl(contextuallyTypedIifeStrict.ts, 22, 3)) +>q : Symbol(q, Decl(contextuallyTypedIifeStrict.ts, 22, 16)) + +(({ p = 14 }) => p)({ p : 15 }); +>p : Symbol(p, Decl(contextuallyTypedIifeStrict.ts, 23, 3)) +>p : Symbol(p, Decl(contextuallyTypedIifeStrict.ts, 23, 3)) +>p : Symbol(p, Decl(contextuallyTypedIifeStrict.ts, 23, 21)) + +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +>r : Symbol(r, Decl(contextuallyTypedIifeStrict.ts, 24, 3)) +>r : Symbol(r, Decl(contextuallyTypedIifeStrict.ts, 24, 16)) +>r : Symbol(r, Decl(contextuallyTypedIifeStrict.ts, 24, 3)) +>r : Symbol(r, Decl(contextuallyTypedIifeStrict.ts, 24, 33)) + +(({ u = 22 } = { u: 23 }) => u)(); +>u : Symbol(u, Decl(contextuallyTypedIifeStrict.ts, 25, 3)) +>u : Symbol(u, Decl(contextuallyTypedIifeStrict.ts, 25, 16)) +>u : Symbol(u, Decl(contextuallyTypedIifeStrict.ts, 25, 3)) + +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +>twelve : Symbol(twelve, Decl(contextuallyTypedIifeStrict.ts, 27, 3)) +>f : Symbol(f, Decl(contextuallyTypedIifeStrict.ts, 27, 14)) +>f : Symbol(f, Decl(contextuallyTypedIifeStrict.ts, 27, 14)) +>i : Symbol(i, Decl(contextuallyTypedIifeStrict.ts, 27, 26)) +>i : Symbol(i, Decl(contextuallyTypedIifeStrict.ts, 27, 26)) + +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +>eleven : Symbol(eleven, Decl(contextuallyTypedIifeStrict.ts, 28, 3)) +>o : Symbol(o, Decl(contextuallyTypedIifeStrict.ts, 28, 14)) +>o.a : Symbol(a, Decl(contextuallyTypedIifeStrict.ts, 28, 29)) +>o : Symbol(o, Decl(contextuallyTypedIifeStrict.ts, 28, 14)) +>a : Symbol(a, Decl(contextuallyTypedIifeStrict.ts, 28, 29)) +>a : Symbol(a, Decl(contextuallyTypedIifeStrict.ts, 28, 29)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 28, 42)) +>n : Symbol(n, Decl(contextuallyTypedIifeStrict.ts, 28, 42)) + +// missing arguments +(function(x, undefined) { return x; })(42); +>x : Symbol(x, Decl(contextuallyTypedIifeStrict.ts, 30, 10)) +>undefined : Symbol(undefined, Decl(contextuallyTypedIifeStrict.ts, 30, 12)) +>x : Symbol(x, Decl(contextuallyTypedIifeStrict.ts, 30, 10)) + +((x, y, z) => 42)(); +>x : Symbol(x, Decl(contextuallyTypedIifeStrict.ts, 31, 2)) +>y : Symbol(y, Decl(contextuallyTypedIifeStrict.ts, 31, 4)) +>z : Symbol(z, Decl(contextuallyTypedIifeStrict.ts, 31, 7)) + diff --git a/tests/baselines/reference/contextuallyTypedIifeStrict.types b/tests/baselines/reference/contextuallyTypedIifeStrict.types new file mode 100644 index 00000000000..cbeee53ec2e --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIifeStrict.types @@ -0,0 +1,271 @@ +=== tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts === +// arrow +(jake => { })("build"); +>(jake => { })("build") : void +>(jake => { }) : (jake: string) => void +>jake => { } : (jake: string) => void +>jake : string +>"build" : "build" + +// function expression +(function (cats) { })("lol"); +>(function (cats) { })("lol") : void +>(function (cats) { }) : (cats: string) => void +>function (cats) { } : (cats: string) => void +>cats : string +>"lol" : "lol" + +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +>(function (x) { } ("!")) : void +>function (x) { } ("!") : void +>function (x) { } : (x: string) => void +>x : string +>"!" : "!" + +((((function (y) { }))))("-"); +>((((function (y) { }))))("-") : void +>((((function (y) { })))) : (y: string) => void +>(((function (y) { }))) : (y: string) => void +>((function (y) { })) : (y: string) => void +>(function (y) { }) : (y: string) => void +>function (y) { } : (y: string) => void +>y : string +>"-" : "-" + +// multiple arguments +((a, b, c) => { })("foo", 101, false); +>((a, b, c) => { })("foo", 101, false) : void +>((a, b, c) => { }) : (a: string, b: number, c: boolean) => void +>(a, b, c) => { } : (a: string, b: number, c: boolean) => void +>a : string +>b : number +>c : boolean +>"foo" : "foo" +>101 : 101 +>false : false + +// default parameters +((m = 10) => m + 1)(12); +>((m = 10) => m + 1)(12) : number +>((m = 10) => m + 1) : (m?: number) => number +>(m = 10) => m + 1 : (m?: number) => number +>m : number +>10 : 10 +>m + 1 : number +>m : number +>1 : 1 +>12 : 12 + +((n = 10) => n + 1)(); +>((n = 10) => n + 1)() : number +>((n = 10) => n + 1) : (n?: number) => number +>(n = 10) => n + 1 : (n?: number) => number +>n : number +>10 : 10 +>n + 1 : number +>n : number +>1 : 1 + +// optional parameters +((j?) => j + 1)(12); +>((j?) => j + 1)(12) : number +>((j?) => j + 1) : (j?: number | undefined) => number +>(j?) => j + 1 : (j?: number | undefined) => number +>j : number | undefined +>j + 1 : number +>j : number | undefined +>1 : 1 +>12 : 12 + +((k?) => k + 1)(); +>((k?) => k + 1)() : number +>((k?) => k + 1) : (k?: undefined) => number +>(k?) => k + 1 : (k?: undefined) => number +>k : undefined +>k + 1 : number +>k : undefined +>1 : 1 + +((l, o?) => l + o)(12); // o should be any +>((l, o?) => l + o)(12) : number +>((l, o?) => l + o) : (l: number, o?: undefined) => number +>(l, o?) => l + o : (l: number, o?: undefined) => number +>l : number +>o : undefined +>l + o : number +>l : number +>o : undefined +>12 : 12 + +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +>((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean +>((...numbers) => numbers.every(n => n > 0)) : (...numbers: number[]) => boolean +>(...numbers) => numbers.every(n => n > 0) : (...numbers: number[]) => boolean +>numbers : number[] +>numbers.every(n => n > 0) : boolean +>numbers.every : (callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any) => boolean +>numbers : number[] +>every : (callbackfn: (value: number, index: number, array: number[]) => boolean, thisArg?: any) => boolean +>n => n > 0 : (n: number) => boolean +>n : number +>n > 0 : boolean +>n : number +>0 : 0 +>5 : 5 +>6 : 6 +>7 : 7 + +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +>((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean +>((...mixed) => mixed.every(n => !!n)) : (...mixed: (string | number)[]) => boolean +>(...mixed) => mixed.every(n => !!n) : (...mixed: (string | number)[]) => boolean +>mixed : (string | number)[] +>mixed.every(n => !!n) : boolean +>mixed.every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean +>mixed : (string | number)[] +>every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean +>n => !!n : (n: string | number) => boolean +>n : string | number +>!!n : boolean +>!n : boolean +>n : string | number +>5 : 5 +>'oops' : "oops" +>'oh no' : "oh no" + +((...noNumbers) => noNumbers.some(n => n > 0))(); +>((...noNumbers) => noNumbers.some(n => n > 0))() : boolean +>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: any[]) => boolean +>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: any[]) => boolean +>noNumbers : any[] +>noNumbers.some(n => n > 0) : boolean +>noNumbers.some : (callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean +>noNumbers : any[] +>some : (callbackfn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean +>n => n > 0 : (n: any) => boolean +>n : any +>n > 0 : boolean +>n : any +>0 : 0 + +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +>((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] +>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: number[]) => boolean[] +>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: number[]) => boolean[] +>first : number +>rest : number[] +>first ? [] : rest.map(n => n > 0) : boolean[] +>first : number +>[] : never[] +>rest.map(n => n > 0) : boolean[] +>rest.map : { (this: [number, number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U]; (this: [number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U]; (this: [number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; } +>rest : number[] +>map : { (this: [number, number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U, U]; (this: [number, number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U, U]; (this: [number, number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U, U]; (this: [number, number], callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): [U, U]; (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; } +>n => n > 0 : (n: number) => boolean +>n : number +>n > 0 : boolean +>n : number +>0 : 0 +>8 : 8 +>9 : 9 +>10 : 10 + +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +>(({ q }) => q)({ q : 13 }) : number +>(({ q }) => q) : ({q}: { q: number; }) => number +>({ q }) => q : ({q}: { q: number; }) => number +>q : number +>q : number +>{ q : 13 } : { q: number; } +>q : number +>13 : 13 + +(({ p = 14 }) => p)({ p : 15 }); +>(({ p = 14 }) => p)({ p : 15 }) : number +>(({ p = 14 }) => p) : ({p}: { p: number; }) => number +>({ p = 14 }) => p : ({p}: { p: number; }) => number +>p : number +>14 : 14 +>p : number +>{ p : 15 } : { p: number; } +>p : number +>15 : 15 + +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +>(({ r = 17 } = { r: 18 }) => r)({r : 19}) : number +>(({ r = 17 } = { r: 18 }) => r) : ({r}?: { r: number; }) => number +>({ r = 17 } = { r: 18 }) => r : ({r}?: { r: number; }) => number +>r : number +>17 : 17 +>{ r: 18 } : { r: number; } +>r : number +>18 : 18 +>r : number +>{r : 19} : { r: number; } +>r : number +>19 : 19 + +(({ u = 22 } = { u: 23 }) => u)(); +>(({ u = 22 } = { u: 23 }) => u)() : number +>(({ u = 22 } = { u: 23 }) => u) : ({u}?: { u?: number; }) => number +>({ u = 22 } = { u: 23 }) => u : ({u}?: { u?: number; }) => number +>u : number +>22 : 22 +>{ u: 23 } : { u?: number; } +>u : number +>23 : 23 +>u : number + +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +>twelve : any +>(f => f(12))(i => i) : any +>(f => f(12)) : (f: (i: any) => any) => any +>f => f(12) : (f: (i: any) => any) => any +>f : (i: any) => any +>f(12) : any +>f : (i: any) => any +>12 : 12 +>i => i : (i: any) => any +>i : any +>i : any + +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +>eleven : any +>(o => o.a(11))({ a: function(n) { return n; } }) : any +>(o => o.a(11)) : (o: { a: (n: any) => any; }) => any +>o => o.a(11) : (o: { a: (n: any) => any; }) => any +>o : { a: (n: any) => any; } +>o.a(11) : any +>o.a : (n: any) => any +>o : { a: (n: any) => any; } +>a : (n: any) => any +>11 : 11 +>{ a: function(n) { return n; } } : { a: (n: any) => any; } +>a : (n: any) => any +>function(n) { return n; } : (n: any) => any +>n : any +>n : any + +// missing arguments +(function(x, undefined) { return x; })(42); +>(function(x, undefined) { return x; })(42) : number +>(function(x, undefined) { return x; }) : (x: number, undefined: undefined) => number +>function(x, undefined) { return x; } : (x: number, undefined: undefined) => number +>x : number +>undefined : undefined +>x : number +>42 : 42 + +((x, y, z) => 42)(); +>((x, y, z) => 42)() : number +>((x, y, z) => 42) : (x: undefined, y: undefined, z: undefined) => number +>(x, y, z) => 42 : (x: undefined, y: undefined, z: undefined) => number +>x : undefined +>y : undefined +>z : undefined +>42 : 42 + diff --git a/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts b/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts index ed3c24e0ac7..ca0d6e67711 100644 --- a/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts +++ b/tests/cases/conformance/expressions/functions/contextuallyTypedIife.ts @@ -27,3 +27,6 @@ // contextually typed parameters. let twelve = (f => f(12))(i => i); let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +// missing arguments +(function(x, undefined) { return x; })(42); +((x, y, z) => 42)(); diff --git a/tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts b/tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts new file mode 100644 index 00000000000..04951beb9f0 --- /dev/null +++ b/tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts @@ -0,0 +1,33 @@ +// @strictNullChecks: true +// arrow +(jake => { })("build"); +// function expression +(function (cats) { })("lol"); +// Lots of Irritating Superfluous Parentheses +(function (x) { } ("!")); +((((function (y) { }))))("-"); +// multiple arguments +((a, b, c) => { })("foo", 101, false); +// default parameters +((m = 10) => m + 1)(12); +((n = 10) => n + 1)(); +// optional parameters +((j?) => j + 1)(12); +((k?) => k + 1)(); +((l, o?) => l + o)(12); // o should be any +// rest parameters +((...numbers) => numbers.every(n => n > 0))(5,6,7); +((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); +((...noNumbers) => noNumbers.some(n => n > 0))(); +((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); +// destructuring parameters (with defaults too!) +(({ q }) => q)({ q : 13 }); +(({ p = 14 }) => p)({ p : 15 }); +(({ r = 17 } = { r: 18 }) => r)({r : 19}); +(({ u = 22 } = { u: 23 }) => u)(); +// contextually typed parameters. +let twelve = (f => f(12))(i => i); +let eleven = (o => o.a(11))({ a: function(n) { return n; } }); +// missing arguments +(function(x, undefined) { return x; })(42); +((x, y, z) => 42)(); From 523aca204ab5d4b41ec52a134486edef627a9593 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 8 Jan 2017 15:21:09 -0800 Subject: [PATCH 236/289] Property track mapped types in combined type mappers --- src/compiler/checker.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 879be1c6fbf..beb3d3dd297 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4606,7 +4606,7 @@ namespace ts { // Create a mapper from T to the current iteration type constituent. Then, if the // mapped type is itself an instantiated type, combine the iteration mapper with the // instantiation mapper. - const iterationMapper = createUnaryTypeMapper(typeParameter, t); + const iterationMapper = createTypeMapper([typeParameter], [t]); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; const propType = instantiateType(templateType, templateMapper); // If the current iteration type constituent is a string literal type, create a property. @@ -4666,7 +4666,7 @@ namespace ts { } function getErasedTemplateTypeFromMappedType(type: MappedType) { - return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + return instantiateType(getTemplateTypeFromMappedType(type), createTypeEraser([getTypeParameterFromMappedType(type)])); } function isGenericMappedType(type: Type) { @@ -6135,7 +6135,7 @@ namespace ts { error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); return unknownType; } - const mapper = createUnaryTypeMapper(getTypeParameterFromMappedType(type), indexType); + const mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); const templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } @@ -6502,16 +6502,16 @@ namespace ts { return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); } - function createUnaryTypeMapper(source: Type, target: Type): TypeMapper { - return t => t === source ? target : t; + function makeUnaryTypeMapper(source: Type, target: Type) { + return (t: Type) => t === source ? target : t; } - function createBinaryTypeMapper(source1: Type, target1: Type, source2: Type, target2: Type): TypeMapper { - return t => t === source1 ? target1 : t === source2 ? target2 : t; + function makeBinaryTypeMapper(source1: Type, target1: Type, source2: Type, target2: Type) { + return (t: Type) => t === source1 ? target1 : t === source2 ? target2 : t; } - function createArrayTypeMapper(sources: Type[], targets: Type[]): TypeMapper { - return t => { + function makeArrayTypeMapper(sources: Type[], targets: Type[]) { + return (t: Type) => { for (let i = 0; i < sources.length; i++) { if (t === sources[i]) { return targets ? targets[i] : anyType; @@ -6522,11 +6522,9 @@ namespace ts { } function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper { - const count = sources.length; - const mapper: TypeMapper = - count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : - count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : - createArrayTypeMapper(sources, targets); + const mapper: TypeMapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + makeArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; return mapper; } @@ -6560,7 +6558,7 @@ namespace ts { function combineTypeMappers(mapper1: TypeMapper, mapper2: TypeMapper): TypeMapper { const mapper: TypeMapper = t => instantiateType(mapper1(t), mapper2); - mapper.mappedTypes = mapper1.mappedTypes; + mapper.mappedTypes = concatenate(mapper1.mappedTypes, mapper2.mappedTypes); return mapper; } @@ -6662,7 +6660,7 @@ namespace ts { if (typeVariable !== mappedTypeVariable) { return mapType(mappedTypeVariable, t => { if (isMappableType(t)) { - const replacementMapper = createUnaryTypeMapper(typeVariable, t); + const replacementMapper = createTypeMapper([typeVariable], [t]); const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); combinedMapper.mappedTypes = mapper.mappedTypes; return instantiateMappedObjectType(type, combinedMapper); From 70763dabb5d98e4b4d10683864410b6f2b4d4c5c Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 8 Jan 2017 15:28:38 -0800 Subject: [PATCH 237/289] Add regression test --- .../mappedTypeNestedGenericInstantiation.js | 19 ++++++ ...ppedTypeNestedGenericInstantiation.symbols | 50 ++++++++++++++++ ...mappedTypeNestedGenericInstantiation.types | 58 +++++++++++++++++++ .../mappedTypeNestedGenericInstantiation.ts | 12 ++++ 4 files changed, 139 insertions(+) create mode 100644 tests/baselines/reference/mappedTypeNestedGenericInstantiation.js create mode 100644 tests/baselines/reference/mappedTypeNestedGenericInstantiation.symbols create mode 100644 tests/baselines/reference/mappedTypeNestedGenericInstantiation.types create mode 100644 tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts diff --git a/tests/baselines/reference/mappedTypeNestedGenericInstantiation.js b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.js new file mode 100644 index 00000000000..f70130a84d5 --- /dev/null +++ b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.js @@ -0,0 +1,19 @@ +//// [mappedTypeNestedGenericInstantiation.ts] +// Repro from #13346 + +interface Chainable { + value(): T; + mapValues(func: (v: T[keyof T]) => U): Chainable<{[k in keyof T]: U}>; +} + +declare function chain(t: T): Chainable; + +const square = (x: number) => x * x; + +const v = chain({a: 1, b: 2}).mapValues(square).value(); + + +//// [mappedTypeNestedGenericInstantiation.js] +// Repro from #13346 +var square = function (x) { return x * x; }; +var v = chain({ a: 1, b: 2 }).mapValues(square).value(); diff --git a/tests/baselines/reference/mappedTypeNestedGenericInstantiation.symbols b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.symbols new file mode 100644 index 00000000000..0ec4f50bedc --- /dev/null +++ b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.symbols @@ -0,0 +1,50 @@ +=== tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts === +// Repro from #13346 + +interface Chainable { +>Chainable : Symbol(Chainable, Decl(mappedTypeNestedGenericInstantiation.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 20)) + + value(): T; +>value : Symbol(Chainable.value, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 24)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 20)) + + mapValues(func: (v: T[keyof T]) => U): Chainable<{[k in keyof T]: U}>; +>mapValues : Symbol(Chainable.mapValues, Decl(mappedTypeNestedGenericInstantiation.ts, 3, 13)) +>U : Symbol(U, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 12)) +>func : Symbol(func, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 15)) +>v : Symbol(v, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 22)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 20)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 20)) +>U : Symbol(U, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 12)) +>Chainable : Symbol(Chainable, Decl(mappedTypeNestedGenericInstantiation.ts, 0, 0)) +>k : Symbol(k, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 56)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 20)) +>U : Symbol(U, Decl(mappedTypeNestedGenericInstantiation.ts, 4, 12)) +} + +declare function chain(t: T): Chainable; +>chain : Symbol(chain, Decl(mappedTypeNestedGenericInstantiation.ts, 5, 1)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 7, 23)) +>t : Symbol(t, Decl(mappedTypeNestedGenericInstantiation.ts, 7, 26)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 7, 23)) +>Chainable : Symbol(Chainable, Decl(mappedTypeNestedGenericInstantiation.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeNestedGenericInstantiation.ts, 7, 23)) + +const square = (x: number) => x * x; +>square : Symbol(square, Decl(mappedTypeNestedGenericInstantiation.ts, 9, 5)) +>x : Symbol(x, Decl(mappedTypeNestedGenericInstantiation.ts, 9, 16)) +>x : Symbol(x, Decl(mappedTypeNestedGenericInstantiation.ts, 9, 16)) +>x : Symbol(x, Decl(mappedTypeNestedGenericInstantiation.ts, 9, 16)) + +const v = chain({a: 1, b: 2}).mapValues(square).value(); +>v : Symbol(v, Decl(mappedTypeNestedGenericInstantiation.ts, 11, 5)) +>chain({a: 1, b: 2}).mapValues(square).value : Symbol(Chainable.value, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 24)) +>chain({a: 1, b: 2}).mapValues : Symbol(Chainable.mapValues, Decl(mappedTypeNestedGenericInstantiation.ts, 3, 13)) +>chain : Symbol(chain, Decl(mappedTypeNestedGenericInstantiation.ts, 5, 1)) +>a : Symbol(a, Decl(mappedTypeNestedGenericInstantiation.ts, 11, 17)) +>b : Symbol(b, Decl(mappedTypeNestedGenericInstantiation.ts, 11, 22)) +>mapValues : Symbol(Chainable.mapValues, Decl(mappedTypeNestedGenericInstantiation.ts, 3, 13)) +>square : Symbol(square, Decl(mappedTypeNestedGenericInstantiation.ts, 9, 5)) +>value : Symbol(Chainable.value, Decl(mappedTypeNestedGenericInstantiation.ts, 2, 24)) + diff --git a/tests/baselines/reference/mappedTypeNestedGenericInstantiation.types b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.types new file mode 100644 index 00000000000..7501bdb19e8 --- /dev/null +++ b/tests/baselines/reference/mappedTypeNestedGenericInstantiation.types @@ -0,0 +1,58 @@ +=== tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts === +// Repro from #13346 + +interface Chainable { +>Chainable : Chainable +>T : T + + value(): T; +>value : () => T +>T : T + + mapValues(func: (v: T[keyof T]) => U): Chainable<{[k in keyof T]: U}>; +>mapValues : (func: (v: T[keyof T]) => U) => Chainable<{ [k in keyof T]: U; }> +>U : U +>func : (v: T[keyof T]) => U +>v : T[keyof T] +>T : T +>T : T +>U : U +>Chainable : Chainable +>k : k +>T : T +>U : U +} + +declare function chain(t: T): Chainable; +>chain : (t: T) => Chainable +>T : T +>t : T +>T : T +>Chainable : Chainable +>T : T + +const square = (x: number) => x * x; +>square : (x: number) => number +>(x: number) => x * x : (x: number) => number +>x : number +>x * x : number +>x : number +>x : number + +const v = chain({a: 1, b: 2}).mapValues(square).value(); +>v : { a: number; b: number; } +>chain({a: 1, b: 2}).mapValues(square).value() : { a: number; b: number; } +>chain({a: 1, b: 2}).mapValues(square).value : () => { a: number; b: number; } +>chain({a: 1, b: 2}).mapValues(square) : Chainable<{ a: number; b: number; }> +>chain({a: 1, b: 2}).mapValues : (func: (v: number) => U) => Chainable<{ a: U; b: U; }> +>chain({a: 1, b: 2}) : Chainable<{ a: number; b: number; }> +>chain : (t: T) => Chainable +>{a: 1, b: 2} : { a: number; b: number; } +>a : number +>1 : 1 +>b : number +>2 : 2 +>mapValues : (func: (v: number) => U) => Chainable<{ a: U; b: U; }> +>square : (x: number) => number +>value : () => { a: number; b: number; } + diff --git a/tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts b/tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts new file mode 100644 index 00000000000..8901c215115 --- /dev/null +++ b/tests/cases/compiler/mappedTypeNestedGenericInstantiation.ts @@ -0,0 +1,12 @@ +// Repro from #13346 + +interface Chainable { + value(): T; + mapValues(func: (v: T[keyof T]) => U): Chainable<{[k in keyof T]: U}>; +} + +declare function chain(t: T): Chainable; + +const square = (x: number) => x * x; + +const v = chain({a: 1, b: 2}).mapValues(square).value(); From a0b417d1beeb8f3b87a0bf37df09e443f1f2000c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 06:31:17 -0800 Subject: [PATCH 238/289] Fix gulp-typescript version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdb85ea764b..c49162343a2 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "gulp-insert": "latest", "gulp-newer": "latest", "gulp-sourcemaps": "latest", - "gulp-typescript": "latest", + "gulp-typescript": "3.1.3", "into-stream": "latest", "istanbul": "latest", "jake": "latest", From c28d98a1468f9a0541dd4ac64bebcd96d18fe289 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 06:36:07 -0800 Subject: [PATCH 239/289] Fix test --- ...eFixClassImplementInterfaceComputedPropertyLiterals.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts b/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts index 465f9a5b4f1..341b4e59814 100644 --- a/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts +++ b/tests/cases/fourslash/codeFixClassImplementInterfaceComputedPropertyLiterals.ts @@ -10,12 +10,12 @@ //// class C implements I {[| |]} verify.rangeAfterCodeFix(` - [1](): string { - throw new Error('Method not implemented.'); - } - [2]: boolean; ["foo"](o: any): boolean { throw new Error('Method not implemented.'); } ["x"]: boolean; + [1](): string { + throw new Error('Method not implemented.'); + } + [2]: boolean; `); \ No newline at end of file From c1b55a9e05f0986306e8d209b67028475ac9aa6c Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 06:58:07 -0800 Subject: [PATCH 240/289] Fix linting --- src/compiler/moduleNameResolver.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index e915103f3ce..7ab65515378 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -357,7 +357,7 @@ namespace ts { * Then it computes the set of parent folders for 'directory' that should have the same module resolution result * and for every parent folder in set it adds entry: parent -> module resolution. . * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. - * Set of parent folders that should have the same result will be: + * Set of parent folders that should have the same result will be: * [ * /a/b/c/d, /a/b/c, /a/b * ] @@ -391,7 +391,7 @@ namespace ts { } } } - + function getCommonPrefix(directory: Path, resolution: string) { if (resolution === undefined) { return undefined; @@ -421,7 +421,7 @@ namespace ts { trace(host, Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); } const containingDirectory = getDirectoryPath(containingFile); - let perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + const perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); let result = perFolderCache && perFolderCache[moduleName]; if (result) { @@ -1022,7 +1022,7 @@ namespace ts { /** * Represents result of search. Normally when searching among several alternatives we treat value `undefined` as indicator - * that search fails and we should try another option. + * that search fails and we should try another option. * However this does not allow us to represent final result that should be used instead of further searching (i.e. a final result that was found in cache). * SearchResult is used to deal with this issue, its values represents following outcomes: * - undefined - not found, continue searching @@ -1030,7 +1030,7 @@ namespace ts { * - { value: } - found - stop searching */ type SearchResult = { value: T | undefined } | undefined; - + /** * Wraps value to SearchResult. * @returns undefined if value is undefined or { value } otherwise From 23fa422b590c7ff1317f0e294a04e91d91cfca31 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 07:47:52 -0800 Subject: [PATCH 241/289] String literal completions: Use call signature only if we are *immediately* in a call expression --- src/compiler/moduleNameResolver.ts | 10 ++--- src/services/completions.ts | 38 +++++++++---------- src/services/signatureHelp.ts | 2 +- .../fourslash/completionForStringLiteral6.ts | 12 ++++++ tests/webTestServer.ts | 2 +- 5 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 tests/cases/fourslash/completionForStringLiteral6.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index e915103f3ce..e95c96220b8 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -15,7 +15,7 @@ namespace ts { } /** Array that is only intended to be pushed to, never read. */ - interface Push { + export interface Push { push(value: T): void; } @@ -357,7 +357,7 @@ namespace ts { * Then it computes the set of parent folders for 'directory' that should have the same module resolution result * and for every parent folder in set it adds entry: parent -> module resolution. . * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. - * Set of parent folders that should have the same result will be: + * Set of parent folders that should have the same result will be: * [ * /a/b/c/d, /a/b/c, /a/b * ] @@ -391,7 +391,7 @@ namespace ts { } } } - + function getCommonPrefix(directory: Path, resolution: string) { if (resolution === undefined) { return undefined; @@ -1022,7 +1022,7 @@ namespace ts { /** * Represents result of search. Normally when searching among several alternatives we treat value `undefined` as indicator - * that search fails and we should try another option. + * that search fails and we should try another option. * However this does not allow us to represent final result that should be used instead of further searching (i.e. a final result that was found in cache). * SearchResult is used to deal with this issue, its values represents following outcomes: * - undefined - not found, continue searching @@ -1030,7 +1030,7 @@ namespace ts { * - { value: } - found - stop searching */ type SearchResult = { value: T | undefined } | undefined; - + /** * Wraps value to SearchResult. * @returns undefined if value is undefined or { value } otherwise diff --git a/src/services/completions.ts b/src/services/completions.ts index f0daa696474..d893e7212ec 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,8 +1,6 @@ -/// - /* @internal */ namespace ts.Completions { - export function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo { + export function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo | undefined { if (isInReferenceComment(sourceFile, position)) { return getTripleSlashReferenceCompletion(sourceFile, position); } @@ -134,7 +132,7 @@ namespace ts.Completions { return uniqueNames; } - function getStringLiteralCompletionEntries(sourceFile: SourceFile, position: number) { + function getStringLiteralCompletionEntries(sourceFile: SourceFile, position: number): CompletionInfo | undefined { const node = findPrecedingToken(position, sourceFile); if (!node || node.kind !== SyntaxKind.StringLiteral) { return undefined; @@ -174,7 +172,7 @@ namespace ts.Completions { return getStringLiteralCompletionEntriesFromModuleNames(node); } else { - const argumentInfo = SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); + const argumentInfo = SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); if (argumentInfo) { // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); @@ -188,7 +186,7 @@ namespace ts.Completions { } } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement) { + function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement): CompletionInfo | undefined { const type = typeChecker.getContextualType((element.parent)); const entries: CompletionEntry[] = []; if (type) { @@ -199,7 +197,7 @@ namespace ts.Completions { } } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo) { + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo): CompletionInfo | undefined { const candidates: Signature[] = []; const entries: CompletionEntry[] = []; @@ -219,7 +217,7 @@ namespace ts.Completions { return undefined; } - function getStringLiteralCompletionEntriesFromElementAccess(node: ElementAccessExpression) { + function getStringLiteralCompletionEntriesFromElementAccess(node: ElementAccessExpression): CompletionInfo | undefined { const type = typeChecker.getTypeAtLocation(node.expression); const entries: CompletionEntry[] = []; if (type) { @@ -231,7 +229,7 @@ namespace ts.Completions { return undefined; } - function getStringLiteralCompletionEntriesFromContextualType(node: StringLiteral) { + function getStringLiteralCompletionEntriesFromContextualType(node: StringLiteral): CompletionInfo | undefined { const type = typeChecker.getContextualType(node); if (type) { const entries: CompletionEntry[] = []; @@ -243,7 +241,7 @@ namespace ts.Completions { return undefined; } - function addStringLiteralCompletionsFromType(type: Type, result: CompletionEntry[]): void { + function addStringLiteralCompletionsFromType(type: Type, result: Push): void { if (type && type.flags & TypeFlags.TypeParameter) { type = typeChecker.getApparentType(type); } @@ -251,18 +249,18 @@ namespace ts.Completions { return; } if (type.flags & TypeFlags.Union) { - forEach((type).types, t => addStringLiteralCompletionsFromType(t, result)); - } - else { - if (type.flags & TypeFlags.StringLiteral) { - result.push({ - name: (type).text, - kindModifiers: ScriptElementKindModifier.none, - kind: ScriptElementKind.variableElement, - sortText: "0" - }); + for (const t of (type).types) { + addStringLiteralCompletionsFromType(t, result); } } + else if (type.flags & TypeFlags.StringLiteral) { + result.push({ + name: (type).text, + kindModifiers: ScriptElementKindModifier.none, + kind: ScriptElementKind.variableElement, + sortText: "0" + }); + } } function getStringLiteralCompletionEntriesFromModuleNames(node: StringLiteral): CompletionInfo { diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 44c2ede9fbb..9e4d906d300 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -260,7 +260,7 @@ namespace ts.SignatureHelp { * Returns relevant information for the argument list and the current argument if we are * in the argument of an invocation; returns undefined otherwise. */ - function getImmediatelyContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo { + export function getImmediatelyContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile): ArgumentListInfo { if (node.parent.kind === SyntaxKind.CallExpression || node.parent.kind === SyntaxKind.NewExpression) { const callExpression = node.parent; // There are 3 cases to handle: diff --git a/tests/cases/fourslash/completionForStringLiteral6.ts b/tests/cases/fourslash/completionForStringLiteral6.ts new file mode 100644 index 00000000000..ac4a378abfb --- /dev/null +++ b/tests/cases/fourslash/completionForStringLiteral6.ts @@ -0,0 +1,12 @@ +/// + +////interface Foo { +//// x: "abc" | "def"; +////} +////function bar(f: Foo) { }; +////bar({x: "/**/"}); + +goTo.marker(); +verify.completionListContains("abc"); +verify.completionListContains("def"); +verify.completionListCount(2); diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 9063d909b15..67bbce2a472 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -129,7 +129,7 @@ function dir(dirPath: string, spec?: string, options?: any) { function deleteFolderRecursive(dirPath: string) { if (fs.existsSync(dirPath)) { fs.readdirSync(dirPath).forEach((file) => { - const curPath = path.join(path, file); + const curPath = path.join(dirPath, file); if (fs.statSync(curPath).isDirectory()) { // recurse deleteFolderRecursive(curPath); } From 876dbe86ee17b8521f6535739a01fe489d768a26 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Jan 2017 08:53:10 -0800 Subject: [PATCH 242/289] Omit class methods from spreads. Others stay. Previously, all methods were omitted except those from the object literal that contained the spread. This gets rid of the ugly third argument to `getSpreadType`. It also fixes a bug that arose from removing the spread type late in the development of object spread; methods from the left-hand-side of a multi-spread object literal were not removed. The spread type code normalised spreads so the left-hand is never an object, but that code was removed. --- src/compiler/checker.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 879be1c6fbf..d33ce374736 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6241,7 +6241,7 @@ namespace ts { * this function should be called in a left folding style, with left = previous result of getSpreadType * and right = the new element to be spread. */ - function getSpreadType(left: Type, right: Type, isFromObjectLiteral: boolean): Type { + function getSpreadType(left: Type, right: Type): Type { if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) { return anyType; } @@ -6254,10 +6254,10 @@ namespace ts { return left; } if (left.flags & TypeFlags.Union) { - return mapType(left, t => getSpreadType(t, right, isFromObjectLiteral)); + return mapType(left, t => getSpreadType(t, right)); } if (right.flags & TypeFlags.Union) { - return mapType(right, t => getSpreadType(left, t, isFromObjectLiteral)); + return mapType(right, t => getSpreadType(left, t)); } const members = createMap(); @@ -6276,18 +6276,18 @@ namespace ts { for (const rightProp of getPropertiesOfType(right)) { // we approximate own properties as non-methods plus methods that are inside the object literal - const isOwnProperty = !(rightProp.flags & SymbolFlags.Method) || isFromObjectLiteral; const isSetterWithoutGetter = rightProp.flags & SymbolFlags.SetAccessor && !(rightProp.flags & SymbolFlags.GetAccessor); if (getDeclarationModifierFlagsFromSymbol(rightProp) & (ModifierFlags.Private | ModifierFlags.Protected)) { skippedPrivateMembers[rightProp.name] = true; } - else if (isOwnProperty && !isSetterWithoutGetter) { + else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { members[rightProp.name] = rightProp; } } for (const leftProp of getPropertiesOfType(left)) { if (leftProp.flags & SymbolFlags.SetAccessor && !(leftProp.flags & SymbolFlags.GetAccessor) - || leftProp.name in skippedPrivateMembers) { + || leftProp.name in skippedPrivateMembers + || isClassMethod(leftProp)) { continue; } if (leftProp.name in members) { @@ -6312,6 +6312,10 @@ namespace ts { return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } + function isClassMethod(prop: Symbol) { + return prop.flags & SymbolFlags.Method && find(prop.declarations, decl => isClassLike(decl.parent)); + } + function createLiteralType(flags: TypeFlags, text: string) { const type = createType(flags); type.text = text; @@ -11658,7 +11662,7 @@ namespace ts { checkExternalEmitHelpers(memberDecl, ExternalEmitHelpers.Assign); } if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; propertiesTable = createMap(); hasComputedStringProperty = false; @@ -11670,7 +11674,7 @@ namespace ts { error(memberDecl, Diagnostics.Spread_types_may_only_be_created_from_object_types); return unknownType; } - spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + spread = getSpreadType(spread, type); offset = i + 1; continue; } @@ -11715,7 +11719,7 @@ namespace ts { if (spread !== emptyObjectType) { if (propertiesArray.length > 0) { - spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + spread = getSpreadType(spread, createObjectLiteralType()); } if (spread.flags & TypeFlags.Object) { // only set the symbol and flags if this is a (fresh) object type From 309a361b19a1a8435f2c4f5f232d1716995ff171 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 9 Jan 2017 08:59:36 -0800 Subject: [PATCH 243/289] Test method removal of object spread Test that 1. Only class methods get removed 2. Methods from both left and right get removed. --- .../reference/spreadMethods.errors.txt | 33 ++++++++++ tests/baselines/reference/spreadMethods.js | 63 +++++++++++++++++++ .../conformance/types/spread/spreadMethods.ts | 23 +++++++ 3 files changed, 119 insertions(+) create mode 100644 tests/baselines/reference/spreadMethods.errors.txt create mode 100644 tests/baselines/reference/spreadMethods.js create mode 100644 tests/cases/conformance/types/spread/spreadMethods.ts diff --git a/tests/baselines/reference/spreadMethods.errors.txt b/tests/baselines/reference/spreadMethods.errors.txt new file mode 100644 index 00000000000..b2b3491ba79 --- /dev/null +++ b/tests/baselines/reference/spreadMethods.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/types/spread/spreadMethods.ts(7,4): error TS2339: Property 'm' does not exist on type '{ p: number; }'. +tests/cases/conformance/types/spread/spreadMethods.ts(9,5): error TS2339: Property 'm' does not exist on type '{ p: number; }'. + + +==== tests/cases/conformance/types/spread/spreadMethods.ts (2 errors) ==== + class K { p = 12; m() { } } + interface I { p: number, m(): void } + let k = new K() + let sk = { ...k }; + let ssk = { ...k, ...k }; + sk.p; + sk.m(); // error + ~ +!!! error TS2339: Property 'm' does not exist on type '{ p: number; }'. + ssk.p; + ssk.m(); // error + ~ +!!! error TS2339: Property 'm' does not exist on type '{ p: number; }'. + let i: I = { p: 12, m() { } }; + let si = { ...i }; + let ssi = { ...i, ...i }; + si.p; + si.m(); // ok + ssi.p; + ssi.m(); // ok + let o = { p: 12, m() { } }; + let so = { ...o }; + let sso = { ...o, ...o }; + so.p; + so.m(); // ok + sso.p; + sso.m(); // ok + \ No newline at end of file diff --git a/tests/baselines/reference/spreadMethods.js b/tests/baselines/reference/spreadMethods.js new file mode 100644 index 00000000000..691d6fa2829 --- /dev/null +++ b/tests/baselines/reference/spreadMethods.js @@ -0,0 +1,63 @@ +//// [spreadMethods.ts] +class K { p = 12; m() { } } +interface I { p: number, m(): void } +let k = new K() +let sk = { ...k }; +let ssk = { ...k, ...k }; +sk.p; +sk.m(); // error +ssk.p; +ssk.m(); // error +let i: I = { p: 12, m() { } }; +let si = { ...i }; +let ssi = { ...i, ...i }; +si.p; +si.m(); // ok +ssi.p; +ssi.m(); // ok +let o = { p: 12, m() { } }; +let so = { ...o }; +let sso = { ...o, ...o }; +so.p; +so.m(); // ok +sso.p; +sso.m(); // ok + + +//// [spreadMethods.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var K = (function () { + function K() { + this.p = 12; + } + K.prototype.m = function () { }; + return K; +}()); +var k = new K(); +var sk = __assign({}, k); +var ssk = __assign({}, k, k); +sk.p; +sk.m(); // error +ssk.p; +ssk.m(); // error +var i = { p: 12, m: function () { } }; +var si = __assign({}, i); +var ssi = __assign({}, i, i); +si.p; +si.m(); // ok +ssi.p; +ssi.m(); // ok +var o = { p: 12, m: function () { } }; +var so = __assign({}, o); +var sso = __assign({}, o, o); +so.p; +so.m(); // ok +sso.p; +sso.m(); // ok diff --git a/tests/cases/conformance/types/spread/spreadMethods.ts b/tests/cases/conformance/types/spread/spreadMethods.ts new file mode 100644 index 00000000000..5d562653424 --- /dev/null +++ b/tests/cases/conformance/types/spread/spreadMethods.ts @@ -0,0 +1,23 @@ +class K { p = 12; m() { } } +interface I { p: number, m(): void } +let k = new K() +let sk = { ...k }; +let ssk = { ...k, ...k }; +sk.p; +sk.m(); // error +ssk.p; +ssk.m(); // error +let i: I = { p: 12, m() { } }; +let si = { ...i }; +let ssi = { ...i, ...i }; +si.p; +si.m(); // ok +ssi.p; +ssi.m(); // ok +let o = { p: 12, m() { } }; +let so = { ...o }; +let sso = { ...o, ...o }; +so.p; +so.m(); // ok +sso.p; +sso.m(); // ok From 9441555778452389b239970cef1f20675ae4ccbf Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 9 Jan 2017 09:11:09 -0800 Subject: [PATCH 244/289] Properly construct replacement mapper in mapped type instantiation --- src/compiler/checker.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 879be1c6fbf..5dbff583bcf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6564,6 +6564,12 @@ namespace ts { return mapper; } + function createReplacementMapper(source: Type, target: Type, baseMapper: TypeMapper) { + const mapper: TypeMapper = t => t === source ? target : baseMapper(t); + mapper.mappedTypes = baseMapper.mappedTypes; + return mapper; + } + function cloneTypeParameter(typeParameter: TypeParameter): TypeParameter { const result = createType(TypeFlags.TypeParameter); result.symbol = typeParameter.symbol; @@ -6662,10 +6668,7 @@ namespace ts { if (typeVariable !== mappedTypeVariable) { return mapType(mappedTypeVariable, t => { if (isMappableType(t)) { - const replacementMapper = createUnaryTypeMapper(typeVariable, t); - const combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); - combinedMapper.mappedTypes = mapper.mappedTypes; - return instantiateMappedObjectType(type, combinedMapper); + return instantiateMappedObjectType(type, createReplacementMapper(typeVariable, t, mapper)); } return t; }); From 80ef89b822d4b11c5bce299250d76852b20cf540 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 9 Jan 2017 09:19:03 -0800 Subject: [PATCH 245/289] Add regression test --- ...ppedTypeWithCombinedTypeMappers.errors.txt | 25 +++++++++++++++++++ .../mappedTypeWithCombinedTypeMappers.js | 24 ++++++++++++++++++ .../mappedTypeWithCombinedTypeMappers.ts | 18 +++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 tests/baselines/reference/mappedTypeWithCombinedTypeMappers.errors.txt create mode 100644 tests/baselines/reference/mappedTypeWithCombinedTypeMappers.js create mode 100644 tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts diff --git a/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.errors.txt b/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.errors.txt new file mode 100644 index 00000000000..56837dd787e --- /dev/null +++ b/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts(18,7): error TS2322: Type 'string' is not assignable to type '{ important: boolean; }'. + + +==== tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts (1 errors) ==== + // Repro from #13351 + + type Meta = { + readonly[P in keyof T]: { + value: T[P]; + also: A; + readonly children: Meta; + }; + } + + interface Input { + x: string; + y: number; + } + + declare const output: Meta; + + const shouldFail: { important: boolean } = output.x.children; + ~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '{ important: boolean; }'. + \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.js b/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.js new file mode 100644 index 00000000000..a445f2eebc5 --- /dev/null +++ b/tests/baselines/reference/mappedTypeWithCombinedTypeMappers.js @@ -0,0 +1,24 @@ +//// [mappedTypeWithCombinedTypeMappers.ts] +// Repro from #13351 + +type Meta = { + readonly[P in keyof T]: { + value: T[P]; + also: A; + readonly children: Meta; + }; +} + +interface Input { + x: string; + y: number; +} + +declare const output: Meta; + +const shouldFail: { important: boolean } = output.x.children; + + +//// [mappedTypeWithCombinedTypeMappers.js] +// Repro from #13351 +var shouldFail = output.x.children; diff --git a/tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts b/tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts new file mode 100644 index 00000000000..9c6d8479b2e --- /dev/null +++ b/tests/cases/compiler/mappedTypeWithCombinedTypeMappers.ts @@ -0,0 +1,18 @@ +// Repro from #13351 + +type Meta = { + readonly[P in keyof T]: { + value: T[P]; + also: A; + readonly children: Meta; + }; +} + +interface Input { + x: string; + y: number; +} + +declare const output: Meta; + +const shouldFail: { important: boolean } = output.x.children; From 2124fcf5885c6498930862b0ad9b452319e617e5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 09:40:03 -0800 Subject: [PATCH 246/289] goToDefinition: Use the name of a declaration (if possible) when creating DefinitionInfo. --- src/compiler/utilities.ts | 4 ++ src/harness/fourslash.ts | 54 ++++++++++++------- src/services/findAllReferences.ts | 6 +-- src/services/goToDefinition.ts | 45 ++++++++-------- src/services/navigateTo.ts | 2 +- src/services/navigationBar.ts | 12 ++--- src/services/outliningElementsCollector.ts | 4 +- .../ambientShorthandGotoDefinition.ts | 10 ++-- tests/cases/fourslash/fourslash.ts | 3 +- tests/cases/fourslash/goToDefinitionAlias.ts | 4 +- .../cases/fourslash/goToDefinitionAmbiants.ts | 6 +-- .../fourslash/goToDefinitionDecorator.ts | 4 +- ...ts => goToDefinitionDecoratorOverloads.ts} | 4 +- .../fourslash/goToDefinitionDifferentFile.ts | 8 +-- .../goToDefinitionDifferentFileIndirectly.ts | 8 +-- .../goToDefinitionExternalModuleName3.ts | 2 +- .../goToDefinitionExternalModuleName5.ts | 2 +- .../goToDefinitionExternalModuleName6.ts | 2 +- .../goToDefinitionExternalModuleName7.ts | 2 +- .../goToDefinitionExternalModuleName8.ts | 2 +- .../goToDefinitionExternalModuleName9.ts | 2 +- tests/cases/fourslash/goToDefinitionFoo.ts | 6 +++ .../goToDefinitionFunctionOverloads.ts | 8 +-- .../goToDefinitionFunctionOverloadsInClass.ts | 4 +- .../goToDefinitionImplicitConstructor.ts | 2 +- .../fourslash/goToDefinitionImportedNames.ts | 2 +- .../fourslash/goToDefinitionImportedNames2.ts | 2 +- .../fourslash/goToDefinitionImportedNames3.ts | 2 +- .../fourslash/goToDefinitionImportedNames4.ts | 2 +- .../fourslash/goToDefinitionImportedNames5.ts | 2 +- .../fourslash/goToDefinitionImportedNames7.ts | 2 +- .../goToDefinitionInMemberDeclaration.ts | 8 +-- .../fourslash/goToDefinitionInTypeArgument.ts | 4 +- .../goToDefinitionInterfaceAfterImplement.ts | 2 +- .../goToDefinitionMethodOverloads.ts | 16 +++--- .../goToDefinitionMultipleDefinitions.ts | 10 ++-- .../goToDefinitionObjectLiteralProperties.ts | 4 +- ...tionOverloadsInMultiplePropertyAccesses.ts | 2 +- .../goToDefinitionPartialImplementation.ts | 4 +- .../cases/fourslash/goToDefinitionSameFile.ts | 8 +-- tests/cases/fourslash/goToDefinitionSimple.ts | 2 +- .../goToDefinitionTaggedTemplateOverloads.ts | 4 +- tests/cases/fourslash/goToDefinitionThis.ts | 2 +- .../fourslash/goToDefinitionTypePredicate.ts | 2 +- tests/cases/fourslash/goToDefinition_super.ts | 2 +- .../fourslash/goToModuleAliasDefinition.ts | 4 +- tests/cases/fourslash/goToTypeDefinition.ts | 6 +-- tests/cases/fourslash/goToTypeDefinition2.ts | 6 +-- .../fourslash/goToTypeDefinitionAliases.ts | 13 ++--- .../goToTypeDefinitionEnumMembers.ts | 4 +- .../fourslash/goToTypeDefinitionModule.ts | 17 +++--- .../fourslash/goToTypeDefinitionPrimitives.ts | 17 +++--- .../fourslash/goToTypeDefinitionUnionType.ts | 18 ++----- tests/cases/fourslash/quickInfoMeaning.ts | 6 +-- .../server/jsdocTypedefTagGoToDefinition.ts | 2 +- .../fourslash/server/typedefinition01.ts | 6 +-- .../shims-pp/getDefinitionAtPosition.ts | 8 +-- .../fourslash/shims-pp/goToTypeDefinition.ts | 6 +-- .../shims/getDefinitionAtPosition.ts | 8 +-- .../fourslash/shims/goToTypeDefinition.ts | 6 +-- .../fourslash/tsxGoToDefinitionClasses.ts | 2 +- 61 files changed, 207 insertions(+), 210 deletions(-) rename tests/cases/fourslash/{goToDeclarationDecoratorOverloads.ts => goToDefinitionDecoratorOverloads.ts} (72%) create mode 100644 tests/cases/fourslash/goToDefinitionFoo.ts diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 192ef888b11..6a017fd996d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4318,6 +4318,10 @@ namespace ts { return createTextSpan(start, end - start); } + export function createTextSpanFromNode(node: Node, sourceFile?: SourceFile): TextSpan { + return createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } + export function textChangeRangeNewSpan(range: TextChangeRange) { return createTextSpan(range.span.start, range.newLength); } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 3de0dba4fdf..c41c9af9f4e 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -47,9 +47,9 @@ namespace FourSlash { /** * Inserted in source files by surrounding desired text * in a range with `[|` and `|]`. For example, - * + * * [|text in range|] - * + * * is a range with `text in range` "selected". */ ranges: Range[]; @@ -540,53 +540,66 @@ namespace FourSlash { } public verifyGoToDefinitionIs(endMarker: string | string[]) { - this.verifyGoToDefinitionWorker(endMarker instanceof Array ? endMarker : [endMarker]); + this.verifyGoToXWorker(endMarker instanceof Array ? endMarker : [endMarker], () => this.getGoToDefinition()); } public verifyGoToDefinition(arg0: any, endMarkerNames?: string | string[]) { + this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinition()); + } + + private getGoToDefinition(): ts.DefinitionInfo[] { + return this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition) + } + + public verifyGoToType(arg0: any, endMarkerNames?: string | string[]) { + this.verifyGoToX(arg0, endMarkerNames, () => + this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition)); + } + + private verifyGoToX(arg0: any, endMarkerNames: string | string[] | undefined, getDefs: () => ts.DefinitionInfo[] | undefined) { if (endMarkerNames) { - this.verifyGoToDefinitionPlain(arg0, endMarkerNames); + this.verifyGoToXPlain(arg0, endMarkerNames, getDefs); } else if (arg0 instanceof Array) { const pairs: [string | string[], string | string[]][] = arg0; for (const [start, end] of pairs) { - this.verifyGoToDefinitionPlain(start, end); + this.verifyGoToXPlain(start, end, getDefs); } } else { const obj: { [startMarkerName: string]: string | string[] } = arg0; for (const startMarkerName in obj) { if (ts.hasProperty(obj, startMarkerName)) { - this.verifyGoToDefinitionPlain(startMarkerName, obj[startMarkerName]); + this.verifyGoToXPlain(startMarkerName, obj[startMarkerName], getDefs); } } } } - private verifyGoToDefinitionPlain(startMarkerNames: string | string[], endMarkerNames: string | string[]) { + private verifyGoToXPlain(startMarkerNames: string | string[], endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) { if (startMarkerNames instanceof Array) { for (const start of startMarkerNames) { - this.verifyGoToDefinitionSingle(start, endMarkerNames); + this.verifyGoToXSingle(start, endMarkerNames, getDefs); } } else { - this.verifyGoToDefinitionSingle(startMarkerNames, endMarkerNames); + this.verifyGoToXSingle(startMarkerNames, endMarkerNames, getDefs); } } public verifyGoToDefinitionForMarkers(markerNames: string[]) { for (const markerName of markerNames) { - this.verifyGoToDefinitionSingle(`${markerName}Reference`, `${markerName}Definition`); + this.verifyGoToXSingle(`${markerName}Reference`, `${markerName}Definition`, () => this.getGoToDefinition()); } } - private verifyGoToDefinitionSingle(startMarkerName: string, endMarkerNames: string | string[]) { + private verifyGoToXSingle(startMarkerName: string, endMarkerNames: string | string[], getDefs: () => ts.DefinitionInfo[] | undefined) { this.goToMarker(startMarkerName); - this.verifyGoToDefinitionWorker(endMarkerNames instanceof Array ? endMarkerNames : [endMarkerNames]); + this.verifyGoToXWorker(endMarkerNames instanceof Array ? endMarkerNames : [endMarkerNames], getDefs); } - private verifyGoToDefinitionWorker(endMarkers: string[]) { - const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition) || []; + private verifyGoToXWorker(endMarkers: string[], getDefs: () => ts.DefinitionInfo[] | undefined) { + const definitions = getDefs() || []; if (endMarkers.length !== definitions.length) { this.raiseError(`goToDefinitions failed - expected to find ${endMarkers.length} definitions but got ${definitions.length}`); @@ -1987,7 +2000,7 @@ namespace FourSlash { * Compares expected text to the text that would be in the sole range * (ie: [|...|]) in the file after applying the codefix sole codefix * in the source file. - * + * * Because codefixes are only applied on the working file, it is unsafe * to apply this more than once (consider a refactoring across files). */ @@ -3042,10 +3055,6 @@ namespace FourSlashInterface { this.state.goToEOF(); } - public type(definitionIndex = 0) { - this.state.goToTypeDefinition(definitionIndex); - } - public implementation() { this.state.goToImplementation(); } @@ -3213,6 +3222,13 @@ namespace FourSlashInterface { this.state.verifyGoToDefinition(arg0, endMarkerName); } + public goToType(startMarkerName: string | string[], endMarkerName: string | string[]): void; + public goToType(startsAndEnds: [string | string[], string | string[]][]): void; + public goToType(startsAndEnds: { [startMarkerName: string]: string | string[] }): void; + public goToType(arg0: any, endMarkerName?: string | string[]) { + this.state.verifyGoToType(arg0, endMarkerName); + } + public goToDefinitionForMarkers(...markerNames: string[]) { this.state.verifyGoToDefinitionForMarkers(markerNames); } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 313a3d2ea3e..d6092644c73 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -325,7 +325,7 @@ namespace ts.FindAllReferences { fileName: targetLabel.getSourceFile().fileName, kind: ScriptElementKind.label, name: labelName, - textSpan: createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), + textSpan: createTextSpanFromNode(targetLabel, sourceFile), displayParts: [displayPart(labelName, SymbolDisplayPartKind.text)] }; @@ -871,7 +871,7 @@ namespace ts.FindAllReferences { fileName: node.getSourceFile().fileName, kind: ScriptElementKind.variableElement, name: "this", - textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()), + textSpan: createTextSpanFromNode(node), displayParts }, references: references @@ -942,7 +942,7 @@ namespace ts.FindAllReferences { fileName: node.getSourceFile().fileName, kind: ScriptElementKind.variableElement, name: type.text, - textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()), + textSpan: createTextSpanFromNode(node), displayParts: [displayPart(getTextOfNode(node), SymbolDisplayPartKind.stringLiteral)] }, references: references diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 4c005640d6a..65421888061 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -15,10 +15,8 @@ namespace ts.GoToDefinition { const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { const referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; + return referenceFile && referenceFile.resolvedFileName && + [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } const node = getTouchingPropertyName(sourceFile, position); @@ -30,7 +28,7 @@ namespace ts.GoToDefinition { if (isJumpStatementTarget(node)) { const labelName = (node).text; const label = getTargetLabel((node.parent), (node).text); - return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + return label ? [createDefinitionInfoFromName(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } const typeChecker = program.getTypeChecker(); @@ -171,33 +169,38 @@ namespace ts.GoToDefinition { function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) { const declarations: Declaration[] = []; - let definition: Declaration; + let definition: Declaration | undefined; - forEach(signatureDeclarations, d => { - if ((selectConstructors && d.kind === SyntaxKind.Constructor) || - (!selectConstructors && (d.kind === SyntaxKind.FunctionDeclaration || d.kind === SyntaxKind.MethodDeclaration || d.kind === SyntaxKind.MethodSignature))) { + for (const d of signatureDeclarations) { + if (selectConstructors ? d.kind === SyntaxKind.Constructor : isSignatureDeclaration(d)) { declarations.push(d); if ((d).body) definition = d; } - }); - - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; - } - else if (declarations.length) { - result.push(createDefinitionInfo(lastOrUndefined(declarations), symbolKind, symbolName, containerName)); - return true; } + if (declarations.length) { + result.push(createDefinitionInfo(definition || lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + return true; + } return false; } } - function createDefinitionInfo(node: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { + function isSignatureDeclaration(node: Node): boolean { + return node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature + } + + /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ + function createDefinitionInfo(node: Declaration, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { + return createDefinitionInfoFromName(node.name || node, symbolKind, symbolName, containerName); + } + + /** Creates a DefinitionInfo directly from the name of a declaration. */ + function createDefinitionInfoFromName(name: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { + const sourceFile = name.getSourceFile(); return { - fileName: node.getSourceFile().fileName, - textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()), + fileName: sourceFile.fileName, + textSpan: createTextSpanFromNode(name, sourceFile), kind: symbolKind, name: symbolName, containerKind: undefined, diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 82f4dd49f2b..7dab7b504cd 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -199,7 +199,7 @@ namespace ts.NavigateTo { matchKind: PatternMatchKind[rawItem.matchKind], isCaseSensitive: rawItem.isCaseSensitive, fileName: rawItem.fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + textSpan: createTextSpanFromNode(declaration), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? (container.name).text : "", containerKind: container && container.name ? getNodeKind(container) : "" diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 4e5986abc01..28f69a0b488 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -591,7 +591,7 @@ namespace ts.NavigationBar { function getNodeSpan(node: Node): TextSpan { return node.kind === SyntaxKind.SourceFile ? createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); + : createTextSpanFromNode(node, curSourceFile); } function getFunctionOrClassName(node: FunctionExpression | FunctionDeclaration | ArrowFunction | ClassLikeDeclaration): string { @@ -626,15 +626,15 @@ namespace ts.NavigationBar { /** * Matches all whitespace characters in a string. Eg: - * + * * "app. - * + * * onactivated" - * + * * matches because of the newline, whereas - * + * * "app.onactivated" - * + * * does not match. */ const whiteSpaceRegex = /\s+/g; diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index dc2e4a59773..2ad20a7ed0c 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -8,7 +8,7 @@ namespace ts.OutliningElementsCollector { if (hintSpanNode && startElement && endElement) { const span: OutliningSpan = { textSpan: createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + hintSpan: createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, autoCollapse: autoCollapse }; @@ -135,7 +135,7 @@ namespace ts.OutliningElementsCollector { // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - const span = createTextSpanFromBounds(n.getStart(), n.end); + const span = createTextSpanFromNode(n); elements.push({ textSpan: span, hintSpan: span, diff --git a/tests/cases/fourslash/ambientShorthandGotoDefinition.ts b/tests/cases/fourslash/ambientShorthandGotoDefinition.ts index 8673d661fe2..410fc932cec 100644 --- a/tests/cases/fourslash/ambientShorthandGotoDefinition.ts +++ b/tests/cases/fourslash/ambientShorthandGotoDefinition.ts @@ -1,13 +1,13 @@ /// // @Filename: declarations.d.ts -/////*module*/declare module "jquery" +////declare module /*module*/"jquery" // @Filename: user.ts /////// ////import /*importFoo*/foo, {bar} from "jquery"; -////import /*importBaz*/* as /*idBaz*/baz from "jquery"; -/////*importBang*/import /*idBang*/bang = require("jquery"); +////import * as /*importBaz*/baz from "jquery"; +////import /*importBang*/bang = require("jquery"); ////foo/*useFoo*/(bar/*useBar*/, baz/*useBaz*/, bang/*useBang*/); verify.quickInfoAt("useFoo", "import foo"); @@ -22,11 +22,11 @@ verify.goToDefinition("useBar", "module"); verify.quickInfoAt("useBaz", "import baz"); verify.goToDefinition({ useBaz: "importBaz", - idBaz: "module" + importBaz: "module" }); verify.quickInfoAt("useBang", "import bang = require(\"jquery\")"); verify.goToDefinition({ useBang: "importBang", - idBang: "module" + importBang: "module" }); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index b8017134db8..4397839fbe8 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -110,7 +110,6 @@ declare namespace FourSlashInterface { marker(name?: string): void; bof(): void; eof(): void; - type(definitionIndex?: number): void; implementation(): void; position(position: number, fileIndex?: number): any; position(position: number, fileName?: string): any; @@ -165,6 +164,8 @@ declare namespace FourSlashInterface { goToDefinition(startsAndEnds: { [startMarkerName: string]: string | string[] }): void; /** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */ goToDefinitionForMarkers(...markerNames: string[]): void; + goToType(startsAndEnds: { [startMarkerName: string]: string | string[] }): void; + goToType(startMarkerNames: string | string[], endMarkerNames: string | string[]): void; verifyGetEmitOutputForCurrentFile(expected: string): void; verifyGetEmitOutputContentsForCurrentFile(expected: ts.OutputFile[]): void; /** diff --git a/tests/cases/fourslash/goToDefinitionAlias.ts b/tests/cases/fourslash/goToDefinitionAlias.ts index 23cf849f101..22aa049fde3 100644 --- a/tests/cases/fourslash/goToDefinitionAlias.ts +++ b/tests/cases/fourslash/goToDefinitionAlias.ts @@ -1,9 +1,9 @@ /// // @Filename: b.ts -/////*alias1Definition*/import alias1 = require("fileb"); +////import /*alias1Definition*/alias1 = require("fileb"); ////module Module { -//// /*alias2Definition*/export import alias2 = alias1; +//// export import /*alias2Definition*/alias2 = alias1; ////} //// ////// Type position diff --git a/tests/cases/fourslash/goToDefinitionAmbiants.ts b/tests/cases/fourslash/goToDefinitionAmbiants.ts index 57885bed4e9..b0932f0cb07 100644 --- a/tests/cases/fourslash/goToDefinitionAmbiants.ts +++ b/tests/cases/fourslash/goToDefinitionAmbiants.ts @@ -1,11 +1,11 @@ /// ////declare var /*ambientVariableDefinition*/ambientVar; -/////*ambientFunctionDefinition*/declare function ambientFunction(); +////declare function /*ambientFunctionDefinition*/ambientFunction(); ////declare class ambientClass { //// /*constructorDefinition*/constructor(); -//// /*staticMethodDefinition*/static method(); -//// /*instanceMethodDefinition*/public method(); +//// static /*staticMethodDefinition*/method(); +//// public /*instanceMethodDefinition*/method(); ////} //// /////*ambientVariableReference*/ambientVar = 1; diff --git a/tests/cases/fourslash/goToDefinitionDecorator.ts b/tests/cases/fourslash/goToDefinitionDecorator.ts index c86b02ab820..bef9c8fa5f1 100644 --- a/tests/cases/fourslash/goToDefinitionDecorator.ts +++ b/tests/cases/fourslash/goToDefinitionDecorator.ts @@ -9,10 +9,10 @@ // @Filename: a.ts -/////*decoratorDefinition*/function decorator(target) { +////function /*decoratorDefinition*/decorator(target) { //// return target; ////} -/////*decoratorFactoryDefinition*/function decoratorFactory(...args) { +////function /*decoratorFactoryDefinition*/decoratorFactory(...args) { //// return target => target; ////} diff --git a/tests/cases/fourslash/goToDeclarationDecoratorOverloads.ts b/tests/cases/fourslash/goToDefinitionDecoratorOverloads.ts similarity index 72% rename from tests/cases/fourslash/goToDeclarationDecoratorOverloads.ts rename to tests/cases/fourslash/goToDefinitionDecoratorOverloads.ts index c107f7f6803..965c8bbbc6d 100644 --- a/tests/cases/fourslash/goToDeclarationDecoratorOverloads.ts +++ b/tests/cases/fourslash/goToDefinitionDecoratorOverloads.ts @@ -3,8 +3,8 @@ ////async function f() {} //// -/////*defDecString*/function dec(target: any, propertyKey: string): void; -/////*defDecSymbol*/function dec(target: any, propertyKey: symbol): void; +////function /*defDecString*/dec(target: any, propertyKey: string): void; +////function /*defDecSymbol*/dec(target: any, propertyKey: symbol): void; ////function dec(target: any, propertyKey: string | symbol) {} //// ////declare const s: symbol; diff --git a/tests/cases/fourslash/goToDefinitionDifferentFile.ts b/tests/cases/fourslash/goToDefinitionDifferentFile.ts index 1679563942c..67e8c44c84c 100644 --- a/tests/cases/fourslash/goToDefinitionDifferentFile.ts +++ b/tests/cases/fourslash/goToDefinitionDifferentFile.ts @@ -2,10 +2,10 @@ // @Filename: goToDefinitionDifferentFile_Definition.ts ////var /*remoteVariableDefinition*/remoteVariable; -/////*remoteFunctionDefinition*/function remoteFunction() { } -/////*remoteClassDefinition*/class remoteClass { } -/////*remoteInterfaceDefinition*/interface remoteInterface{ } -/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} +////function /*remoteFunctionDefinition*/remoteFunction() { } +////class /*remoteClassDefinition*/remoteClass { } +////interface /*remoteInterfaceDefinition*/remoteInterface{ } +////module /*remoteModuleDefinition*/remoteModule{ export var foo = 1;} // @Filename: goToDefinitionDifferentFile_Consumption.ts /////*remoteVariableReference*/remoteVariable = 1; diff --git a/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts b/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts index 96a65a22033..f577712c930 100644 --- a/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts +++ b/tests/cases/fourslash/goToDefinitionDifferentFileIndirectly.ts @@ -2,10 +2,10 @@ // @Filename: Remote2.ts ////var /*remoteVariableDefinition*/rem2Var; -/////*remoteFunctionDefinition*/function rem2Fn() { } -/////*remoteClassDefinition*/class rem2Cls { } -/////*remoteInterfaceDefinition*/interface rem2Int{} -/////*remoteModuleDefinition*/module rem2Mod { export var foo; } +////function /*remoteFunctionDefinition*/rem2Fn() { } +////class /*remoteClassDefinition*/rem2Cls { } +////interface /*remoteInterfaceDefinition*/rem2Int{} +////module /*remoteModuleDefinition*/rem2Mod { export var foo; } // @Filename: Remote1.ts ////var remVar; diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts index afd3b4054a2..7ac0376474d 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts @@ -5,7 +5,7 @@ ////var x = new n.Foo(); // @Filename: a.ts -/////*2*/declare module "e" { +////declare module /*2*/"e" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName5.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName5.ts index ae9343a8f5b..36ae9dd716f 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName5.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName5.ts @@ -1,7 +1,7 @@ /// // @Filename: a.ts -/////*2*/declare module "external/*1*/" { +////declare module /*2*/"external/*1*/" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName6.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName6.ts index 03c3a23febc..a71030628e6 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName6.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName6.ts @@ -4,7 +4,7 @@ ////import * from 'e/*1*/'; // @Filename: a.ts -/////*2*/declare module "e" { +////declare module /*2*/"e" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName7.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName7.ts index 4c82099ab20..b025944d012 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName7.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName7.ts @@ -4,7 +4,7 @@ ////import {Foo, Bar} from 'e/*1*/'; // @Filename: a.ts -/////*2*/declare module "e" { +////declare module /*2*/"e" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName8.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName8.ts index 5eab37e8393..ca9d7c83e66 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName8.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName8.ts @@ -4,7 +4,7 @@ ////export {Foo, Bar} from 'e/*1*/'; // @Filename: a.ts -/////*2*/declare module "e" { +////declare module /*2*/"e" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionExternalModuleName9.ts b/tests/cases/fourslash/goToDefinitionExternalModuleName9.ts index 9e0c1b4986e..80971be100f 100644 --- a/tests/cases/fourslash/goToDefinitionExternalModuleName9.ts +++ b/tests/cases/fourslash/goToDefinitionExternalModuleName9.ts @@ -4,7 +4,7 @@ ////export * from 'e/*1*/'; // @Filename: a.ts -/////*2*/declare module "e" { +////declare module /*2*/"e" { //// class Foo { } ////} diff --git a/tests/cases/fourslash/goToDefinitionFoo.ts b/tests/cases/fourslash/goToDefinitionFoo.ts new file mode 100644 index 00000000000..3e05ee20ecb --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionFoo.ts @@ -0,0 +1,6 @@ +/// + +////function /*def*/f() {} +/////*use*/f(123); + +verify.goToDefinition("use", "def"); diff --git a/tests/cases/fourslash/goToDefinitionFunctionOverloads.ts b/tests/cases/fourslash/goToDefinitionFunctionOverloads.ts index e30150a1f45..60c7a8111ee 100644 --- a/tests/cases/fourslash/goToDefinitionFunctionOverloads.ts +++ b/tests/cases/fourslash/goToDefinitionFunctionOverloads.ts @@ -1,8 +1,8 @@ /// -/////*functionOverload1*/function /*functionOverload*/functionOverload(value: number); -/////*functionOverload2*/function functionOverload(value: string); -/////*functionOverloadDefinition*/function functionOverload() {} +////function /*functionOverload1*/functionOverload(value: number); +////function /*functionOverload2*/functionOverload(value: string); +////function /*functionOverloadDefinition*/functionOverload() {} //// /////*functionOverloadReference1*/functionOverload(123); /////*functionOverloadReference2*/functionOverload("123"); @@ -12,5 +12,5 @@ verify.goToDefinition({ functionOverloadReference1: "functionOverload1", functionOverloadReference2: "functionOverload2", brokenOverload: "functionOverload1", - functionOverload: "functionOverloadDefinition" + functionOverload1: "functionOverloadDefinition" }); diff --git a/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts b/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts index 3426a4d5e1e..04017123fd8 100644 --- a/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts +++ b/tests/cases/fourslash/goToDefinitionFunctionOverloadsInClass.ts @@ -3,10 +3,10 @@ ////class clsInOverload { //// static fnOverload(); //// static /*staticFunctionOverload*/fnOverload(foo: string); -//// /*staticFunctionOverloadDefinition*/static fnOverload(foo: any) { } +//// static /*staticFunctionOverloadDefinition*/fnOverload(foo: any) { } //// public /*functionOverload*/fnOverload(): any; //// public fnOverload(foo: string); -//// /*functionOverloadDefinition*/public fnOverload(foo: any) { return "foo" } +//// public /*functionOverloadDefinition*/fnOverload(foo: any) { return "foo" } //// //// constructor() { } ////} diff --git a/tests/cases/fourslash/goToDefinitionImplicitConstructor.ts b/tests/cases/fourslash/goToDefinitionImplicitConstructor.ts index bf24e35307f..2d1dde785a7 100644 --- a/tests/cases/fourslash/goToDefinitionImplicitConstructor.ts +++ b/tests/cases/fourslash/goToDefinitionImplicitConstructor.ts @@ -1,6 +1,6 @@ /// -/////*constructorDefinition*/class ImplicitConstructor { +////class /*constructorDefinition*/ImplicitConstructor { ////} ////var implicitConstructor = new /*constructorReference*/ImplicitConstructor(); diff --git a/tests/cases/fourslash/goToDefinitionImportedNames.ts b/tests/cases/fourslash/goToDefinitionImportedNames.ts index b7374d00f18..41a1c443b28 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames.ts @@ -7,7 +7,7 @@ // @Filename: a.ts ////export module Module { ////} -/////*classDefinition*/export class Class { +////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { diff --git a/tests/cases/fourslash/goToDefinitionImportedNames2.ts b/tests/cases/fourslash/goToDefinitionImportedNames2.ts index b0b8776ee37..fa3c5c862b7 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames2.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames2.ts @@ -7,7 +7,7 @@ // @Filename: a.ts ////export module Module { ////} -/////*classDefinition*/export class Class { +////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { diff --git a/tests/cases/fourslash/goToDefinitionImportedNames3.ts b/tests/cases/fourslash/goToDefinitionImportedNames3.ts index f8016464360..b9f598f30cd 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames3.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames3.ts @@ -20,7 +20,7 @@ // @Filename: a.ts ////export module Module { ////} -/////*classDefinition*/export class Class { +////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { diff --git a/tests/cases/fourslash/goToDefinitionImportedNames4.ts b/tests/cases/fourslash/goToDefinitionImportedNames4.ts index 4b6b019cfae..81f2e671266 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames4.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames4.ts @@ -7,7 +7,7 @@ // @Filename: a.ts ////export module Module { ////} -/////*classDefinition*/export class Class { +////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { diff --git a/tests/cases/fourslash/goToDefinitionImportedNames5.ts b/tests/cases/fourslash/goToDefinitionImportedNames5.ts index 5add12ae0bc..b78110c95d9 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames5.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames5.ts @@ -7,7 +7,7 @@ // @Filename: a.ts ////export module Module { ////} -/////*classDefinition*/export class Class { +////export class /*classDefinition*/Class { //// private f; ////} ////export interface Interface { diff --git a/tests/cases/fourslash/goToDefinitionImportedNames7.ts b/tests/cases/fourslash/goToDefinitionImportedNames7.ts index 86be4af3d85..bdf1eff86eb 100644 --- a/tests/cases/fourslash/goToDefinitionImportedNames7.ts +++ b/tests/cases/fourslash/goToDefinitionImportedNames7.ts @@ -5,7 +5,7 @@ // @Filename: a.ts -/////*classDefinition*/class Class { +////class /*classDefinition*/Class { //// private f; ////} ////export default Class; diff --git a/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts b/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts index 66719bb621b..93be2086440 100644 --- a/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts +++ b/tests/cases/fourslash/goToDefinitionInMemberDeclaration.ts @@ -1,14 +1,14 @@ /// -/////*interfaceDefinition*/interface IFoo { method1(): number; } +////interface /*interfaceDefinition*/IFoo { method1(): number; } //// -/////*classDefinition*/class Foo implements IFoo { +////class /*classDefinition*/Foo implements IFoo { //// public method1(): number { return 0; } ////} //// -/////*enumDefinition*/enum Enum { value1, value2 }; +////enum /*enumDefinition*/Enum { value1, value2 }; //// -/////*selfDefinition*/class Bar { +////class /*selfDefinition*/Bar { //// public _interface: IFo/*interfaceReference*/o = new Fo/*classReferenceInInitializer*/o(); //// public _class: Fo/*classReference*/o = new Foo(); //// public _list: IF/*interfaceReferenceInList*/oo[]=[]; diff --git a/tests/cases/fourslash/goToDefinitionInTypeArgument.ts b/tests/cases/fourslash/goToDefinitionInTypeArgument.ts index 343b5810df3..a9bddeda434 100644 --- a/tests/cases/fourslash/goToDefinitionInTypeArgument.ts +++ b/tests/cases/fourslash/goToDefinitionInTypeArgument.ts @@ -1,8 +1,8 @@ /// -/////*fooDefinition*/class Foo { } +////class /*fooDefinition*/Foo { } //// -/////*barDefinition*/class Bar { } +////class /*barDefinition*/Bar { } //// ////var x = new Fo/*fooReference*/o(); diff --git a/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts b/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts index 585cc187e48..46d9e0182a4 100644 --- a/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts +++ b/tests/cases/fourslash/goToDefinitionInterfaceAfterImplement.ts @@ -1,6 +1,6 @@ /// -/////*interfaceDefinition*/interface sInt { +////interface /*interfaceDefinition*/sInt { //// sVar: number; //// sFn: () => void; ////} diff --git a/tests/cases/fourslash/goToDefinitionMethodOverloads.ts b/tests/cases/fourslash/goToDefinitionMethodOverloads.ts index 199b5aee226..4dfe4753ce7 100644 --- a/tests/cases/fourslash/goToDefinitionMethodOverloads.ts +++ b/tests/cases/fourslash/goToDefinitionMethodOverloads.ts @@ -1,12 +1,12 @@ /// ////class MethodOverload { -//// /*staticMethodOverload1*/static /*staticMethodOverload1Name*/method(); -//// /*staticMethodOverload2*/static method(foo: string); -//// /*staticMethodDefinition*/static method(foo?: any) { } -//// /*instanceMethodOverload1*/public /*instanceMethodOverload1Name*/method(): any; -//// /*instanceMethodOverload2*/public method(foo: string); -/////*instanceMethodDefinition*/public method(foo?: any) { return "foo" } +//// static /*staticMethodOverload1*/method(); +//// static /*staticMethodOverload2*/method(foo: string); +//// static /*staticMethodDefinition*/method(foo?: any) { } +//// public /*instanceMethodOverload1*/method(): any; +//// public /*instanceMethodOverload2*/method(foo: string); +//// public /*instanceMethodDefinition*/method(foo?: any) { return "foo" } ////} ////// static method @@ -23,6 +23,6 @@ verify.goToDefinition({ staticMethodReference2: "staticMethodOverload2", instanceMethodReference1: "instanceMethodOverload1", instanceMethodReference2: "instanceMethodOverload2", - staticMethodOverload1Name: "staticMethodDefinition", - instanceMethodOverload1Name: "instanceMethodDefinition" + staticMethodOverload1: "staticMethodDefinition", + instanceMethodOverload1: "instanceMethodDefinition" }); diff --git a/tests/cases/fourslash/goToDefinitionMultipleDefinitions.ts b/tests/cases/fourslash/goToDefinitionMultipleDefinitions.ts index 7b2cf6e7a85..fb022f7711f 100644 --- a/tests/cases/fourslash/goToDefinitionMultipleDefinitions.ts +++ b/tests/cases/fourslash/goToDefinitionMultipleDefinitions.ts @@ -1,16 +1,16 @@ /// // @Filename: a.ts -/////*interfaceDefinition1*/interface IFoo { +////interface /*interfaceDefinition1*/IFoo { //// instance1: number; ////} // @Filename: b.ts -/////*interfaceDefinition2*/interface IFoo { +////interface /*interfaceDefinition2*/IFoo { //// instance2: number; ////} //// -/////*interfaceDefinition3*/interface IFoo { +////interface /*interfaceDefinition3*/IFoo { //// instance3: number; ////} //// @@ -19,12 +19,12 @@ verify.goToDefinition("interfaceReference", ["interfaceDefinition1", "interfaceDefinition2", "interfaceDefinition3"]); // @Filename: c.ts -/////*moduleDefinition1*/module Module { +////module /*moduleDefinition1*/Module { //// export class c1 { } ////} // @Filename: d.ts -/////*moduleDefinition2*/module Module { +////module /*moduleDefinition2*/Module { //// export class c2 { } ////} diff --git a/tests/cases/fourslash/goToDefinitionObjectLiteralProperties.ts b/tests/cases/fourslash/goToDefinitionObjectLiteralProperties.ts index 8523df2111b..d430df3433d 100644 --- a/tests/cases/fourslash/goToDefinitionObjectLiteralProperties.ts +++ b/tests/cases/fourslash/goToDefinitionObjectLiteralProperties.ts @@ -2,8 +2,8 @@ ////var o = { //// /*valueDefinition*/value: 0, -//// /*getterDefinition*/get getter() {return 0 }, -//// /*setterDefinition*/set setter(v: number) { }, +//// get /*getterDefinition*/getter() {return 0 }, +//// set /*setterDefinition*/setter(v: number) { }, //// /*methodDefinition*/method: () => { }, //// /*es6StyleMethodDefinition*/es6StyleMethod() { } ////}; diff --git a/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts b/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts index 63c23cfe46f..04a07f41a7f 100644 --- a/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts +++ b/tests/cases/fourslash/goToDefinitionOverloadsInMultiplePropertyAccesses.ts @@ -5,7 +5,7 @@ ////namespace A { //// export namespace B { //// export function f(value: number): void; -//// /*1*/export function f(value: string): void; +//// export function /*1*/f(value: string): void; //// export function f(value: number | string) {} //// } ////} diff --git a/tests/cases/fourslash/goToDefinitionPartialImplementation.ts b/tests/cases/fourslash/goToDefinitionPartialImplementation.ts index 90402b3f8e6..81f19b578ed 100644 --- a/tests/cases/fourslash/goToDefinitionPartialImplementation.ts +++ b/tests/cases/fourslash/goToDefinitionPartialImplementation.ts @@ -2,14 +2,14 @@ // @Filename: goToDefinitionPartialImplementation_1.ts ////module A { -//// /*Part1Definition*/export interface IA { +//// export interface /*Part1Definition*/IA { //// y: string; //// } ////} // @Filename: goToDefinitionPartialImplementation_2.ts ////module A { -//// /*Part2Definition*/export interface IA { +//// export interface /*Part2Definition*/IA { //// x: number; //// } //// diff --git a/tests/cases/fourslash/goToDefinitionSameFile.ts b/tests/cases/fourslash/goToDefinitionSameFile.ts index 6bbdaf3a189..e9b8b211bf7 100644 --- a/tests/cases/fourslash/goToDefinitionSameFile.ts +++ b/tests/cases/fourslash/goToDefinitionSameFile.ts @@ -1,10 +1,10 @@ /// ////var /*localVariableDefinition*/localVariable; -/////*localFunctionDefinition*/function localFunction() { } -/////*localClassDefinition*/class localClass { } -/////*localInterfaceDefinition*/interface localInterface{ } -/////*localModuleDefinition*/module localModule{ export var foo = 1;} +////function /*localFunctionDefinition*/localFunction() { } +////class /*localClassDefinition*/localClass { } +////interface /*localInterfaceDefinition*/localInterface{ } +////module /*localModuleDefinition*/localModule{ export var foo = 1;} //// //// /////*localVariableReference*/localVariable = 1; diff --git a/tests/cases/fourslash/goToDefinitionSimple.ts b/tests/cases/fourslash/goToDefinitionSimple.ts index 39aa8ecfca9..9ae02f26bf2 100644 --- a/tests/cases/fourslash/goToDefinitionSimple.ts +++ b/tests/cases/fourslash/goToDefinitionSimple.ts @@ -1,7 +1,7 @@ /// // @Filename: Definition.ts -//// /*2*/class c { } +////class /*2*/c { } // @Filename: Consumption.ts //// var n = new /*1*/c(); diff --git a/tests/cases/fourslash/goToDefinitionTaggedTemplateOverloads.ts b/tests/cases/fourslash/goToDefinitionTaggedTemplateOverloads.ts index fad27cabbb6..b01bace4feb 100644 --- a/tests/cases/fourslash/goToDefinitionTaggedTemplateOverloads.ts +++ b/tests/cases/fourslash/goToDefinitionTaggedTemplateOverloads.ts @@ -1,7 +1,7 @@ /// -/////*defFNumber*/function f(strs: TemplateStringsArray, x: number): void; -/////*defFBool*/function f(strs: TemplateStringsArray, x: boolean): void; +////function /*defFNumber*/f(strs: TemplateStringsArray, x: number): void; +////function /*defFBool*/f(strs: TemplateStringsArray, x: boolean): void; ////function f(strs: TemplateStringsArray, x: number | boolean) {} //// /////*useFNumber*/f`${0}`; diff --git a/tests/cases/fourslash/goToDefinitionThis.ts b/tests/cases/fourslash/goToDefinitionThis.ts index 5cb94ef35c7..923fb6c8feb 100644 --- a/tests/cases/fourslash/goToDefinitionThis.ts +++ b/tests/cases/fourslash/goToDefinitionThis.ts @@ -3,7 +3,7 @@ ////function f(/*fnDecl*/this: number) { //// return /*fnUse*/this; ////} -/////*cls*/class C { +////class /*cls*/C { //// constructor() { return /*clsUse*/this; } //// get self(/*getterDecl*/this: number) { return /*getterUse*/this; } ////} diff --git a/tests/cases/fourslash/goToDefinitionTypePredicate.ts b/tests/cases/fourslash/goToDefinitionTypePredicate.ts index dd2b69f37e8..17e6fc1be6b 100644 --- a/tests/cases/fourslash/goToDefinitionTypePredicate.ts +++ b/tests/cases/fourslash/goToDefinitionTypePredicate.ts @@ -1,6 +1,6 @@ /// -//// /*classDeclaration*/class A {} +//// class /*classDeclaration*/A {} //// function f(/*parameterDeclaration*/parameter: any): /*parameterName*/parameter is /*typeReference*/A { //// return typeof parameter === "string"; //// } diff --git a/tests/cases/fourslash/goToDefinition_super.ts b/tests/cases/fourslash/goToDefinition_super.ts index 7a7008ba07f..115e4a4a6ed 100644 --- a/tests/cases/fourslash/goToDefinition_super.ts +++ b/tests/cases/fourslash/goToDefinition_super.ts @@ -4,7 +4,7 @@ //// /*ctr*/constructor() {} //// x() {} ////} -/////*B*/class B extends A {} +////class /*B*/B extends A {} ////class C extends B { //// constructor() { //// /*super*/super(); diff --git a/tests/cases/fourslash/goToModuleAliasDefinition.ts b/tests/cases/fourslash/goToModuleAliasDefinition.ts index cdec82fd0d4..dfccc3393c5 100644 --- a/tests/cases/fourslash/goToModuleAliasDefinition.ts +++ b/tests/cases/fourslash/goToModuleAliasDefinition.ts @@ -1,10 +1,10 @@ /// // @Filename: a.ts -//// /*2*/export class Foo {} +////export class /*2*/Foo {} // @Filename: b.ts -//// /*3*/import n = require('a'); +//// import /*3*/n = require('a'); //// var x = new /*1*/n.Foo(); // Won't-fixed: Should go to '2' instead diff --git a/tests/cases/fourslash/goToTypeDefinition.ts b/tests/cases/fourslash/goToTypeDefinition.ts index 6b34e7e4886..b6bbd839003 100644 --- a/tests/cases/fourslash/goToTypeDefinition.ts +++ b/tests/cases/fourslash/goToTypeDefinition.ts @@ -1,7 +1,7 @@ /// // @Filename: goToTypeDefinition_Definition.ts -/////*definition*/class C { +////class /*definition*/C { //// p; ////} ////var c: C; @@ -9,6 +9,4 @@ // @Filename: goToTypeDefinition_Consumption.ts /////*reference*/c = undefined; -goTo.marker('reference'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType("reference", "definition"); diff --git a/tests/cases/fourslash/goToTypeDefinition2.ts b/tests/cases/fourslash/goToTypeDefinition2.ts index 8c76655f4a8..4f93edcd68a 100644 --- a/tests/cases/fourslash/goToTypeDefinition2.ts +++ b/tests/cases/fourslash/goToTypeDefinition2.ts @@ -1,7 +1,7 @@ /// // @Filename: goToTypeDefinition2_Definition.ts -/////*definition*/interface I1 { +////interface /*definition*/I1 { //// p; ////} ////type propertyType = I1; @@ -13,6 +13,4 @@ ////var i2: I2; ////i2.prop/*reference*/erty; -goTo.marker('reference'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType("reference", "definition"); diff --git a/tests/cases/fourslash/goToTypeDefinitionAliases.ts b/tests/cases/fourslash/goToTypeDefinitionAliases.ts index da9d3d5a84e..89dacedc7aa 100644 --- a/tests/cases/fourslash/goToTypeDefinitionAliases.ts +++ b/tests/cases/fourslash/goToTypeDefinitionAliases.ts @@ -1,7 +1,7 @@ /// // @Filename: goToTypeDefinitioAliases_module1.ts -/////*definition*/interface I { +////interface /*definition*/I { //// p; ////} ////export {I as I2}; @@ -15,10 +15,7 @@ ////import {/*reference1*/v2 as v3} from "./goToTypeDefinitioAliases_module2"; /////*reference2*/v3; -goTo.marker('reference1'); -goTo.type(); -verify.caretAtMarker('definition'); - -goTo.marker('reference2'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType({ + reference1: "definition", + reference2: "definition" +}); diff --git a/tests/cases/fourslash/goToTypeDefinitionEnumMembers.ts b/tests/cases/fourslash/goToTypeDefinitionEnumMembers.ts index 1c2a0259d58..d4f89d29ee8 100644 --- a/tests/cases/fourslash/goToTypeDefinitionEnumMembers.ts +++ b/tests/cases/fourslash/goToTypeDefinitionEnumMembers.ts @@ -8,6 +8,4 @@ //// /////*reference*/x; -goTo.marker('reference'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType("reference", "definition"); diff --git a/tests/cases/fourslash/goToTypeDefinitionModule.ts b/tests/cases/fourslash/goToTypeDefinitionModule.ts index 2afccab97c3..00e0fa82a09 100644 --- a/tests/cases/fourslash/goToTypeDefinitionModule.ts +++ b/tests/cases/fourslash/goToTypeDefinitionModule.ts @@ -1,19 +1,16 @@ /// -// @Filename: goToTypeDefinitioAliases_module1.ts -/////*definition*/module M { +// @Filename: module1.ts +////module /*definition*/M { //// export var p; ////} ////var m: typeof M; -// @Filename: goToTypeDefinitioAliases_module3.ts +// @Filename: module3.ts /////*reference1*/M; /////*reference2*/m; -goTo.marker('reference1'); -goTo.type(); -verify.caretAtMarker('definition'); - -goTo.marker('reference2'); -goTo.type(); -verify.caretAtMarker('definition'); \ No newline at end of file +verify.goToType({ + reference1: "definition", + reference2: "definition" +}); diff --git a/tests/cases/fourslash/goToTypeDefinitionPrimitives.ts b/tests/cases/fourslash/goToTypeDefinitionPrimitives.ts index d38a0c16343..0b6f6903524 100644 --- a/tests/cases/fourslash/goToTypeDefinitionPrimitives.ts +++ b/tests/cases/fourslash/goToTypeDefinitionPrimitives.ts @@ -12,14 +12,9 @@ /////*reference3*/y; /////*reference4*/y; -goTo.marker('reference1'); -verify.typeDefinitionCountIs(0); - -goTo.marker('reference1'); -verify.typeDefinitionCountIs(0); - -goTo.marker('reference2'); -verify.typeDefinitionCountIs(0); - -goTo.marker('reference4'); -verify.typeDefinitionCountIs(0); +verify.goToType({ + reference1: [], + reference2: [], + reference3: [], + reference4: [] +}); diff --git a/tests/cases/fourslash/goToTypeDefinitionUnionType.ts b/tests/cases/fourslash/goToTypeDefinitionUnionType.ts index 0630ae3ebb9..5658ce77b64 100644 --- a/tests/cases/fourslash/goToTypeDefinitionUnionType.ts +++ b/tests/cases/fourslash/goToTypeDefinitionUnionType.ts @@ -1,15 +1,15 @@ /// -/////*definition0*/class C { +////class /*definition0*/C { //// p; ////} //// -/////*definition1*/interface I { +////interface /*definition1*/I { //// x; ////} //// ////module M { -//// /*definition2*/export interface I { +//// export interface /*definition2*/I { //// y; //// } ////} @@ -18,14 +18,4 @@ //// /////*reference*/x; -goTo.marker('reference'); -goTo.type(0); -verify.caretAtMarker('definition0'); - -goTo.marker('reference'); -goTo.type(1); -verify.caretAtMarker('definition1'); - -goTo.marker('reference'); -goTo.type(2); -verify.caretAtMarker('definition2'); +verify.goToType("reference", ["definition0", "definition1", "definition2"]); diff --git a/tests/cases/fourslash/quickInfoMeaning.ts b/tests/cases/fourslash/quickInfoMeaning.ts index 390dc367959..414fcc0c86d 100644 --- a/tests/cases/fourslash/quickInfoMeaning.ts +++ b/tests/cases/fourslash/quickInfoMeaning.ts @@ -14,7 +14,7 @@ // @Filename: foo_user.ts /////// -/////*foo_type_declaration*/import foo = require("foo_module"); +////import /*foo_type_declaration*/foo = require("foo_module"); ////const x = foo/*foo_value*/; ////const i: foo/*foo_type*/ = { x: 1, y: 2 }; @@ -37,7 +37,7 @@ verify.goToDefinitionIs("foo_type_declaration"); // @Filename: bar.d.ts -/////*bar_type_declaration*/declare interface bar { x: number; y: number } +////declare interface /*bar_type_declaration*/bar { x: number; y: number } ////declare module "bar_module" { //// const x: number; //// export = x; @@ -45,7 +45,7 @@ verify.goToDefinitionIs("foo_type_declaration"); // @Filename: bar_user.ts /////// -/////*bar_value_declaration*/import bar = require("bar_module"); +////import /*bar_value_declaration*/bar = require("bar_module"); ////const x = bar/*bar_value*/; ////const i: bar/*bar_type*/ = { x: 1, y: 2 }; diff --git a/tests/cases/fourslash/server/jsdocTypedefTagGoToDefinition.ts b/tests/cases/fourslash/server/jsdocTypedefTagGoToDefinition.ts index 2183c8d5471..000adef9081 100644 --- a/tests/cases/fourslash/server/jsdocTypedefTagGoToDefinition.ts +++ b/tests/cases/fourslash/server/jsdocTypedefTagGoToDefinition.ts @@ -5,7 +5,7 @@ //// /** //// * @typedef {Object} Person -//// * /*1*/@property {string} personName +//// * @property {string} /*1*/personName //// * @property {number} personAge //// */ //// diff --git a/tests/cases/fourslash/server/typedefinition01.ts b/tests/cases/fourslash/server/typedefinition01.ts index bde9f4dc4d8..40e1dcf43bb 100644 --- a/tests/cases/fourslash/server/typedefinition01.ts +++ b/tests/cases/fourslash/server/typedefinition01.ts @@ -5,8 +5,6 @@ ////var x/*1*/ = new n.Foo(); // @Filename: a.ts -//// /*2*/export class Foo {} +////export class /*2*/Foo {} -goTo.marker('1'); -goTo.type(); -verify.caretAtMarker('2'); \ No newline at end of file +verify.goToType("1", "2"); diff --git a/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts b/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts index 1679563942c..67e8c44c84c 100644 --- a/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts @@ -2,10 +2,10 @@ // @Filename: goToDefinitionDifferentFile_Definition.ts ////var /*remoteVariableDefinition*/remoteVariable; -/////*remoteFunctionDefinition*/function remoteFunction() { } -/////*remoteClassDefinition*/class remoteClass { } -/////*remoteInterfaceDefinition*/interface remoteInterface{ } -/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} +////function /*remoteFunctionDefinition*/remoteFunction() { } +////class /*remoteClassDefinition*/remoteClass { } +////interface /*remoteInterfaceDefinition*/remoteInterface{ } +////module /*remoteModuleDefinition*/remoteModule{ export var foo = 1;} // @Filename: goToDefinitionDifferentFile_Consumption.ts /////*remoteVariableReference*/remoteVariable = 1; diff --git a/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts b/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts index 6b34e7e4886..b6bbd839003 100644 --- a/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts +++ b/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts @@ -1,7 +1,7 @@ /// // @Filename: goToTypeDefinition_Definition.ts -/////*definition*/class C { +////class /*definition*/C { //// p; ////} ////var c: C; @@ -9,6 +9,4 @@ // @Filename: goToTypeDefinition_Consumption.ts /////*reference*/c = undefined; -goTo.marker('reference'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType("reference", "definition"); diff --git a/tests/cases/fourslash/shims/getDefinitionAtPosition.ts b/tests/cases/fourslash/shims/getDefinitionAtPosition.ts index 1679563942c..67e8c44c84c 100644 --- a/tests/cases/fourslash/shims/getDefinitionAtPosition.ts +++ b/tests/cases/fourslash/shims/getDefinitionAtPosition.ts @@ -2,10 +2,10 @@ // @Filename: goToDefinitionDifferentFile_Definition.ts ////var /*remoteVariableDefinition*/remoteVariable; -/////*remoteFunctionDefinition*/function remoteFunction() { } -/////*remoteClassDefinition*/class remoteClass { } -/////*remoteInterfaceDefinition*/interface remoteInterface{ } -/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} +////function /*remoteFunctionDefinition*/remoteFunction() { } +////class /*remoteClassDefinition*/remoteClass { } +////interface /*remoteInterfaceDefinition*/remoteInterface{ } +////module /*remoteModuleDefinition*/remoteModule{ export var foo = 1;} // @Filename: goToDefinitionDifferentFile_Consumption.ts /////*remoteVariableReference*/remoteVariable = 1; diff --git a/tests/cases/fourslash/shims/goToTypeDefinition.ts b/tests/cases/fourslash/shims/goToTypeDefinition.ts index 6b34e7e4886..b6bbd839003 100644 --- a/tests/cases/fourslash/shims/goToTypeDefinition.ts +++ b/tests/cases/fourslash/shims/goToTypeDefinition.ts @@ -1,7 +1,7 @@ /// // @Filename: goToTypeDefinition_Definition.ts -/////*definition*/class C { +////class /*definition*/C { //// p; ////} ////var c: C; @@ -9,6 +9,4 @@ // @Filename: goToTypeDefinition_Consumption.ts /////*reference*/c = undefined; -goTo.marker('reference'); -goTo.type(); -verify.caretAtMarker('definition'); +verify.goToType("reference", "definition"); diff --git a/tests/cases/fourslash/tsxGoToDefinitionClasses.ts b/tests/cases/fourslash/tsxGoToDefinitionClasses.ts index 9c54834534d..fb76080f6df 100644 --- a/tests/cases/fourslash/tsxGoToDefinitionClasses.ts +++ b/tests/cases/fourslash/tsxGoToDefinitionClasses.ts @@ -6,7 +6,7 @@ //// interface IntrinsicElements { } //// interface ElementAttributesProperty { props; } //// } -//// /*ct*/class MyClass { +//// class /*ct*/MyClass { //// props: { //// /*pt*/foo: string; //// } From 463626d56f3b52712a23f09c81f411763df0bf19 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 9 Jan 2017 13:51:25 -0800 Subject: [PATCH 247/289] Move helper to services/utilities --- src/compiler/utilities.ts | 4 ---- src/services/utilities.ts | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6a017fd996d..192ef888b11 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4318,10 +4318,6 @@ namespace ts { return createTextSpan(start, end - start); } - export function createTextSpanFromNode(node: Node, sourceFile?: SourceFile): TextSpan { - return createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); - } - export function textChangeRangeNewSpan(range: TextChangeRange) { return createTextSpan(range.span.start, range.newLength); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 76a3b43da21..47608a59e75 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1112,6 +1112,10 @@ namespace ts { return !tripleSlashDirectivePrefixRegex.test(commentText); } } + + export function createTextSpanFromNode(node: Node, sourceFile?: SourceFile): TextSpan { + return createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd()); + } } // Display-part writer helpers From fc641fa2752dfd0049b51516b4ac642ca5850c18 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 9 Jan 2017 16:51:30 -0800 Subject: [PATCH 248/289] Properly check T[K] constraints in type relationships --- src/compiler/checker.ts | 2 +- src/compiler/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3769f2493b3..2bdfe9c0c03 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7206,7 +7206,7 @@ namespace ts { return related === RelationComparisonResult.Succeeded; } } - if (source.flags & TypeFlags.StructuredOrTypeParameter || target.flags & TypeFlags.StructuredOrTypeParameter) { + if (source.flags & TypeFlags.StructuredOrTypeVariable || target.flags & TypeFlags.StructuredOrTypeVariable) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6eebb0b99d7..8e626384533 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2803,7 +2803,7 @@ namespace ts { EnumLike = Enum | EnumLiteral, UnionOrIntersection = Union | Intersection, StructuredType = Object | Union | Intersection, - StructuredOrTypeParameter = StructuredType | TypeParameter | Index, + StructuredOrTypeVariable = StructuredType | TypeParameter | Index | IndexedAccess, TypeVariable = TypeParameter | IndexedAccess, // 'Narrowable' types are types where narrowing actually narrows. From 81e891812e96e5b03286e61ebd0ce412cf2345bd Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 9 Jan 2017 16:51:46 -0800 Subject: [PATCH 249/289] Add regression test --- .../reference/keyofAndIndexedAccess.js | 51 +++++++++++ .../reference/keyofAndIndexedAccess.symbols | 80 +++++++++++++++++ .../reference/keyofAndIndexedAccess.types | 86 +++++++++++++++++++ .../types/keyof/keyofAndIndexedAccess.ts | 27 ++++++ 4 files changed, 244 insertions(+) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index 3ad7bdd79f8..f5c2624fc40 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -463,6 +463,33 @@ let MyThingy: { [key in KeyTypes]: string[] }; function addToMyThingy(key: S) { MyThingy[key].push("a"); } + +// Repro from #13285 + +function updateIds, K extends string>( + obj: T, + idFields: K[], + idMapping: { [oldId: string]: string } +): Record { + for (const idField of idFields) { + const newId = idMapping[obj[idField]]; + if (newId) { + obj[idField] = newId; + } + } + return obj; +} + +// Repro from #13285 + +function updateIds2( + obj: T, + key: K, + stringMap: { [oldId: string]: string } +) { + var x = obj[key]; + stringMap[x]; // Should be OK. +} //// [keyofAndIndexedAccess.js] @@ -769,6 +796,22 @@ var MyThingy; function addToMyThingy(key) { MyThingy[key].push("a"); } +// Repro from #13285 +function updateIds(obj, idFields, idMapping) { + for (var _i = 0, idFields_1 = idFields; _i < idFields_1.length; _i++) { + var idField = idFields_1[_i]; + var newId = idMapping[obj[idField]]; + if (newId) { + obj[idField] = newId; + } + } + return obj; +} +// Repro from #13285 +function updateIds2(obj, key, stringMap) { + var x = obj[key]; + stringMap[x]; // Should be OK. +} //// [keyofAndIndexedAccess.d.ts] @@ -986,3 +1029,11 @@ declare let MyThingy: { [key in KeyTypes]: string[]; }; declare function addToMyThingy(key: S): void; +declare function updateIds, K extends string>(obj: T, idFields: K[], idMapping: { + [oldId: string]: string; +}): Record; +declare function updateIds2(obj: T, key: K, stringMap: { + [oldId: string]: string; +}): void; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index fb8129a5301..a6eb03dd6e5 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -1699,3 +1699,83 @@ function addToMyThingy(key: S) { >push : Symbol(Array.push, Decl(lib.d.ts, --, --)) } +// Repro from #13285 + +function updateIds, K extends string>( +>updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 463, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 19)) +>Record : Symbol(Record, Decl(lib.d.ts, --, --)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) + + obj: T, +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 19)) + + idFields: K[], +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) + + idMapping: { [oldId: string]: string } +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469, 18)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 470, 18)) + +): Record { +>Record : Symbol(Record, Decl(lib.d.ts, --, --)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) + + for (const idField of idFields) { +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468, 11)) + + const newId = idMapping[obj[idField]]; +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469, 18)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) + + if (newId) { +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) + + obj[idField] = newId; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) + } + } + return obj; +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) +} + +// Repro from #13285 + +function updateIds2( +>updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 479, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 483, 33)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483, 54)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) + + obj: T, +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483, 74)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) + + key: K, +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483, 54)) + + stringMap: { [oldId: string]: string } +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485, 11)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 486, 18)) + +) { + var x = obj[key]; +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483, 74)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484, 11)) + + stringMap[x]; // Should be OK. +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488, 7)) +} + diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index ccf0bde4e1c..920758c8beb 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -2013,3 +2013,89 @@ function addToMyThingy(key: S) { >"a" : "a" } +// Repro from #13285 + +function updateIds, K extends string>( +>updateIds : , K extends string>(obj: T, idFields: K[], idMapping: { [oldId: string]: string; }) => Record +>T : T +>Record : Record +>K : K +>K : K + + obj: T, +>obj : T +>T : T + + idFields: K[], +>idFields : K[] +>K : K + + idMapping: { [oldId: string]: string } +>idMapping : { [oldId: string]: string; } +>oldId : string + +): Record { +>Record : Record +>K : K + + for (const idField of idFields) { +>idField : K +>idFields : K[] + + const newId = idMapping[obj[idField]]; +>newId : { [oldId: string]: string; }[T[K]] +>idMapping[obj[idField]] : { [oldId: string]: string; }[T[K]] +>idMapping : { [oldId: string]: string; } +>obj[idField] : T[K] +>obj : T +>idField : K + + if (newId) { +>newId : { [oldId: string]: string; }[T[K]] + + obj[idField] = newId; +>obj[idField] = newId : { [oldId: string]: string; }[T[K]] +>obj[idField] : T[K] +>obj : T +>idField : K +>newId : { [oldId: string]: string; }[T[K]] + } + } + return obj; +>obj : T +} + +// Repro from #13285 + +function updateIds2( +>updateIds2 : (obj: T, key: K, stringMap: { [oldId: string]: string; }) => void +>T : T +>x : string +>K : K +>T : T + + obj: T, +>obj : T +>T : T + + key: K, +>key : K +>K : K + + stringMap: { [oldId: string]: string } +>stringMap : { [oldId: string]: string; } +>oldId : string + +) { + var x = obj[key]; +>x : T[K] +>obj[key] : T[K] +>obj : T +>key : K + + stringMap[x]; // Should be OK. +>stringMap[x] : { [oldId: string]: string; }[T[K]] +>stringMap : { [oldId: string]: string; } +>x : T[K] +} + diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 0ef73c736f4..770dc2ead98 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -464,3 +464,30 @@ let MyThingy: { [key in KeyTypes]: string[] }; function addToMyThingy(key: S) { MyThingy[key].push("a"); } + +// Repro from #13285 + +function updateIds, K extends string>( + obj: T, + idFields: K[], + idMapping: { [oldId: string]: string } +): Record { + for (const idField of idFields) { + const newId = idMapping[obj[idField]]; + if (newId) { + obj[idField] = newId; + } + } + return obj; +} + +// Repro from #13285 + +function updateIds2( + obj: T, + key: K, + stringMap: { [oldId: string]: string } +) { + var x = obj[key]; + stringMap[x]; // Should be OK. +} From 41af749196c32bdac1a61be462c348a0f014c326 Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Mon, 9 Jan 2017 21:29:34 -0800 Subject: [PATCH 250/289] Update based on feedback --- src/compiler/commandLineParser.ts | 4 ++-- src/compiler/diagnosticMessages.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 9111a72eb2d..3a4d5c6b1f7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -212,8 +212,8 @@ namespace ts { shortName: "p", type: "string", isFilePath: true, - description: Diagnostics.Compile_the_project_in_the_given_directory_using_tsconfig_json_or_the_specified_config_file, - paramType: Diagnostics.DIRECTORY_OR_FILE + description: Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + paramType: Diagnostics.FILE_OR_DIRECTORY }, { name: "removeComments", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 2230ffdbac0..6bdf9932fca 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2513,7 +2513,7 @@ "category": "Message", "code": 6019 }, - "Compile the project in the given directory, using 'tsconfig.json' or the specified config file.": { + "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'": { "category": "Message", "code": 6020 }, @@ -2573,7 +2573,7 @@ "category": "Message", "code": 6039 }, - "DIRECTORY_OR_FILE": { + "FILE OR DIRECTORY": { "category": "Message", "code": 6040 }, From c9e301f236f7fad0f6dfb51f7e622f8b189d7207 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Jan 2017 08:55:15 -0800 Subject: [PATCH 251/289] Test:object rest skips only class methods Previously, it skipped all methods. --- tests/baselines/reference/objectRest.js | 9 ++ tests/baselines/reference/objectRest.symbols | 82 ++++++++++++------- tests/baselines/reference/objectRest.types | 22 +++++ .../conformance/types/rest/objectRest.ts | 7 ++ 4 files changed, 90 insertions(+), 30 deletions(-) diff --git a/tests/baselines/reference/objectRest.js b/tests/baselines/reference/objectRest.js index 48a1bf8daf8..59eb11542c0 100644 --- a/tests/baselines/reference/objectRest.js +++ b/tests/baselines/reference/objectRest.js @@ -29,8 +29,15 @@ class Removable { removed: string; remainder: string; } +interface I { + m(): void; + removed: string; + remainder: string; +} var removable = new Removable(); var { removed, ...removableRest } = removable; +var i: I = removable; +var { removed, ...removableRest2 } = i; let computed = 'b'; let computed2 = 'a'; @@ -74,6 +81,8 @@ class Removable { } var removable = new Removable(); var { removed } = removable, removableRest = __rest(removable, ["removed"]); +var i = removable; +var { removed } = i, removableRest2 = __rest(i, ["removed"]); let computed = 'b'; let computed2 = 'a'; var _g = computed, stillNotGreat = o[_g], _h = computed2, soSo = o[_h], o = __rest(o, [typeof _g === "symbol" ? _g : _g + "", typeof _h === "symbol" ? _h : _h + ""]); diff --git a/tests/baselines/reference/objectRest.symbols b/tests/baselines/reference/objectRest.symbols index 46309392135..2992220d8b2 100644 --- a/tests/baselines/reference/objectRest.symbols +++ b/tests/baselines/reference/objectRest.symbols @@ -1,42 +1,42 @@ === tests/cases/conformance/types/rest/objectRest.ts === var o = { a: 1, b: 'no' } ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) >a : Symbol(a, Decl(objectRest.ts, 0, 9)) >b : Symbol(b, Decl(objectRest.ts, 0, 15)) var { ...clone } = o; >clone : Symbol(clone, Decl(objectRest.ts, 1, 5)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var { a, ...justB } = o; >a : Symbol(a, Decl(objectRest.ts, 2, 5), Decl(objectRest.ts, 3, 5)) >justB : Symbol(justB, Decl(objectRest.ts, 2, 8)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var { a, b: renamed, ...empty } = o; >a : Symbol(a, Decl(objectRest.ts, 2, 5), Decl(objectRest.ts, 3, 5)) >b : Symbol(b, Decl(objectRest.ts, 0, 15)) >renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5)) >empty : Symbol(empty, Decl(objectRest.ts, 3, 20)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var { ['b']: renamed, ...justA } = o; >'b' : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5)) >renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5)) >justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var { 'b': renamed, ...justA } = o; >renamed : Symbol(renamed, Decl(objectRest.ts, 3, 8), Decl(objectRest.ts, 4, 5), Decl(objectRest.ts, 5, 5), Decl(objectRest.ts, 9, 5)) >justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var { b: { '0': n, '1': oooo }, ...justA } = o; >b : Symbol(b, Decl(objectRest.ts, 0, 15)) >n : Symbol(n, Decl(objectRest.ts, 6, 10)) >oooo : Symbol(oooo, Decl(objectRest.ts, 6, 18)) >justA : Symbol(justA, Decl(objectRest.ts, 4, 21), Decl(objectRest.ts, 5, 19), Decl(objectRest.ts, 6, 31)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) let o2 = { c: 'terrible idea?', d: 'yes' }; >o2 : Symbol(o2, Decl(objectRest.ts, 8, 3)) @@ -138,41 +138,63 @@ class Removable { remainder: string; >remainder : Symbol(Removable.remainder, Decl(objectRest.ts, 27, 20)) } +interface I { +>I : Symbol(I, Decl(objectRest.ts, 29, 1)) + + m(): void; +>m : Symbol(I.m, Decl(objectRest.ts, 30, 13)) + + removed: string; +>removed : Symbol(I.removed, Decl(objectRest.ts, 31, 14)) + + remainder: string; +>remainder : Symbol(I.remainder, Decl(objectRest.ts, 32, 20)) +} var removable = new Removable(); ->removable : Symbol(removable, Decl(objectRest.ts, 30, 3)) +>removable : Symbol(removable, Decl(objectRest.ts, 35, 3)) >Removable : Symbol(Removable, Decl(objectRest.ts, 18, 35)) var { removed, ...removableRest } = removable; ->removed : Symbol(removed, Decl(objectRest.ts, 31, 5)) ->removableRest : Symbol(removableRest, Decl(objectRest.ts, 31, 14)) ->removable : Symbol(removable, Decl(objectRest.ts, 30, 3)) +>removed : Symbol(removed, Decl(objectRest.ts, 36, 5), Decl(objectRest.ts, 38, 5)) +>removableRest : Symbol(removableRest, Decl(objectRest.ts, 36, 14)) +>removable : Symbol(removable, Decl(objectRest.ts, 35, 3)) + +var i: I = removable; +>i : Symbol(i, Decl(objectRest.ts, 37, 3)) +>I : Symbol(I, Decl(objectRest.ts, 29, 1)) +>removable : Symbol(removable, Decl(objectRest.ts, 35, 3)) + +var { removed, ...removableRest2 } = i; +>removed : Symbol(removed, Decl(objectRest.ts, 36, 5), Decl(objectRest.ts, 38, 5)) +>removableRest2 : Symbol(removableRest2, Decl(objectRest.ts, 38, 14)) +>i : Symbol(i, Decl(objectRest.ts, 37, 3)) let computed = 'b'; ->computed : Symbol(computed, Decl(objectRest.ts, 33, 3)) +>computed : Symbol(computed, Decl(objectRest.ts, 40, 3)) let computed2 = 'a'; ->computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3)) +>computed2 : Symbol(computed2, Decl(objectRest.ts, 41, 3)) var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; ->computed : Symbol(computed, Decl(objectRest.ts, 33, 3)) ->stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 35, 5)) ->computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3)) ->soSo : Symbol(soSo, Decl(objectRest.ts, 35, 32)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>computed : Symbol(computed, Decl(objectRest.ts, 40, 3)) +>stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 42, 5)) +>computed2 : Symbol(computed2, Decl(objectRest.ts, 41, 3)) +>soSo : Symbol(soSo, Decl(objectRest.ts, 42, 32)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); ->computed : Symbol(computed, Decl(objectRest.ts, 33, 3)) ->stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 35, 5)) ->computed2 : Symbol(computed2, Decl(objectRest.ts, 34, 3)) ->soSo : Symbol(soSo, Decl(objectRest.ts, 35, 32)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) ->o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +>computed : Symbol(computed, Decl(objectRest.ts, 40, 3)) +>stillNotGreat : Symbol(stillNotGreat, Decl(objectRest.ts, 42, 5)) +>computed2 : Symbol(computed2, Decl(objectRest.ts, 41, 3)) +>soSo : Symbol(soSo, Decl(objectRest.ts, 42, 32)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) +>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 42, 51)) var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; ->noContextualType : Symbol(noContextualType, Decl(objectRest.ts, 38, 3)) ->aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) ->notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) ->aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) ->notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) +>noContextualType : Symbol(noContextualType, Decl(objectRest.ts, 45, 3)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 45, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 45, 39)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 45, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 45, 39)) diff --git a/tests/baselines/reference/objectRest.types b/tests/baselines/reference/objectRest.types index 1dc05741713..5347f09f5a3 100644 --- a/tests/baselines/reference/objectRest.types +++ b/tests/baselines/reference/objectRest.types @@ -158,6 +158,18 @@ class Removable { remainder: string; >remainder : string } +interface I { +>I : I + + m(): void; +>m : () => void + + removed: string; +>removed : string + + remainder: string; +>remainder : string +} var removable = new Removable(); >removable : Removable >new Removable() : Removable @@ -168,6 +180,16 @@ var { removed, ...removableRest } = removable; >removableRest : { both: number; remainder: string; } >removable : Removable +var i: I = removable; +>i : I +>I : I +>removable : Removable + +var { removed, ...removableRest2 } = i; +>removed : string +>removableRest2 : { m(): void; remainder: string; } +>i : I + let computed = 'b'; >computed : string >'b' : "b" diff --git a/tests/cases/conformance/types/rest/objectRest.ts b/tests/cases/conformance/types/rest/objectRest.ts index 2fba5d0b6dc..77f0fca1ed7 100644 --- a/tests/cases/conformance/types/rest/objectRest.ts +++ b/tests/cases/conformance/types/rest/objectRest.ts @@ -29,8 +29,15 @@ class Removable { removed: string; remainder: string; } +interface I { + m(): void; + removed: string; + remainder: string; +} var removable = new Removable(); var { removed, ...removableRest } = removable; +var i: I = removable; +var { removed, ...removableRest2 } = i; let computed = 'b'; let computed2 = 'a'; From 945e65f4d8d79dc7bd25a9e818a1999a48664ad7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 10 Jan 2017 08:55:46 -0800 Subject: [PATCH 252/289] Object rest skips only class methods Previously, it skipped all methods --- src/compiler/checker.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 54f0758b3a9..f828fb02c0c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3125,9 +3125,8 @@ namespace ts { for (const prop of getPropertiesOfType(source)) { const inNamesToRemove = prop.name in names; const isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (ModifierFlags.Private | ModifierFlags.Protected); - const isMethod = prop.flags & SymbolFlags.Method; const isSetOnlyAccessor = prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor); - if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { + if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { members[prop.name] = prop; } } From 2ae5806210d0ccd508c1adeec01e5a056ebd33d0 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 10 Jan 2017 13:04:32 -0800 Subject: [PATCH 253/289] Include "export" modifier on function assigned to an export (`export const x = () => 0;`). --- src/services/navigationBar.ts | 11 ++- .../navigationBarItemsFunctionProperties.ts | 4 - .../navigationBarItemsNamedArrowFunctions.ts | 78 +++++++++++++++++++ 3 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 28f69a0b488..9735ce4528b 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -514,7 +514,7 @@ namespace ts.NavigationBar { return { text: getItemName(n.node), kind: getNodeKind(n.node), - kindModifiers: getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: map(n.children, convertToTree) }; @@ -524,7 +524,7 @@ namespace ts.NavigationBar { return { text: getItemName(n.node), kind: getNodeKind(n.node), - kindModifiers: getNodeModifiers(n.node), + kindModifiers: getModifiers(n.node), spans: getSpans(n), childItems: map(n.children, convertToChildItem) || emptyChildItemArray, indent: n.indent, @@ -594,6 +594,13 @@ namespace ts.NavigationBar { : createTextSpanFromNode(node, curSourceFile); } + function getModifiers(node: ts.Node): string { + if (node.parent && node.parent.kind === SyntaxKind.VariableDeclaration) { + node = node.parent; + } + return getNodeModifiers(node); + } + function getFunctionOrClassName(node: FunctionExpression | FunctionDeclaration | ArrowFunction | ClassLikeDeclaration): string { if (node.name && getFullWidth(node.name) > 0) { return declarationNameToString(node.name); diff --git a/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts b/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts index 75c20736b41..9844f53d879 100644 --- a/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts +++ b/tests/cases/fourslash/navigationBarItemsFunctionProperties.ts @@ -6,10 +6,6 @@ //// .a = function() { }; //// })(); -function navExact(name: string, kind: string) { - return; -} - verify.navigationTree( { "text": "", diff --git a/tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts b/tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts new file mode 100644 index 00000000000..32abf4092c7 --- /dev/null +++ b/tests/cases/fourslash/navigationBarItemsNamedArrowFunctions.ts @@ -0,0 +1,78 @@ +/// + +////export const value = 2; +////export const func = () => 2; +////export const func2 = function() { }; +////export function exportedFunction() { } + +verify.navigationBar([ + { + "text": "\"navigationBarItemsNamedArrowFunctions\"", + "kind": "module", + "childItems": [ + { + "text": "exportedFunction", + "kind": "function", + "kindModifiers": "export" + }, + { + "text": "func", + "kind": "function" + }, + { + "text": "func2", + "kind": "function" + }, + { + "text": "value", + "kind": "const", + "kindModifiers": "export" + } + ] + }, + { + "text": "exportedFunction", + "kind": "function", + "kindModifiers": "export", + "indent": 1 + }, + { + "text": "func", + "kind": "function", + "kindModifiers": "export", + "indent": 1 + }, + { + "text": "func2", + "kind": "function", + "kindModifiers": "export", + "indent": 1 + } +]); + +verify.navigationTree({ + "text": "\"navigationBarItemsNamedArrowFunctions\"", + "kind": "module", + "childItems": [ + { + "text": "exportedFunction", + "kind": "function", + "kindModifiers": "export" + }, + { + "text": "func", + "kind": "function", + "kindModifiers": "export" + }, + { + "text": "func2", + "kind": "function", + "kindModifiers": "export" + }, + { + "text": "value", + "kind": "const", + "kindModifiers": "export" + } + ] +}); From 54f12307601c2dfb364575210c131da7f7a71ba6 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Tue, 10 Jan 2017 16:58:43 -0800 Subject: [PATCH 254/289] Change the remove unused local code fix message --- src/compiler/diagnosticMessages.json | 2 +- src/services/codefixes/unusedIdentifierFixes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6bdf9932fca..bce99cbaf39 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3247,7 +3247,7 @@ "category": "Message", "code": 90003 }, - "Remove unused identifiers.": { + "Remove the unused identifier: {0}": { "category": "Message", "code": 90004 }, diff --git a/src/services/codefixes/unusedIdentifierFixes.ts b/src/services/codefixes/unusedIdentifierFixes.ts index 8e14bdcb73e..5c42fc8e6e9 100644 --- a/src/services/codefixes/unusedIdentifierFixes.ts +++ b/src/services/codefixes/unusedIdentifierFixes.ts @@ -146,7 +146,7 @@ namespace ts.codefix { function createCodeFix(newText: string, start: number, length: number): CodeAction[] { return [{ - description: getLocaleSpecificMessage(Diagnostics.Remove_unused_identifiers), + description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Remove_the_unused_identifier_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText, span: { start, length } }] From 0c7e4bbb455b99725d49fe3e89a353656048e9b6 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Tue, 10 Jan 2017 17:55:52 -0800 Subject: [PATCH 255/289] Update the message --- src/compiler/diagnosticMessages.json | 2 +- src/services/codefixes/unusedIdentifierFixes.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index bce99cbaf39..52fc401d1f1 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3247,7 +3247,7 @@ "category": "Message", "code": 90003 }, - "Remove the unused identifier: {0}": { + "Remove declaration for: {0}": { "category": "Message", "code": 90004 }, diff --git a/src/services/codefixes/unusedIdentifierFixes.ts b/src/services/codefixes/unusedIdentifierFixes.ts index 5c42fc8e6e9..2784a09a504 100644 --- a/src/services/codefixes/unusedIdentifierFixes.ts +++ b/src/services/codefixes/unusedIdentifierFixes.ts @@ -146,7 +146,7 @@ namespace ts.codefix { function createCodeFix(newText: string, start: number, length: number): CodeAction[] { return [{ - description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Remove_the_unused_identifier_Colon_0), { 0: token.getText() }), + description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Remove_declaration_for_Colon_0), { 0: token.getText() }), changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText, span: { start, length } }] From 37e18d974158b73d3eb9c7d07b65b34df836120d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 11 Jan 2017 09:52:50 -0800 Subject: [PATCH 256/289] Add `createMapFromTemplate` helper --- src/compiler/checker.ts | 6 ++--- src/compiler/commandLineParser.ts | 12 +++++----- src/compiler/core.ts | 7 +++++- src/compiler/scanner.ts | 2 +- src/compiler/transformers/jsx.ts | 2 +- src/compiler/utilities.ts | 2 +- src/harness/fourslash.ts | 2 +- .../unittests/cachingInServerLSHost.ts | 4 ++-- .../unittests/configurationExtension.ts | 2 +- src/harness/unittests/moduleResolution.ts | 22 +++++++++---------- .../unittests/reuseProgramStructure.ts | 12 +++++----- src/server/editorServices.ts | 2 +- src/services/jsTyping.ts | 2 +- src/services/transpile.ts | 2 +- 14 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3348db7272a..efa10943793 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -315,7 +315,7 @@ namespace ts { NullFacts = TypeofEQObject | TypeofNEString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEFunction | TypeofNEHostObject | EQNull | EQUndefinedOrNull | NEUndefined | Falsy, } - const typeofEQFacts = createMap({ + const typeofEQFacts = createMapFromTemplate({ "string": TypeFacts.TypeofEQString, "number": TypeFacts.TypeofEQNumber, "boolean": TypeFacts.TypeofEQBoolean, @@ -325,7 +325,7 @@ namespace ts { "function": TypeFacts.TypeofEQFunction }); - const typeofNEFacts = createMap({ + const typeofNEFacts = createMapFromTemplate({ "string": TypeFacts.TypeofNEString, "number": TypeFacts.TypeofNENumber, "boolean": TypeFacts.TypeofNEBoolean, @@ -335,7 +335,7 @@ namespace ts { "function": TypeFacts.TypeofNEFunction }); - const typeofTypesByName = createMap({ + const typeofTypesByName = createMapFromTemplate({ "string": stringType, "number": numberType, "boolean": booleanType, diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a8c55a88e3f..b222df53630 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -65,7 +65,7 @@ namespace ts { }, { name: "jsx", - type: createMap({ + type: createMapFromTemplate({ "preserve": JsxEmit.Preserve, "react": JsxEmit.React }), @@ -100,7 +100,7 @@ namespace ts { { name: "module", shortName: "m", - type: createMap({ + type: createMapFromTemplate({ "none": ModuleKind.None, "commonjs": ModuleKind.CommonJS, "amd": ModuleKind.AMD, @@ -114,7 +114,7 @@ namespace ts { }, { name: "newLine", - type: createMap({ + type: createMapFromTemplate({ "crlf": NewLineKind.CarriageReturnLineFeed, "lf": NewLineKind.LineFeed }), @@ -263,7 +263,7 @@ namespace ts { { name: "target", shortName: "t", - type: createMap({ + type: createMapFromTemplate({ "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES2015, @@ -300,7 +300,7 @@ namespace ts { }, { name: "moduleResolution", - type: createMap({ + type: createMapFromTemplate({ "node": ModuleResolutionKind.NodeJs, "classic": ModuleResolutionKind.Classic, }), @@ -409,7 +409,7 @@ namespace ts { type: "list", element: { name: "lib", - type: createMap({ + type: createMapFromTemplate({ // JavaScript only "es5": "lib.es5.d.ts", "es6": "lib.es2015.d.ts", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 34c47bcd2f4..7e9cb460ba8 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -40,7 +40,12 @@ namespace ts { } /** Create a new map. If a template object is provided, the map will copy entries from it. */ - export function createMap(template?: MapLike): Map { + export function createMap(): Map { + return new MapCtr(); + } + + //!!! + export function createMapFromTemplate(template?: MapLike): Map { const map: Map = new MapCtr(); // Copies keys/values from template. Note that for..in will not throw if diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 259eaa0f5f3..84f1f624d95 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -56,7 +56,7 @@ namespace ts { tryScan(callback: () => T): T; } - const textToToken = createMap({ + const textToToken = createMapFromTemplate({ "abstract": SyntaxKind.AbstractKeyword, "any": SyntaxKind.AnyKeyword, "as": SyntaxKind.AsKeyword, diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 4879b3c4fa3..1307a7f8551 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -286,7 +286,7 @@ namespace ts { } } - const entities = createMap({ + const entities = createMapFromTemplate({ "quot": 0x0022, "amp": 0x0026, "apos": 0x0027, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d3e1f076638..932e75d0345 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2351,7 +2351,7 @@ namespace ts { // 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. const escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - const escapedCharsMap = createMap({ + const escapedCharsMap = createMapFromTemplate({ "\0": "\\0", "\t": "\\t", "\v": "\\v", diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index ff4964b284b..a75acec53a5 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -90,7 +90,7 @@ namespace FourSlash { export import IndentStyle = ts.IndentStyle; - const entityMap = ts.createMap({ + const entityMap = ts.createMapFromTemplate({ "&": "&", "\"": """, "'": "'", diff --git a/src/harness/unittests/cachingInServerLSHost.ts b/src/harness/unittests/cachingInServerLSHost.ts index 8389186c486..caeab18958e 100644 --- a/src/harness/unittests/cachingInServerLSHost.ts +++ b/src/harness/unittests/cachingInServerLSHost.ts @@ -86,7 +86,7 @@ namespace ts { content: `foo()` }; - const serverHost = createDefaultServerHost(createMap({ [root.name]: root, [imported.name]: imported })); + const serverHost = createDefaultServerHost(createMapFromTemplate({ [root.name]: root, [imported.name]: imported })); const { project, rootScriptInfo } = createProject(root.name, serverHost); // ensure that imported file was found @@ -170,7 +170,7 @@ namespace ts { content: `export var y = 1` }; - const fileMap = createMap({ [root.name]: root }); + const fileMap = createMapFromTemplate({ [root.name]: root }); const serverHost = createDefaultServerHost(fileMap); const originalFileExists = serverHost.fileExists; diff --git a/src/harness/unittests/configurationExtension.ts b/src/harness/unittests/configurationExtension.ts index c68d07f5123..886ee5d54b5 100644 --- a/src/harness/unittests/configurationExtension.ts +++ b/src/harness/unittests/configurationExtension.ts @@ -2,7 +2,7 @@ /// namespace ts { - const testContents = createMap({ + const testContents = createMapFromTemplate({ "/dev/tsconfig.json": `{ "extends": "./configs/base", "files": [ diff --git a/src/harness/unittests/moduleResolution.ts b/src/harness/unittests/moduleResolution.ts index 8e4ace38655..aa30f1e01e2 100644 --- a/src/harness/unittests/moduleResolution.ts +++ b/src/harness/unittests/moduleResolution.ts @@ -331,7 +331,7 @@ namespace ts { } it("should find all modules", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c/first/shared.ts": ` class A {} export = A`, @@ -350,7 +350,7 @@ export = C; }); it("should find modules in node_modules", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/parent/node_modules/mod/index.d.ts": "export var x", "/parent/app/myapp.ts": `import {x} from "mod"` }); @@ -358,7 +358,7 @@ export = C; }); it("should find file referenced via absolute and relative names", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c.ts": `/// `, "/a/b/b.ts": "var x" }); @@ -409,7 +409,7 @@ export = C; } it("should succeed when the same file is referenced using absolute and relative names", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c.ts": `/// `, "/a/b/d.ts": "var x" }); @@ -417,7 +417,7 @@ export = C; }); it("should fail when two files used in program differ only in casing (tripleslash references)", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c.ts": `/// `, "/a/b/d.ts": "var x" }); @@ -425,7 +425,7 @@ export = C; }); it("should fail when two files used in program differ only in casing (imports)", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c.ts": `import {x} from "D"`, "/a/b/d.ts": "export var x" }); @@ -433,7 +433,7 @@ export = C; }); it("should fail when two files used in program differ only in casing (imports, relative module names)", () => { - const files = createMap({ + const files = createMapFromTemplate({ "moduleA.ts": `import {x} from "./ModuleB"`, "moduleB.ts": "export var x" }); @@ -441,7 +441,7 @@ export = C; }); it("should fail when two files exist on disk that differs only in casing", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/b/c.ts": `import {x} from "D"`, "/a/b/D.ts": "export var x", "/a/b/d.ts": "export var y" @@ -450,7 +450,7 @@ export = C; }); it("should fail when module name in 'require' calls has inconsistent casing", () => { - const files = createMap({ + const files = createMapFromTemplate({ "moduleA.ts": `import a = require("./ModuleC")`, "moduleB.ts": `import a = require("./moduleC")`, "moduleC.ts": "export var x" @@ -459,7 +459,7 @@ export = C; }); it("should fail when module names in 'require' calls has inconsistent casing and current directory has uppercase chars", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/B/c/moduleA.ts": `import a = require("./ModuleC")`, "/a/B/c/moduleB.ts": `import a = require("./moduleC")`, "/a/B/c/moduleC.ts": "export var x", @@ -471,7 +471,7 @@ import b = require("./moduleB"); test(files, { module: ts.ModuleKind.CommonJS, forceConsistentCasingInFileNames: true }, "/a/B/c", /*useCaseSensitiveFileNames*/ false, ["moduleD.ts"], [1149]); }); it("should not fail when module names in 'require' calls has consistent casing and current directory has uppercase chars", () => { - const files = createMap({ + const files = createMapFromTemplate({ "/a/B/c/moduleA.ts": `import a = require("./moduleC")`, "/a/B/c/moduleB.ts": `import a = require("./moduleC")`, "/a/B/c/moduleC.ts": "export var x", diff --git a/src/harness/unittests/reuseProgramStructure.ts b/src/harness/unittests/reuseProgramStructure.ts index 8a89b8d27c6..d13dd7a26fa 100644 --- a/src/harness/unittests/reuseProgramStructure.ts +++ b/src/harness/unittests/reuseProgramStructure.ts @@ -322,7 +322,7 @@ namespace ts { const options: CompilerOptions = { target }; const program_1 = newProgram(files, ["a.ts"], options); - checkResolvedModulesCache(program_1, "a.ts", createMap({ "b": createResolvedModule("b.ts") })); + checkResolvedModulesCache(program_1, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts") })); checkResolvedModulesCache(program_1, "b.ts", undefined); const program_2 = updateProgram(program_1, ["a.ts"], options, files => { @@ -331,7 +331,7 @@ namespace ts { assert.isTrue(program_1.structureIsReused); // content of resolution cache should not change - checkResolvedModulesCache(program_1, "a.ts", createMap({ "b": createResolvedModule("b.ts") })); + checkResolvedModulesCache(program_1, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts") })); checkResolvedModulesCache(program_1, "b.ts", undefined); // imports has changed - program is not reused @@ -348,7 +348,7 @@ namespace ts { files[0].text = files[0].text.updateImportsAndExports(newImports); }); assert.isTrue(!program_3.structureIsReused); - checkResolvedModulesCache(program_4, "a.ts", createMap({ "b": createResolvedModule("b.ts"), "c": undefined })); + checkResolvedModulesCache(program_4, "a.ts", createMapFromTemplate({ "b": createResolvedModule("b.ts"), "c": undefined })); }); it("resolved type directives cache follows type directives", () => { @@ -359,7 +359,7 @@ namespace ts { const options: CompilerOptions = { target, typeRoots: ["/types"] }; const program_1 = newProgram(files, ["/a.ts"], options); - checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMap({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); const program_2 = updateProgram(program_1, ["/a.ts"], options, files => { @@ -368,7 +368,7 @@ namespace ts { assert.isTrue(program_1.structureIsReused); // content of resolution cache should not change - checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMap({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); // type reference directives has changed - program is not reused @@ -386,7 +386,7 @@ namespace ts { files[0].text = files[0].text.updateReferences(newReferences); }); assert.isTrue(!program_3.structureIsReused); - checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMap({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", createMapFromTemplate({ "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } })); }); it("can reuse ambient module declarations from non-modified files", () => { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 8153804a7bd..25d58142a06 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -51,7 +51,7 @@ namespace ts.server { } const compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(optionDeclarations); - const indentStyle = createMap({ + const indentStyle = createMapFromTemplate({ "none": IndentStyle.None, "block": IndentStyle.Block, "smart": IndentStyle.Smart diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index e587a14b459..248ceef1bd3 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -76,7 +76,7 @@ namespace ts.JsTyping { if (!safeList) { const result = readConfigFile(safeListPath, (path: string) => host.readFile(path)); - safeList = result.config ? createMap(result.config) : EmptySafeList; + safeList = result.config ? createMapFromTemplate(result.config) : EmptySafeList; } const filesToWatch: string[] = []; diff --git a/src/services/transpile.ts b/src/services/transpile.ts index b72399384b7..0b90e9d030b 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -63,7 +63,7 @@ } if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = createMap(transpileOptions.renamedDependencies); + sourceFile.renamedDependencies = createMapFromTemplate(transpileOptions.renamedDependencies); } const newLine = getNewLineCharacter(options); From 13ce0e9414a992a4b33f7115664ceb0b70ec18ae Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 11:48:49 -0800 Subject: [PATCH 257/289] Fix type relations for 'keyof T' type where T is union or intersection --- src/compiler/checker.ts | 36 +++++++++++++++++------------------- src/compiler/types.ts | 4 +++- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f828fb02c0c..8d949d6ac79 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4753,15 +4753,15 @@ namespace ts { getPropertiesOfObjectType(type); } - function getConstraintOfTypeVariable(type: TypeVariable): Type { - return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : getBaseConstraintOfTypeVariable(type); + function getConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type { + return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(type) : getBaseConstraintOfType(type); } function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type { return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; } - function getBaseConstraintOfTypeVariable(type: TypeVariable): Type { + function getBaseConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type { const constraint = getResolvedBaseConstraint(type); return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; } @@ -4775,15 +4775,15 @@ namespace ts { * type variable has no constraint, and the circularConstraintType singleton is returned if the constraint * circularly references the type variable. */ - function getResolvedBaseConstraint(type: TypeVariable): Type { + function getResolvedBaseConstraint(type: TypeVariable | UnionOrIntersectionType): Type { let typeStack: Type[]; let circular: boolean; - if (!type.resolvedApparentType) { + if (!type.resolvedBaseConstraint) { typeStack = []; const constraint = getBaseConstraint(type); - type.resolvedApparentType = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); + type.resolvedBaseConstraint = circular ? circularConstraintType : getTypeWithThisArgument(constraint || noConstraintType, type); } - return type.resolvedApparentType; + return type.resolvedBaseConstraint; function getBaseConstraint(t: Type): Type { if (contains(typeStack, t)) { @@ -4834,7 +4834,7 @@ namespace ts { * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type: Type): Type { - const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfTypeVariable(type) || emptyObjectType : type; + const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfType(type) || emptyObjectType : type; return t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : @@ -7427,14 +7427,12 @@ namespace ts { return result; } } - // Given a type variable T with a constraint C, a type S is assignable to - // keyof T if S is assignable to keyof C. - if ((target).type.flags & TypeFlags.TypeVariable) { - const constraint = getConstraintOfTypeVariable((target).type); - if (constraint) { - if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { - return result; - } + // A type S is assignable to keyof T if S is assignable to keyof C, where C is the + // constraint of T. + const constraint = getConstraintOfType((target).type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; } } } @@ -7448,7 +7446,7 @@ namespace ts { } // A type S is related to a type T[K] if S is related to A[K], where K is string-like and // A is the apparent type of S. - const constraint = getBaseConstraintOfTypeVariable(target); + const constraint = getBaseConstraintOfType(target); if (constraint) { if (result = isRelatedTo(source, constraint, reportErrors)) { errorInfo = saveErrorInfo; @@ -7488,7 +7486,7 @@ namespace ts { else if (source.flags & TypeFlags.IndexedAccess) { // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and // A is the apparent type of S. - const constraint = getBaseConstraintOfTypeVariable(source); + const constraint = getBaseConstraintOfType(source); if (constraint) { if (result = isRelatedTo(constraint, target, reportErrors)) { errorInfo = saveErrorInfo; @@ -15207,7 +15205,7 @@ namespace ts { function isLiteralContextualType(contextualType: Type) { if (contextualType) { if (contextualType.flags & TypeFlags.TypeVariable) { - const constraint = getBaseConstraintOfTypeVariable(contextualType) || emptyObjectType; + const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8827aea633a..954ad21ba29 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2923,6 +2923,8 @@ namespace ts { /* @internal */ resolvedIndexType: IndexType; /* @internal */ + resolvedBaseConstraint: Type; + /* @internal */ couldContainTypeVariables: boolean; } @@ -2982,7 +2984,7 @@ namespace ts { export interface TypeVariable extends Type { /* @internal */ - resolvedApparentType: Type; + resolvedBaseConstraint: Type; /* @internal */ resolvedIndexType: IndexType; } From 1f4cbcefb1cf0735a4925fb7420d338e596c71d5 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 11:50:30 -0800 Subject: [PATCH 258/289] Remove incorrect type relationship --- src/compiler/checker.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8d949d6ac79..cc4afc8aa3e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7409,16 +7409,6 @@ namespace ts { } } } - else { - // Given a type parameter K with a constraint keyof T, a type S is - // assignable to K if S is assignable to keyof T. - const constraint = getConstraintOfTypeParameter(target); - if (constraint && constraint.flags & TypeFlags.Index) { - if (result = isRelatedTo(source, constraint, reportErrors)) { - return result; - } - } - } } else if (target.flags & TypeFlags.Index) { // A keyof S is related to a keyof T if T is related to S. From 5abd3230a4b7470161cba25456501e4805fd48ab Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 11:50:41 -0800 Subject: [PATCH 259/289] Add regression test --- .../reference/keyofAndIndexedAccess.js | 19 ++++ .../reference/keyofAndIndexedAccess.symbols | 103 +++++++++++------- .../reference/keyofAndIndexedAccess.types | 29 +++++ .../types/keyof/keyofAndIndexedAccess.ts | 10 ++ 4 files changed, 123 insertions(+), 38 deletions(-) diff --git a/tests/baselines/reference/keyofAndIndexedAccess.js b/tests/baselines/reference/keyofAndIndexedAccess.js index f7d5663bc10..05658d50515 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.js +++ b/tests/baselines/reference/keyofAndIndexedAccess.js @@ -464,6 +464,16 @@ function addToMyThingy(key: S) { MyThingy[key].push("a"); } +// Repro from #13102 + +type Handler = { + onChange: (name: keyof T) => void; +}; + +function onChangeGenericFunction(handler: Handler) { + handler.onChange('preset') +} + // Repro from #13285 function updateIds, K extends string>( @@ -801,6 +811,9 @@ var MyThingy; function addToMyThingy(key) { MyThingy[key].push("a"); } +function onChangeGenericFunction(handler) { + handler.onChange('preset'); +} // Repro from #13285 function updateIds(obj, idFields, idMapping) { for (var _i = 0, idFields_1 = idFields; _i < idFields_1.length; _i++) { @@ -1034,6 +1047,12 @@ declare let MyThingy: { [key in KeyTypes]: string[]; }; declare function addToMyThingy(key: S): void; +declare type Handler = { + onChange: (name: keyof T) => void; +}; +declare function onChangeGenericFunction(handler: Handler): void; declare function updateIds, K extends string>(obj: T, idFields: K[], idMapping: { [oldId: string]: string; }): Record; diff --git a/tests/baselines/reference/keyofAndIndexedAccess.symbols b/tests/baselines/reference/keyofAndIndexedAccess.symbols index a6eb03dd6e5..d7bc419af24 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.symbols +++ b/tests/baselines/reference/keyofAndIndexedAccess.symbols @@ -1699,83 +1699,110 @@ function addToMyThingy(key: S) { >push : Symbol(Array.push, Decl(lib.d.ts, --, --)) } +// Repro from #13102 + +type Handler = { +>Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 463, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 13)) + + onChange: (name: keyof T) => void; +>onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19)) +>name : Symbol(name, Decl(keyofAndIndexedAccess.ts, 468, 15)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 13)) + +}; + +function onChangeGenericFunction(handler: Handler) { +>onChangeGenericFunction : Symbol(onChangeGenericFunction, Decl(keyofAndIndexedAccess.ts, 469, 2)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 471, 33)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 471, 36)) +>Handler : Symbol(Handler, Decl(keyofAndIndexedAccess.ts, 463, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 471, 33)) +>preset : Symbol(preset, Decl(keyofAndIndexedAccess.ts, 471, 58)) + + handler.onChange('preset') +>handler.onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19)) +>handler : Symbol(handler, Decl(keyofAndIndexedAccess.ts, 471, 36)) +>onChange : Symbol(onChange, Decl(keyofAndIndexedAccess.ts, 467, 19)) +} + // Repro from #13285 function updateIds, K extends string>( ->updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 463, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 19)) +>updateIds : Symbol(updateIds, Decl(keyofAndIndexedAccess.ts, 473, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 477, 19)) >Record : Symbol(Record, Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477, 47)) obj: T, ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 467, 19)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477, 66)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 477, 19)) idFields: K[], ->idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 478, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477, 47)) idMapping: { [oldId: string]: string } ->idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469, 18)) ->oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 470, 18)) +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 479, 18)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 480, 18)) ): Record { >Record : Symbol(Record, Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 467, 47)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 477, 47)) for (const idField of idFields) { ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) ->idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 468, 11)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482, 14)) +>idFields : Symbol(idFields, Decl(keyofAndIndexedAccess.ts, 478, 11)) const newId = idMapping[obj[idField]]; ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) ->idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 469, 18)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483, 13)) +>idMapping : Symbol(idMapping, Decl(keyofAndIndexedAccess.ts, 479, 18)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482, 14)) if (newId) { ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483, 13)) obj[idField] = newId; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) ->idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 472, 14)) ->newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 473, 13)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477, 66)) +>idField : Symbol(idField, Decl(keyofAndIndexedAccess.ts, 482, 14)) +>newId : Symbol(newId, Decl(keyofAndIndexedAccess.ts, 483, 13)) } } return obj; ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 467, 66)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 477, 66)) } // Repro from #13285 function updateIds2( ->updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 479, 1)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 483, 33)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483, 54)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) +>updateIds2 : Symbol(updateIds2, Decl(keyofAndIndexedAccess.ts, 489, 1)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493, 20)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 493, 33)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 493, 54)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493, 20)) obj: T, ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483, 74)) ->T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 483, 20)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 493, 74)) +>T : Symbol(T, Decl(keyofAndIndexedAccess.ts, 493, 20)) key: K, ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484, 11)) ->K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 483, 54)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 494, 11)) +>K : Symbol(K, Decl(keyofAndIndexedAccess.ts, 493, 54)) stringMap: { [oldId: string]: string } ->stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485, 11)) ->oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 486, 18)) +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 495, 11)) +>oldId : Symbol(oldId, Decl(keyofAndIndexedAccess.ts, 496, 18)) ) { var x = obj[key]; ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488, 7)) ->obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 483, 74)) ->key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 484, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 498, 7)) +>obj : Symbol(obj, Decl(keyofAndIndexedAccess.ts, 493, 74)) +>key : Symbol(key, Decl(keyofAndIndexedAccess.ts, 494, 11)) stringMap[x]; // Should be OK. ->stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 485, 11)) ->x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 488, 7)) +>stringMap : Symbol(stringMap, Decl(keyofAndIndexedAccess.ts, 495, 11)) +>x : Symbol(x, Decl(keyofAndIndexedAccess.ts, 498, 7)) } diff --git a/tests/baselines/reference/keyofAndIndexedAccess.types b/tests/baselines/reference/keyofAndIndexedAccess.types index 920758c8beb..543c39b3c92 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess.types +++ b/tests/baselines/reference/keyofAndIndexedAccess.types @@ -2013,6 +2013,35 @@ function addToMyThingy(key: S) { >"a" : "a" } +// Repro from #13102 + +type Handler = { +>Handler : Handler +>T : T + + onChange: (name: keyof T) => void; +>onChange : (name: keyof T) => void +>name : keyof T +>T : T + +}; + +function onChangeGenericFunction(handler: Handler) { +>onChangeGenericFunction : (handler: Handler) => void +>T : T +>handler : Handler +>Handler : Handler +>T : T +>preset : number + + handler.onChange('preset') +>handler.onChange('preset') : void +>handler.onChange : (name: keyof (T & { preset: number; })) => void +>handler : Handler +>onChange : (name: keyof (T & { preset: number; })) => void +>'preset' : "preset" +} + // Repro from #13285 function updateIds, K extends string>( diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index 770dc2ead98..27e47da177c 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -465,6 +465,16 @@ function addToMyThingy(key: S) { MyThingy[key].push("a"); } +// Repro from #13102 + +type Handler = { + onChange: (name: keyof T) => void; +}; + +function onChangeGenericFunction(handler: Handler) { + handler.onChange('preset') +} + // Repro from #13285 function updateIds, K extends string>( From c897235364f8d16a861669746bc298532a59bf03 Mon Sep 17 00:00:00 2001 From: Zhengbo Li Date: Wed, 11 Jan 2017 14:30:37 -0800 Subject: [PATCH 260/289] Change the module specifier search order --- src/services/codefixes/importFixes.ts | 4 ++-- .../importNameCodeFixNewImportTypeRoots1.ts | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 3627d60492d..8c6222ff845 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -420,10 +420,10 @@ namespace ts.codefix { const options = context.program.getCompilerOptions(); return tryGetModuleNameFromAmbientModule() || - tryGetModuleNameFromBaseUrl() || - tryGetModuleNameFromRootDirs() || tryGetModuleNameFromTypeRoots() || tryGetModuleNameAsNodeModule() || + tryGetModuleNameFromBaseUrl() || + tryGetModuleNameFromRootDirs() || removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); function tryGetModuleNameFromAmbientModule(): string { diff --git a/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts b/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts new file mode 100644 index 00000000000..2778f51bacf --- /dev/null +++ b/tests/cases/fourslash/importNameCodeFixNewImportTypeRoots1.ts @@ -0,0 +1,23 @@ +/// + +// @Filename: a/f1.ts +//// [|foo/*0*/();|] + +// @Filename: types/random/index.ts +//// export function foo() {}; + +// @Filename: tsconfig.json +//// { +//// "compilerOptions": { +//// "baseUrl": ".", +//// "typeRoots": [ +//// "./types" +//// ] +//// } +//// } + +verify.importFixAtPosition([ +`import { foo } from "random"; + +foo();` +]); \ No newline at end of file From 9ed5ad1c2d7a9c8d7afe05ec71ff5205fb388131 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 16:10:59 -0800 Subject: [PATCH 261/289] Unconstrained type parameter not assignable to non-primitive object --- src/compiler/checker.ts | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc4afc8aa3e..e92ea973f8f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7172,8 +7172,7 @@ namespace ts { if (source.flags & TypeFlags.Enum && target.flags & TypeFlags.Enum && isEnumTypeRelatedTo(source, target, errorReporter)) return true; if (source.flags & TypeFlags.Undefined && (!strictNullChecks || target.flags & (TypeFlags.Undefined | TypeFlags.Void))) return true; if (source.flags & TypeFlags.Null && (!strictNullChecks || target.flags & TypeFlags.Null)) return true; - if (source.flags & TypeFlags.Object && target === nonPrimitiveType) return true; - if (source.flags & TypeFlags.Primitive && target === nonPrimitiveType) return false; + if (source.flags & TypeFlags.Object && target.flags & TypeFlags.NonPrimitive) return true; if (relation === assignableRelation || relation === comparableRelation) { if (source.flags & TypeFlags.Any) return true; if ((source.flags & TypeFlags.Number | source.flags & TypeFlags.NumberLiteral) && target.flags & TypeFlags.EnumLike) return true; @@ -7457,19 +7456,19 @@ namespace ts { } else { let constraint = getConstraintOfTypeParameter(source); - - if (!constraint || constraint.flags & TypeFlags.Any) { - constraint = emptyObjectType; - } - - // The constraint may need to be further instantiated with its 'this' type. - constraint = getTypeWithThisArgument(constraint, source); - - // Report constraint errors only if the constraint is not the empty object type - const reportConstraintErrors = reportErrors && constraint !== emptyObjectType; - if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { - errorInfo = saveErrorInfo; - return result; + // A type parameter with no constraint is not related to the non-primitive object type. + if (constraint || !(target.flags & TypeFlags.NonPrimitive)) { + if (!constraint || constraint.flags & TypeFlags.Any) { + constraint = emptyObjectType; + } + // The constraint may need to be further instantiated with its 'this' type. + constraint = getTypeWithThisArgument(constraint, source); + // Report constraint errors only if the constraint is not the empty object type + const reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } } @@ -9237,9 +9236,6 @@ namespace ts { } function getTypeFacts(type: Type): TypeFacts { - if (type === nonPrimitiveType) { - return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts; - } const flags = type.flags; if (flags & TypeFlags.String) { return strictNullChecks ? TypeFacts.StringStrictFacts : TypeFacts.StringFacts; @@ -9280,6 +9276,9 @@ namespace ts { if (flags & TypeFlags.ESSymbol) { return strictNullChecks ? TypeFacts.SymbolStrictFacts : TypeFacts.SymbolFacts; } + if (flags & TypeFlags.NonPrimitive) { + return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts; + } if (flags & TypeFlags.TypeParameter) { const constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); From 0e0953fc4fbe0220ba9c2ddf70b7ce0787dfa21a Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 16:11:16 -0800 Subject: [PATCH 262/289] Add tests --- .../types/nonPrimitive/nonPrimitiveInGeneric.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts index a19271a59d3..836896b5a57 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts @@ -1,4 +1,6 @@ -function generic(t: T) {} +function generic(t: T) { + var o: object = t; // expect error +} var a = {}; var b = "42"; @@ -7,7 +9,9 @@ generic(a); generic(123); // expect error generic(b); // expect error -function bound(t: T) {} +function bound(t: T) { + var o: object = t; // ok +} bound({}); bound(a); @@ -21,6 +25,10 @@ bound2(); bound2(); // expect error bound2(); // expect error +function bound3(t: T) { + var o: object = t; // ok +} + interface Proxy {} var x: Proxy; // error @@ -29,7 +37,7 @@ var z: Proxy ; // ok interface Blah { - foo: number; + foo: number; } var u: Proxy; // ok From e90f67d48126bb8b722ccc826c8e1c2e14a0891e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 11 Jan 2017 16:11:22 -0800 Subject: [PATCH 263/289] Accept new baselines --- .../nonPrimitiveInGeneric.errors.txt | 33 ++++++++++++------- .../reference/nonPrimitiveInGeneric.js | 25 +++++++++++--- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt index 04d4ee4a1a7..ce257c87680 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInGeneric.errors.txt @@ -1,14 +1,19 @@ -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(7,17): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(8,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(14,7): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(15,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(21,8): error TS2344: Type 'number' does not satisfy the constraint 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(22,8): error TS2344: Type 'string' does not satisfy the constraint 'object'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,14): error TS2344: Type 'number' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(2,9): error TS2322: Type 'T' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(9,17): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(10,17): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(18,7): error TS2345: Argument of type '123' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(19,7): error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(25,8): error TS2344: Type 'number' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,8): error TS2344: Type 'string' does not satisfy the constraint 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(34,14): error TS2344: Type 'number' does not satisfy the constraint 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (7 errors) ==== - function generic(t: T) {} +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts (8 errors) ==== + function generic(t: T) { + var o: object = t; // expect error + ~ +!!! error TS2322: Type 'T' is not assignable to type 'object'. + } var a = {}; var b = "42"; @@ -21,7 +26,9 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,14): erro ~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'object'. - function bound(t: T) {} + function bound(t: T) { + var o: object = t; // ok + } bound({}); bound(a); @@ -43,6 +50,10 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,14): erro ~~~~~~ !!! error TS2344: Type 'string' does not satisfy the constraint 'object'. + function bound3(t: T) { + var o: object = t; // ok + } + interface Proxy {} var x: Proxy; // error @@ -53,7 +64,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts(26,14): erro interface Blah { - foo: number; + foo: number; } var u: Proxy; // ok diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.js b/tests/baselines/reference/nonPrimitiveInGeneric.js index b7080e149b4..2db357c3eb5 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.js +++ b/tests/baselines/reference/nonPrimitiveInGeneric.js @@ -1,5 +1,7 @@ //// [nonPrimitiveInGeneric.ts] -function generic(t: T) {} +function generic(t: T) { + var o: object = t; // expect error +} var a = {}; var b = "42"; @@ -8,7 +10,9 @@ generic(a); generic(123); // expect error generic(b); // expect error -function bound(t: T) {} +function bound(t: T) { + var o: object = t; // ok +} bound({}); bound(a); @@ -22,6 +26,10 @@ bound2(); bound2(); // expect error bound2(); // expect error +function bound3(t: T) { + var o: object = t; // ok +} + interface Proxy {} var x: Proxy; // error @@ -30,21 +38,25 @@ var z: Proxy ; // ok interface Blah { - foo: number; + foo: number; } var u: Proxy; // ok //// [nonPrimitiveInGeneric.js] -function generic(t) { } +function generic(t) { + var o = t; // expect error +} var a = {}; var b = "42"; generic({}); generic(a); generic(123); // expect error generic(b); // expect error -function bound(t) { } +function bound(t) { + var o = t; // ok +} bound({}); bound(a); bound(123); // expect error @@ -54,6 +66,9 @@ bound2(); bound2(); bound2(); // expect error bound2(); // expect error +function bound3(t) { + var o = t; // ok +} var x; // error var y; // ok var z; // ok From 890676a5d8f9f5c76057ab4556bf7cc7e8ebf2df Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 11 Jan 2017 14:28:22 -0800 Subject: [PATCH 264/289] Include properties of an `export =` value in import completions. --- src/compiler/checker.ts | 1 + src/compiler/types.ts | 1 + src/harness/fourslash.ts | 28 +++++++++++++++++-- src/services/completions.ts | 6 ++++ .../completionListForExportEquals.ts | 16 +++++++++++ .../completionListForExportEquals2.ts | 14 ++++++++++ .../completionListInImportClause04.ts | 5 +--- tests/cases/fourslash/fourslash.ts | 1 + 8 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/completionListForExportEquals.ts create mode 100644 tests/cases/fourslash/completionListForExportEquals2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc4afc8aa3e..46a381a561e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -108,6 +108,7 @@ namespace ts { getAliasedSymbol: resolveAlias, getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + resolveExternalModuleSymbol, getAmbientModules, getJsxElementAttributesType, getJsxIntrinsicTagNames, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 954ad21ba29..8b3b821a25b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2370,6 +2370,7 @@ namespace ts { isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; + /* @internal */ resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol; getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c41c9af9f4e..f0f2f87175e 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -425,8 +425,7 @@ namespace FourSlash { } private raiseError(message: string) { - message = this.messageAtLastKnownMarker(message); - throw new Error(message); + throw new Error(this.messageAtLastKnownMarker(message)); } private messageAtLastKnownMarker(message: string) { @@ -723,6 +722,27 @@ namespace FourSlash { } } + public verifyCompletionsAt(markerName: string, expected: string[]) { + this.goToMarker(markerName); + + const actualCompletions = this.getCompletionListAtCaret(); + if (!actualCompletions) { + this.raiseError(`No completions at position '${this.currentCaretPosition}'.`); + } + + const actual = actualCompletions.entries; + + if (actual.length !== expected.length) { + this.raiseError(`Expected ${expected.length} completions, got ${actual.map(a => a.name)}.`); + } + + ts.zipWith(actual, expected, (completion, expectedCompletion, index) => { + if (completion.name !== expectedCompletion) { + this.raiseError(`Expected completion at index ${index} to be ${expectedCompletion}, got ${completion.name}`); + } + }); + } + public verifyCompletionListContains(symbol: string, text?: string, documentation?: string, kind?: string, spanIndex?: number) { const completions = this.getCompletionListAtCaret(); if (completions) { @@ -3166,6 +3186,10 @@ namespace FourSlashInterface { super(state); } + public completionsAt(markerName: string, completions: string[]) { + this.state.verifyCompletionsAt(markerName, completions); + } + public quickInfoIs(expectedText: string, expectedDocumentation?: string) { this.state.verifyQuickInfoString(expectedText, expectedDocumentation); } diff --git a/src/services/completions.ts b/src/services/completions.ts index d893e7212ec..27cd78bbe17 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1322,6 +1322,12 @@ namespace ts.Completions { const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); if (moduleSpecifierSymbol) { exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + const exportEquals = typeChecker.resolveExternalModuleSymbol(moduleSpecifierSymbol); + if (exportEquals !== moduleSpecifierSymbol) { + // Location doesn't matter so long as it's not an identifier. + const exportEqualsType = typeChecker.getTypeOfSymbolAtLocation(exportEquals, moduleSpecifier); + exports = ts.concatenate(exports, typeChecker.getPropertiesOfType(exportEqualsType)); + } } symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray; diff --git a/tests/cases/fourslash/completionListForExportEquals.ts b/tests/cases/fourslash/completionListForExportEquals.ts new file mode 100644 index 00000000000..28b20177c57 --- /dev/null +++ b/tests/cases/fourslash/completionListForExportEquals.ts @@ -0,0 +1,16 @@ + +/// + +// @Filename: /node_modules/foo/index.d.ts +////export = Foo; +////declare var Foo: Foo.Static; +////declare namespace Foo { +//// interface Static { +//// foo(): void; +//// } +////} + +// @Filename: /a.ts +////import { /**/ } from "foo"; + +verify.completionsAt("", ["Static", "foo"]); diff --git a/tests/cases/fourslash/completionListForExportEquals2.ts b/tests/cases/fourslash/completionListForExportEquals2.ts new file mode 100644 index 00000000000..a7b0772d55e --- /dev/null +++ b/tests/cases/fourslash/completionListForExportEquals2.ts @@ -0,0 +1,14 @@ + +/// + +// @Filename: /node_modules/foo/index.d.ts +////export = Foo; +////interface Foo { bar: number; } +////declare namespace Foo { +//// interface Static {} +////} + +// @Filename: /a.ts +////import { /**/ } from "foo"; + +verify.completionsAt("", ["Static"]); diff --git a/tests/cases/fourslash/completionListInImportClause04.ts b/tests/cases/fourslash/completionListInImportClause04.ts index 672c754e807..fa49b57c8d7 100644 --- a/tests/cases/fourslash/completionListInImportClause04.ts +++ b/tests/cases/fourslash/completionListInImportClause04.ts @@ -11,10 +11,7 @@ // @Filename: app.ts ////import {/*1*/} from './foo'; -goTo.marker('1'); -verify.completionListContains('prop1'); -verify.completionListContains('prop2'); -verify.not.completionListContains('Foo'); +verify.completionsAt("1", ["prototype", "prop1", "prop2"]); verify.numberOfErrorsInCurrentFile(0); goTo.marker('2'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 4397839fbe8..0de303238f1 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -138,6 +138,7 @@ declare namespace FourSlashInterface { class verify extends verifyNegatable { assertHasRanges(ranges: Range[]): void; caretAtMarker(markerName?: string): void; + completionsAt(markerName: string, completions: string[]): void; indentationIs(numberOfSpaces: number): void; indentationAtPositionIs(fileName: string, position: number, numberOfSpaces: number, indentStyle?: ts.IndentStyle, baseIndentSize?: number): void; textAtCaretIs(text: string): void; From 733111a931d4fc65bd8e624215dc6f1ef37af9cb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 07:46:55 -0800 Subject: [PATCH 265/289] Use tsconfig inheritance --- src/compiler/tsconfig.json | 10 +--------- src/harness/tsconfig.json | 13 +++---------- src/server/cancellationToken/tsconfig.json | 12 ++---------- src/server/tsconfig.json | 12 ++---------- src/server/typingsInstaller/tsconfig.json | 12 ++---------- src/services/tsconfig.json | 10 +--------- src/tsconfig-base.json | 14 ++++++++++++++ 7 files changed, 25 insertions(+), 58 deletions(-) create mode 100644 src/tsconfig-base.json diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index cbbdbb04d50..1ed009444b1 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -1,17 +1,9 @@ { + "extends": "../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, "removeComments": true, - "preserveConstEnums": true, - "pretty": true, "outFile": "../../built/local/tsc.js", - "sourceMap": true, "declaration": true, - "stripInternal": true, - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true, "types": [ ] }, "files": [ diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index 6b83cf249a7..ebd07118cc5 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -1,19 +1,12 @@ { + "extends": "../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "pretty": true, "removeComments": false, - "preserveConstEnums": true, "outFile": "../../built/local/run.js", - "sourceMap": true, "declaration": false, - "stripInternal": true, "types": [ "node", "mocha", "chai" - ], - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true + ] }, "files": [ "../compiler/core.ts", @@ -85,7 +78,7 @@ "../services/codefixes/importFixes.ts", "../services/codefixes/unusedIdentifierFixes.ts", "../services/harness.ts", - + "sourceMapRecorder.ts", "harnessLanguageService.ts", "fourslash.ts", diff --git a/src/server/cancellationToken/tsconfig.json b/src/server/cancellationToken/tsconfig.json index 1c4c0d60826..fa7f88ca994 100644 --- a/src/server/cancellationToken/tsconfig.json +++ b/src/server/cancellationToken/tsconfig.json @@ -1,19 +1,11 @@ { + "extends": "../../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, "removeComments": true, - "preserveConstEnums": true, - "pretty": true, "module": "commonjs", - "sourceMap": true, - "stripInternal": true, "types": [ "node" - ], - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true + ] }, "files": [ "cancellationToken.ts" diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index 85c88679164..2f17019e2de 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -1,19 +1,11 @@ { + "extends": "../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, "removeComments": true, - "preserveConstEnums": true, - "pretty": true, "outFile": "../../built/local/tsserver.js", - "sourceMap": true, - "stripInternal": true, "types": [ "node" - ], - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true + ] }, "files": [ "../services/shims.ts", diff --git a/src/server/typingsInstaller/tsconfig.json b/src/server/typingsInstaller/tsconfig.json index 27f5cedc9d1..7bfb6c8b1ed 100644 --- a/src/server/typingsInstaller/tsconfig.json +++ b/src/server/typingsInstaller/tsconfig.json @@ -1,19 +1,11 @@ { + "extends": "../../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, "removeComments": true, - "preserveConstEnums": true, - "pretty": true, "outFile": "../../../built/local/typingsInstaller.js", - "sourceMap": true, - "stripInternal": true, "types": [ "node" - ], - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true + ] }, "files": [ "../types.ts", diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 921ee7762f8..e79716d2c67 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -1,18 +1,10 @@ { + "extends": "../tsconfig-base", "compilerOptions": { - "noImplicitAny": true, - "noImplicitThis": true, "removeComments": false, - "preserveConstEnums": true, - "pretty": true, "outFile": "../../built/local/typescriptServices.js", - "sourceMap": true, - "stripInternal": true, "noResolve": false, "declaration": true, - "target": "es5", - "noUnusedLocals": true, - "noUnusedParameters": true, "types": [] }, "files": [ diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json new file mode 100644 index 00000000000..d3fcf8f1520 --- /dev/null +++ b/src/tsconfig-base.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "lib": ["es5"], + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "pretty": true, + "preserveConstEnums": true, + "stripInternal": true, + "sourceMap": true, + "target": "es5" + } +} \ No newline at end of file From 30e2fd6c2043b1ee407bb503529a3b0c219b1501 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 10:18:59 -0800 Subject: [PATCH 266/289] Remove "noResolve" --- src/services/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index e79716d2c67..13686d232a1 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "removeComments": false, "outFile": "../../built/local/typescriptServices.js", - "noResolve": false, "declaration": true, "types": [] }, From bf7258742eccd1691c139417715e3eb5e7d18d54 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 12 Jan 2017 10:49:44 -0800 Subject: [PATCH 267/289] Improve type relationships for generic mapped types --- src/compiler/checker.ts | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc4afc8aa3e..d8456b8074c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4662,10 +4662,6 @@ namespace ts { return type.modifiersType; } - function getErasedTemplateTypeFromMappedType(type: MappedType) { - return instantiateType(getTemplateTypeFromMappedType(type), createTypeEraser([getTypeParameterFromMappedType(type)])); - } - function isGenericMappedType(type: Type) { if (getObjectFlags(type) & ObjectFlags.Mapped) { const constraintType = getConstraintTypeFromMappedType(type); @@ -7765,25 +7761,24 @@ namespace ts { return result; } - // A type [P in S]: X is related to a type [P in T]: Y if T is related to S and X is related to Y. + // A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is + // related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice + // that S and T are contra-variant whereas X and Y are co-variant. function mappedTypeRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary { if (isGenericMappedType(target)) { if (isGenericMappedType(source)) { - let result: Ternary; - if (relation === identityRelation) { - const readonlyMatches = !(source).declaration.readonlyToken === !(target).declaration.readonlyToken; - const optionalMatches = !(source).declaration.questionToken === !(target).declaration.questionToken; - if (readonlyMatches && optionalMatches) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getErasedTemplateTypeFromMappedType(source), getErasedTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else { - if (relation === comparableRelation || !(source).declaration.questionToken || (target).declaration.questionToken) { - if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - return result & isRelatedTo(getTemplateTypeFromMappedType(source), getTemplateTypeFromMappedType(target), reportErrors); - } + const sourceReadonly = !!(source).declaration.readonlyToken; + const sourceOptional = !!(source).declaration.questionToken; + const targetReadonly = !!(target).declaration.readonlyToken; + const targetOptional = !!(target).declaration.questionToken; + const modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + let result: Ternary; + if (result = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + const mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } } From dafea7f54d46cf7715cffa466649e48d51684c54 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 12 Jan 2017 10:49:58 -0800 Subject: [PATCH 268/289] Add tests --- .../types/mapped/mappedTypeRelationships.ts | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/tests/cases/conformance/types/mapped/mappedTypeRelationships.ts b/tests/cases/conformance/types/mapped/mappedTypeRelationships.ts index 4af71fbea08..587ec1c9d7e 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeRelationships.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeRelationships.ts @@ -105,4 +105,66 @@ function f50(obj: T, key: keyof T) { function f51(obj: T, key: K) { let item: Item = obj[key]; return obj[key].name; -} \ No newline at end of file +} + +type T1 = { + [P in keyof T]: T[P]; +} + +type T2 = { + [P in keyof T]: T[P]; +} + +function f60(x: T1, y: T2) { + x = y; + y = x; +} + +type Identity = { + [P in keyof T]: T[P]; +} + +function f61(x: Identity, y: Partial) { + x = y; // Error + y = x; +} + +function f62(x: Identity, y: Readonly) { + x = y; + y = x; +} + +function f70(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; +} + +function f71(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error +} + +function f72(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error +} + +function f73(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; // Error +} + +function f74(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error +} + +function f75(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error +} + +function f76(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) { + x = y; + y = x; // Error +} From 1f8b9f8bbeab6a244bfcb5fa292bf4261a196b20 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 12 Jan 2017 10:50:08 -0800 Subject: [PATCH 269/289] Accept new baselines --- .../mappedTypeRelationships.errors.txt | 104 +++++++++++- .../reference/mappedTypeRelationships.js | 152 +++++++++++++++++- 2 files changed, 253 insertions(+), 3 deletions(-) diff --git a/tests/baselines/reference/mappedTypeRelationships.errors.txt b/tests/baselines/reference/mappedTypeRelationships.errors.txt index ce6ecaa61fa..22f56dacaf6 100644 --- a/tests/baselines/reference/mappedTypeRelationships.errors.txt +++ b/tests/baselines/reference/mappedTypeRelationships.errors.txt @@ -30,9 +30,24 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(62,5): error TS2 tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(67,5): error TS2542: Index signature in type 'Readonly' only permits reading. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(71,5): error TS2322: Type 'Partial' is not assignable to type 'T'. tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2322: Type 'Partial' is not assignable to type 'T'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(126,5): error TS2322: Type 'Partial' is not assignable to type 'Identity'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(142,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. + Type 'T[P]' is not assignable to type 'U[P]'. + Type 'T' is not assignable to type 'U'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(147,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. + Type 'keyof U' is not assignable to type 'keyof T'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(152,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. + Type 'keyof T' is not assignable to type 'K'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(157,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. + Type 'keyof U' is not assignable to type 'K'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(162,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. + Type 'keyof T' is not assignable to type 'K'. +tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. + Type 'T[P]' is not assignable to type 'U[P]'. + Type 'T' is not assignable to type 'U'. -==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (20 errors) ==== +==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (27 errors) ==== function f1(x: T, k: keyof T) { return x[k]; @@ -190,4 +205,89 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2 function f51(obj: T, key: K) { let item: Item = obj[key]; return obj[key].name; - } \ No newline at end of file + } + + type T1 = { + [P in keyof T]: T[P]; + } + + type T2 = { + [P in keyof T]: T[P]; + } + + function f60(x: T1, y: T2) { + x = y; + y = x; + } + + type Identity = { + [P in keyof T]: T[P]; + } + + function f61(x: Identity, y: Partial) { + x = y; // Error + ~ +!!! error TS2322: Type 'Partial' is not assignable to type 'Identity'. + y = x; + } + + function f62(x: Identity, y: Readonly) { + x = y; + y = x; + } + + function f70(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; + } + + function f71(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. +!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. + } + + function f72(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. +!!! error TS2322: Type 'keyof U' is not assignable to type 'keyof T'. + } + + function f73(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'K'. + } + + function f74(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'. +!!! error TS2322: Type 'keyof U' is not assignable to type 'K'. + } + + function f75(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'K'. + } + + function f76(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'. +!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'. +!!! error TS2322: Type 'T' is not assignable to type 'U'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeRelationships.js b/tests/baselines/reference/mappedTypeRelationships.js index a81ff973da8..2476b72cef6 100644 --- a/tests/baselines/reference/mappedTypeRelationships.js +++ b/tests/baselines/reference/mappedTypeRelationships.js @@ -104,7 +104,70 @@ function f50(obj: T, key: keyof T) { function f51(obj: T, key: K) { let item: Item = obj[key]; return obj[key].name; -} +} + +type T1 = { + [P in keyof T]: T[P]; +} + +type T2 = { + [P in keyof T]: T[P]; +} + +function f60(x: T1, y: T2) { + x = y; + y = x; +} + +type Identity = { + [P in keyof T]: T[P]; +} + +function f61(x: Identity, y: Partial) { + x = y; // Error + y = x; +} + +function f62(x: Identity, y: Readonly) { + x = y; + y = x; +} + +function f70(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; +} + +function f71(x: { [P in keyof T]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error +} + +function f72(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error +} + +function f73(x: { [P in K]: T[P] }, y: { [P in keyof T]: T[P] }) { + x = y; + y = x; // Error +} + +function f74(x: { [P in K]: T[P] }, y: { [P in keyof U]: U[P] }) { + x = y; + y = x; // Error +} + +function f75(x: { [P in K]: T[P] }, y: { [P in keyof T]: U[P] }) { + x = y; + y = x; // Error +} + +function f76(x: { [P in K]: T[P] }, y: { [P in K]: U[P] }) { + x = y; + y = x; // Error +} + //// [mappedTypeRelationships.js] function f1(x, k) { @@ -185,6 +248,46 @@ function f51(obj, key) { var item = obj[key]; return obj[key].name; } +function f60(x, y) { + x = y; + y = x; +} +function f61(x, y) { + x = y; // Error + y = x; +} +function f62(x, y) { + x = y; + y = x; +} +function f70(x, y) { + x = y; + y = x; +} +function f71(x, y) { + x = y; + y = x; // Error +} +function f72(x, y) { + x = y; + y = x; // Error +} +function f73(x, y) { + x = y; + y = x; // Error +} +function f74(x, y) { + x = y; + y = x; // Error +} +function f75(x, y) { + x = y; + y = x; // Error +} +function f76(x, y) { + x = y; + y = x; // Error +} //// [mappedTypeRelationships.d.ts] @@ -214,3 +317,50 @@ declare type ItemMap = { }; declare function f50(obj: T, key: keyof T): string; declare function f51(obj: T, key: K): string; +declare type T1 = { + [P in keyof T]: T[P]; +}; +declare type T2 = { + [P in keyof T]: T[P]; +}; +declare function f60(x: T1, y: T2): void; +declare type Identity = { + [P in keyof T]: T[P]; +}; +declare function f61(x: Identity, y: Partial): void; +declare function f62(x: Identity, y: Readonly): void; +declare function f70(x: { + [P in keyof T]: T[P]; +}, y: { + [P in keyof T]: T[P]; +}): void; +declare function f71(x: { + [P in keyof T]: T[P]; +}, y: { + [P in keyof T]: U[P]; +}): void; +declare function f72(x: { + [P in keyof T]: T[P]; +}, y: { + [P in keyof U]: U[P]; +}): void; +declare function f73(x: { + [P in K]: T[P]; +}, y: { + [P in keyof T]: T[P]; +}): void; +declare function f74(x: { + [P in K]: T[P]; +}, y: { + [P in keyof U]: U[P]; +}): void; +declare function f75(x: { + [P in K]: T[P]; +}, y: { + [P in keyof T]: U[P]; +}): void; +declare function f76(x: { + [P in K]: T[P]; +}, y: { + [P in K]: U[P]; +}): void; From b98e82e5c4f1172309546e51d9b871aa2e0c1dc7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 12:25:00 -0800 Subject: [PATCH 270/289] Fix one more use of `createMapFromTemplate` --- src/server/typingsInstaller/nodeTypingsInstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 19f794ad57c..ff20e89e2d7 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -46,7 +46,7 @@ namespace ts.server.typingsInstaller { } try { const content = JSON.parse(host.readFile(typesRegistryFilePath)); - return createMap(content.entries); + return createMapFromTemplate(content.entries); } catch (e) { if (log.isEnabled()) { From 757af2e1d6ae10666aa1f26cb7efdc59e01884d5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 13:11:26 -0800 Subject: [PATCH 271/289] Fix tsconfig inheritance in gulpfile -- must do it manually --- Gulpfile.ts | 14 ++++++-------- src/compiler/sys.ts | 2 +- src/tsconfig-base.json | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index ef65454bc23..2daa8970582 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -242,13 +242,14 @@ function needsUpdate(source: string | string[], dest: string | string[]): boolea return true; } +// Doing tsconfig inheritance manually. https://github.com/ivogabe/gulp-typescript/issues/459 +const tsconfigBase = JSON.parse(fs.readFileSync("src/tsconfig-base.json", "utf-8")).compilerOptions; + function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings { const copy: tsc.Settings = {}; - copy.noEmitOnError = true; - copy.noImplicitAny = true; - copy.noImplicitThis = true; - copy.pretty = true; - copy.types = []; + for (const key in tsconfigBase) { + copy[key] = tsconfigBase[key]; + } for (const key in base) { copy[key] = base[key]; } @@ -256,9 +257,6 @@ function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): ts if (copy.removeComments === undefined) copy.removeComments = true; copy.newLine = "lf"; } - else { - copy.preserveConstEnums = true; - } if (useBuiltCompiler === true) { copy.typescript = require("./built/local/typescript.js"); } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 8e140375dd0..966f0e0cd03 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -18,7 +18,7 @@ namespace ts { getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; /** - * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that + * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that * use native OS file watching */ watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index d3fcf8f1520..b4c82dbeeee 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "lib": ["es5"], + "noEmitOnError": true, "noImplicitAny": true, "noImplicitThis": true, "noUnusedLocals": true, From 6b6c34bef14ff50733c479b52cdb4b27c20c981d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 12 Jan 2017 13:56:45 -0800 Subject: [PATCH 272/289] Fix typo --- src/compiler/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 02cc2b4a453..654b1bc2912 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -895,7 +895,7 @@ namespace ts { return undefined; } - /** `forEachInMap` for just keys. */ + /** `forEachEntry` for just keys. */ export function forEachKey(map: Map<{}>, callback: (key: string) => T | undefined): T | undefined { const iterator = map.keys(); for (let { value: key, done } = iterator.next(); !done; { value: key, done } = iterator.next()) { From 765114fccd08440a2676da74ee76229f571d8330 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 13 Jan 2017 07:57:01 -0800 Subject: [PATCH 273/289] Refactor to move code into checker --- src/compiler/checker.ts | 11 ++++++++++- src/compiler/types.ts | 3 ++- src/services/completions.ts | 18 ++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 46a381a561e..a5d1e439879 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -108,7 +108,7 @@ namespace ts { getAliasedSymbol: resolveAlias, getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, - resolveExternalModuleSymbol, + getExportsAndPropertiesOfModule, getAmbientModules, getJsxElementAttributesType, getJsxIntrinsicTagNames, @@ -1528,6 +1528,15 @@ namespace ts { return symbolsToArray(getExportsOfModule(moduleSymbol)); } + function getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[] { + const exports = getExportsOfModuleAsArray(moduleSymbol); + const exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + addRange(exports, getPropertiesOfType(getTypeOfSymbol(exportEquals))); + } + return exports; + } + function tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined { const symbolTable = getExportsOfModule(moduleSymbol); if (symbolTable) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8b3b821a25b..0906488ea33 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2370,7 +2370,8 @@ namespace ts { isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; getExportsOfModule(moduleSymbol: Symbol): Symbol[]; - /* @internal */ resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol; + /** Unlike `getExportsOfModule`, this includes properties of an `export =` value. */ + /* @internal */ getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[]; getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; diff --git a/src/services/completions.ts b/src/services/completions.ts index 27cd78bbe17..bb5922af9ad 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1318,20 +1318,14 @@ namespace ts.Completions { isMemberCompletion = true; isNewIdentifierLocation = false; - let exports: Symbol[]; - const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); - const exportEquals = typeChecker.resolveExternalModuleSymbol(moduleSpecifierSymbol); - if (exportEquals !== moduleSpecifierSymbol) { - // Location doesn't matter so long as it's not an identifier. - const exportEqualsType = typeChecker.getTypeOfSymbolAtLocation(exportEquals, moduleSpecifier); - exports = ts.concatenate(exports, typeChecker.getPropertiesOfType(exportEqualsType)); - } + const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); + if (!moduleSpecifierSymbol) { + symbols = emptyArray; + return true; } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray; - + const exports = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol); + symbols = filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements); return true; } From 639f5cb6e5f8ae61eee1ca9828ad14c6ea43ada5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 13 Jan 2017 08:10:58 -0800 Subject: [PATCH 274/289] Fix bug for constructor with modifier --- src/services/findAllReferences.ts | 5 ++--- src/services/utilities.ts | 2 +- .../fourslash/findAllRefsOfConstructor_withModifier.ts | 10 ++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index d6092644c73..287c16d5e7e 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -502,9 +502,8 @@ namespace ts.FindAllReferences { const result: Node[] = []; for (const decl of classSymbol.members["__constructor"].declarations) { - Debug.assert(decl.kind === SyntaxKind.Constructor); - const ctrKeyword = decl.getChildAt(0); - Debug.assert(ctrKeyword.kind === SyntaxKind.ConstructorKeyword); + const ctrKeyword = ts.findChildOfKind(decl, ts.SyntaxKind.ConstructorKeyword, sourceFile)! + Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword); result.push(ctrKeyword); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 47608a59e75..def7ab8e4bd 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -600,7 +600,7 @@ namespace ts { return !!findChildOfKind(n, kind, sourceFile); } - export function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node { + export function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node | undefined { return forEach(n.getChildren(sourceFile), c => c.kind === kind && c); } diff --git a/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts b/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts new file mode 100644 index 00000000000..0954945a546 --- /dev/null +++ b/tests/cases/fourslash/findAllRefsOfConstructor_withModifier.ts @@ -0,0 +1,10 @@ +/// + +////class X { +//// public [|constructor|]() {} +////} +////var x = new [|X|](); + +const ranges = test.ranges(); +const ctr = ranges[0]; +verify.referencesOf(ctr, ranges); From ebf36ac06bee8029f0183a5dc3f529a8281f20ba Mon Sep 17 00:00:00 2001 From: MANISH-GIRI Date: Fri, 13 Jan 2017 12:53:21 -0500 Subject: [PATCH 275/289] Fix incorrect return type --- src/compiler/scanner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index a03bf733f75..da7308ecb89 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -734,11 +734,11 @@ namespace ts { return comments; } - export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] { + export function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined { return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); } - export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] { + export function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined { return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); } From 0b8de64a1b74728f28e4abb1eebdbac6bc877b0a Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 13 Jan 2017 13:16:14 -0800 Subject: [PATCH 276/289] Move code out of closure in `getReferencedSymbolsForNode` --- src/services/findAllReferences.ts | 2091 +++++++++---------- tests/cases/fourslash/findAllRefsForRest.ts | 5 +- 2 files changed, 1046 insertions(+), 1050 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 287c16d5e7e..cf502ad50f9 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -30,20 +30,20 @@ namespace ts.FindAllReferences { const 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 and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + return labelDefinition && getLabelReferencesInNode(labelDefinition.parent, labelDefinition, cancellationToken); } else { // it is a label definition and not a target, search within the parent labeledStatement - return getLabelReferencesInNode(node.parent, node); + return getLabelReferencesInNode(node.parent, node, cancellationToken); } } if (isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); + return getReferencesForThisKeyword(node, sourceFiles, typeChecker, cancellationToken); } if (node.kind === SyntaxKind.SuperKeyword) { - return getReferencesForSuperKeyword(node); + return getReferencesForSuperKeyword(node, typeChecker, cancellationToken); } } @@ -52,10 +52,9 @@ namespace ts.FindAllReferences { const symbol = typeChecker.getSymbolAtLocation(node); if (!implementations && !symbol && node.kind === SyntaxKind.StringLiteral) { - return getReferencesForStringLiteral(node, sourceFiles); + return getReferencesForStringLiteral(node, sourceFiles, typeChecker, cancellationToken); } - // Could not find a symbol e.g. unknown identifier if (!symbol) { // Can't have references to something that we have no symbol for. @@ -87,7 +86,7 @@ namespace ts.FindAllReferences { if (scope) { result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken); } else { const internedName = getInternedName(symbol, node); @@ -98,1158 +97,1156 @@ namespace ts.FindAllReferences { if (nameTable[internedName] !== undefined) { result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex, implementations, typeChecker, cancellationToken); } } } return result; + } - function getDefinition(symbol: Symbol): ReferencedSymbolDefinitionInfo { - const info = SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), getContainerNode(node), node); - const name = map(info.displayParts, p => p.text).join(""); - const declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; - } - - return { - containerKind: "", - containerName: "", - name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: createTextSpan(declarations[0].getStart(), 0), - displayParts: info.displayParts - }; - } - - function getAliasSymbolForPropertyNameSymbol(symbol: Symbol, location: Node): Symbol | undefined { - if (symbol.flags & SymbolFlags.Alias) { - // Default import get alias - const defaultImport = getDeclarationOfKind(symbol, SyntaxKind.ImportClause); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - - const importOrExportSpecifier = forEach(symbol.declarations, - declaration => (declaration.kind === SyntaxKind.ImportSpecifier || - declaration.kind === SyntaxKind.ExportSpecifier) ? declaration : undefined); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === SyntaxKind.ImportSpecifier ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } - } + function getDefinition(symbol: Symbol, node: Node, typeChecker: TypeChecker): ReferencedSymbolDefinitionInfo { + const info = SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), getContainerNode(node), node); + const name = map(info.displayParts, p => p.text).join(""); + const declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { return undefined; } - function followAliasIfNecessary(symbol: Symbol, location: Node): Symbol { - return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; - } + return { + containerKind: "", + containerName: "", + name, + kind: info.symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: createTextSpan(declarations[0].getStart(), 0), + displayParts: info.displayParts + }; + } - function getPropertySymbolOfDestructuringAssignment(location: Node) { - return isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); - } + function getAliasSymbolForPropertyNameSymbol(symbol: Symbol, location: Node, typeChecker: TypeChecker): Symbol | undefined { + if (symbol.flags & SymbolFlags.Alias) { + // Default import get alias + const defaultImport = getDeclarationOfKind(symbol, SyntaxKind.ImportClause); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } - function isObjectBindingPatternElementWithoutPropertyName(symbol: Symbol) { + const importOrExportSpecifier = forEach(symbol.declarations, + declaration => (declaration.kind === SyntaxKind.ImportSpecifier || + declaration.kind === SyntaxKind.ExportSpecifier) ? declaration : undefined); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === SyntaxKind.ImportSpecifier ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + + function followAliasIfNecessary(symbol: Symbol, location: Node, typeChecker: TypeChecker): Symbol { + return getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker) || symbol; + } + + function getPropertySymbolOfDestructuringAssignment(location: Node, typeChecker: TypeChecker) { + return isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + + function isObjectBindingPatternElementWithoutPropertyName(symbol: Symbol) { + const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); + return bindingElement && + bindingElement.parent.kind === SyntaxKind.ObjectBindingPattern && + !bindingElement.propertyName; + } + + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol: Symbol, typeChecker: TypeChecker) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); - return bindingElement && - bindingElement.parent.kind === SyntaxKind.ObjectBindingPattern && - !bindingElement.propertyName; + const typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, (bindingElement.name).text); + } + return undefined; + } + + function getInternedName(symbol: Symbol, location: Node): string { + // If this is an export or import specifier it could have been renamed using the 'as' syntax. + // If so we want to search for whatever under the cursor. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol: Symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); - const typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, (bindingElement.name).text); + // Try to get the local symbol if we're dealing with an 'export default' + // since that symbol has the "true" name. + const localExportDefaultSymbol = getLocalSymbolForExportDefault(symbol); + symbol = localExportDefaultSymbol || symbol; + + return stripQuotes(symbol.name); + } + + /** + * Determines the smallest scope in which a symbol may have named references. + * Note that not every construct has been accounted for. This function can + * probably be improved. + * + * @returns undefined if the scope cannot be determined, implying that + * a reference to a symbol can occur anywhere. + */ + function getSymbolScope(symbol: Symbol): Node { + // If this is the symbol of a named function expression or named class expression, + // then named references are limited to its own scope. + const valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === SyntaxKind.FunctionExpression || valueDeclaration.kind === SyntaxKind.ClassExpression)) { + return valueDeclaration; + } + + // If this is private property or method, the scope is the containing class + if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) { + const privateDeclaration = forEach(symbol.getDeclarations(), d => (getModifierFlags(d) & ModifierFlags.Private) ? d : undefined); + if (privateDeclaration) { + return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } + } + + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visible outside its declaration scope. + if (symbol.flags & SymbolFlags.Alias) { return undefined; } - function getInternedName(symbol: Symbol, location: Node): string { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - const localExportDefaultSymbol = getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - - return stripQuotes(symbol.name); + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; } - /** - * Determines the smallest scope in which a symbol may have named references. - * Note that not every construct has been accounted for. This function can - * probably be improved. - * - * @returns undefined if the scope cannot be determined, implying that - * a reference to a symbol can occur anywhere. - */ - function getSymbolScope(symbol: Symbol): Node { - // If this is the symbol of a named function expression or named class expression, - // then named references are limited to its own scope. - const valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === SyntaxKind.FunctionExpression || valueDeclaration.kind === SyntaxKind.ClassExpression)) { - return valueDeclaration; - } - - // If this is private property or method, the scope is the containing class - if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) { - const privateDeclaration = forEach(symbol.getDeclarations(), d => (getModifierFlags(d) & ModifierFlags.Private) ? d : undefined); - if (privateDeclaration) { - return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); - } - } - - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & SymbolFlags.Alias) { - return undefined; - } - - // If symbol is of object binding pattern element without property name we would want to - // look for property too and that could be anywhere - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; - } - - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & SymbolFlags.SyntheticProperty)) { - return undefined; - } - - let scope: Node; - - const declarations = symbol.getDeclarations(); - if (declarations) { - for (const declaration of declarations) { - const container = getContainerNode(declaration); - - if (!container) { - return undefined; - } - - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - - if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { - // This is a global variable and not an external module, any declaration defined - // within this scope is visible outside the file - return undefined; - } - - // The search scope is the container node - scope = container; - } - } - - return scope; + // if this symbol is visible from its parent container, e.g. exported, then bail out + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.flags & SymbolFlags.SyntheticProperty)) { + return undefined; } - function getPossibleSymbolReferencePositions(sourceFile: SourceFile, symbolName: string, start: number, end: number): number[] { - const positions: number[] = []; + let scope: Node; - /// TODO: Cache symbol existence for files to save text search - // Also, need to make this work for unicode escapes. + const declarations = symbol.getDeclarations(); + if (declarations) { + for (const declaration of declarations) { + const container = getContainerNode(declaration); - // Be resilient in the face of a symbol with no name or zero length name - if (!symbolName || !symbolName.length) { - return positions; - } - - const text = sourceFile.text; - const sourceLength = text.length; - const symbolNameLength = symbolName.length; - - let position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - - // If we are past the end, stop looking - if (position > end) break; - - // 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). - const endPosition = position + symbolNameLength; - - if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) && - (endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) { - // Found a real match. Keep searching. - positions.push(position); + if (!container) { + return undefined; } - position = text.indexOf(symbolName, position + symbolNameLength + 1); - } + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; + } + + if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { + // This is a global variable and not an external module, any declaration defined + // within this scope is visible outside the file + return undefined; + } + + // The search scope is the container node + scope = container; + } + } + + return scope; + } + + function getPossibleSymbolReferencePositions(sourceFile: SourceFile, symbolName: string, start: number, end: number, cancellationToken: CancellationToken): number[] { + const positions: number[] = []; + + /// TODO: Cache symbol existence for files to save text search + // Also, need to make this work for unicode escapes. + + // Be resilient in the face of a symbol with no name or zero length name + if (!symbolName || !symbolName.length) { return positions; } - function getLabelReferencesInNode(container: Node, targetLabel: Identifier): ReferencedSymbol[] { - const references: ReferenceEntry[] = []; - const sourceFile = container.getSourceFile(); - const labelName = targetLabel.text; - const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + const text = sourceFile.text; + const sourceLength = text.length; + const symbolNameLength = symbolName.length; + + let position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + + // If we are past the end, stop looking + if (position > end) break; + + // 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). + const endPosition = position + symbolNameLength; + + if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) && + (endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) { + // Found a real match. Keep searching. + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + + return positions; + } + + function getLabelReferencesInNode(container: Node, targetLabel: Identifier, cancellationToken: CancellationToken): ReferencedSymbol[] { + const references: ReferenceEntry[] = []; + const sourceFile = container.getSourceFile(); + const labelName = targetLabel.text; + const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd(), cancellationToken); + forEach(possiblePositions, position => { + cancellationToken.throwIfCancellationRequested(); + + const node = getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + + // Only pick labels that are either the target label, or have a target that is the target label + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); + } + }); + + const definition: ReferencedSymbolDefinitionInfo = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ScriptElementKind.label, + name: labelName, + textSpan: createTextSpanFromNode(targetLabel, sourceFile), + displayParts: [displayPart(labelName, SymbolDisplayPartKind.text)] + }; + + return [{ definition, references }]; + } + + function isValidReferencePosition(node: Node, searchSymbolName: string): boolean { + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node && node.kind) { + case SyntaxKind.Identifier: + return node.getWidth() === searchSymbolName.length; + + case SyntaxKind.StringLiteral: + return (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && + // For string literals we have two additional chars for the quotes + node.getWidth() === searchSymbolName.length + 2; + + case SyntaxKind.NumericLiteral: + return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.getWidth() === searchSymbolName.length; + + default: + return false; + } + } + + /** Search within node "container" for references for a search value, where the search value is defined as a + * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). + * searchLocation: a node where the search value + */ + function getReferencesInNode(container: Node, + searchSymbol: Symbol, + searchText: string, + searchLocation: Node, + searchMeaning: SemanticMeaning, + findInStrings: boolean, + findInComments: boolean, + result: ReferencedSymbol[], + symbolToIndex: number[], + implementations: boolean, + typeChecker: TypeChecker, + cancellationToken: CancellationToken): void { + + const sourceFile = container.getSourceFile(); + + const start = findInComments ? container.getFullStart() : container.getStart(); + const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd(), cancellationToken); + + const parents = getParentSymbolsOfPropertyAccess(); + const inheritsFromCache: Map = createMap(); + + if (possiblePositions.length) { + // Build the set of symbols to search for, initially it has only the current symbol + const searchSymbols = populateSearchSymbolSet(searchSymbol, searchLocation, typeChecker, implementations); + forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - const node = getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { + const 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 + // for. + if (!implementations && ((findInStrings && isInString(sourceFile, position)) || + (findInComments && isInNonReferenceComment(sourceFile, position)))) { + + // In the case where we're looking inside comments/strings, we don't have + // an actual definition. So just use 'undefined' here. Features like + // 'Rename' won't care (as they ignore the definitions), and features like + // 'FindReferences' will just filter out these results. + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); + } return; } - // Only pick labels that are either the target label, or have a target that is the target label - if (node === targetLabel || - (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); + if (!(getMeaningFromLocation(referenceLocation) & searchMeaning)) { + return; + } + + const referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + const referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + const shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + const relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, + /*searchLocationIsConstructor*/ searchLocation.kind === SyntaxKind.ConstructorKeyword, parents, inheritsFromCache, typeChecker); + + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); + } + /* Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment + * has two meaning : property name and property value. Therefore when we do findAllReference at the position where + * an identifier is declared, the language service should return the position of the variable declaration as well as + * the position in short-hand property assignment excluding property accessing. However, if we do findAllReference at the + * position of property accessing, the referenceEntry of such position will be handled in the first case. + */ + else if (!(referenceSymbol.flags & SymbolFlags.Transient) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); + } + else if (searchLocation.kind === SyntaxKind.ConstructorKeyword) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + } } }); + } + return; - const definition: ReferencedSymbolDefinitionInfo = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ScriptElementKind.label, - name: labelName, - textSpan: createTextSpanFromNode(targetLabel, sourceFile), - displayParts: [displayPart(labelName, SymbolDisplayPartKind.text)] - }; - - return [{ definition, references }]; + /* If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess(): Symbol[] | undefined { + if (implementations) { + const propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + const localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & TypeFlags.UnionOrIntersection) { + return getSymbolsForClassAndInterfaceComponents(localParentType); + } + } + } + } } - function isValidReferencePosition(node: Node, searchSymbolName: string): boolean { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case SyntaxKind.Identifier: - return node.getWidth() === searchSymbolName.length; - - case SyntaxKind.StringLiteral: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - - case SyntaxKind.NumericLiteral: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; - } - } - - return false; + function getPropertyAccessExpressionFromRightHandSide(node: Node): PropertyAccessExpression { + return isRightSideOfPropertyAccess(node) && node.parent; } - /** Search within node "container" for references for a search value, where the search value is defined as a - * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - * searchLocation: a node where the search value - */ - function getReferencesInNode(container: Node, - searchSymbol: Symbol, - searchText: string, - searchLocation: Node, - searchMeaning: SemanticMeaning, - findInStrings: boolean, - findInComments: boolean, - result: ReferencedSymbol[], - symbolToIndex: number[]): void { + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findAdditionalConstructorReferences(referenceSymbol: Symbol, referenceLocation: Node): void { + Debug.assert(isClassLike(searchSymbol.valueDeclaration)); - const sourceFile = container.getSourceFile(); - - const start = findInComments ? container.getFullStart() : container.getStart(); - const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); - - const parents = getParentSymbolsOfPropertyAccess(); - const inheritsFromCache: Map = createMap(); - - if (possiblePositions.length) { - // Build the set of symbols to search for, initially it has only the current symbol - const searchSymbols = populateSearchSymbolSet(searchSymbol, searchLocation); - - forEach(possiblePositions, position => { - cancellationToken.throwIfCancellationRequested(); - - const 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 - // for. - if (!implementations && ((findInStrings && isInString(sourceFile, position)) || - (findInComments && isInNonReferenceComment(sourceFile, position)))) { - - // In the case where we're looking inside comments/strings, we don't have - // an actual definition. So just use 'undefined' here. Features like - // 'Rename' won't care (as they ignore the definitions), and features like - // 'FindReferences' will just filter out these results. - result.push({ - definition: undefined, - references: [{ - fileName: sourceFile.fileName, - textSpan: createTextSpan(position, searchText.length), - isWriteAccess: false, - isDefinition: false - }] - }); - } - return; - } - - if (!(getMeaningFromLocation(referenceLocation) & searchMeaning)) { - return; - } - - const referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); - if (referenceSymbol) { - const referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - const shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); - const relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, - /*searchLocationIsConstructor*/ searchLocation.kind === SyntaxKind.ConstructorKeyword, parents, inheritsFromCache); - - if (relatedSymbol) { - addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); - } - /* Because in short-hand property assignment, an identifier which stored as name of the short-hand property assignment - * has two meaning : property name and property value. Therefore when we do findAllReference at the position where - * an identifier is declared, the language service should return the position of the variable declaration as well as - * the position in short-hand property assignment excluding property accessing. However, if we do findAllReference at the - * position of property accessing, the referenceEntry of such position will be handled in the first case. - */ - else if (!(referenceSymbol.flags & SymbolFlags.Transient) && searchSymbols.indexOf(shorthandValueSymbol) >= 0) { - addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); - } - else if (searchLocation.kind === SyntaxKind.ConstructorKeyword) { - findAdditionalConstructorReferences(referenceSymbol, referenceLocation); - } - } - }); + const referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && isClassLike(referenceClass)) { + Debug.assert(referenceClass.name === referenceLocation); + // This is the class declaration containing the constructor. + addReferences(findOwnConstructorCalls(searchSymbol)); } - return; - - /* If we are just looking for implementations and this is a property access expression, we need to get the - * symbol of the local type of the symbol the property is being accessed on. This is because our search - * symbol may have a different parent symbol if the local type's symbol does not declare the property - * being accessed (i.e. it is declared in some parent class or interface) - */ - function getParentSymbolsOfPropertyAccess(): Symbol[] | undefined { - if (implementations) { - const propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); - if (propertyAccessExpression) { - const localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); - if (localParentType) { - if (localParentType.symbol && localParentType.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== searchSymbol.parent) { - return [localParentType.symbol]; - } - else if (localParentType.flags & TypeFlags.UnionOrIntersection) { - return getSymbolsForClassAndInterfaceComponents(localParentType); - } - } - } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + const classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation, typeChecker) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); } } + } - function getPropertyAccessExpressionFromRightHandSide(node: Node): PropertyAccessExpression { - return isRightSideOfPropertyAccess(node) && node.parent; + function addReferences(references: Node[]): void { + if (references.length) { + const referencedSymbol = getReferencedSymbol(searchSymbol); + addRange(referencedSymbol.references, map(references, getReferenceEntryFromNode)); + } + } + + /** `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorCalls(classSymbol: Symbol): Node[] { + const result: Node[] = []; + + for (const decl of classSymbol.members["__constructor"].declarations) { + const ctrKeyword = ts.findChildOfKind(decl, ts.SyntaxKind.ConstructorKeyword, sourceFile)! + Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword); + result.push(ctrKeyword); } - /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ - function findAdditionalConstructorReferences(referenceSymbol: Symbol, referenceLocation: Node): void { - Debug.assert(isClassLike(searchSymbol.valueDeclaration)); - - const referenceClass = referenceLocation.parent; - if (referenceSymbol === searchSymbol && isClassLike(referenceClass)) { - Debug.assert(referenceClass.name === referenceLocation); - // This is the class declaration containing the constructor. - addReferences(findOwnConstructorCalls(searchSymbol)); - } - else { - // If this class appears in `extends C`, then the extending class' "super" calls are references. - const classExtending = tryGetClassByExtendingIdentifier(referenceLocation); - if (classExtending && isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { - addReferences(superConstructorAccesses(classExtending)); - } - } - } - - function addReferences(references: Node[]): void { - if (references.length) { - const referencedSymbol = getReferencedSymbol(searchSymbol); - addRange(referencedSymbol.references, map(references, getReferenceEntryFromNode)); - } - } - - /** `classSymbol` is the class where the constructor was defined. - * Reference the constructor and all calls to `new this()`. - */ - function findOwnConstructorCalls(classSymbol: Symbol): Node[] { - const result: Node[] = []; - - for (const decl of classSymbol.members["__constructor"].declarations) { - const ctrKeyword = ts.findChildOfKind(decl, ts.SyntaxKind.ConstructorKeyword, sourceFile)! - Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword); - result.push(ctrKeyword); - } - - forEachProperty(classSymbol.exports, member => { - const decl = member.valueDeclaration; - if (decl && decl.kind === SyntaxKind.MethodDeclaration) { - const body = (decl).body; - if (body) { - forEachDescendantOfKind(body, SyntaxKind.ThisKeyword, thisKeyword => { - if (isNewExpressionTarget(thisKeyword)) { - result.push(thisKeyword); - } - }); - } - } - }); - - return result; - } - - /** Find references to `super` in the constructor of an extending class. */ - function superConstructorAccesses(cls: ClassLikeDeclaration): Node[] { - const symbol = cls.symbol; - const ctr = symbol.members["__constructor"]; - if (!ctr) { - return []; - } - - const result: Node[] = []; - for (const decl of ctr.declarations) { - Debug.assert(decl.kind === SyntaxKind.Constructor); - const body = (decl).body; + forEachProperty(classSymbol.exports, member => { + const decl = member.valueDeclaration; + if (decl && decl.kind === SyntaxKind.MethodDeclaration) { + const body = (decl).body; if (body) { - forEachDescendantOfKind(body, SyntaxKind.SuperKeyword, node => { - if (isCallExpressionTarget(node)) { - result.push(node); + forEachDescendantOfKind(body, SyntaxKind.ThisKeyword, thisKeyword => { + if (isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); } }); } - }; - return result; - } - - function getReferencedSymbol(symbol: Symbol): ReferencedSymbol { - const symbolId = getSymbolId(symbol); - let index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - - result.push({ - definition: getDefinition(symbol), - references: [] - }); } + }); - return result[index]; - } - - function addReferenceToRelatedSymbol(node: Node, relatedSymbol: Symbol) { - const references = getReferencedSymbol(relatedSymbol).references; - if (implementations) { - getImplementationReferenceEntryForNode(node, references); - } - else { - references.push(getReferenceEntryFromNode(node)); - } - } - } - - function getImplementationReferenceEntryForNode(refNode: Node, result: ReferenceEntry[]): void { - // Check if we found a function/propertyAssignment/method with an implementation or initializer - if (isDeclarationName(refNode) && isImplementation(refNode.parent)) { - result.push(getReferenceEntryFromNode(refNode.parent)); - } - else if (refNode.kind === SyntaxKind.Identifier) { - if (refNode.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { - // Go ahead and dereference the shorthand assignment by going to its definition - getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); - } - - // Check if the node is within an extends or implements clause - const containingClass = getContainingClassIfInHeritageClause(refNode); - if (containingClass) { - result.push(getReferenceEntryFromNode(containingClass)); - return; - } - - // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface - const containingTypeReference = getContainingTypeReference(refNode); - if (containingTypeReference) { - const parent = containingTypeReference.parent; - if (isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { - maybeAdd(getReferenceEntryFromNode(parent.initializer)); - } - else if (isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { - if (parent.body.kind === SyntaxKind.Block) { - forEachReturnStatement(parent.body, returnStatement => { - if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { - maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); - } - }); - } - else if (isImplementationExpression(parent.body)) { - maybeAdd(getReferenceEntryFromNode(parent.body)); - } - } - else if (isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { - maybeAdd(getReferenceEntryFromNode(parent.expression)); - } - } - } - - // Type nodes can contain multiple references to the same type. For example: - // let x: Foo & (Foo & Bar) = ... - // Because we are returning the implementation locations and not the identifier locations, - // duplicate entries would be returned here as each of the type references is part of - // the same implementation. For that reason, check before we add a new entry - function maybeAdd(a: ReferenceEntry) { - if (!forEach(result, b => a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length)) { - result.push(a); - } - } - } - - function getSymbolsForClassAndInterfaceComponents(type: UnionOrIntersectionType, result: Symbol[] = []): Symbol[] { - for (const componentType of type.types) { - if (componentType.symbol && componentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface)) { - result.push(componentType.symbol); - } - if (componentType.getFlags() & TypeFlags.UnionOrIntersection) { - getSymbolsForClassAndInterfaceComponents(componentType, result); - } - } return result; } - function getContainingTypeReference(node: Node): Node { - let topLevelTypeReference: Node = undefined; - - while (node) { - if (isTypeNode(node)) { - topLevelTypeReference = node; - } - node = node.parent; + /** Find references to `super` in the constructor of an extending class. */ + function superConstructorAccesses(cls: ClassLikeDeclaration): Node[] { + const symbol = cls.symbol; + const ctr = symbol.members["__constructor"]; + if (!ctr) { + return []; } - return topLevelTypeReference; + const result: Node[] = []; + for (const decl of ctr.declarations) { + Debug.assert(decl.kind === SyntaxKind.Constructor); + const body = (decl).body; + if (body) { + forEachDescendantOfKind(body, SyntaxKind.SuperKeyword, node => { + if (isCallExpressionTarget(node)) { + result.push(node); + } + }); + } + }; + return result; } - function getContainingClassIfInHeritageClause(node: Node): ClassLikeDeclaration { - if (node && node.parent) { - if (node.kind === SyntaxKind.ExpressionWithTypeArguments - && node.parent.kind === SyntaxKind.HeritageClause - && isClassLike(node.parent.parent)) { - return node.parent.parent; - } + function getReferencedSymbol(symbol: Symbol): ReferencedSymbol { + const symbolId = getSymbolId(symbol); + let index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; - else if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.PropertyAccessExpression) { - return getContainingClassIfInHeritageClause(node.parent); + result.push({ + definition: getDefinition(symbol, searchLocation, typeChecker), + references: [] + }); + } + + return result[index]; + } + + function addReferenceToRelatedSymbol(node: Node, relatedSymbol: Symbol) { + const references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references, typeChecker); + } + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + + function getImplementationReferenceEntryForNode(refNode: Node, result: ReferenceEntry[], typeChecker: TypeChecker): void { + // Check if we found a function/propertyAssignment/method with an implementation or initializer + if (isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === SyntaxKind.Identifier) { + if (refNode.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); + } + + // Check if the node is within an extends or implements clause + const containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + + // If we got a type reference, try and see if the reference applies to any expressions that can implement an interface + const containingTypeReference = getContainingTypeReference(refNode); + if (containingTypeReference) { + const parent = containingTypeReference.parent; + if (isVariableLike(parent) && parent.type === containingTypeReference && parent.initializer && isImplementationExpression(parent.initializer)) { + maybeAdd(getReferenceEntryFromNode(parent.initializer)); + } + else if (isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { + if (parent.body.kind === SyntaxKind.Block) { + forEachReturnStatement(parent.body, returnStatement => { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); + } + else if (isImplementationExpression(parent.body)) { + maybeAdd(getReferenceEntryFromNode(parent.body)); + } + } + else if (isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { + maybeAdd(getReferenceEntryFromNode(parent.expression)); } } - return undefined; } - /** - * Returns true if this is an expression that can be considered an implementation - */ - function isImplementationExpression(node: Expression): boolean { - // Unwrap parentheses - if (node.kind === SyntaxKind.ParenthesizedExpression) { + // Type nodes can contain multiple references to the same type. For example: + // let x: Foo & (Foo & Bar) = ... + // Because we are returning the implementation locations and not the identifier locations, + // duplicate entries would be returned here as each of the type references is part of + // the same implementation. For that reason, check before we add a new entry + function maybeAdd(a: ReferenceEntry) { + if (!forEach(result, b => a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length)) { + result.push(a); + } + } + } + + function getSymbolsForClassAndInterfaceComponents(type: UnionOrIntersectionType, result: Symbol[] = []): Symbol[] { + for (const componentType of type.types) { + if (componentType.symbol && componentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & TypeFlags.UnionOrIntersection) { + getSymbolsForClassAndInterfaceComponents(componentType, result); + } + } + return result; + } + + function getContainingTypeReference(node: Node): Node { + let topLevelTypeReference: Node = undefined; + + while (node) { + if (isTypeNode(node)) { + topLevelTypeReference = node; + } + node = node.parent; + } + + return topLevelTypeReference; + } + + function getContainingClassIfInHeritageClause(node: Node): ClassLikeDeclaration { + if (node && node.parent) { + if (node.kind === SyntaxKind.ExpressionWithTypeArguments + && node.parent.kind === SyntaxKind.HeritageClause + && isClassLike(node.parent.parent)) { + return node.parent.parent; + } + + else if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.PropertyAccessExpression) { + return getContainingClassIfInHeritageClause(node.parent); + } + } + return undefined; + } + + /** + * Returns true if this is an expression that can be considered an implementation + */ + function isImplementationExpression(node: Expression): boolean { + switch (node.kind) { + case SyntaxKind.ParenthesizedExpression: return isImplementationExpression((node).expression); + case SyntaxKind.ArrowFunction: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ObjectLiteralExpression: + case SyntaxKind.ClassExpression: + case SyntaxKind.ArrayLiteralExpression: + return true; + default: + return false; + } + } + + /** + * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol + * is an interface, determines if some ancestor of the child symbol extends or inherits from it. + * Also takes in a cache of previous results which makes this slightly more efficient and is + * necessary to avoid potential loops like so: + * class A extends B { } + * class B extends A { } + * + * We traverse the AST rather than using the type checker because users are typically only interested + * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling + * implementations of types that share a common ancestor with the type whose implementation we are + * searching for need to be filtered out of the results. The type checker doesn't let us make the + * distinction between structurally compatible implementations and explicit implementations, so we + * must use the AST. + * + * @param child A class or interface Symbol + * @param parent Another class or interface Symbol + * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results + */ + function explicitlyInheritsFrom(child: Symbol, parent: Symbol, cachedResults: Map, typeChecker: TypeChecker): boolean { + const parentIsInterface = parent.getFlags() & SymbolFlags.Interface; + return searchHierarchy(child); + + function searchHierarchy(symbol: Symbol): boolean { + if (symbol === parent) { + return true; } - return node.kind === SyntaxKind.ArrowFunction || - node.kind === SyntaxKind.FunctionExpression || - node.kind === SyntaxKind.ObjectLiteralExpression || - node.kind === SyntaxKind.ClassExpression || - node.kind === SyntaxKind.ArrayLiteralExpression; - } + const key = getSymbolId(symbol) + "," + getSymbolId(parent); + if (key in cachedResults) { + return cachedResults[key]; + } - /** - * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol - * is an interface, determines if some ancestor of the child symbol extends or inherits from it. - * Also takes in a cache of previous results which makes this slightly more efficient and is - * necessary to avoid potential loops like so: - * class A extends B { } - * class B extends A { } - * - * We traverse the AST rather than using the type checker because users are typically only interested - * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling - * implementations of types that share a common ancestor with the type whose implementation we are - * searching for need to be filtered out of the results. The type checker doesn't let us make the - * distinction between structurally compatible implementations and explicit implementations, so we - * must use the AST. - * - * @param child A class or interface Symbol - * @param parent Another class or interface Symbol - * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results - */ - function explicitlyInheritsFrom(child: Symbol, parent: Symbol, cachedResults: Map): boolean { - const parentIsInterface = parent.getFlags() & SymbolFlags.Interface; - return searchHierarchy(child); + // Set the key so that we don't infinitely recurse + cachedResults[key] = false; - function searchHierarchy(symbol: Symbol): boolean { - if (symbol === parent) { - return true; - } - - const key = getSymbolId(symbol) + "," + getSymbolId(parent); - if (key in cachedResults) { - return cachedResults[key]; - } - - // Set the key so that we don't infinitely recurse - cachedResults[key] = false; - - const inherits = forEach(symbol.getDeclarations(), declaration => { - if (isClassLike(declaration)) { - if (parentIsInterface) { - const interfaceReferences = getClassImplementsHeritageClauseElements(declaration); - if (interfaceReferences) { - for (const typeReference of interfaceReferences) { - if (searchTypeReference(typeReference)) { - return true; - } + const inherits = forEach(symbol.getDeclarations(), declaration => { + if (isClassLike(declaration)) { + if (parentIsInterface) { + const interfaceReferences = getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (const typeReference of interfaceReferences) { + if (searchTypeReference(typeReference)) { + return true; } } } - return searchTypeReference(getClassExtendsHeritageClauseElement(declaration)); } - else if (declaration.kind === SyntaxKind.InterfaceDeclaration) { - if (parentIsInterface) { - return forEach(getInterfaceBaseTypeNodes(declaration), searchTypeReference); - } - } - return false; - }); - - cachedResults[key] = inherits; - return inherits; - } - - function searchTypeReference(typeReference: ExpressionWithTypeArguments): boolean { - if (typeReference) { - const type = typeChecker.getTypeAtLocation(typeReference); - if (type && type.symbol) { - return searchHierarchy(type.symbol); + return searchTypeReference(getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === SyntaxKind.InterfaceDeclaration) { + if (parentIsInterface) { + return forEach(getInterfaceBaseTypeNodes(declaration), searchTypeReference); } } return false; - } + }); + + cachedResults[key] = inherits; + return inherits; } - function getReferencesForSuperKeyword(superKeyword: Node): ReferencedSymbol[] { - let searchSpaceNode = getSuperContainer(superKeyword, /*stopOnFunctions*/ false); - if (!searchSpaceNode) { + function searchTypeReference(typeReference: ExpressionWithTypeArguments): boolean { + if (typeReference) { + const type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } + } + return false; + } + } + + function getReferencesForSuperKeyword(superKeyword: Node, typeChecker: TypeChecker, cancellationToken: CancellationToken): ReferencedSymbol[] { + let searchSpaceNode = getSuperContainer(superKeyword, /*stopOnFunctions*/ false); + if (!searchSpaceNode) { + return undefined; + } + // Whether 'super' occurs in a static context within a class. + let staticFlag = ModifierFlags.Static; + + switch (searchSpaceNode.kind) { + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + staticFlag &= getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + default: return undefined; - } - // Whether 'super' occurs in a static context within a class. - let staticFlag = ModifierFlags.Static; + } - switch (searchSpaceNode.kind) { - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.Constructor: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - staticFlag &= getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + const references: ReferenceEntry[] = []; + + const sourceFile = searchSpaceNode.getSourceFile(); + const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + forEach(possiblePositions, position => { + cancellationToken.throwIfCancellationRequested(); + + const node = getTouchingWord(sourceFile, position); + + if (!node || node.kind !== SyntaxKind.SuperKeyword) { + return; + } + + const container = getSuperContainer(node, /*stopOnFunctions*/ 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 + // and has the same static qualifier as the original 'super's owner. + if (container && (ModifierFlags.Static & getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + }); + + const definition = getDefinition(searchSpaceNode.symbol, superKeyword, typeChecker); + return [{ definition, references }]; + } + + function getReferencesForThisKeyword(thisOrSuperKeyword: Node, sourceFiles: SourceFile[], typeChecker: TypeChecker, cancellationToken: CancellationToken): ReferencedSymbol[] { + let searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); + + // Whether 'this' occurs in a static context within a class. + let staticFlag = ModifierFlags.Static; + + switch (searchSpaceNode.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + if (isObjectLiteralMethod(searchSpaceNode)) { break; - default: + } + // fall through + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + staticFlag &= getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + case SyntaxKind.SourceFile: + if (isExternalModule(searchSpaceNode)) { return undefined; - } + } + // Fall through + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + break; + // Computed properties in classes are not handled here because references to this are illegal, + // so there is no point finding references to them. + default: + return undefined; + } - const references: ReferenceEntry[] = []; + const references: ReferenceEntry[] = []; + let possiblePositions: number[]; + if (searchSpaceNode.kind === SyntaxKind.SourceFile) { + forEach(sourceFiles, sourceFile => { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { const sourceFile = searchSpaceNode.getSourceFile(); - const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd(), cancellationToken); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + + const thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + + const displayParts = thisOrSuperSymbol && SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind( + typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: thisOrSuperKeyword.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: "this", + textSpan: createTextSpanFromNode(thisOrSuperKeyword), + displayParts + }, + references: references + }]; + + function getThisReferencesInFile(sourceFile: SourceFile, searchSpaceNode: Node, possiblePositions: number[], result: ReferenceEntry[]): void { forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); const node = getTouchingWord(sourceFile, position); - - if (!node || node.kind !== SyntaxKind.SuperKeyword) { + if (!node || !isThis(node)) { return; } - const container = getSuperContainer(node, /*stopOnFunctions*/ false); + const container = getThisContainer(node, /* includeArrowFunctions */ 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 - // and has the same static qualifier as the original 'super's owner. - if (container && (ModifierFlags.Static & getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); - } - }); - - const definition = getDefinition(searchSpaceNode.symbol); - return [{ definition, references }]; - } - - function getReferencesForThisKeyword(thisOrSuperKeyword: Node, sourceFiles: SourceFile[]): ReferencedSymbol[] { - let searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); - - // Whether 'this' occurs in a static context within a class. - let staticFlag = ModifierFlags.Static; - - switch (searchSpaceNode.kind) { - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - if (isObjectLiteralMethod(searchSpaceNode)) { + switch (searchSpaceNode.kind) { + case SyntaxKind.FunctionExpression: + case SyntaxKind.FunctionDeclaration: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case SyntaxKind.ClassExpression: + case SyntaxKind.ClassDeclaration: + // Make sure the container belongs to the same class + // and has the appropriate static modifier from the original container. + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case SyntaxKind.SourceFile: + if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } break; - } - // fall through - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - case SyntaxKind.Constructor: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - staticFlag &= getModifierFlags(searchSpaceNode); - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class - break; - case SyntaxKind.SourceFile: - if (isExternalModule(searchSpaceNode)) { - return undefined; - } - // Fall through - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - break; - // Computed properties in classes are not handled here because references to this are illegal, - // so there is no point finding references to them. - default: - return undefined; - } - - const references: ReferenceEntry[] = []; - - let possiblePositions: number[]; - if (searchSpaceNode.kind === SyntaxKind.SourceFile) { - forEach(sourceFiles, sourceFile => { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - const sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); - } - - const thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); - - const displayParts = thisOrSuperSymbol && SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind( - typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; - - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ScriptElementKind.variableElement, - name: "this", - textSpan: createTextSpanFromNode(node), - displayParts - }, - references: references - }]; - - function getThisReferencesInFile(sourceFile: SourceFile, searchSpaceNode: Node, possiblePositions: number[], result: ReferenceEntry[]): void { - forEach(possiblePositions, position => { - cancellationToken.throwIfCancellationRequested(); - - const node = getTouchingWord(sourceFile, position); - if (!node || !isThis(node)) { - return; - } - - const container = getThisContainer(node, /* includeArrowFunctions */ false); - - switch (searchSpaceNode.kind) { - case SyntaxKind.FunctionExpression: - case SyntaxKind.FunctionDeclaration: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - if (isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case SyntaxKind.ClassExpression: - case SyntaxKind.ClassDeclaration: - // Make sure the container belongs to the same class - // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (getModifierFlags(container) & ModifierFlags.Static) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case SyntaxKind.SourceFile: - if (container.kind === SyntaxKind.SourceFile && !isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); - } - } - - - function getReferencesForStringLiteral(node: StringLiteral, sourceFiles: SourceFile[]): ReferencedSymbol[] { - const type = getStringLiteralTypeForNode(node, typeChecker); - - if (!type) { - // nothing to do here. moving on - return undefined; - } - - const references: ReferenceEntry[] = []; - - for (const sourceFile of sourceFiles) { - const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); - } - - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ScriptElementKind.variableElement, - name: type.text, - textSpan: createTextSpanFromNode(node), - displayParts: [displayPart(getTextOfNode(node), SymbolDisplayPartKind.stringLiteral)] - }, - references: references - }]; - - function getReferencesForStringLiteralInFile(sourceFile: SourceFile, searchType: Type, possiblePositions: number[], references: ReferenceEntry[]): void { - for (const position of possiblePositions) { - cancellationToken.throwIfCancellationRequested(); - - const node = getTouchingWord(sourceFile, position); - if (!node || node.kind !== SyntaxKind.StringLiteral) { - return; - } - - const type = getStringLiteralTypeForNode(node, typeChecker); - if (type === searchType) { - references.push(getReferenceEntryFromNode(node)); - } - } - } - } - - function populateSearchSymbolSet(symbol: Symbol, location: Node): Symbol[] { - // The search set contains at least the current symbol - let result = [symbol]; - - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - const containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== SyntaxKind.ShorthandPropertyAssignment) { - const propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - const aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set - if (containingObjectLiteralElement) { - forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), contextualSymbol => { - addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - - /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * 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 - * const name = "Foo"; - * const 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. - */ - const shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } - } - - // If the symbol.valueDeclaration is a property parameter declaration, - // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. - // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter && - isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); - } - - // If this is symbol of binding element without propertyName declaration in Object binding pattern - // Include the property in the search - const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); - } - - // If this is a union property, add all the symbols from all its source symbols in all unioned types. - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - forEach(typeChecker.getRootSymbols(symbol), rootSymbol => { - if (rootSymbol !== symbol) { - result.push(rootSymbol); - } - - // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap()); } }); - - return result; } + } - /** - * Find symbol of the given property-name and add the symbol to the given result array - * @param symbol a symbol to start searching for the given propertyName - * @param propertyName a name of property to search for - * @param result an array of symbol of found property symbols - * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. - * The value of previousIterationSymbol is undefined when the function is first called. - */ - function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[], - previousIterationSymbolsCache: SymbolTable): void { - if (!symbol) { - return; - } + function getReferencesForStringLiteral(node: StringLiteral, sourceFiles: SourceFile[], typeChecker: TypeChecker, cancellationToken: CancellationToken): ReferencedSymbol[] { + const type = getStringLiteralTypeForNode(node, typeChecker); - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { - return; - } - - if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - forEach(symbol.getDeclarations(), declaration => { - if (isClassLike(declaration)) { - getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(declaration)); - forEach(getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === SyntaxKind.InterfaceDeclaration) { - forEach(getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - - function getPropertySymbolFromTypeReference(typeReference: ExpressionWithTypeArguments) { - if (typeReference) { - const type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - const propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push(...typeChecker.getRootSymbols(propertySymbol)); - } - - // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); - } - } - } - } - - function getRelatedSymbol(searchSymbols: Symbol[], referenceSymbol: Symbol, referenceLocation: Node, searchLocationIsConstructor: boolean, parents: Symbol[] | undefined, cache: Map): Symbol { - if (contains(searchSymbols, referenceSymbol)) { - // If we are searching for constructor uses, they must be 'new' expressions. - return (!searchLocationIsConstructor || isNewExpressionTarget(referenceLocation)) && referenceSymbol; - } - - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - const aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); - } - - // If the reference location is in an object literal, try to get the contextual type for the - // object literal, lookup the property symbol in the contextual type, and use this symbol to - // compare to our searchSymbol - const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - const contextualSymbol = forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), contextualSymbol => { - return forEach(typeChecker.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined); - }); - - if (contextualSymbol) { - return contextualSymbol; - } - - // If the reference location is the name of property from object literal destructuring pattern - // Get the property symbol from the object literal's type and look if thats the search symbol - // In below eg. get 'property' from type of elems iterating type - // for ( { property: p2 } of elems) { } - const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } - } - - // If the reference location is the binding element and doesn't have property name - // then include the binding element in the related symbols - // let { a } : { a }; - const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; - } - - // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) - // Or a union property, use its underlying unioned symbols - return forEach(typeChecker.getRootSymbols(referenceSymbol), rootSymbol => { - // if it is in the list, then we are done - if (searchSymbols.indexOf(rootSymbol) >= 0) { - return rootSymbol; - } - - // 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 we were passed a parent symbol, only include types that are subtypes of the - // parent symbol - if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - // Parents will only be defined if implementations is true - if (parents) { - if (!forEach(parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, cache))) { - return undefined; - } - } - - const result: Symbol[] = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap()); - return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined); - } - - return undefined; - }); - } - - function getNameFromObjectLiteralElement(node: ObjectLiteralElement) { - if (node.name.kind === SyntaxKind.ComputedPropertyName) { - const nameExpression = (node.name).expression; - // treat computed property names where expression is string/numeric literal as just string/numeric literal - if (isStringOrNumericLiteral(nameExpression)) { - return (nameExpression).text; - } - return undefined; - } - return (node.name).text; - } - - function getPropertySymbolsFromContextualType(node: ObjectLiteralElement): Symbol[] { - const objectLiteral = node.parent; - const contextualType = typeChecker.getContextualType(objectLiteral); - const name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - const result: Symbol[] = []; - const symbol = contextualType.getProperty(name); - if (symbol) { - result.push(symbol); - } - - if (contextualType.flags & TypeFlags.Union) { - forEach((contextualType).types, t => { - const symbol = t.getProperty(name); - if (symbol) { - result.push(symbol); - } - }); - } - return result; - } + if (!type) { + // nothing to do here. moving on return undefined; } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ - 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 - // intersects with the class in the value space. - // To achieve that we will keep iterating until the result stabilizes. + const references: ReferenceEntry[] = []; - // Remember the last meaning - lastIterationMeaning = meaning; + for (const sourceFile of sourceFiles) { + const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd(), cancellationToken); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } - for (const declaration of declarations) { - const declarationMeaning = getMeaningFromDeclaration(declaration); + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ScriptElementKind.variableElement, + name: type.text, + textSpan: createTextSpanFromNode(node), + displayParts: [displayPart(getTextOfNode(node), SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } + function getReferencesForStringLiteralInFile(sourceFile: SourceFile, searchType: Type, possiblePositions: number[], references: ReferenceEntry[]): void { + for (const position of possiblePositions) { + cancellationToken.throwIfCancellationRequested(); + + const node = getTouchingWord(sourceFile, position); + if (!node || node.kind !== SyntaxKind.StringLiteral) { + return; + } + + const type = getStringLiteralTypeForNode(node, typeChecker); + if (type === searchType) { + references.push(getReferenceEntryFromNode(node)); + } + } + } + } + + function populateSearchSymbolSet(symbol: Symbol, location: Node, typeChecker: TypeChecker, implementations: boolean): Symbol[] { + // The search set contains at least the current symbol + let result = [symbol]; + + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + const containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== SyntaxKind.ShorthandPropertyAssignment) { + const propertySymbol = getPropertySymbolOfDestructuringAssignment(location, typeChecker); + if (propertySymbol) { + result.push(propertySymbol); + } + } + + // If the symbol is an alias, add what it aliases to the list + // import {a} from "mod"; + // export {a} + // If the symbol is an alias to default declaration, add what it aliases to the list + // declare "mod" { export default class B { } } + // import B from "mod"; + //// For export specifiers, the exported name can be referring to a local symbol, e.g.: + //// import {a} from "mod"; + //// export {a as somethingElse} + //// We want the *local* declaration of 'a' as declared in the import, + //// *not* as declared within "mod" (or farther) + const aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location, typeChecker); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location, typeChecker, implementations)); + } + + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + if (containingObjectLiteralElement) { + forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), contextualSymbol => { + addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + + /* Because in short-hand property assignment, location has two meaning : property name and as value of the property + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * 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 + * const name = "Foo"; + * const 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. + */ + const shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === SyntaxKind.Parameter && + isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, typeChecker); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + + // If this is a union property, add all the symbols from all its source symbols in all unioned types. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list + forEach(typeChecker.getRootSymbols(symbol), rootSymbol => { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + + // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap(), typeChecker); + } + }); + + return result; + } + + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[], + previousIterationSymbolsCache: SymbolTable, typeChecker: TypeChecker): void { + if (!symbol) { + return; + } + + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (symbol.name in previousIterationSymbolsCache) { + return; + } + + if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + forEach(symbol.getDeclarations(), declaration => { + if (isClassLike(declaration)) { + getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(declaration)); + forEach(getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === SyntaxKind.InterfaceDeclaration) { + forEach(getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + + function getPropertySymbolFromTypeReference(typeReference: ExpressionWithTypeArguments) { + if (typeReference) { + const type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + const propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push(...typeChecker.getRootSymbols(propertySymbol)); + } + + // Visit the typeReference as well to see if it directly or indirectly use that property + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, typeChecker); + } + } + } + } + + function getRelatedSymbol(searchSymbols: Symbol[], referenceSymbol: Symbol, referenceLocation: Node, searchLocationIsConstructor: boolean, parents: Symbol[] | undefined, cache: Map, typeChecker: TypeChecker): Symbol { + if (contains(searchSymbols, referenceSymbol)) { + // If we are searching for constructor uses, they must be 'new' expressions. + return (!searchLocationIsConstructor || isNewExpressionTarget(referenceLocation)) && referenceSymbol; + } + + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + const aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation, typeChecker); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache, typeChecker); + } + + // If the reference location is in an object literal, try to get the contextual type for the + // object literal, lookup the property symbol in the contextual type, and use this symbol to + // compare to our searchSymbol + const containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + const contextualSymbol = forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement, typeChecker), contextualSymbol => { + return forEach(typeChecker.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined); + }); + + if (contextualSymbol) { + return contextualSymbol; + } + + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + const propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation, typeChecker); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + const bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol, typeChecker); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; + } + + // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) + // Or a union property, use its underlying unioned symbols + return forEach(typeChecker.getRootSymbols(referenceSymbol), rootSymbol => { + // if it is in the list, then we are done + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return rootSymbol; + } + + // 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 we were passed a parent symbol, only include types that are subtypes of the + // parent symbol + if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { + // Parents will only be defined if implementations is true + if (parents) { + if (!forEach(parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, cache, typeChecker))) { + return undefined; } } - while (meaning !== lastIterationMeaning); + + const result: Symbol[] = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap(), typeChecker); + return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined); } - return meaning; + + return undefined; + }); + } + + function getNameFromObjectLiteralElement(node: ObjectLiteralElement) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + const nameExpression = (node.name).expression; + // treat computed property names where expression is string/numeric literal as just string/numeric literal + if (isStringOrNumericLiteral(nameExpression)) { + return (nameExpression).text; + } + return undefined; } + return (node.name).text; + } + + function getPropertySymbolsFromContextualType(node: ObjectLiteralElement, typeChecker: TypeChecker): Symbol[] { + const objectLiteral = node.parent; + const contextualType = typeChecker.getContextualType(objectLiteral); + const name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + const result: Symbol[] = []; + const symbol = contextualType.getProperty(name); + if (symbol) { + result.push(symbol); + } + + if (contextualType.flags & TypeFlags.Union) { + forEach((contextualType).types, t => { + const symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + } + return result; + } + return undefined; + } + + /** + * Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ + 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 + // intersects with the class in the value space. + // To achieve that we will keep iterating until the result stabilizes. + + // Remember the last meaning + lastIterationMeaning = meaning; + + for (const declaration of declarations) { + const declarationMeaning = getMeaningFromDeclaration(declaration); + + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } + while (meaning !== lastIterationMeaning); + } + return meaning; } export function convertReferences(referenceSymbols: ReferencedSymbol[]): ReferenceEntry[] { diff --git a/tests/cases/fourslash/findAllRefsForRest.ts b/tests/cases/fourslash/findAllRefsForRest.ts index c3a970e9e73..65d6a3c60e3 100644 --- a/tests/cases/fourslash/findAllRefsForRest.ts +++ b/tests/cases/fourslash/findAllRefsForRest.ts @@ -7,6 +7,5 @@ ////let t: Gen; ////var { x, ...rest } = t; ////rest.[|parent|]; -const ranges = test.ranges(); -verify.referencesOf(ranges[0], ranges); -verify.referencesOf(ranges[1], ranges); + +verify.rangesReferenceEachOther(); From f1b481a1b61cd0808317b78c9a19acaea1eefa77 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 13 Jan 2017 14:08:44 -0800 Subject: [PATCH 277/289] Support completions for string literal in rest parameter --- src/compiler/checker.ts | 1 + src/compiler/types.ts | 5 +++++ src/services/completions.ts | 5 +---- tests/cases/fourslash/completionForStringLiteral7.ts | 10 ++++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 tests/cases/fourslash/completionForStringLiteral7.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a916e9cbba6..dbb1b53efc1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -84,6 +84,7 @@ namespace ts { getIndexTypeOfType, getBaseTypes, getTypeFromTypeNode, + getParameterType: getTypeAtPosition, getReturnTypeOfSignature, getNonNullableType, getSymbolsInScope, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0906488ea33..23c55aacf26 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2341,6 +2341,11 @@ namespace ts { getIndexTypeOfType(type: Type, kind: IndexKind): Type; getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; + /** + * Gets the type of a parameter at a given position in a signature. + * Returns `any` if the index is not valid. + */ + /* @internal */ getParameterType(signature: Signature, parameterIndex: number): Type; getNonNullableType(type: Type): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; diff --git a/src/services/completions.ts b/src/services/completions.ts index bb5922af9ad..8c0d52b2c34 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -204,10 +204,7 @@ namespace ts.Completions { typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); for (const candidate of candidates) { - if (candidate.parameters.length > argumentInfo.argumentIndex) { - const parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries); } if (entries.length) { diff --git a/tests/cases/fourslash/completionForStringLiteral7.ts b/tests/cases/fourslash/completionForStringLiteral7.ts new file mode 100644 index 00000000000..b2d250ac3fd --- /dev/null +++ b/tests/cases/fourslash/completionForStringLiteral7.ts @@ -0,0 +1,10 @@ +/// + +////type T = "foo" | "bar"; +////type U = "oof" | "rab"; +////function f(x: T, ...args: U[]) { }; +////f("/*1*/", "/*2*/", "/*3*/"); + +verify.completionsAt("1", ["foo", "bar"]); +verify.completionsAt("2", ["oof", "rab"]); +verify.completionsAt("3", ["oof", "rab"]); From bc7f86c1df771ed2cce7f784eca9cde6ea26cb45 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 15:05:08 -0800 Subject: [PATCH 278/289] Improved undefined/null handling for arithmetic operators --- src/compiler/checker.ts | 47 ++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9e4e81e3da9..cb48b2176f9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12332,16 +12332,18 @@ namespace ts { } function checkNonNullExpression(node: Expression | QualifiedName) { - const type = checkExpression(node); - if (strictNullChecks) { - const kind = getFalsyFlags(type) & TypeFlags.Nullable; - if (kind) { - error(node, kind & TypeFlags.Undefined ? kind & TypeFlags.Null ? - Diagnostics.Object_is_possibly_null_or_undefined : - Diagnostics.Object_is_possibly_undefined : - Diagnostics.Object_is_possibly_null); - } - return getNonNullableType(type); + return checkNonNullType(checkExpression(node), node); + } + + function checkNonNullType(type: Type, errorNode: Node): Type { + const kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & TypeFlags.Nullable; + if (kind) { + error(errorNode, kind & TypeFlags.Undefined ? kind & TypeFlags.Null ? + Diagnostics.Object_is_possibly_null_or_undefined : + Diagnostics.Object_is_possibly_undefined : + Diagnostics.Object_is_possibly_null); + const t = getNonNullableType(type); + return t.flags & (TypeFlags.Nullable | TypeFlags.Never) ? unknownType : t; } return type; } @@ -14880,17 +14882,9 @@ namespace ts { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.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 - // 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. - if (leftType.flags & TypeFlags.Nullable) leftType = rightType; - if (rightType.flags & TypeFlags.Nullable) rightType = leftType; - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); let suggestedOperator: SyntaxKind; // if a user tries to apply a bitwise operator to 2 boolean operands @@ -14915,16 +14909,11 @@ namespace ts { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - // TypeScript 1.0 spec (April 2014): 4.19.2 - // The binary + operator requires both operands to be of the Number primitive type or an enum type, - // or at least one of the operands to be of type Any or the String primitive type. - // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & TypeFlags.Nullable) leftType = rightType; - if (rightType.flags & TypeFlags.Nullable) rightType = leftType; - - leftType = getNonNullableType(leftType); - rightType = getNonNullableType(rightType); + if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike) && !isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.StringLike)) { + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); + } let resultType: Type; if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { From a1e16d2cb492bbe49ead4baddc98b720ca63b35f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 15:06:24 -0800 Subject: [PATCH 279/289] Accept new baselines --- ...WithNullValueAndInvalidOperator.errors.txt | 66 +-- ...orWithNullValueAndValidOperator.errors.txt | 63 ++ ...thOnlyNullValueOrUndefinedValue.errors.txt | 38 +- ...ditionOperatorWithTypeParameter.errors.txt | 12 +- ...ndefinedValueAndInvalidOperands.errors.txt | 66 +-- ...hUndefinedValueAndValidOperator.errors.txt | 63 ++ .../ambientWithStatements.errors.txt | 4 +- ...WithNullValueAndInvalidOperands.errors.txt | 542 ++++++++++-------- ...orWithNullValueAndValidOperands.errors.txt | 353 ++++++++++++ ...thOnlyNullValueOrUndefinedValue.errors.txt | 320 +++++------ ...ndefinedValueAndInvalidOperands.errors.txt | 542 ++++++++++-------- ...hUndefinedValueAndValidOperands.errors.txt | 353 ++++++++++++ .../reference/binaryArithmatic1.errors.txt | 7 + .../reference/binaryArithmatic2.errors.txt | 7 + .../reference/binaryArithmatic3.errors.txt | 8 +- .../reference/binaryArithmatic4.errors.txt | 8 +- ...wiseNotOperatorWithAnyOtherType.errors.txt | 29 +- ...itionAssignmentLHSCanBeAssigned.errors.txt | 65 +++ ...onAssignmentWithInvalidOperands.errors.txt | 36 +- ...meticAssignmentLHSCanBeAssigned.errors.txt | 47 ++ ...icAssignmentWithInvalidOperands.errors.txt | 32 +- .../compoundAssignmentLHSIsValue.errors.txt | 8 +- ...tionAssignmentLHSCanBeAssigned1.errors.txt | 47 ++ ...onAssignmentLHSCannotBeAssigned.errors.txt | 32 +- ...onentiationAssignmentLHSIsValue.errors.txt | 8 +- .../contextuallyTypedIifeStrict.errors.txt | 45 ++ ...thAnyOtherTypeInvalidOperations.errors.txt | 56 +- .../deleteOperatorWithAnyOtherType.errors.txt | 29 +- .../emitExponentiationOperator4.errors.txt | 70 +++ ...onentiationOperatorSyntaxError2.errors.txt | 32 +- ...WithNullValueAndInvalidOperands.errors.txt | 48 +- ...orWithNullValueAndValidOperands.errors.txt | 47 ++ ...thOnlyNullValueOrUndefinedValue.errors.txt | 32 +- ...ndefinedValueAndInvalidOperands.errors.txt | 48 +- ...hUndefinedValueAndValidOperands.errors.txt | 47 ++ ...gReturnStatementsAndExpressions.errors.txt | 5 +- ...thAnyOtherTypeInvalidOperations.errors.txt | 56 +- tests/baselines/reference/literals.errors.txt | 16 +- ...icalNotOperatorWithAnyOtherType.errors.txt | 29 +- .../moduleVariableArrayIndexer.errors.txt | 11 + ...negateOperatorInvalidOperations.errors.txt | 24 +- .../nonPrimitiveStrictNull.errors.txt | 14 +- tests/baselines/reference/null.errors.txt | 28 + .../reference/nullKeyword.errors.txt | 6 +- .../operatorAddNullUndefined.errors.txt | 64 ++- .../plusOperatorWithAnyOtherType.errors.txt | 29 +- .../reference/propertyAccess4.errors.txt | 6 +- .../reference/propertyAccess5.errors.txt | 6 +- .../typeofOperatorWithAnyOtherType.errors.txt | 29 +- .../voidOperatorWithAnyOtherType.errors.txt | 29 +- .../reference/widenedTypes.errors.txt | 4 +- 51 files changed, 2531 insertions(+), 1035 deletions(-) create mode 100644 tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.errors.txt create mode 100644 tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.errors.txt create mode 100644 tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.errors.txt create mode 100644 tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.errors.txt create mode 100644 tests/baselines/reference/binaryArithmatic1.errors.txt create mode 100644 tests/baselines/reference/binaryArithmatic2.errors.txt create mode 100644 tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.errors.txt create mode 100644 tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.errors.txt create mode 100644 tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.errors.txt create mode 100644 tests/baselines/reference/contextuallyTypedIifeStrict.errors.txt create mode 100644 tests/baselines/reference/emitExponentiationOperator4.errors.txt create mode 100644 tests/baselines/reference/exponentiationOperatorWithNullValueAndValidOperands.errors.txt create mode 100644 tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndValidOperands.errors.txt create mode 100644 tests/baselines/reference/moduleVariableArrayIndexer.errors.txt create mode 100644 tests/baselines/reference/null.errors.txt diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt index d18a9a13d8c..5f0d78c59d5 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'true' and 'true'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(11,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(12,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(13,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(14,14): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(15,14): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(16,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(19,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(20,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(21,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(22,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts(23,11): error TS2531: Object is possibly 'null'. ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndInvalidOperator.ts (11 errors) ==== @@ -23,37 +23,37 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe // null + boolean/Object var r1 = null + a; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r2 = null + b; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r3 = null + c; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r4 = a + null; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r5 = b + null; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r6 = null + c; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. // other cases var r7 = null + d; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r8 = null + true; - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'true' and 'true'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r9 = null + { a: '' }; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r10 = null + foo(); - ~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r11 = null + (() => { }); - ~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.errors.txt b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.errors.txt new file mode 100644 index 00000000000..db01a42c8bd --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithNullValueAndValidOperator.errors.txt @@ -0,0 +1,63 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(15,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(16,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(17,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(18,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(19,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(20,14): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(21,14): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(22,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(23,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts(24,20): error TS2531: Object is possibly 'null'. + + +==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithNullValueAndValidOperator.ts (10 errors) ==== + // If one operand is the null or undefined value, it is treated as having the type of the other operand. + + enum E { a, b, c } + + var a: any; + var b: number; + var c: E; + var d: string; + + // null + any + var r1: any = null + a; + var r2: any = a + null; + + // null + number/enum + var r3 = null + b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4 = null + 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r5 = null + c; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r6 = null + E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r7 = null + E['a']; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r8 = b + null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r9 = 1 + null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r10 = c + null + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r11 = E.a + null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r12 = E['a'] + null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // null + string + var r13 = null + d; + var r14 = null + ''; + var r15 = d + null; + var r16 = '' + null; \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt b/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt index 9e7e4c01ad2..aef66891be0 100644 --- a/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt +++ b/tests/baselines/reference/additionOperatorWithOnlyNullValueOrUndefinedValue.errors.txt @@ -1,20 +1,32 @@ -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(2,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(3,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(4,22): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts(5,22): error TS2532: Object is possibly 'undefined'. -==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts (4 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithOnlyNullValueOrUndefinedValue.ts (8 errors) ==== // bug 819721 var r1 = null + null; - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r2 = null + undefined; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r3 = undefined + null; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r4 = undefined + undefined; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. \ No newline at end of file + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt b/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt index ff7120c145d..478c4fdee3f 100644 --- a/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt +++ b/tests/baselines/reference/additionOperatorWithTypeParameter.errors.txt @@ -8,8 +8,8 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(27,15): error TS2365: Operator '+' cannot be applied to types 'Object' and 'T'. tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(28,15): error TS2365: Operator '+' cannot be applied to types 'E' and 'T'. tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(29,15): error TS2365: Operator '+' cannot be applied to types 'void' and 'T'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(32,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(33,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(32,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(33,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(34,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(35,15): error TS2365: Operator '+' cannot be applied to types 'T' and 'U'. tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithTypeParameter.ts(36,15): error TS2365: Operator '+' cannot be applied to types 'T' and '() => void'. @@ -69,11 +69,11 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe // other cases var r15 = t + null; - ~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r16 = t + undefined; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r17 = t + t; ~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'T' and 'T'. diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt index d61f101a544..06e8c67b105 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(11,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(12,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(13,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(14,10): error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,10): error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2365: Operator '+' cannot be applied to types 'true' and 'true'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(11,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(12,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(13,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(14,14): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(15,14): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(16,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(19,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(20,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(21,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(22,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts(23,11): error TS2532: Object is possibly 'undefined'. ==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndInvalidOperands.ts (11 errors) ==== @@ -23,37 +23,37 @@ tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOpe // undefined + boolean/Object var r1 = undefined + a; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r2 = undefined + b; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r3 = undefined + c; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r4 = a + undefined; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'boolean' and 'boolean'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r5 = b + undefined; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Object' and 'Object'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r6 = undefined + c; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // other cases var r7 = undefined + d; - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'Number' and 'Number'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r8 = undefined + true; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'true' and 'true'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r9 = undefined + { a: '' }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '{ a: string; }' and '{ a: string; }'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r10 = undefined + foo(); - ~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'void' and 'void'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r11 = undefined + (() => { }); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types '() => void' and '() => void'. \ No newline at end of file + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.errors.txt b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.errors.txt new file mode 100644 index 00000000000..04c0e2f3266 --- /dev/null +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndValidOperator.errors.txt @@ -0,0 +1,63 @@ +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(15,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(16,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(17,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(18,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(19,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(20,14): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(21,14): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(22,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(23,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts(24,20): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/binaryOperators/additionOperator/additionOperatorWithUndefinedValueAndValidOperator.ts (10 errors) ==== + // If one operand is the null or undefined value, it is treated as having the type of the other operand. + + enum E { a, b, c } + + var a: any; + var b: number; + var c: E; + var d: string; + + // undefined + any + var r1: any = undefined + a; + var r2: any = a + undefined; + + // undefined + number/enum + var r3 = undefined + b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r4 = undefined + 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r5 = undefined + c; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r6 = undefined + E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r7 = undefined + E['a']; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r8 = b + undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r9 = 1 + undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r10 = c + undefined + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r11 = E.a + undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var r12 = E['a'] + undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // undefined + string + var r13 = undefined + d; + var r14 = undefined + ''; + var r15 = d + undefined; + var r16 = '' + undefined; \ No newline at end of file diff --git a/tests/baselines/reference/ambientWithStatements.errors.txt b/tests/baselines/reference/ambientWithStatements.errors.txt index 6fb6aafd864..3e134970a1f 100644 --- a/tests/baselines/reference/ambientWithStatements.errors.txt +++ b/tests/baselines/reference/ambientWithStatements.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/ambientWithStatements.ts(2,5): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/ambientWithStatements.ts(3,5): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. -tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/compiler/ambientWithStatements.ts(7,15): error TS2531: Object is possibly 'null'. tests/cases/compiler/ambientWithStatements.ts(11,5): error TS1108: A 'return' statement can only be used within a function body. tests/cases/compiler/ambientWithStatements.ts(25,5): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. @@ -18,7 +18,7 @@ tests/cases/compiler/ambientWithStatements.ts(25,5): error TS2410: The 'with' st var x; for (x in null) { } ~~~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2531: Object is possibly 'null'. if (true) { } else { } 1; L: var y; diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt index c043cda8e68..16a0264a805 100644 --- a/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndInvalidOperands.errors.txt @@ -1,234 +1,246 @@ -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(9,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(9,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(10,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(10,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(11,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(11,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(13,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(13,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(14,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(14,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(15,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(15,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(17,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(17,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(18,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(18,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(19,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(19,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(21,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(21,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(22,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(22,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(23,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(26,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(23,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(26,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(26,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(27,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(27,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(27,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(28,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(28,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(28,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(30,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(30,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(30,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(31,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(31,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(31,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(32,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(32,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(34,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(32,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(34,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(34,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(35,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(35,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(35,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(36,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(36,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(36,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(38,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(38,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(38,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(39,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(39,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(39,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(40,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(40,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(43,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(40,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(43,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(43,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(44,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(44,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(44,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(45,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(45,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(45,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(47,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(47,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(47,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(48,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(48,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(48,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(49,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(49,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(51,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(49,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(51,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(51,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(52,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(52,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(52,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(53,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(53,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(53,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(55,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(55,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(55,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(56,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(56,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(56,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(57,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(60,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(57,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(60,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(60,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(61,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(61,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(61,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(62,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(62,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(62,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(64,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(64,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(64,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(65,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(65,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(65,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(66,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(66,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(68,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(66,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(68,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(68,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(69,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(69,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(69,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(70,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(70,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(70,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(72,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(72,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(72,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(73,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(73,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(73,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(74,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(74,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(77,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(74,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(77,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(77,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(78,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(78,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(78,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(79,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(79,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(79,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(81,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(81,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(81,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(82,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(82,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(82,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(83,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(83,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(85,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(83,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(85,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(85,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(86,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(86,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(86,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(87,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(87,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(87,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(89,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(89,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(89,20): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(90,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(90,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(90,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(91,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(91,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(94,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(91,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(94,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(94,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(95,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(95,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(95,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(96,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(96,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(96,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(98,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(98,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(98,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(99,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(99,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(99,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(100,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(100,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(102,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(100,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(102,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(102,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(103,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(103,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(103,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(104,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(104,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(104,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(106,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(106,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(106,20): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(107,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(107,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(107,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(108,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(108,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(111,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(108,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(111,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(111,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(112,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(112,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(112,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(113,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(113,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(113,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(115,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(115,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(115,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(116,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(116,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(116,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(117,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(117,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(119,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(117,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(119,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(119,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(120,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(120,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(120,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(121,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(121,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(121,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(123,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(123,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(123,21): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(124,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(125,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(128,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(129,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(130,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(132,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(133,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(134,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(136,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(137,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(138,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(140,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(141,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(142,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(145,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(146,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(147,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(149,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(150,16): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(151,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(153,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(154,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(155,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(157,19): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(158,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(159,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,13): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(162,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,13): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(163,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,13): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(164,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(166,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(167,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(168,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,13): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(170,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,13): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(171,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,13): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(172,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(174,20): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(175,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts(176,18): error TS2531: Object is possibly 'null'. -==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (228 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndInvalidOperands.ts (240 errors) ==== // If one operand is the null or undefined value, it is treated as having the type of the // other operand. @@ -239,17 +251,17 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti // operator * var r1a1 = null * a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = null * b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = null * c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -257,31 +269,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1b2 = b * null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1b3 = c * null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1c1 = null * true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = null * ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = null * {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -289,32 +301,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1d2 = '' * null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1d3 = {} * null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator / var r2a1 = null / a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a2 = null / b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = null / c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -322,31 +334,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2b2 = b / null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2b3 = c / null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2c1 = null / true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c2 = null / ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = null / {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -354,32 +366,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2d2 = '' / null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2d3 = {} / null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator % var r3a1 = null % a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a2 = null % b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a3 = null % c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -387,31 +399,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r3b2 = b % null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r3b3 = c % null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r3c1 = null % true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c2 = null % ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c3 = null % {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -419,32 +431,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r3d2 = '' % null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r3d3 = {} % null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator - var r4a1 = null - a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a2 = null - b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a3 = null - c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -452,31 +464,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4b2 = b - null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4b3 = c - null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4c1 = null - true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c2 = null - ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c3 = null - {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -484,32 +496,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4d2 = '' - null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4d3 = {} - null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator << var r5a1 = null << a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a2 = null << b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a3 = null << c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -517,31 +529,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r5b2 = b << null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r5b3 = c << null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r5c1 = null << true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c2 = null << ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c3 = null << {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -549,32 +561,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r5d2 = '' << null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r5d3 = {} << null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator >> var r6a1 = null >> a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a2 = null >> b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a3 = null >> c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -582,31 +594,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r6b2 = b >> null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r6b3 = c >> null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r6c1 = null >> true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c2 = null >> ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c3 = null >> {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -614,32 +626,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r6d2 = '' >> null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r6d3 = {} >> null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator >>> var r7a1 = null >>> a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a2 = null >>> b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a3 = null >>> c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -647,31 +659,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r7b2 = b >>> null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r7b3 = c >>> null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r7c1 = null >>> true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c2 = null >>> ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c3 = null >>> {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -679,185 +691,209 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r7d2 = '' >>> null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r7d3 = {} >>> null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator & var r8a1 = null & a; - ~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a2 = null & b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a3 = null & c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b1 = a & null; - ~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r8b2 = b & null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r8b3 = c & null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r8c1 = null & true; - ~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c2 = null & ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c3 = null & {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d1 = true & null; - ~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r8d2 = '' & null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r8d3 = {} & null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator ^ var r9a1 = null ^ a; - ~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a2 = null ^ b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a3 = null ^ c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b1 = a ^ null; - ~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r9b2 = b ^ null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r9b3 = c ^ null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r9c1 = null ^ true; - ~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c2 = null ^ ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c3 = null ^ {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d1 = true ^ null; - ~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r9d2 = '' ^ null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r9d3 = {} ^ null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. // operator | var r10a1 = null | a; - ~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a2 = null | b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a3 = null | c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b1 = a | null; - ~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r10b2 = b | null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r10b3 = c | null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r10c1 = null | true; - ~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c2 = null | ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c3 = null | {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d1 = true | null; - ~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var r10d2 = '' | null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r10d3 = {} | null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.errors.txt new file mode 100644 index 00000000000..426db291224 --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithNullValueAndValidOperands.errors.txt @@ -0,0 +1,353 @@ +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(13,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(14,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(15,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(16,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(17,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(18,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(19,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(20,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(23,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(24,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(25,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(26,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(27,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(28,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(29,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(30,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(33,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(34,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(35,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(36,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(37,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(38,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(39,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(40,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(43,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(44,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(45,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(46,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(47,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(48,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(49,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(50,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(53,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(54,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(55,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(56,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(57,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(58,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(59,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(60,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(63,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(64,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(65,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(66,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(67,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(68,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(69,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(70,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(73,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(74,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(75,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(76,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(77,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(78,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(79,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(80,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(83,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(84,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(85,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(86,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(87,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(88,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(89,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(90,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(93,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(94,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(95,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(96,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(97,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(98,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(99,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(100,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(103,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(104,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(105,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(106,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(107,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(108,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(109,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts(110,17): error TS2531: Object is possibly 'null'. + + +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithNullValueAndValidOperands.ts (80 errors) ==== + // If one operand is the null or undefined value, it is treated as having the type of the + // other operand. + + enum E { + a, + b + } + + var a: any; + var b: number; + + // operator * + var ra1 = null * a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra2 = null * b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra3 = null * 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra4 = null * E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra5 = a * null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra6 = b * null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra7 = 0 * null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra8 = E.b * null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator / + var rb1 = null / a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb2 = null / b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb3 = null / 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb4 = null / E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb5 = a / null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb6 = b / null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb7 = 0 / null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb8 = E.b / null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator % + var rc1 = null % a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc2 = null % b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc3 = null % 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc4 = null % E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc5 = a % null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc6 = b % null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc7 = 0 % null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc8 = E.b % null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator - + var rd1 = null - a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd2 = null - b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd3 = null - 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd4 = null - E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd5 = a - null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd6 = b - null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd7 = 0 - null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd8 = E.b - null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator << + var re1 = null << a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re2 = null << b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re3 = null << 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re4 = null << E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re5 = a << null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re6 = b << null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re7 = 0 << null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var re8 = E.b << null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator >> + var rf1 = null >> a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf2 = null >> b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf3 = null >> 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf4 = null >> E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf5 = a >> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf6 = b >> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf7 = 0 >> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rf8 = E.b >> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator >>> + var rg1 = null >>> a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg2 = null >>> b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg3 = null >>> 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg4 = null >>> E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg5 = a >>> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg6 = b >>> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg7 = 0 >>> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rg8 = E.b >>> null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator & + var rh1 = null & a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh2 = null & b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh3 = null & 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh4 = null & E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh5 = a & null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh6 = b & null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh7 = 0 & null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rh8 = E.b & null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator ^ + var ri1 = null ^ a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri2 = null ^ b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri3 = null ^ 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri4 = null ^ E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri5 = a ^ null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri6 = b ^ null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri7 = 0 ^ null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ri8 = E.b ^ null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator | + var rj1 = null | a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj2 = null | b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj3 = null | 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj4 = null | E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj5 = a | null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj6 = b | null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj7 = 0 | null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rj8 = E.b | null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt index d00eee1d4dd..e67db44a780 100644 --- a/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.errors.txt @@ -1,302 +1,302 @@ -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,11): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(2,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(3,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(4,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(5,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(8,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(9,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(10,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(11,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(14,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(15,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(16,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(17,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(20,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(21,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(22,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(23,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(26,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(27,19): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(28,24): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(29,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(32,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(33,19): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(34,24): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(35,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(38,20): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(39,20): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(40,25): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(41,25): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(44,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(45,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(46,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(47,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(50,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(51,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(52,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(53,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(56,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(57,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(58,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts(59,23): error TS2532: Object is possibly 'undefined'. ==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithOnlyNullValueOrUndefinedValue.ts (80 errors) ==== // operator * var ra1 = null * null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var ra2 = null * undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var ra3 = undefined * null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var ra4 = undefined * undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator / var rb1 = null / null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rb2 = null / undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rb3 = undefined / null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rb4 = undefined / undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator % var rc1 = null % null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rc2 = null % undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rc3 = undefined % null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rc4 = undefined % undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator - var rd1 = null - null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rd2 = null - undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rd3 = undefined - null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rd4 = undefined - undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator << var re1 = null << null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var re2 = null << undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var re3 = undefined << null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var re4 = undefined << undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator >> var rf1 = null >> null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rf2 = null >> undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rf3 = undefined >> null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rf4 = undefined >> undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator >>> var rg1 = null >>> null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rg2 = null >>> undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rg3 = undefined >>> null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rg4 = undefined >>> undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator & var rh1 = null & null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rh2 = null & undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rh3 = undefined & null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rh4 = undefined & undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator ^ var ri1 = null ^ null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var ri2 = null ^ undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var ri3 = undefined ^ null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var ri4 = undefined ^ undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator | var rj1 = null | null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rj2 = null | undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var rj3 = undefined | null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var rj4 = undefined | undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt index 9ee53c2f15c..8a9d014f2c2 100644 --- a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndInvalidOperands.errors.txt @@ -1,234 +1,246 @@ -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(9,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(9,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(10,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(10,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(11,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(11,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(13,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(13,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(14,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(14,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(15,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(15,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(17,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(17,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(18,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(18,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(19,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(19,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(21,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(21,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(22,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(22,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(23,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(26,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(23,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(26,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(26,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(27,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(27,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(27,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(28,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(28,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(28,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(30,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(30,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(30,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(31,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(31,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(31,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(32,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(32,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(34,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(32,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(34,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(34,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(35,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(35,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(35,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(36,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(36,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(36,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(38,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(38,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(38,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(39,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(39,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(39,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(40,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(40,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(43,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(40,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(43,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(43,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(44,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(44,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(44,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(45,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(45,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(45,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(47,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(47,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(47,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(48,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(48,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(48,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(49,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(49,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(51,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(49,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(51,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(51,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(52,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(52,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(52,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(53,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(53,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(53,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(55,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(55,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(55,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(56,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(56,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(56,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(57,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(57,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(60,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(57,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(60,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(60,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(61,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(61,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(61,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(62,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(62,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(62,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(64,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(64,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(64,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(65,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(65,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(65,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(66,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(66,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(68,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(66,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(68,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(68,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(69,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(69,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(69,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(70,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(70,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(70,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(72,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(72,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(72,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(73,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(73,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(73,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(74,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(74,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(77,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(74,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(77,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(77,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(78,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(78,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(78,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(79,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(79,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(79,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(81,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(81,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(81,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(82,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(82,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(82,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(83,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(83,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(85,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(83,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(85,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(85,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(86,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(86,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(86,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(87,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(87,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(87,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(89,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(89,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(89,20): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(90,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(90,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(90,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(91,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(91,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(94,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(91,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(94,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(94,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(95,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(95,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(95,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(96,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(96,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(96,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(98,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(98,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(98,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(99,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(99,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(99,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(100,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(100,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(102,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(100,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(102,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(102,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(103,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(103,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(103,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(104,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(104,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(104,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(106,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(106,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(106,20): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(107,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(107,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(107,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(108,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(108,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(111,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(108,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(111,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(111,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(112,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(112,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(112,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(113,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(113,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(113,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(115,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(115,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(115,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(116,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(116,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(116,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(117,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(117,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(119,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(117,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(119,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(119,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(120,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(120,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(120,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(121,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(121,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(121,26): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(123,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(123,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(123,21): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(124,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,19): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(125,19): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,12): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(128,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(129,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(130,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(132,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(133,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(134,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,12): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(136,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(137,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(138,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,12): error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(140,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(141,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(142,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,12): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(145,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(146,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(147,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(149,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(150,16): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(151,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,12): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(153,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(154,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(155,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,12): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(157,19): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(158,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(159,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,13): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(162,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,13): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(163,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,13): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(164,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(166,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(167,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(168,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,13): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(170,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,13): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(171,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,13): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(172,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,13): error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(174,20): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(175,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,13): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts(176,18): error TS2532: Object is possibly 'undefined'. -==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (228 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts (240 errors) ==== // If one operand is the undefined or undefined value, it is treated as having the type of the // other operand. @@ -239,17 +251,17 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti // operator * var r1a1 = undefined * a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = undefined * b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = undefined * c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -257,31 +269,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1b2 = b * undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1b3 = c * undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1c1 = undefined * true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = undefined * ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = undefined * {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -289,32 +301,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1d2 = '' * undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1d3 = {} * undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator / var r2a1 = undefined / a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a2 = undefined / b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2a3 = undefined / c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -322,31 +334,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r2b2 = b / undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r2b3 = c / undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r2c1 = undefined / true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c2 = undefined / ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r2c3 = undefined / {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -354,32 +366,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r2d2 = '' / undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r2d3 = {} / undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator % var r3a1 = undefined % a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a2 = undefined % b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3a3 = undefined % c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -387,31 +399,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3b2 = b % undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3b3 = c % undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3c1 = undefined % true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c2 = undefined % ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r3c3 = undefined % {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -419,32 +431,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3d2 = '' % undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3d3 = {} % undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator - var r4a1 = undefined - a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a2 = undefined - b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4a3 = undefined - c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -452,31 +464,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r4b2 = b - undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r4b3 = c - undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r4c1 = undefined - true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c2 = undefined - ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r4c3 = undefined - {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -484,32 +496,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r4d2 = '' - undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r4d3 = {} - undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator << var r5a1 = undefined << a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a2 = undefined << b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5a3 = undefined << c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -517,31 +529,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r5b2 = b << undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r5b3 = c << undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r5c1 = undefined << true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c2 = undefined << ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r5c3 = undefined << {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -549,32 +561,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r5d2 = '' << undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r5d3 = {} << undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator >> var r6a1 = undefined >> a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a2 = undefined >> b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6a3 = undefined >> c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -582,31 +594,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r6b2 = b >> undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r6b3 = c >> undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r6c1 = undefined >> true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c2 = undefined >> ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r6c3 = undefined >> {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -614,32 +626,32 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r6d2 = '' >> undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r6d3 = {} >> undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator >>> var r7a1 = undefined >>> a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a2 = undefined >>> b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7a3 = undefined >>> c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -647,31 +659,31 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r7b2 = b >>> undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r7b3 = c >>> undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r7c1 = undefined >>> true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c2 = undefined >>> ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r7c3 = undefined >>> {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -679,185 +691,209 @@ tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeti ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r7d2 = '' >>> undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r7d3 = {} >>> undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator & var r8a1 = undefined & a; - ~~~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a2 = undefined & b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8a3 = undefined & c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8b1 = a & undefined; - ~~~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r8b2 = b & undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r8b3 = c & undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r8c1 = undefined & true; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c2 = undefined & ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8c3 = undefined & {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r8d1 = true & undefined; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '&' operator is not allowed for boolean types. Consider using '&&' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r8d2 = '' & undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r8d3 = {} & undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator ^ var r9a1 = undefined ^ a; - ~~~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a2 = undefined ^ b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9a3 = undefined ^ c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9b1 = a ^ undefined; - ~~~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r9b2 = b ^ undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r9b3 = c ^ undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r9c1 = undefined ^ true; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c2 = undefined ^ ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9c3 = undefined ^ {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r9d1 = true ^ undefined; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r9d2 = '' ^ undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r9d3 = {} ^ undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // operator | var r10a1 = undefined | a; - ~~~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a2 = undefined | b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10a3 = undefined | c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10b1 = a | undefined; - ~~~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r10b2 = b | undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r10b3 = c | undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r10c1 = undefined | true; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c2 = undefined | ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10c3 = undefined | {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r10d1 = true | undefined; - ~~~~~~~~~~~~~~~~ -!!! error TS2447: The '|' operator is not allowed for boolean types. Consider using '||' instead. + ~~~~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var r10d2 = '' | undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r10d3 = {} | undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.errors.txt b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.errors.txt new file mode 100644 index 00000000000..246b642603c --- /dev/null +++ b/tests/baselines/reference/arithmeticOperatorWithUndefinedValueAndValidOperands.errors.txt @@ -0,0 +1,353 @@ +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(13,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(14,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(15,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(16,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(17,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(18,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(19,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(20,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(23,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(24,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(25,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(26,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(27,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(28,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(29,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(30,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(33,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(34,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(35,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(36,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(37,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(38,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(39,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(40,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(43,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(44,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(45,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(46,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(47,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(48,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(49,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(50,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(53,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(54,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(55,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(56,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(57,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(58,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(59,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(60,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(63,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(64,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(65,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(66,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(67,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(68,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(69,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(70,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(73,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(74,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(75,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(76,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(77,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(78,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(79,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(80,19): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(83,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(84,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(85,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(86,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(87,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(88,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(89,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(90,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(93,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(94,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(95,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(96,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(97,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(98,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(99,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(100,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(103,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(104,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(105,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(106,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(107,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(108,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(109,15): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts(110,17): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithUndefinedValueAndValidOperands.ts (80 errors) ==== + // If one operand is the undefined or undefined value, it is treated as having the type of the + // other operand. + + enum E { + a, + b + } + + var a: any; + var b: number; + + // operator * + var ra1 = undefined * a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra2 = undefined * b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra3 = undefined * 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra4 = undefined * E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra5 = a * undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra6 = b * undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra7 = 0 * undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ra8 = E.b * undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator / + var rb1 = undefined / a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb2 = undefined / b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb3 = undefined / 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb4 = undefined / E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb5 = a / undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb6 = b / undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb7 = 0 / undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rb8 = E.b / undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator % + var rc1 = undefined % a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc2 = undefined % b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc3 = undefined % 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc4 = undefined % E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc5 = a % undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc6 = b % undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc7 = 0 % undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rc8 = E.b % undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator - + var rd1 = undefined - a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd2 = undefined - b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd3 = undefined - 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd4 = undefined - E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd5 = a - undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd6 = b - undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd7 = 0 - undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rd8 = E.b - undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator << + var re1 = undefined << a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re2 = undefined << b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re3 = undefined << 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re4 = undefined << E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re5 = a << undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re6 = b << undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re7 = 0 << undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var re8 = E.b << undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator >> + var rf1 = undefined >> a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf2 = undefined >> b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf3 = undefined >> 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf4 = undefined >> E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf5 = a >> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf6 = b >> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf7 = 0 >> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rf8 = E.b >> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator >>> + var rg1 = undefined >>> a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg2 = undefined >>> b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg3 = undefined >>> 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg4 = undefined >>> E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg5 = a >>> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg6 = b >>> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg7 = 0 >>> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rg8 = E.b >>> undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator & + var rh1 = undefined & a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh2 = undefined & b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh3 = undefined & 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh4 = undefined & E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh5 = a & undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh6 = b & undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh7 = 0 & undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rh8 = E.b & undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator ^ + var ri1 = undefined ^ a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri2 = undefined ^ b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri3 = undefined ^ 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri4 = undefined ^ E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri5 = a ^ undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri6 = b ^ undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri7 = 0 ^ undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var ri8 = E.b ^ undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator | + var rj1 = undefined | a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj2 = undefined | b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj3 = undefined | 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj4 = undefined | E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj5 = a | undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj6 = b | undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj7 = 0 | undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rj8 = E.b | undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/binaryArithmatic1.errors.txt b/tests/baselines/reference/binaryArithmatic1.errors.txt new file mode 100644 index 00000000000..51c0b649890 --- /dev/null +++ b/tests/baselines/reference/binaryArithmatic1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/binaryArithmatic1.ts(1,13): error TS2531: Object is possibly 'null'. + + +==== tests/cases/compiler/binaryArithmatic1.ts (1 errors) ==== + var v = 4 | null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/binaryArithmatic2.errors.txt b/tests/baselines/reference/binaryArithmatic2.errors.txt new file mode 100644 index 00000000000..28f379c30e2 --- /dev/null +++ b/tests/baselines/reference/binaryArithmatic2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/binaryArithmatic2.ts(1,13): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/compiler/binaryArithmatic2.ts (1 errors) ==== + var v = 4 | undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/binaryArithmatic3.errors.txt b/tests/baselines/reference/binaryArithmatic3.errors.txt index 6dffe5e150c..1457407a7b8 100644 --- a/tests/baselines/reference/binaryArithmatic3.errors.txt +++ b/tests/baselines/reference/binaryArithmatic3.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/binaryArithmatic3.ts(1,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/binaryArithmatic3.ts(1,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/binaryArithmatic3.ts(1,9): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/binaryArithmatic3.ts(1,21): error TS2532: Object is possibly 'undefined'. ==== tests/cases/compiler/binaryArithmatic3.ts (2 errors) ==== var v = undefined | undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/binaryArithmatic4.errors.txt b/tests/baselines/reference/binaryArithmatic4.errors.txt index f72c23073ca..fe7523e0884 100644 --- a/tests/baselines/reference/binaryArithmatic4.errors.txt +++ b/tests/baselines/reference/binaryArithmatic4.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/binaryArithmatic4.ts(1,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/compiler/binaryArithmatic4.ts(1,16): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/compiler/binaryArithmatic4.ts(1,9): error TS2531: Object is possibly 'null'. +tests/cases/compiler/binaryArithmatic4.ts(1,16): error TS2531: Object is possibly 'null'. ==== tests/cases/compiler/binaryArithmatic4.ts (2 errors) ==== var v = null | null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt index 66d4cbb628e..262ac042c68 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,12 @@ -tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(49,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,26): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,33): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(48,33): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(49,26): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(49,38): error TS2532: Object is possibly 'undefined'. -==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts (6 errors) ==== // ~ operator on any type @@ -51,14 +54,20 @@ tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNot var ResultIsNumber14 = ~A.foo(); var ResultIsNumber15 = ~(ANY + ANY1); var ResultIsNumber16 = ~(null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber17 = ~(null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber18 = ~(undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // multiple ~ operators var ResultIsNumber19 = ~~ANY; diff --git a/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.errors.txt b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.errors.txt new file mode 100644 index 00000000000..08d8fd0c6d3 --- /dev/null +++ b/tests/baselines/reference/compoundAdditionAssignmentLHSCanBeAssigned.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts(32,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts(33,7): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts(39,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts(40,7): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentLHSCanBeAssigned.ts (4 errors) ==== + enum E { a, b } + + var a: any; + var b: void; + + var x1: any; + x1 += a; + x1 += b; + x1 += true; + x1 += 0; + x1 += ''; + x1 += E.a; + x1 += {}; + x1 += null; + x1 += undefined; + + var x2: string; + x2 += a; + x2 += b; + x2 += true; + x2 += 0; + x2 += ''; + x2 += E.a; + x2 += {}; + x2 += null; + x2 += undefined; + + var x3: number; + x3 += a; + x3 += 0; + x3 += E.a; + x3 += null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x3 += undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x4: E; + x4 += a; + x4 += 0; + x4 += E.a; + x4 += null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x4 += undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x5: boolean; + x5 += a; + + var x6: {}; + x6 += a; + x6 += ''; + + var x7: void; + x7 += a; \ No newline at end of file diff --git a/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt b/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt index cadc5c945d1..1812065f149 100644 --- a/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/compoundAdditionAssignmentWithInvalidOperands.errors.txt @@ -3,22 +3,22 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(8,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '0'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'E.a'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(11,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(12,1): error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(11,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(12,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(15,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'void'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(16,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'true'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(17,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '0'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(18,1): error TS2365: Operator '+=' cannot be applied to types '{}' and 'E.a'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(19,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(20,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(21,1): error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(20,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(21,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(24,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(25,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'true'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(26,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '0'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(27,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'E.a'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(28,1): error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(29,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. -tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(30,1): error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(29,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(30,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(33,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(34,1): error TS2365: Operator '+=' cannot be applied to types 'number' and 'true'. tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmentWithInvalidOperands.ts(35,1): error TS2365: Operator '+=' cannot be applied to types 'number' and '{}'. @@ -49,11 +49,11 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen ~~~~~~~~ !!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and '{}'. x1 += null; - ~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. x1 += undefined; - ~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types 'boolean' and 'boolean'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x2: {}; x2 += a; @@ -72,11 +72,11 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen ~~~~~~~~ !!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. x2 += null; - ~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. x2 += undefined; - ~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types '{}' and '{}'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x3: void; x3 += a; @@ -95,11 +95,11 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAdditionAssignmen ~~~~~~~~ !!! error TS2365: Operator '+=' cannot be applied to types 'void' and '{}'. x3 += null; - ~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. x3 += undefined; - ~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+=' cannot be applied to types 'void' and 'void'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x4: number; x4 += a; diff --git a/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.errors.txt b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.errors.txt new file mode 100644 index 00000000000..f438045a45f --- /dev/null +++ b/tests/baselines/reference/compoundArithmeticAssignmentLHSCanBeAssigned.errors.txt @@ -0,0 +1,47 @@ +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(11,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(12,7): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(18,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(19,7): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(25,7): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts(26,7): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentLHSCanBeAssigned.ts (6 errors) ==== + enum E { a, b, c } + + var a: any; + var b: number; + var c: E; + + var x1: any; + x1 *= a; + x1 *= b; + x1 *= c; + x1 *= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x1 *= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x2: number; + x2 *= a; + x2 *= b; + x2 *= c; + x2 *= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x2 *= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x3: E; + x3 *= a; + x3 *= b; + x3 *= c; + x3 *= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x3 *= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt b/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt index 9367285ef93..7429445b422 100644 --- a/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/compoundArithmeticAssignmentWithInvalidOperands.errors.txt @@ -10,9 +10,9 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(13,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(14,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(14,7): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(15,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(19,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -25,9 +25,9 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(24,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(25,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(25,7): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(26,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(26,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(30,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -40,9 +40,9 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(35,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(35,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(36,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(36,7): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(37,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(37,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(41,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(41,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -55,9 +55,9 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(46,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(47,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(47,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(47,7): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(48,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(48,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(48,7): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(51,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(52,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignmentWithInvalidOperands.ts(53,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -108,12 +108,12 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x1 *= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x2: string; x2 *= a; @@ -149,12 +149,12 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x2 *= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x3: {}; x3 *= a; @@ -190,12 +190,12 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x3 *= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x4: void; x4 *= a; @@ -231,12 +231,12 @@ tests/cases/conformance/expressions/assignmentOperator/compoundArithmeticAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x4 *= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x5: number; x5 *= b; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt index bc6bb41b27f..8948467c590 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.errors.txt @@ -17,6 +17,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(41,1): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(42,1): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(45,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(45,1): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(46,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(47,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(48,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -55,6 +56,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(104,2): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(105,2): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(106,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(106,1): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(107,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(108,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(109,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -74,7 +76,7 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts(123,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (74 errors) ==== +==== tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsValue.ts (76 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value: any; @@ -158,6 +160,8 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa null *= value; ~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. null += value; ~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -295,6 +299,8 @@ tests/cases/conformance/expressions/assignmentOperator/compoundAssignmentLHSIsVa (null) *= value; ~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + ~~~~~~ +!!! error TS2531: Object is possibly 'null'. (null) += value; ~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.errors.txt b/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.errors.txt new file mode 100644 index 00000000000..26f23028dfa --- /dev/null +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSCanBeAssigned1.errors.txt @@ -0,0 +1,47 @@ +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(11,8): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(12,8): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(18,8): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(19,8): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(25,8): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts(26,8): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts (6 errors) ==== + enum E { a, b, c } + + var a: any; + var b: number; + var c: E; + + var x1: any; + x1 **= a; + x1 **= b; + x1 **= c; + x1 **= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x1 **= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x2: number; + x2 **= a; + x2 **= b; + x2 **= c; + x2 **= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x2 **= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + var x3: E; + x3 **= a; + x3 **= b; + x3 **= c; + x3 **= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + x3 **= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSCannotBeAssigned.errors.txt b/tests/baselines/reference/compoundExponentiationAssignmentLHSCannotBeAssigned.errors.txt index 8d152712808..6d48d968638 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSCannotBeAssigned.errors.txt +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSCannotBeAssigned.errors.txt @@ -10,9 +10,9 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(13,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(14,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(14,8): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(15,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(15,8): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -25,9 +25,9 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(24,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(25,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(25,8): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(26,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(26,8): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(30,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -40,9 +40,9 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(35,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(35,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(36,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(36,8): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(37,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(37,8): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(41,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(41,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -55,9 +55,9 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(46,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(47,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(47,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(47,8): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(48,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(48,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(48,8): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(51,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(52,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(53,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -108,12 +108,12 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x1 **= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x2: string; x2 **= a; @@ -149,12 +149,12 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x2 **= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x3: {}; x3 **= a; @@ -190,12 +190,12 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x3 **= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x4: void; x4 **= a; @@ -231,12 +231,12 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. x4 **= undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var x5: number; x5 **= b; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt index 22eeb18ac4a..51b69f81620 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.errors.txt @@ -8,6 +8,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(30,1): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(32,1): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(35,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(35,1): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(38,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -28,6 +29,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(75,2): error TS2539: Cannot assign to 'E' because it is not a variable. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(76,2): error TS2539: Cannot assign to 'foo' because it is not a variable. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(77,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. +tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(77,1): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(78,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(79,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(80,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -38,7 +40,7 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (38 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (40 errors) ==== // expected error for all the LHS of compound assignments (arithmetic and addition) var value: any; @@ -94,6 +96,8 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm null **= value; ~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. true **= value; ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -176,6 +180,8 @@ tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignm (null) **= value; ~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. + ~~~~~~ +!!! error TS2531: Object is possibly 'null'. (true) **= value; ~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/contextuallyTypedIifeStrict.errors.txt b/tests/baselines/reference/contextuallyTypedIifeStrict.errors.txt new file mode 100644 index 00000000000..220204fc536 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedIifeStrict.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts(14,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts(15,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts(16,17): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/functions/contextuallyTypedIifeStrict.ts (3 errors) ==== + // arrow + (jake => { })("build"); + // function expression + (function (cats) { })("lol"); + // Lots of Irritating Superfluous Parentheses + (function (x) { } ("!")); + ((((function (y) { }))))("-"); + // multiple arguments + ((a, b, c) => { })("foo", 101, false); + // default parameters + ((m = 10) => m + 1)(12); + ((n = 10) => n + 1)(); + // optional parameters + ((j?) => j + 1)(12); + ~ +!!! error TS2532: Object is possibly 'undefined'. + ((k?) => k + 1)(); + ~ +!!! error TS2532: Object is possibly 'undefined'. + ((l, o?) => l + o)(12); // o should be any + ~ +!!! error TS2532: Object is possibly 'undefined'. + // rest parameters + ((...numbers) => numbers.every(n => n > 0))(5,6,7); + ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); + ((...noNumbers) => noNumbers.some(n => n > 0))(); + ((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); + // destructuring parameters (with defaults too!) + (({ q }) => q)({ q : 13 }); + (({ p = 14 }) => p)({ p : 15 }); + (({ r = 17 } = { r: 18 }) => r)({r : 19}); + (({ u = 22 } = { u: 23 }) => u)(); + // contextually typed parameters. + let twelve = (f => f(12))(i => i); + let eleven = (o => o.a(11))({ a: function(n) { return n; } }); + // missing arguments + (function(x, undefined) { return x; })(42); + ((x, y, z) => 42)(); + \ No newline at end of file diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index e42b6ff67b4..e5456d6f0bd 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -17,21 +17,27 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,34): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,34): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,39): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(51,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(52,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(54,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,32): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,32): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,37): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(59,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -50,7 +56,7 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,12): error TS1109: Expression expected. -==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (50 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (56 errors) ==== // -- operator on any type var ANY1: any; var ANY2: any[] = ["", ""]; @@ -137,18 +143,24 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp var ResultIsNumber19 = --(null + undefined); ~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber20 = --(null + null); ~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber21 = --(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber22 = --obj1.x; ~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -165,18 +177,24 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp var ResultIsNumber26 = (null + undefined)--; ~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber27 = (null + null)--; ~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber28 = (undefined + undefined)--; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber29 = obj1.x--; ~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 69153fc235c..819f1c39050 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -9,12 +9,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2703: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2703: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,40): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2703: The operand of a delete operator must be a property reference -tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,40): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2703: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,45): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2703: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2703: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2703: The operand of a delete operator must be a property reference @@ -25,7 +28,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (25 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (28 errors) ==== // delete operator on any type var ANY: any; @@ -93,20 +96,26 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator ~~~~~~~~~~ !!! error TS2703: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~~~~~~~~ !!! error TS2703: The operand of a delete operator must be a property reference + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsBoolean18 = delete (null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~~~ !!! error TS2703: The operand of a delete operator must be a property reference + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsBoolean19 = delete (undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2703: The operand of a delete operator must be a property reference + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; diff --git a/tests/baselines/reference/emitExponentiationOperator4.errors.txt b/tests/baselines/reference/emitExponentiationOperator4.errors.txt new file mode 100644 index 00000000000..e8f46874ad8 --- /dev/null +++ b/tests/baselines/reference/emitExponentiationOperator4.errors.txt @@ -0,0 +1,70 @@ +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(14,1): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(15,1): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(16,1): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(17,1): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(18,1): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(21,6): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(22,6): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(23,6): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(24,6): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts(25,6): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/es7/exponentiationOperator/emitExponentiationOperator4.ts (10 errors) ==== + var temp: any; + + (temp) ** 3; + (--temp) ** 3; + (++temp) ** 3; + (temp--) ** 3; + (temp++) ** 3; + + 1 ** (--temp) ** 3; + 1 ** (++temp) ** 3; + 1 ** (temp--) ** 3; + 1 ** (temp++) ** 3; + + (void --temp) ** 3; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + (void temp--) ** 3; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + (void 3) ** 4; + ~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + (void temp++) ** 4; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + (void temp--) ** 4; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + + 1 ** (void --temp) ** 3; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + 1 ** (void temp--) ** 3; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + 1 ** (void 3) ** 4; + ~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + 1 ** (void temp++) ** 4; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + 1 ** (void temp--) ** 4; + ~~~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + (~ --temp) ** 3; + (~ temp--) ** 3; + (~ 3) ** 4; + (~ temp++) ** 4; + (~ temp--) ** 4; + + 1 ** (~ --temp) ** 3; + 1 ** (~ temp--) ** 3; + 1 ** (~ 3) ** 4; + 1 ** (~ temp++) ** 4; + 1 ** (~ temp--) ** 4; \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt index 6ac93ecf27a..1075c505794 100644 --- a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt @@ -42,15 +42,25 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(25,6): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(26,6): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(28,1): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(28,1): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(29,1): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(29,1): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(30,1): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(30,1): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(31,1): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(31,1): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(32,1): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(32,1): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(34,6): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(34,6): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(35,6): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(35,6): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(36,6): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(36,6): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(37,6): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(37,6): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(38,6): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(38,6): error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(40,1): error TS17006: An unary expression with the '~' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(41,1): error TS17006: An unary expression with the '~' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. @@ -89,7 +99,7 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(68,1): error TS17007: A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (89 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (99 errors) ==== // Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without () var temp: any; @@ -207,34 +217,54 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE void --temp ** 3; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. void temp-- ** 3; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. void 3 ** 4; ~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. void temp++ ** 4; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. void temp-- ** 4; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. 1 ** void --temp ** 3; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. 1 ** void temp-- ** 3; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. 1 ** void 3 ** 4; ~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. 1 ** void temp++ ** 4; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. 1 ** void temp-- ** 4 ; ~~~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'void' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. ~ --temp ** 3; diff --git a/tests/baselines/reference/exponentiationOperatorWithNullValueAndInvalidOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithNullValueAndInvalidOperands.errors.txt index 99535985628..2d0b76f28cc 100644 --- a/tests/baselines/reference/exponentiationOperatorWithNullValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithNullValueAndInvalidOperands.errors.txt @@ -1,27 +1,27 @@ -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(9,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(9,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(10,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(10,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(11,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(11,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(13,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(13,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(14,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(14,17): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(15,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(15,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(17,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(17,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(18,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(18,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(19,12): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(19,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(21,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(21,20): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(22,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(22,18): error TS2531: Object is possibly 'null'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(23,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts(23,18): error TS2531: Object is possibly 'null'. ==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndInvalidOperands.ts (24 errors) ==== @@ -35,17 +35,17 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNul // operator ** var r1a1 = null ** a; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = null ** b; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = null ** c; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -53,31 +53,31 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNul ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1b2 = b ** null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1b3 = c ** null; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1c1 = null ** true; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = null ** ''; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = null ** {}; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -85,14 +85,14 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNul ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1d2 = '' ** null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r1d3 = {} ** null; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithNullValueAndValidOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithNullValueAndValidOperands.errors.txt new file mode 100644 index 00000000000..c8a462c0f54 --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithNullValueAndValidOperands.errors.txt @@ -0,0 +1,47 @@ +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(13,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(14,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(15,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(16,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(17,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(18,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(19,15): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts(20,17): error TS2531: Object is possibly 'null'. + + +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithNullValueAndValidOperands.ts (8 errors) ==== + // If one operand is the null or undefined value, it is treated as having the type of the + // other operand. + + enum E { + a, + b + } + + var a: any; + var b: number; + + // operator ** + var r1 = null ** a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2 = null ** b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3 = null ** 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4 = null ** E.a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r5 = a ** null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r6 = b ** null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r7 = 0 ** null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r8 = E.b ** null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.errors.txt b/tests/baselines/reference/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.errors.txt index 86f4930e77c..20b004625ca 100644 --- a/tests/baselines/reference/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.errors.txt @@ -1,33 +1,33 @@ -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(2,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(3,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(4,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(5,23): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(2,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(2,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(3,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(3,18): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(4,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(4,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(5,10): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts(5,23): error TS2532: Object is possibly 'undefined'. ==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithOnlyNullValueOrUndefinedValue.ts (8 errors) ==== // operator ** var r1 = null ** null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r2 = null ** undefined; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r3 = undefined ** null; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var r4 = undefined ** undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndInvalidOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndInvalidOperands.errors.txt index f456e0f554f..ce14298d02d 100644 --- a/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndInvalidOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndInvalidOperands.errors.txt @@ -1,27 +1,27 @@ -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(9,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(9,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(9,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(10,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(10,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(10,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(11,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(11,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(11,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(13,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(13,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(13,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(14,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(14,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(14,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(15,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(15,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(17,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(15,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(17,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(17,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(18,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(18,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(18,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(19,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(19,12): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(19,25): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(21,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(21,20): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(21,20): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(22,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(22,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(22,18): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(23,12): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(23,18): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts(23,18): error TS2532: Object is possibly 'undefined'. ==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndInvalidOperands.ts (24 errors) ==== @@ -35,17 +35,17 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUnd // operator ** var r1a1 = undefined ** a; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a2 = undefined ** b; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1a3 = undefined ** c; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -53,31 +53,31 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUnd ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1b2 = b ** undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1b3 = c ** undefined; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1c1 = undefined ** true; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c2 = undefined ** ''; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. var r1c3 = undefined ** {}; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~ !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -85,14 +85,14 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUnd ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1d2 = '' ** undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var r1d3 = {} ** undefined; ~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndValidOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndValidOperands.errors.txt new file mode 100644 index 00000000000..ce9843a9612 --- /dev/null +++ b/tests/baselines/reference/exponentiationOperatorWithUndefinedValueAndValidOperands.errors.txt @@ -0,0 +1,47 @@ +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(13,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(14,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(15,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(16,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(17,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(18,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(19,16): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts(20,18): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithUndefinedValueAndValidOperands.ts (8 errors) ==== + // If one operand is the undefined or undefined value, it is treated as having the type of the + // other operand. + + enum E { + a, + b + } + + var a: any; + var b: number; + + // operator * + var rk1 = undefined ** a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk2 = undefined ** b; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk3 = undefined ** 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk4 = undefined ** E.a; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk5 = a ** undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk6 = b ** undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk7 = 0 ** undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + var rk8 = E.b ** undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt index 1ccc296b75b..e0c552141b2 100644 --- a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.errors.txt @@ -1,10 +1,11 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(3,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(101,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(106,16): error TS2378: A 'get' accessor must return a value. +tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(128,15): error TS2532: Object is possibly 'undefined'. tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(129,5): error TS1003: Identifier expected. -==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (4 errors) ==== +==== tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts (5 errors) ==== function f1(): string { @@ -139,6 +140,8 @@ tests/cases/compiler/functionsMissingReturnStatementsAndExpressions.ts(129,5): e // if no return statements are present but we are a get accessor. throw null; throw undefined. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. } ~ !!! error TS1003: Identifier expected. diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index 0a303d12bf3..bf980bfd153 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -17,21 +17,27 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,34): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,34): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,39): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(51,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(52,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(54,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,32): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,32): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,37): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(59,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -45,7 +51,7 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,12): error TS1109: Expression expected. -==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (45 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (51 errors) ==== // ++ operator on any type var ANY1: any; var ANY2: any[] = [1, 2]; @@ -132,18 +138,24 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp var ResultIsNumber19 = ++(null + undefined); ~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber20 = ++(null + null); ~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber21 = ++(undefined + undefined); ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber22 = ++obj1.x; ~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -160,18 +172,24 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp var ResultIsNumber26 = (null + undefined)++; ~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber27 = (null + null)++; ~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber28 = (undefined + undefined)++; ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber29 = obj1.x++; ~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/literals.errors.txt b/tests/baselines/reference/literals.errors.txt index 6fa1d7d3abd..ae058e0b530 100644 --- a/tests/baselines/reference/literals.errors.txt +++ b/tests/baselines/reference/literals.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/literals/literals.ts(9,10): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/literals/literals.ts(9,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/literals/literals.ts(10,9): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/literals/literals.ts(10,21): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/literals/literals.ts(20,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'. tests/cases/conformance/expressions/literals/literals.ts(25,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'. @@ -17,14 +17,14 @@ tests/cases/conformance/expressions/literals/literals.ts(25,9): error TS1085: Oc var nu = null / null; ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var u = undefined / undefined; ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var b: boolean; var b = true; diff --git a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt index 02b4bf16fd2..0cb9869ca4c 100644 --- a/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/logicalNotOperatorWithAnyOtherType.errors.txt @@ -1,10 +1,13 @@ -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(45,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(46,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(47,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(45,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(45,34): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(46,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(46,34): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(47,27): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(47,39): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts(57,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts (4 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithAnyOtherType.ts (7 errors) ==== // ! operator on any type var ANY: any; @@ -50,14 +53,20 @@ tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNot var ResultIsBoolean15 = !A.foo(); var ResultIsBoolean16 = !(ANY + ANY1); var ResultIsBoolean17 = !(null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsBoolean18 = !(null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsBoolean19 = !(undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // multiple ! operators var ResultIsBoolean20 = !!ANY; diff --git a/tests/baselines/reference/moduleVariableArrayIndexer.errors.txt b/tests/baselines/reference/moduleVariableArrayIndexer.errors.txt new file mode 100644 index 00000000000..f0c070375f6 --- /dev/null +++ b/tests/baselines/reference/moduleVariableArrayIndexer.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/moduleVariableArrayIndexer.ts(3,13): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/compiler/moduleVariableArrayIndexer.ts (1 errors) ==== + module Bar { + export var a = 1; + var t = undefined[a][a]; // CG: var t = undefined[Bar.a][a]; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + } + \ No newline at end of file diff --git a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt index 3bc5689d170..e0f818ba9c1 100644 --- a/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt +++ b/tests/baselines/reference/negateOperatorInvalidOperations.errors.txt @@ -1,12 +1,12 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,15): error TS1109: Expression expected. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,25): error TS1005: '=' expected. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(4,26): error TS1109: Expression expected. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,24): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,17): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,29): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(7,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(8,24): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,17): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(9,29): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorInvalidOperations.ts(12,14): error TS1109: Expression expected. @@ -25,19 +25,19 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperator // invalid expressions var NUMBER2 = -(null - undefined); ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. var NUMBER3 = -(null - null); ~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. ~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2531: Object is possibly 'null'. var NUMBER4 = -(undefined - undefined); ~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. ~~~~~~~~~ -!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +!!! error TS2532: Object is possibly 'undefined'. // miss operand var NUMBER =-; diff --git a/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt index de6fbfcf698..473011aaa7f 100644 --- a/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt +++ b/tests/baselines/reference/nonPrimitiveStrictNull.errors.txt @@ -12,21 +12,17 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(22,5): erro Type 'null' is not assignable to type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(27,5): error TS2531: Object is possibly 'null'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(29,5): error TS2532: Object is possibly 'undefined'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(29,7): error TS2339: Property 'toString' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(33,5): error TS2533: Object is possibly 'null' or 'undefined'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(33,7): error TS2339: Property 'toString' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(39,5): error TS2531: Object is possibly 'null'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(39,7): error TS2339: Property 'toString' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(41,5): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,5): error TS2532: Object is possibly 'undefined'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(45,7): error TS2339: Property 'toString' does not exist on type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(47,5): error TS2531: Object is possibly 'null'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(52,14): error TS2344: Type 'number' does not satisfy the constraint 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(53,14): error TS2344: Type 'null' does not satisfy the constraint 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(54,14): error TS2344: Type 'undefined' does not satisfy the constraint 'object'. -==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts (22 errors) ==== +==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts (18 errors) ==== var a: object declare var b: object | null @@ -80,16 +76,12 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(54,14): err d.toString(); // error, undefined ~ !!! error TS2532: Object is possibly 'undefined'. - ~~~~~~~~ -!!! error TS2339: Property 'toString' does not exist on type 'never'. } if (d == null) { d.toString(); // error, undefined | null ~ !!! error TS2533: Object is possibly 'null' or 'undefined'. - ~~~~~~~~ -!!! error TS2339: Property 'toString' does not exist on type 'never'. } else { d.toString(); // object } @@ -98,8 +90,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(54,14): err d.toString(); // error, null ~ !!! error TS2531: Object is possibly 'null'. - ~~~~~~~~ -!!! error TS2339: Property 'toString' does not exist on type 'never'. } else { d.toString(); // error, object | undefined ~ @@ -110,8 +100,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveStrictNull.ts(54,14): err d.toString(); // error, undefined ~ !!! error TS2532: Object is possibly 'undefined'. - ~~~~~~~~ -!!! error TS2339: Property 'toString' does not exist on type 'never'. } else { d.toString(); // error, object | null ~ diff --git a/tests/baselines/reference/null.errors.txt b/tests/baselines/reference/null.errors.txt new file mode 100644 index 00000000000..f957507438c --- /dev/null +++ b/tests/baselines/reference/null.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/null.ts(4,9): error TS2531: Object is possibly 'null'. + + +==== tests/cases/compiler/null.ts (1 errors) ==== + + var x=null; + var y=3+x; + var z=3+null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + class C { + } + function f() { + return null; + return new C(); + } + function g() { + return null; + return 3; + } + interface I { + x:any; + y:number; + } + var w:I={x:null,y:3}; + + + \ No newline at end of file diff --git a/tests/baselines/reference/nullKeyword.errors.txt b/tests/baselines/reference/nullKeyword.errors.txt index a140fce0b0f..b815b61b676 100644 --- a/tests/baselines/reference/nullKeyword.errors.txt +++ b/tests/baselines/reference/nullKeyword.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/nullKeyword.ts(1,6): error TS2339: Property 'foo' does not exist on type 'null'. +tests/cases/compiler/nullKeyword.ts(1,1): error TS2531: Object is possibly 'null'. ==== tests/cases/compiler/nullKeyword.ts (1 errors) ==== null.foo; - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'null'. \ No newline at end of file + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/operatorAddNullUndefined.errors.txt b/tests/baselines/reference/operatorAddNullUndefined.errors.txt index 269ee0a5166..871ef3fc98f 100644 --- a/tests/baselines/reference/operatorAddNullUndefined.errors.txt +++ b/tests/baselines/reference/operatorAddNullUndefined.errors.txt @@ -1,32 +1,68 @@ -tests/cases/compiler/operatorAddNullUndefined.ts(2,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/compiler/operatorAddNullUndefined.ts(3,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/compiler/operatorAddNullUndefined.ts(4,10): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/compiler/operatorAddNullUndefined.ts(5,10): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(2,10): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(2,17): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(3,10): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(3,17): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(4,10): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(4,22): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(5,10): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(5,22): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(6,14): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(7,14): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(8,10): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(9,10): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(14,11): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(15,11): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/operatorAddNullUndefined.ts(16,17): error TS2531: Object is possibly 'null'. +tests/cases/compiler/operatorAddNullUndefined.ts(17,17): error TS2532: Object is possibly 'undefined'. -==== tests/cases/compiler/operatorAddNullUndefined.ts (4 errors) ==== +==== tests/cases/compiler/operatorAddNullUndefined.ts (16 errors) ==== enum E { x } var x1 = null + null; - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var x2 = null + undefined; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x3 = undefined + null; - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var x4 = undefined + undefined; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x5 = 1 + null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. var x6 = 1 + undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x7 = null + 1; + ~~~~ +!!! error TS2531: Object is possibly 'null'. var x8 = undefined + 1; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x9 = "test" + null; var x10 = "test" + undefined; var x11 = null + "test"; var x12 = undefined + "test"; var x13 = null + E.x + ~~~~ +!!! error TS2531: Object is possibly 'null'. var x14 = undefined + E.x + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var x15 = E.x + null - var x16 = E.x + undefined \ No newline at end of file + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var x16 = E.x + undefined + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt index 6c0f113b17b..c316cf92e6d 100644 --- a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt @@ -1,10 +1,13 @@ -tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(46,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(47,26): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(48,26): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(46,26): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(46,33): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(47,26): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(47,33): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(48,26): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(48,38): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(54,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts (4 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts (7 errors) ==== // + operator on any type var ANY: any; @@ -51,14 +54,20 @@ tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWith var ResultIsNumber15 = +A.foo(); var ResultIsNumber16 = +(ANY + ANY1); var ResultIsNumber17 = +(null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber18 = +(null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber19 = +(undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // miss assignment operators +ANY; diff --git a/tests/baselines/reference/propertyAccess4.errors.txt b/tests/baselines/reference/propertyAccess4.errors.txt index cdc772ba528..fc491d8c7a9 100644 --- a/tests/baselines/reference/propertyAccess4.errors.txt +++ b/tests/baselines/reference/propertyAccess4.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/propertyAccess4.ts(1,6): error TS2339: Property 'toBAZ' does not exist on type 'null'. +tests/cases/compiler/propertyAccess4.ts(1,1): error TS2531: Object is possibly 'null'. ==== tests/cases/compiler/propertyAccess4.ts (1 errors) ==== null.toBAZ(); - ~~~~~ -!!! error TS2339: Property 'toBAZ' does not exist on type 'null'. \ No newline at end of file + ~~~~ +!!! error TS2531: Object is possibly 'null'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccess5.errors.txt b/tests/baselines/reference/propertyAccess5.errors.txt index 81c05c5342b..4f7e7f4bcd6 100644 --- a/tests/baselines/reference/propertyAccess5.errors.txt +++ b/tests/baselines/reference/propertyAccess5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/propertyAccess5.ts(1,11): error TS2339: Property 'toBAZ' does not exist on type 'undefined'. +tests/cases/compiler/propertyAccess5.ts(1,1): error TS2532: Object is possibly 'undefined'. ==== tests/cases/compiler/propertyAccess5.ts (1 errors) ==== undefined.toBAZ(); - ~~~~~ -!!! error TS2339: Property 'toBAZ' does not exist on type 'undefined'. \ No newline at end of file + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt index 94bca545609..3680b1be60f 100644 --- a/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/typeofOperatorWithAnyOtherType.errors.txt @@ -1,6 +1,9 @@ -tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(46,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(47,32): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(48,32): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(46,32): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(46,39): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(47,32): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(47,39): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(48,32): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(48,44): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(58,1): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(68,1): error TS7028: Unused label. tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(69,1): error TS7028: Unused label. @@ -11,7 +14,7 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts(74,1): error TS7028: Unused label. -==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (11 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithAnyOtherType.ts (14 errors) ==== // typeof operator on any type var ANY: any; @@ -58,14 +61,20 @@ tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperator var ResultIsString15 = typeof A.foo(); var ResultIsString16 = typeof (ANY + ANY1); var ResultIsString17 = typeof (null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsString18 = typeof (null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsString19 = typeof (undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // multiple typeof operators var ResultIsString20 = typeof typeof ANY; diff --git a/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt index 8796f316303..5867a7ad6f5 100644 --- a/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/voidOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,12 @@ -tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(46,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. -tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(47,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. -tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(46,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(46,34): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(47,27): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(47,34): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(48,27): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts(48,39): error TS2532: Object is possibly 'undefined'. -==== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWithAnyOtherType.ts (6 errors) ==== // void operator on any type var ANY: any; @@ -50,14 +53,20 @@ tests/cases/conformance/expressions/unaryOperators/voidOperator/voidOperatorWith var ResultIsAny15 = void A.foo(); var ResultIsAny16 = void (ANY + ANY1); var ResultIsAny17 = void (null + undefined); - ~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsAny18 = void (null + null); - ~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsAny19 = void (undefined + undefined); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. // multiple void operators var ResultIsAny20 = void void ANY; diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 5ea097acf2e..1fd338e6410 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/compiler/widenedTypes.ts(8,15): error TS2531: Object is possibly 'null'. tests/cases/compiler/widenedTypes.ts(10,14): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/widenedTypes.ts(18,1): error TS2322: Type '""' is not assignable to type 'number'. @@ -25,7 +25,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: for (var a in null) { } ~~~~ -!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +!!! error TS2531: Object is possibly 'null'. var t = [3, (3, null)]; ~ From 8ce193c30295300c7b09d50a73fae770003f41c4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 15:54:39 -0800 Subject: [PATCH 280/289] Improved undefined/null handling for relational operators --- src/compiler/checker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cb48b2176f9..434dd46d0eb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14585,7 +14585,6 @@ namespace ts { } // NOTE: do not raise error if right is unknown as related error was already reported if (!(isTypeAny(rightType) || - rightType.flags & TypeFlags.Nullable || getSignaturesOfType(rightType, SignatureKind.Call).length || getSignaturesOfType(rightType, SignatureKind.Construct).length || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -14598,6 +14597,8 @@ namespace ts { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } + leftType = checkNonNullType(leftType, left); + rightType = checkNonNullType(rightType, right); // TypeScript 1.0 spec (April 2014): 4.15.5 // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. @@ -14952,8 +14953,8 @@ namespace ts { case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: if (checkForDisallowedESSymbolOperand(operator)) { - leftType = getBaseTypeOfLiteralType(leftType); - rightType = getBaseTypeOfLiteralType(rightType); + leftType = getBaseTypeOfLiteralType(checkNonNullType(leftType, left)); + rightType = getBaseTypeOfLiteralType(checkNonNullType(rightType, right)); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } From 6dcaac621419d023d6c34b94b2ed8c901e0147dc Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 15:54:50 -0800 Subject: [PATCH 281/289] Accept new baselines --- ...yncFunctionDeclaration10_es2017.errors.txt | 5 +- .../asyncFunctionDeclaration10_es5.errors.txt | 5 +- .../asyncFunctionDeclaration10_es6.errors.txt | 5 +- ...syncFunctionDeclaration5_es2017.errors.txt | 5 +- .../asyncFunctionDeclaration5_es5.errors.txt | 5 +- .../asyncFunctionDeclaration5_es6.errors.txt | 5 +- ...ratorWithIdenticalPrimitiveType.errors.txt | 130 +++++++ ...sonOperatorWithOneOperandIsNull.errors.txt | 360 ++++++++++++++++++ .../reference/equalityStrictNulls.errors.txt | 24 +- .../inOperatorWithInvalidOperands.errors.txt | 16 +- .../reference/widenedTypes.errors.txt | 9 +- 11 files changed, 543 insertions(+), 26 deletions(-) create mode 100644 tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.errors.txt create mode 100644 tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.errors.txt diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es2017.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration10_es2017.errors.txt index d5da3432264..33cd913a2eb 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es2017.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es2017.errors.txt @@ -4,10 +4,11 @@ tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclarati tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,33): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,38): error TS1005: ';' expected. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,39): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,49): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts(1,53): error TS1109: Expression expected. -==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts (7 errors) ==== +==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts (8 errors) ==== async function foo(a = await => await): Promise { ~~~~~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -21,6 +22,8 @@ tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclarati !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt index dc814e9c887..b974eacd882 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es5.errors.txt @@ -4,10 +4,11 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts(1,33): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts(1,38): error TS1005: ';' expected. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts(1,39): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts(1,49): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts(1,53): error TS1109: Expression expected. -==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts (7 errors) ==== +==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts (8 errors) ==== async function foo(a = await => await): Promise { ~~~~~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -21,6 +22,8 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration10_es6.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration10_es6.errors.txt index 15ceb3e60c7..b752ec94a45 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration10_es6.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration10_es6.errors.txt @@ -4,10 +4,11 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,33): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,38): error TS1005: ';' expected. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,39): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,49): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,53): error TS1109: Expression expected. -==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts (7 errors) ==== +==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts (8 errors) ==== async function foo(a = await => await): Promise { ~~~~~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -21,6 +22,8 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1 !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es2017.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration5_es2017.errors.txt index ad8c0280206..1fc74dfa0a2 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es2017.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es2017.errors.txt @@ -2,10 +2,11 @@ tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclarati tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,20): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,36): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts(1,40): error TS1109: Expression expected. -==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts (5 errors) ==== +==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts (6 errors) ==== async function foo(await): Promise { ~~~~~ !!! error TS1138: Parameter declaration expected. @@ -15,6 +16,8 @@ tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclarati !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt index 3060c2c836b..48299773218 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es5.errors.txt @@ -2,10 +2,11 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5 tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts(1,20): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts(1,36): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts(1,40): error TS1109: Expression expected. -==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts (5 errors) ==== +==== tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts (6 errors) ==== async function foo(await): Promise { ~~~~~ !!! error TS1138: Parameter declaration expected. @@ -15,6 +16,8 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration5 !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/asyncFunctionDeclaration5_es6.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration5_es6.errors.txt index a6944e0c6e6..2e907d13400 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration5_es6.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration5_es6.errors.txt @@ -2,10 +2,11 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5 tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,20): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,25): error TS1005: ';' expected. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,26): error TS1128: Declaration or statement expected. +tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,36): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,40): error TS1109: Expression expected. -==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts (5 errors) ==== +==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts (6 errors) ==== async function foo(await): Promise { ~~~~~ !!! error TS1138: Parameter declaration expected. @@ -15,6 +16,8 @@ tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5 !!! error TS1005: ';' expected. ~ !!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2532: Object is possibly 'undefined'. ~ !!! error TS1109: Expression expected. } \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.errors.txt b/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.errors.txt new file mode 100644 index 00000000000..ad41a280aad --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalPrimitiveType.errors.txt @@ -0,0 +1,130 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(15,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(15,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(16,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(16,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(24,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(24,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(25,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(25,23): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(33,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(33,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(34,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(34,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(42,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(42,19): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(43,11): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts(43,24): error TS2532: Object is possibly 'undefined'. + + +==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithIdenticalPrimitiveType.ts (16 errors) ==== + enum E { a, b, c } + + var a: number; + var b: boolean; + var c: string; + var d: void; + var e: E; + + // operator < + var ra1 = a < a; + var ra2 = b < b; + var ra3 = c < c; + var ra4 = d < d; + var ra5 = e < e; + var ra6 = null < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var ra7 = undefined < undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator > + var rb1 = a > a; + var rb2 = b > b; + var rb3 = c > c; + var rb4 = d > d; + var rb5 = e > e; + var rb6 = null > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rb7 = undefined > undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator <= + var rc1 = a <= a; + var rc2 = b <= b; + var rc3 = c <= c; + var rc4 = d <= d; + var rc5 = e <= e; + var rc6 = null <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rc7 = undefined <= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator >= + var rd1 = a >= a; + var rd2 = b >= b; + var rd3 = c >= c; + var rd4 = d >= d; + var rd5 = e >= e; + var rd6 = null >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var rd7 = undefined >= undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. + + // operator == + var re1 = a == a; + var re2 = b == b; + var re3 = c == c; + var re4 = d == d; + var re5 = e == e; + var re6 = null == null; + var re7 = undefined == undefined; + + // operator != + var rf1 = a != a; + var rf2 = b != b; + var rf3 = c != c; + var rf4 = d != d; + var rf5 = e != e; + var rf6 = null != null; + var rf7 = undefined != undefined; + + // operator === + var rg1 = a === a; + var rg2 = b === b; + var rg3 = c === c; + var rg4 = d === d; + var rg5 = e === e; + var rg6 = null === null; + var rg7 = undefined === undefined; + + // operator !== + var rh1 = a !== a; + var rh2 = b !== b; + var rh3 = c !== c; + var rh4 = d !== d; + var rh5 = e !== e; + var rh6 = null !== null; + var rh7 = undefined !== undefined; \ No newline at end of file diff --git a/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.errors.txt b/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.errors.txt new file mode 100644 index 00000000000..c74ab997a59 --- /dev/null +++ b/tests/baselines/reference/comparisonOperatorWithOneOperandIsNull.errors.txt @@ -0,0 +1,360 @@ +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(4,22): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(5,22): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(6,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(7,23): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(13,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(14,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(15,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(16,18): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(32,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(33,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(34,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(35,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(36,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(37,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(38,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(40,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(41,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(42,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(43,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(44,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(45,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(46,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(49,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(50,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(51,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(52,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(53,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(54,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(55,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(57,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(58,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(59,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(60,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(61,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(62,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(63,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(66,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(67,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(68,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(69,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(70,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(71,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(72,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(74,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(75,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(76,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(77,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(78,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(79,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(80,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(83,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(84,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(85,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(86,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(87,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(88,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(89,12): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(91,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(92,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(93,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(94,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(95,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(96,17): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts(97,17): error TS2531: Object is possibly 'null'. + + +==== tests/cases/conformance/expressions/binaryOperators/comparisonOperator/comparisonOperatorWithOneOperandIsNull.ts (64 errors) ==== + enum E { a, b, c } + + function foo(t: T) { + var foo_r1 = t < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r2 = t > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r3 = t <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r4 = t >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r5 = t == null; + var foo_r6 = t != null; + var foo_r7 = t === null; + var foo_r8 = t !== null; + + var foo_r1 = null < t; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r2 = null > t; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r3 = null <= t; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r4 = null >= t; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var foo_r5 = null == t; + var foo_r6 = null != t; + var foo_r7 = null === t; + var foo_r8 = null !== t; + } + + var a: boolean; + var b: number; + var c: string; + var d: void; + var e: E; + var f: {}; + var g: string[]; + + // operator < + var r1a1 = null < a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a2 = null < b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a3 = null < c; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a4 = null < d; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a5 = null < e; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a6 = null < f; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1a7 = null < g; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + var r1b1 = a < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b2 = b < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b3 = c < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b4 = d < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b5 = e < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b6 = f < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r1b7 = g < null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator > + var r2a1 = null > a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a2 = null > b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a3 = null > c; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a4 = null > d; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a5 = null > e; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a6 = null > f; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2a7 = null > g; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + var r2b1 = a > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b2 = b > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b3 = c > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b4 = d > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b5 = e > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b6 = f > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r2b7 = g > null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator <= + var r3a1 = null <= a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a2 = null <= b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a3 = null <= c; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a4 = null <= d; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a5 = null <= e; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a6 = null <= f; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3a7 = null <= g; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + var r3b1 = a <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b2 = b <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b3 = c <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b4 = d <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b5 = e <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b6 = f <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r3b7 = g <= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator >= + var r4a1 = null >= a; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a2 = null >= b; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a3 = null >= c; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a4 = null >= d; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a5 = null >= e; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a6 = null >= f; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4a7 = null >= g; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + var r4b1 = a >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b2 = b >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b3 = c >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b4 = d >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b5 = e >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b6 = f >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + var r4b7 = g >= null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. + + // operator == + var r5a1 = null == a; + var r5a2 = null == b; + var r5a3 = null == c; + var r5a4 = null == d; + var r5a5 = null == e; + var r5a6 = null == f; + var r5a7 = null == g; + + var r5b1 = a == null; + var r5b2 = b == null; + var r5b3 = c == null; + var r5b4 = d == null; + var r5b5 = e == null; + var r5b6 = f == null; + var r5b7 = g == null; + + // operator != + var r6a1 = null != a; + var r6a2 = null != b; + var r6a3 = null != c; + var r6a4 = null != d; + var r6a5 = null != e; + var r6a6 = null != f; + var r6a7 = null != g; + + var r6b1 = a != null; + var r6b2 = b != null; + var r6b3 = c != null; + var r6b4 = d != null; + var r6b5 = e != null; + var r6b6 = f != null; + var r6b7 = g != null; + + // operator === + var r7a1 = null === a; + var r7a2 = null === b; + var r7a3 = null === c; + var r7a4 = null === d; + var r7a5 = null === e; + var r7a6 = null === f; + var r7a7 = null === g; + + var r7b1 = a === null; + var r7b2 = b === null; + var r7b3 = c === null; + var r7b4 = d === null; + var r7b5 = e === null; + var r7b6 = f === null; + var r7b7 = g === null; + + // operator !== + var r8a1 = null !== a; + var r8a2 = null !== b; + var r8a3 = null !== c; + var r8a4 = null !== d; + var r8a5 = null !== e; + var r8a6 = null !== f; + var r8a7 = null !== g; + + var r8b1 = a !== null; + var r8b2 = b !== null; + var r8b3 = c !== null; + var r8b4 = d !== null; + var r8b5 = e !== null; + var r8b6 = f !== null; + var r8b7 = g !== null; \ No newline at end of file diff --git a/tests/baselines/reference/equalityStrictNulls.errors.txt b/tests/baselines/reference/equalityStrictNulls.errors.txt index e0793542b84..16772d8eeab 100644 --- a/tests/baselines/reference/equalityStrictNulls.errors.txt +++ b/tests/baselines/reference/equalityStrictNulls.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(60,9): error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'. -tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(62,9): error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'. -tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(64,9): error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'. -tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(66,9): error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(60,13): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(62,13): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(64,14): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(66,14): error TS2532: Object is possibly 'undefined'. ==== tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts (4 errors) ==== @@ -65,20 +65,20 @@ tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.t function f4(x: number) { if (x > undefined) { - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. } if (x < undefined) { - ~~~~~~~~~~~~~ -!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. } if (x >= undefined) { - ~~~~~~~~~~~~~~ -!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. } if (x <= undefined) { - ~~~~~~~~~~~~~~ -!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'. + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. } } function f5(x: string) { diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 5aeae5f160e..7615008d89c 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,6 +1,8 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -11,13 +13,13 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(35,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(36,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2531: Object is possibly 'null'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (17 errors) ==== +==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (19 errors) ==== enum E { a } var x: any; @@ -40,7 +42,11 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv !!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ra6 = undefined in x; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ @@ -83,10 +89,10 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter var rb9 = x in null; ~~~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2531: Object is possibly 'null'. var rb10 = x in undefined; ~~~~~~~~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2532: Object is possibly 'undefined'. // both operands are invalid diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 1fd338e6410..f0e3ec33f50 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +tests/cases/compiler/widenedTypes.ts(5,1): error TS2531: Object is possibly 'null'. +tests/cases/compiler/widenedTypes.ts(6,7): error TS2531: Object is possibly 'null'. tests/cases/compiler/widenedTypes.ts(8,15): error TS2531: Object is possibly 'null'. tests/cases/compiler/widenedTypes.ts(10,14): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type '""' is not assignable to type 'number'. @@ -11,7 +12,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: Type 'number' is not assignable to type 'string'. -==== tests/cases/compiler/widenedTypes.ts (8 errors) ==== +==== tests/cases/compiler/widenedTypes.ts (9 errors) ==== null instanceof (() => { }); ~~~~ @@ -19,9 +20,11 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: ({}) instanceof null; // Ok because null is a subtype of function null in {}; + ~~~~ +!!! error TS2531: Object is possibly 'null'. "" in null; ~~~~ -!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter +!!! error TS2531: Object is possibly 'null'. for (var a in null) { } ~~~~ From 894ba853a080ae33a7a44eab2eec880108850367 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 16:09:03 -0800 Subject: [PATCH 282/289] Improved undefined/null handling for unary operators --- src/compiler/checker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 434dd46d0eb..8d9b3eb3142 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14483,6 +14483,7 @@ namespace ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: + checkNonNullType(operandType, node.operand); if (maybeTypeOfKind(operandType, TypeFlags.ESSymbol)) { error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } @@ -14494,7 +14495,7 @@ namespace ts { booleanType; case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: - const ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), + const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 @@ -14510,7 +14511,7 @@ namespace ts { if (operandType === silentNeverType) { return silentNeverType; } - const ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), + const ok = checkArithmeticOperandType(node.operand, checkNonNullType(operandType, node.operand), 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 From 221c0d7a39a31da863ea13a78e7f3b37f524e93e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 13 Jan 2017 16:09:11 -0800 Subject: [PATCH 283/289] Accept new baselines --- ...bitwiseNotOperatorWithAnyOtherType.errors.txt | 8 +++++++- ...rWithAnyOtherTypeInvalidOperations.errors.txt | 16 +++++++++++----- ...rWithAnyOtherTypeInvalidOperations.errors.txt | 16 +++++++++++----- .../negateOperatorWithAnyOtherType.errors.txt | 8 +++++++- .../plusOperatorWithAnyOtherType.errors.txt | 8 +++++++- 5 files changed, 43 insertions(+), 13 deletions(-) diff --git a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt index 262ac042c68..c3e9f220a3a 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/bitwiseNotOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,5 @@ +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(35,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(36,24): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,26): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(47,33): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(48,26): error TS2531: Object is possibly 'null'. @@ -6,7 +8,7 @@ tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNot tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts(49,38): error TS2532: Object is possibly 'undefined'. -==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts (6 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithAnyOtherType.ts (8 errors) ==== // ~ operator on any type @@ -42,7 +44,11 @@ tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNot // any type literal var ResultIsNumber6 = ~undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber7 = ~null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. // any type expressions var ResultIsNumber8 = ~ANY2[0] diff --git a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index e5456d6f0bd..33e31bc9478 100644 --- a/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/decrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -9,9 +9,11 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(34,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2539: Cannot assign to 'undefined' because it is not a variable. -tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. +tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2539: Cannot assign to 'undefined' because it is not a variable. tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. @@ -56,7 +58,7 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,12): error TS1109: Expression expected. -==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (56 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (58 errors) ==== // -- operator on any type var ANY1: any; var ANY2: any[] = ["", ""]; @@ -118,14 +120,18 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = --null; ~~~~ -!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber13 = --undefined; ~~~~~~~~~ !!! error TS2539: Cannot assign to 'undefined' because it is not a variable. var ResultIsNumber14 = null--; ~~~~ -!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber15 = {}--; ~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt index bf980bfd153..afdddab86a7 100644 --- a/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt +++ b/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt @@ -9,9 +9,11 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(34,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2539: Cannot assign to 'undefined' because it is not a variable. -tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. +tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2539: Cannot assign to 'undefined' because it is not a variable. tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access. @@ -51,7 +53,7 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,12): error TS1109: Expression expected. -==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (51 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (53 errors) ==== // ++ operator on any type var ANY1: any; var ANY2: any[] = [1, 2]; @@ -113,14 +115,18 @@ tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOp !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. var ResultIsNumber12 = ++null; ~~~~ -!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber13 = ++undefined; ~~~~~~~~~ !!! error TS2539: Cannot assign to 'undefined' because it is not a variable. var ResultIsNumber14 = null++; ~~~~ -!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access. + ~~~~ +!!! error TS2531: Object is possibly 'null'. var ResultIsNumber15 = {}++; ~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. diff --git a/tests/baselines/reference/negateOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/negateOperatorWithAnyOtherType.errors.txt index 03e596aca41..0fbf89fb7ec 100644 --- a/tests/baselines/reference/negateOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/negateOperatorWithAnyOtherType.errors.txt @@ -1,7 +1,9 @@ +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts(34,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts(35,23): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts(51,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts (1 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithAnyOtherType.ts (3 errors) ==== // - operator on any type var ANY: any; @@ -36,7 +38,11 @@ tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperator // any type literal var ResultIsNumber7 = -undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber = -null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. // any type expressions var ResultIsNumber8 = -ANY2[0]; diff --git a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt index c316cf92e6d..d693aaa17d9 100644 --- a/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/plusOperatorWithAnyOtherType.errors.txt @@ -1,3 +1,5 @@ +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(34,24): error TS2532: Object is possibly 'undefined'. +tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(35,24): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(46,26): error TS2531: Object is possibly 'null'. tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(46,33): error TS2532: Object is possibly 'undefined'. tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(47,26): error TS2531: Object is possibly 'null'. @@ -7,7 +9,7 @@ tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWith tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts(54,1): error TS2695: Left side of comma operator is unused and has no side effects. -==== tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts (7 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithAnyOtherType.ts (9 errors) ==== // + operator on any type var ANY: any; @@ -42,7 +44,11 @@ tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWith // any type literal var ResultIsNumber7 = +undefined; + ~~~~~~~~~ +!!! error TS2532: Object is possibly 'undefined'. var ResultIsNumber8 = +null; + ~~~~ +!!! error TS2531: Object is possibly 'null'. // any type expressions var ResultIsNumber9 = +ANY2[0]; From 33f6fa8cc68786d8fb70ff9b8c9fa107f90733b5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 13 Jan 2017 18:47:18 -0800 Subject: [PATCH 284/289] Error on the return statement itself when checking against function return types. --- src/compiler/checker.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a916e9cbba6..80516ef9319 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17922,27 +17922,27 @@ namespace ts { if (func.kind === SyntaxKind.SetAccessor) { if (node.expression) { - error(node.expression, Diagnostics.Setters_cannot_return_a_value); + error(node, Diagnostics.Setters_cannot_return_a_value); } } else if (func.kind === SyntaxKind.Constructor) { - if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { - error(node.expression, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + if (node.expression && !checkTypeAssignableTo(exprType, returnType, node)) { + error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (isAsyncFunctionLike(func)) { const promisedType = getPromisedType(returnType); - const awaitedType = checkAwaitedType(exprType, node.expression || node, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + const awaitedType = checkAwaitedType(exprType, node, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); + checkTypeAssignableTo(awaitedType, promisedType, node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression || node); + checkTypeAssignableTo(exprType, returnType, node); } } } From 3ecfc8d0f28ab19c63c215d4a76d538c12b85071 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 13 Jan 2017 18:47:35 -0800 Subject: [PATCH 285/289] Accepted baselines. --- ...rs_spec_section-4.5_error-cases.errors.txt | 8 ++--- .../constructorReturnsInvalidType.errors.txt | 8 ++--- ...rWithAssignableReturnExpression.errors.txt | 16 +++++----- .../derivedGenericClassWithAny.errors.txt | 8 ++--- tests/baselines/reference/fuzzy.errors.txt | 4 +-- .../getSetAccessorContextualTyping.errors.txt | 4 +-- .../reference/inferSetterParamType.errors.txt | 4 +-- .../invalidReturnStatements.errors.txt | 8 ++--- .../matchReturnTypeInAllBranches.errors.txt | 4 +-- .../reference/neverTypeErrors1.errors.txt | 4 +-- .../reference/neverTypeErrors2.errors.txt | 4 +-- .../nonPrimitiveInFunction.errors.txt | 4 +-- .../reference/numberToString.errors.txt | 4 +-- .../reference/objectLiteralErrors.errors.txt | 4 +-- ...rthandPropertiesAssignmentError.errors.txt | 4 +-- ...nmentErrorFromMissingIdentifier.errors.txt | 4 +-- ...OnTypeParameterWithConstraints5.errors.txt | 4 +-- .../recursiveFunctionTypes.errors.txt | 4 +-- .../reference/returnInConstructor1.errors.txt | 32 +++++++++---------- .../reference/returnValueInSetter.errors.txt | 4 +-- .../reference/setterWithReturn.errors.txt | 8 ++--- .../reference/symbolProperty47.errors.txt | 4 +-- .../reference/targetTypeVoidFunc.errors.txt | 4 +-- .../typeGuardFunctionErrors.errors.txt | 16 +++++----- .../typeParameterAssignmentCompat1.errors.txt | 8 ++--- ...ypeParameterHasSelfAsConstraint.errors.txt | 4 +-- 26 files changed, 90 insertions(+), 90 deletions(-) diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt index 5393eee87d4..278de87e729 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,55): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(3,48): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,54): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(5,47): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(8,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -20,13 +20,13 @@ tests/cases/compiler/accessors_spec_section-4.5_error-cases.ts(12,16): error TS1 public get AnnotatedSetter_SetterFirst() { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'number'. public get AnnotatedSetter_SetterLast() { return ""; } ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'number'. public set AnnotatedSetter_SetterLast(a: number) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt index a1a5c5e75b9..a615d7177cf 100644 --- a/tests/baselines/reference/constructorReturnsInvalidType.errors.txt +++ b/tests/baselines/reference/constructorReturnsInvalidType.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2322: Type '1' is not assignable to type 'X'. -tests/cases/compiler/constructorReturnsInvalidType.ts(3,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2322: Type '1' is not assignable to type 'X'. +tests/cases/compiler/constructorReturnsInvalidType.ts(3,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class ==== tests/cases/compiler/constructorReturnsInvalidType.ts (2 errors) ==== class X { constructor() { return 1; - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'X'. - ~ + ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } foo() { } diff --git a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt index 77c63a217e7..f5948382d64 100644 --- a/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt +++ b/tests/baselines/reference/constructorWithAssignableReturnExpression.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2322: Type '1' is not assignable to type 'D'. -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,16): error TS2322: Type '{ x: number; }' is not assignable to type 'F'. +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2322: Type '1' is not assignable to type 'D'. +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(12,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2322: Type '{ x: number; }' is not assignable to type 'F'. Types of property 'x' are incompatible. Type 'number' is not assignable to type 'T'. -tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts(26,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class ==== tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignableReturnExpression.ts (4 errors) ==== @@ -19,9 +19,9 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl x: number; constructor() { return 1; // error - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'D'. - ~ + ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } @@ -37,11 +37,11 @@ tests/cases/conformance/classes/constructorDeclarations/constructorWithAssignabl x: T; constructor() { return { x: 1 }; // error - ~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ x: number; }' is not assignable to type 'F'. !!! error TS2322: Types of property 'x' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'T'. - ~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index 81e43f7d8fe..359fab212e9 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2322: Type '""' is not assignable to type 'T'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2322: Type '""' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,18): error TS2322: Type '""' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,9): error TS2322: Type '""' is not assignable to type 'T'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -48,11 +48,11 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC get X(): T { return ''; } // error ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. foo(): T { return ''; // error - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'T'. } } diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index 19f0ad56a5e..c3f05fd7f2f 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'. Property 'alsoWorks' is missing in type 'C'. -tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'. +tests/cases/compiler/fuzzy.ts(21,13): error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'. Types of property 'oneI' are incompatible. Type 'this' is not assignable to type 'I'. Type 'C' is not assignable to type 'I'. @@ -33,7 +33,7 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' canno doesntWork():R { return { anything:1, oneI:this }; - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ anything: number; oneI: this; }' is not assignable to type 'R'. !!! error TS2322: Types of property 'oneI' are incompatible. !!! error TS2322: Type 'this' is not assignable to type 'I'. diff --git a/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt b/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt index 845a4011d9f..dc77d530e01 100644 --- a/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt +++ b/tests/baselines/reference/getSetAccessorContextualTyping.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,16): error TS2322: Type '"string"' is not assignable to type 'number'. +tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts(8,9): error TS2322: Type '"string"' is not assignable to type 'number'. ==== tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyping.ts (1 errors) ==== @@ -10,7 +10,7 @@ tests/cases/conformance/expressions/contextualTyping/getSetAccessorContextualTyp set X(x: number) { } get X() { return "string"; // Error; get contextual type by set accessor parameter type annotation - ~~~~~~~~ + ~~~~~~~~~~~~~~~~ !!! error TS2322: Type '"string"' is not assignable to type 'number'. } diff --git a/tests/baselines/reference/inferSetterParamType.errors.txt b/tests/baselines/reference/inferSetterParamType.errors.txt index 02c02ba69d5..7b28c52d48b 100644 --- a/tests/baselines/reference/inferSetterParamType.errors.txt +++ b/tests/baselines/reference/inferSetterParamType.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/inferSetterParamType.ts(3,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/inferSetterParamType.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/inferSetterParamType.ts(13,16): error TS2322: Type '0' is not assignable to type 'string'. +tests/cases/compiler/inferSetterParamType.ts(13,9): error TS2322: Type '0' is not assignable to type 'string'. tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -25,7 +25,7 @@ tests/cases/compiler/inferSetterParamType.ts(15,9): error TS1056: Accessors are ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return 0; // should be an error - can't coerce infered return type to match setter annotated type - ~ + ~~~~~~~~~ !!! error TS2322: Type '0' is not assignable to type 'string'. } set bar(n:string) { diff --git a/tests/baselines/reference/invalidReturnStatements.errors.txt b/tests/baselines/reference/invalidReturnStatements.errors.txt index 6fbe961cd54..0f51e75a47d 100644 --- a/tests/baselines/reference/invalidReturnStatements.errors.txt +++ b/tests/baselines/reference/invalidReturnStatements.errors.txt @@ -2,9 +2,9 @@ tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(2 tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(3,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(4,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(5,17): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. -tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(16,29): error TS2322: Type '{ id: number; }' is not assignable to type 'D'. +tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(16,22): error TS2322: Type '{ id: number; }' is not assignable to type 'D'. Property 'name' is missing in type '{ id: number; }'. -tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(18,29): error TS2322: Type 'C' is not assignable to type 'D'. +tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(18,22): error TS2322: Type 'C' is not assignable to type 'D'. Property 'name' is missing in type 'C'. @@ -33,12 +33,12 @@ tests/cases/conformance/statements/returnStatements/invalidReturnStatements.ts(1 name: string; } function fn10(): D { return { id: 12 }; } - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ id: number; }' is not assignable to type 'D'. !!! error TS2322: Property 'name' is missing in type '{ id: number; }'. function fn11(): D { return new C(); } - ~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'C' is not assignable to type 'D'. !!! error TS2322: Property 'name' is missing in type 'C'. diff --git a/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt b/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt index 405fa4d2036..6cf1bbc5fa3 100644 --- a/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt +++ b/tests/baselines/reference/matchReturnTypeInAllBranches.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/matchReturnTypeInAllBranches.ts(30,20): error TS2322: Type '12345' is not assignable to type 'boolean'. +tests/cases/compiler/matchReturnTypeInAllBranches.ts(30,13): error TS2322: Type '12345' is not assignable to type 'boolean'. ==== tests/cases/compiler/matchReturnTypeInAllBranches.ts (1 errors) ==== @@ -32,7 +32,7 @@ tests/cases/compiler/matchReturnTypeInAllBranches.ts(30,20): error TS2322: Type else { return 12345; - ~~~~~ + ~~~~~~~~~~~~~ !!! error TS2322: Type '12345' is not assignable to type 'boolean'. } } diff --git a/tests/baselines/reference/neverTypeErrors1.errors.txt b/tests/baselines/reference/neverTypeErrors1.errors.txt index cb79c0c19fb..a27c6fba065 100644 --- a/tests/baselines/reference/neverTypeErrors1.errors.txt +++ b/tests/baselines/reference/neverTypeErrors1.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(6,5): error TS2322: Type tests/cases/conformance/types/never/neverTypeErrors1.ts(7,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(8,5): error TS2322: Type '{}' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(12,5): error TS2322: Type 'undefined' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors1.ts(16,12): error TS2322: Type '1' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors1.ts(16,5): error TS2322: Type '1' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors1.ts(19,16): error TS2534: A function returning 'never' cannot have a reachable end point. @@ -40,7 +40,7 @@ tests/cases/conformance/types/never/neverTypeErrors1.ts(19,16): error TS2534: A function f3(): never { return 1; - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'never'. } diff --git a/tests/baselines/reference/neverTypeErrors2.errors.txt b/tests/baselines/reference/neverTypeErrors2.errors.txt index ed27e615ea1..60e6947f44a 100644 --- a/tests/baselines/reference/neverTypeErrors2.errors.txt +++ b/tests/baselines/reference/neverTypeErrors2.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(7,5): error TS2322: Type tests/cases/conformance/types/never/neverTypeErrors2.ts(8,5): error TS2322: Type 'null' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(9,5): error TS2322: Type '{}' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(13,5): error TS2322: Type 'undefined' is not assignable to type 'never'. -tests/cases/conformance/types/never/neverTypeErrors2.ts(17,12): error TS2322: Type '1' is not assignable to type 'never'. +tests/cases/conformance/types/never/neverTypeErrors2.ts(17,5): error TS2322: Type '1' is not assignable to type 'never'. tests/cases/conformance/types/never/neverTypeErrors2.ts(20,16): error TS2534: A function returning 'never' cannot have a reachable end point. @@ -41,7 +41,7 @@ tests/cases/conformance/types/never/neverTypeErrors2.ts(20,16): error TS2534: A function f3(): never { return 1; - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'never'. } diff --git a/tests/baselines/reference/nonPrimitiveInFunction.errors.txt b/tests/baselines/reference/nonPrimitiveInFunction.errors.txt index 5ca231b61c8..c7f89fbdd06 100644 --- a/tests/baselines/reference/nonPrimitiveInFunction.errors.txt +++ b/tests/baselines/reference/nonPrimitiveInFunction.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(12,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'object'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(13,1): error TS2322: Type 'object' is not assignable to type 'boolean'. -tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(17,12): error TS2322: Type 'number' is not assignable to type 'object'. +tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(17,5): error TS2322: Type 'number' is not assignable to type 'object'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts (3 errors) ==== @@ -25,7 +25,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts(17,12): err function returnError(): object { var ret = 123; return ret; // expect error - ~~~ + ~~~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'object'. } \ No newline at end of file diff --git a/tests/baselines/reference/numberToString.errors.txt b/tests/baselines/reference/numberToString.errors.txt index 60a382e47c3..bbd9178862a 100644 --- a/tests/baselines/reference/numberToString.errors.txt +++ b/tests/baselines/reference/numberToString.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/numberToString.ts(2,12): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/compiler/numberToString.ts(2,5): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type '3' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/numberToString.ts (2 errors) ==== function f1(n:number):string { return n; // error return type mismatch - ~ + ~~~~~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'string'. } diff --git a/tests/baselines/reference/objectLiteralErrors.errors.txt b/tests/baselines/reference/objectLiteralErrors.errors.txt index 03b4b74eacd..0e0db0b414f 100644 --- a/tests/baselines/reference/objectLiteralErrors.errors.txt +++ b/tests/baselines/reference/objectLiteralErrors.errors.txt @@ -73,7 +73,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46) tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(40,46): error TS2300: Duplicate identifier 'a'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,16): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(43,47): error TS2380: 'get' and 'set' accessor must have the same type. -tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,29): error TS2322: Type '4' is not assignable to type 'string'. +tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(44,22): error TS2322: Type '4' is not assignable to type 'string'. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,16): error TS2380: 'get' and 'set' accessor must have the same type. tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55): error TS2380: 'get' and 'set' accessor must have the same type. @@ -273,7 +273,7 @@ tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts(45,55) ~ !!! error TS2380: 'get' and 'set' accessor must have the same type. var g2 = { get a() { return 4; }, set a(n: string) { } }; - ~ + ~~~~~~~~~ !!! error TS2322: Type '4' is not assignable to type 'string'. var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; ~ diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt index 6f405facceb..c0e6e10d8de 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(6,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. Types of property 'id' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentError.ts(8,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ name: string; id: boolean; }'. @@ -18,7 +18,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr !!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. var person1: { name, id }; // ok function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error - ~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ id: string; name: number; }'. !!! error TS2322: Types of property 'id' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt index 92750fd29a0..6b227fce710 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(4,43): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. -tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,79): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. +tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(5,72): error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. Types of property 'name' are incompatible. Type 'string' is not assignable to type 'number'. tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts(8,5): error TS2322: Type '{ name: number; id: string; }' is not assignable to type '{ name: string; id: number; }'. @@ -17,7 +17,7 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ b: string; id: number; }'. !!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type '{ b: string; id: number; }'. function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error - ~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ name: string; id: number; }' is not assignable to type '{ name: number; id: string; }'. !!! error TS2322: Types of property 'name' are incompatible. !!! error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.errors.txt b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.errors.txt index fd012d0e5a5..c1052dff554 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.errors.txt +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(15,32): error TS2339: Property 'notHere' does not exist on type 'U'. tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(25,16): error TS2339: Property 'notHere' does not exist on type 'B'. tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(32,22): error TS2339: Property 'notHere' does not exist on type 'A'. -tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(38,16): error TS2322: Type 'string' is not assignable to type 'U'. +tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(38,9): error TS2322: Type 'string' is not assignable to type 'U'. tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints5.ts(38,22): error TS2339: Property 'notHere' does not exist on type 'U'. @@ -50,7 +50,7 @@ tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOn foo: (x: U): U => { var a = x['foo'](); // should be string return a + x.notHere(); - ~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type 'U'. ~~~~~~~ !!! error TS2339: Property 'notHere' does not exist on type 'U'. diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index 8614f747016..8a454133a82 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/recursiveFunctionTypes.ts(1,35): error TS2322: Type '1' is not assignable to type '() => typeof fn'. +tests/cases/compiler/recursiveFunctionTypes.ts(1,28): error TS2322: Type '1' is not assignable to type '() => typeof fn'. tests/cases/compiler/recursiveFunctionTypes.ts(3,5): error TS2322: Type '() => typeof fn' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(4,5): error TS2322: Type '() => typeof fn' is not assignable to type '() => number'. Type '() => typeof fn' is not assignable to type 'number'. @@ -16,7 +16,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of ==== tests/cases/compiler/recursiveFunctionTypes.ts (13 errors) ==== function fn(): typeof fn { return 1; } - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type '() => typeof fn'. var x: number = fn; // error diff --git a/tests/baselines/reference/returnInConstructor1.errors.txt b/tests/baselines/reference/returnInConstructor1.errors.txt index a7d3fd05204..939d303ec65 100644 --- a/tests/baselines/reference/returnInConstructor1.errors.txt +++ b/tests/baselines/reference/returnInConstructor1.errors.txt @@ -1,15 +1,15 @@ -tests/cases/compiler/returnInConstructor1.ts(11,16): error TS2322: Type '1' is not assignable to type 'B'. -tests/cases/compiler/returnInConstructor1.ts(11,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class -tests/cases/compiler/returnInConstructor1.ts(25,16): error TS2322: Type '"test"' is not assignable to type 'D'. -tests/cases/compiler/returnInConstructor1.ts(25,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class -tests/cases/compiler/returnInConstructor1.ts(39,16): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. +tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2322: Type '1' is not assignable to type 'B'. +tests/cases/compiler/returnInConstructor1.ts(11,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2322: Type '"test"' is not assignable to type 'D'. +tests/cases/compiler/returnInConstructor1.ts(25,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. Types of property 'foo' are incompatible. Type 'number' is not assignable to type 'string'. -tests/cases/compiler/returnInConstructor1.ts(39,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class -tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2322: Type 'G' is not assignable to type 'H'. +tests/cases/compiler/returnInConstructor1.ts(39,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2322: Type 'G' is not assignable to type 'H'. Types of property 'foo' are incompatible. Type '() => void' is not assignable to type 'string'. -tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/compiler/returnInConstructor1.ts(55,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class ==== tests/cases/compiler/returnInConstructor1.ts (8 errors) ==== @@ -24,9 +24,9 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o foo() { } constructor() { return 1; // error - ~ + ~~~~~~~~~ !!! error TS2322: Type '1' is not assignable to type 'B'. - ~ + ~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } @@ -42,9 +42,9 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o foo() { } constructor() { return "test"; // error - ~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2322: Type '"test"' is not assignable to type 'D'. - ~~~~~~ + ~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } @@ -60,11 +60,11 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o public foo: string; constructor() { return { foo: 1 }; //error - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ foo: number; }' is not assignable to type 'F'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type 'number' is not assignable to type 'string'. - ~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } @@ -82,11 +82,11 @@ tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type o constructor() { super(); return new G(); //error - ~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2322: Type 'G' is not assignable to type 'H'. !!! error TS2322: Types of property 'foo' are incompatible. !!! error TS2322: Type '() => void' is not assignable to type 'string'. - ~~~~~~~ + ~~~~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } } diff --git a/tests/baselines/reference/returnValueInSetter.errors.txt b/tests/baselines/reference/returnValueInSetter.errors.txt index f9dffa1bc36..4d7b0d185f9 100644 --- a/tests/baselines/reference/returnValueInSetter.errors.txt +++ b/tests/baselines/reference/returnValueInSetter.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/returnValueInSetter.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/returnValueInSetter.ts(3,16): error TS2408: Setters cannot return a value. +tests/cases/compiler/returnValueInSetter.ts(3,9): error TS2408: Setters cannot return a value. ==== tests/cases/compiler/returnValueInSetter.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/returnValueInSetter.ts(3,16): error TS2408: Setters cannot ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. return null; // Should be an error - ~~~~ + ~~~~~~~~~~~~ !!! error TS2408: Setters cannot return a value. } } diff --git a/tests/baselines/reference/setterWithReturn.errors.txt b/tests/baselines/reference/setterWithReturn.errors.txt index 6aed49105b8..a0f04506a71 100644 --- a/tests/baselines/reference/setterWithReturn.errors.txt +++ b/tests/baselines/reference/setterWithReturn.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/setterWithReturn.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/setterWithReturn.ts(4,20): error TS2408: Setters cannot return a value. +tests/cases/compiler/setterWithReturn.ts(4,13): error TS2408: Setters cannot return a value. tests/cases/compiler/setterWithReturn.ts(7,13): error TS7027: Unreachable code detected. -tests/cases/compiler/setterWithReturn.ts(7,20): error TS2408: Setters cannot return a value. +tests/cases/compiler/setterWithReturn.ts(7,13): error TS2408: Setters cannot return a value. ==== tests/cases/compiler/setterWithReturn.ts (4 errors) ==== @@ -11,14 +11,14 @@ tests/cases/compiler/setterWithReturn.ts(7,20): error TS2408: Setters cannot ret !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. if (true) { return arg1; - ~~~~ + ~~~~~~~~~~~~ !!! error TS2408: Setters cannot return a value. } else { return 0; ~~~~~~ !!! error TS7027: Unreachable code detected. - ~ + ~~~~~~~~~ !!! error TS2408: Setters cannot return a value. } } diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt index 2e15085eb24..143d2405d0b 100644 --- a/tests/baselines/reference/symbolProperty47.errors.txt +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type '""' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,9): error TS2322: Type '""' is not assignable to type 'number'. tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type '""' is not assignable to type 'number'. @@ -6,7 +6,7 @@ tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Typ class C { get [Symbol.hasInstance]() { return ""; - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'number'. } // Should take a string diff --git a/tests/baselines/reference/targetTypeVoidFunc.errors.txt b/tests/baselines/reference/targetTypeVoidFunc.errors.txt index d47f811c2ed..6c0efe288bd 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.errors.txt +++ b/tests/baselines/reference/targetTypeVoidFunc.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/targetTypeVoidFunc.ts(2,12): error TS2322: Type '() => void' is not assignable to type 'new () => number'. +tests/cases/compiler/targetTypeVoidFunc.ts(2,5): error TS2322: Type '() => void' is not assignable to type 'new () => number'. Type '() => void' provides no match for the signature 'new (): number' ==== tests/cases/compiler/targetTypeVoidFunc.ts (1 errors) ==== function f1(): { new (): number; } { return function () { return; } - ~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'new () => number'. !!! error TS2322: Type '() => void' provides no match for the signature 'new (): number' }; diff --git a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt index 88f71cda196..e9dfbf5bf27 100644 --- a/tests/baselines/reference/typeGuardFunctionErrors.errors.txt +++ b/tests/baselines/reference/typeGuardFunctionErrors.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(2,7): error TS2300: Duplicate identifier 'A'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(15,12): error TS2322: Type '""' is not assignable to type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(15,5): error TS2322: Type '""' is not assignable to type 'boolean'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,55): error TS2304: Cannot find name 'x'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,57): error TS1144: '{' or ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(18,57): error TS2304: Cannot find name 'is'. @@ -47,11 +47,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,22) tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,25): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(98,27): error TS1005: ';' expected. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(104,25): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,16): error TS2322: Type 'true' is not assignable to type 'D'. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,9): error TS2322: Type 'true' is not assignable to type 'D'. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(105,9): error TS2409: Return type of constructor signature must be assignable to the instance type of the class tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(107,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(110,20): error TS1228: A type predicate is only allowed in return type position for functions and methods. -tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(111,16): error TS2408: Setters cannot return a value. +tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(111,9): error TS2408: Setters cannot return a value. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(116,18): error TS1228: A type predicate is only allowed in return type position for functions and methods. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,22): error TS2304: Cannot find name 'p1'. tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(120,25): error TS1005: ';' expected. @@ -82,7 +82,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 function hasANonBooleanReturnStatement(x): x is A { return ''; - ~~ + ~~~~~~~~~~ !!! error TS2322: Type '""' is not assignable to type 'boolean'. } @@ -258,9 +258,9 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 ~~~~~~~ !!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return true; - ~~~~ + ~~~~~~~~~~~~ !!! error TS2322: Type 'true' is not assignable to type 'D'. - ~~~~ + ~~~~~~~~~~~~ !!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class } get m1(p1: A): p1 is C { @@ -272,7 +272,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardFunctionErrors.ts(137,39 ~~~~~~~ !!! error TS1228: A type predicate is only allowed in return type position for functions and methods. return true; - ~~~~ + ~~~~~~~~~~~~ !!! error TS2408: Setters cannot return a value. } } diff --git a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt index d3bc25c00b1..9665ef017c0 100644 --- a/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt +++ b/tests/baselines/reference/typeParameterAssignmentCompat1.errors.txt @@ -1,10 +1,10 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(8,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'T'. -tests/cases/compiler/typeParameterAssignmentCompat1.ts(9,12): error TS2322: Type 'Foo' is not assignable to type 'Foo'. +tests/cases/compiler/typeParameterAssignmentCompat1.ts(9,5): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'T' is not assignable to type 'U'. tests/cases/compiler/typeParameterAssignmentCompat1.ts(16,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'U' is not assignable to type 'T'. -tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,16): error TS2322: Type 'Foo' is not assignable to type 'Foo'. +tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,9): error TS2322: Type 'Foo' is not assignable to type 'Foo'. Type 'T' is not assignable to type 'U'. @@ -21,7 +21,7 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,16): error TS2322: Typ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'U' is not assignable to type 'T'. return x; - ~ + ~~~~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'T' is not assignable to type 'U'. } @@ -35,7 +35,7 @@ tests/cases/compiler/typeParameterAssignmentCompat1.ts(17,16): error TS2322: Typ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'U' is not assignable to type 'T'. return x; - ~ + ~~~~~~~~~ !!! error TS2322: Type 'Foo' is not assignable to type 'Foo'. !!! error TS2322: Type 'T' is not assignable to type 'U'. } diff --git a/tests/baselines/reference/typeParameterHasSelfAsConstraint.errors.txt b/tests/baselines/reference/typeParameterHasSelfAsConstraint.errors.txt index b459534080f..01cfff63e5f 100644 --- a/tests/baselines/reference/typeParameterHasSelfAsConstraint.errors.txt +++ b/tests/baselines/reference/typeParameterHasSelfAsConstraint.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/typeParameterHasSelfAsConstraint.ts(1,24): error TS2313: Type parameter 'T' has a circular constraint. -tests/cases/compiler/typeParameterHasSelfAsConstraint.ts(2,12): error TS2322: Type 'T' is not assignable to type 'number'. +tests/cases/compiler/typeParameterHasSelfAsConstraint.ts(2,5): error TS2322: Type 'T' is not assignable to type 'number'. ==== tests/cases/compiler/typeParameterHasSelfAsConstraint.ts (2 errors) ==== @@ -7,7 +7,7 @@ tests/cases/compiler/typeParameterHasSelfAsConstraint.ts(2,12): error TS2322: Ty ~ !!! error TS2313: Type parameter 'T' has a circular constraint. return x; - ~ + ~~~~~~~~~ !!! error TS2322: Type 'T' is not assignable to type 'number'. } From 093929e49ced5d4207f69b4de822dff03103505d Mon Sep 17 00:00:00 2001 From: rdosanjh Date: Sat, 14 Jan 2017 11:02:05 +0000 Subject: [PATCH 286/289] adding 2 new lines to tsc --watch output --- src/compiler/tsc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index a7304eebe4b..866065af972 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -155,7 +155,7 @@ namespace ts { output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `; } - output += `${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`; + output += `${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine + sys.newLine + sys.newLine }`; sys.write(output); } From 061175ef9fb6ab985de56b9c4b49db4bdd4d272a Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sun, 15 Jan 2017 16:26:17 -0800 Subject: [PATCH 287/289] Emit 'object' type in declaration emitter --- src/compiler/declarationEmitter.ts | 1 + .../reference/nonPrimitiveAsProperty.js | 8 ++++++++ .../reference/nonPrimitiveInFunction.js | 8 ++++++++ .../reference/nonPrimitiveInGeneric.js | 18 ++++++++++++++++++ .../reference/nonPrimitiveUnionIntersection.js | 5 +++++ .../nonPrimitive/nonPrimitiveAsProperty.ts | 1 + .../nonPrimitive/nonPrimitiveInFunction.ts | 1 + .../nonPrimitive/nonPrimitiveInGeneric.ts | 1 + .../nonPrimitiveUnionIntersection.ts | 1 + 9 files changed, 44 insertions(+) diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index cd98622e080..bdeb700f1d1 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -390,6 +390,7 @@ namespace ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.ObjectKeyword: case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.UndefinedKeyword: diff --git a/tests/baselines/reference/nonPrimitiveAsProperty.js b/tests/baselines/reference/nonPrimitiveAsProperty.js index f51a9b35435..d3e1b072a06 100644 --- a/tests/baselines/reference/nonPrimitiveAsProperty.js +++ b/tests/baselines/reference/nonPrimitiveAsProperty.js @@ -11,3 +11,11 @@ var b: WithNonPrimitive = {foo: "bar"}; // expect error //// [nonPrimitiveAsProperty.js] var a = { foo: { bar: "bar" } }; var b = { foo: "bar" }; // expect error + + +//// [nonPrimitiveAsProperty.d.ts] +interface WithNonPrimitive { + foo: object; +} +declare var a: WithNonPrimitive; +declare var b: WithNonPrimitive; diff --git a/tests/baselines/reference/nonPrimitiveInFunction.js b/tests/baselines/reference/nonPrimitiveInFunction.js index a67b68542dd..1d2a2462502 100644 --- a/tests/baselines/reference/nonPrimitiveInFunction.js +++ b/tests/baselines/reference/nonPrimitiveInFunction.js @@ -34,3 +34,11 @@ function returnError() { var ret = 123; return ret; // expect error } + + +//// [nonPrimitiveInFunction.d.ts] +declare function takeObject(o: object): void; +declare function returnObject(): object; +declare var nonPrimitive: object; +declare var primitive: boolean; +declare function returnError(): object; diff --git a/tests/baselines/reference/nonPrimitiveInGeneric.js b/tests/baselines/reference/nonPrimitiveInGeneric.js index 2db357c3eb5..d7e013c71f1 100644 --- a/tests/baselines/reference/nonPrimitiveInGeneric.js +++ b/tests/baselines/reference/nonPrimitiveInGeneric.js @@ -73,3 +73,21 @@ var x; // error var y; // ok var z; // ok var u; // ok + + +//// [nonPrimitiveInGeneric.d.ts] +declare function generic(t: T): void; +declare var a: {}; +declare var b: string; +declare function bound(t: T): void; +declare function bound2(): void; +declare function bound3(t: T): void; +interface Proxy { +} +declare var x: Proxy; +declare var y: Proxy; +declare var z: Proxy; +interface Blah { + foo: number; +} +declare var u: Proxy; diff --git a/tests/baselines/reference/nonPrimitiveUnionIntersection.js b/tests/baselines/reference/nonPrimitiveUnionIntersection.js index c50a2330018..7f4b46c42ed 100644 --- a/tests/baselines/reference/nonPrimitiveUnionIntersection.js +++ b/tests/baselines/reference/nonPrimitiveUnionIntersection.js @@ -10,3 +10,8 @@ var a = ""; // error var b = ""; // ok a = b; // error b = a; // ok + + +//// [nonPrimitiveUnionIntersection.d.ts] +declare var a: object & string; +declare var b: object | string; diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts index ee4011ecf7d..3cd2ce4cef5 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveAsProperty.ts @@ -1,3 +1,4 @@ +// @declaration: true interface WithNonPrimitive { foo: object } diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts index c38693dbfb1..d56c02fafe9 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInFunction.ts @@ -1,3 +1,4 @@ +// @declaration: true function takeObject(o: object) {} function returnObject(): object { return {}; diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts index 836896b5a57..490a9f88135 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveInGeneric.ts @@ -1,3 +1,4 @@ +// @declaration: true function generic(t: T) { var o: object = t; // expect error } diff --git a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts index c1667c7a32e..a9d5872705c 100644 --- a/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts +++ b/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts @@ -1,3 +1,4 @@ +// @declaration: true var a: object & string = ""; // error var b: object | string = ""; // ok a = b; // error From f1e7142f3c7e74224a15780651f86330fbadfd90 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 17 Jan 2017 07:42:31 -0800 Subject: [PATCH 288/289] Move code out of closure in `getCompletionsAtPosition` --- src/services/completions.ts | 1145 ++++++++++++++++++----------------- 1 file changed, 573 insertions(+), 572 deletions(-) diff --git a/src/services/completions.ts b/src/services/completions.ts index 8c0d52b2c34..acb78772132 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,12 +1,14 @@ /* @internal */ namespace ts.Completions { - export function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo | undefined { + type Log = (message: string) => void; + + export function getCompletionsAtPosition(host: LanguageServiceHost, typeChecker: TypeChecker, log: Log, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number): CompletionInfo | undefined { if (isInReferenceComment(sourceFile, position)) { - return getTripleSlashReferenceCompletion(sourceFile, position); + return getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); } if (isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); + return getStringLiteralCompletionEntries(sourceFile, position, typeChecker, compilerOptions, host, log); } const completionData = getCompletionData(typeChecker, log, sourceFile, position); @@ -24,8 +26,8 @@ namespace ts.Completions { const entries: CompletionEntry[] = []; if (isSourceFileJavaScript(sourceFile)) { - const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + const uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); + addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); } else { if (!symbols || symbols.length === 0) { @@ -48,7 +50,7 @@ namespace ts.Completions { } } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true, typeChecker, compilerOptions.target, log); } // Add keywords if this is not a member completion list @@ -57,693 +59,692 @@ namespace ts.Completions { } return { isGlobalCompletion, isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries }; + } - function getJavaScriptCompletionEntries(sourceFile: SourceFile, position: number, uniqueNames: Map): CompletionEntry[] { - const entries: CompletionEntry[] = []; + function getJavaScriptCompletionEntries(sourceFile: SourceFile, position: number, uniqueNames: Map, target: ScriptTarget): CompletionEntry[] { + const entries: CompletionEntry[] = []; - const nameTable = getNameTable(sourceFile); - for (const name in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name] === position) { - continue; + const nameTable = getNameTable(sourceFile); + for (const name in nameTable) { + // Skip identifiers produced only from the current location + if (nameTable[name] === position) { + continue; + } + + if (!uniqueNames[name]) { + uniqueNames[name] = name; + const displayName = getCompletionEntryDisplayName(unescapeIdentifier(name), target, /*performCharacterChecks*/ true); + if (displayName) { + const entry = { + name: displayName, + kind: ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); } + } + } - if (!uniqueNames[name]) { - uniqueNames[name] = name; - const displayName = getCompletionEntryDisplayName(unescapeIdentifier(name), compilerOptions.target, /*performCharacterChecks*/ true); - if (displayName) { - const entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; + return entries; + } + + function createCompletionEntry(symbol: Symbol, location: Node, performCharacterChecks: boolean, typeChecker: TypeChecker, target: ScriptTarget): CompletionEntry { + // 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) + const displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + + // 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. + + // Use a 'sortText' of 0' so that all symbol completion entries come before any other + // entries (like JavaScript identifier entries). + return { + name: displayName, + kind: SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + + function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: Push, location: Node, performCharacterChecks: boolean, typeChecker: TypeChecker, target: ScriptTarget, log: Log): Map { + const start = timestamp(); + const uniqueNames = createMap(); + if (symbols) { + for (const symbol of symbols) { + const entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); + if (entry) { + const id = escapeIdentifier(entry.name); + if (!uniqueNames[id]) { entries.push(entry); + uniqueNames[id] = id; } } } - - return entries; } - function createCompletionEntry(symbol: Symbol, location: Node, performCharacterChecks: boolean): CompletionEntry { - // 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) - const displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - - // 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. - - // Use a 'sortText' of 0' so that all symbol completion entries come before any other - // entries (like JavaScript identifier entries). - return { - name: displayName, - kind: SymbolDisplay.getSymbolKind(typeChecker, symbol, location), - kindModifiers: SymbolDisplay.getSymbolModifiers(symbol), - sortText: "0", - }; + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile: SourceFile, position: number, typeChecker: TypeChecker, compilerOptions: CompilerOptions, host: LanguageServiceHost, log: Log): CompletionInfo | undefined { + const node = findPrecedingToken(position, sourceFile); + if (!node || node.kind !== SyntaxKind.StringLiteral) { + return undefined; } - function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[], location: Node, performCharacterChecks: boolean): Map { - const start = timestamp(); - const uniqueNames = createMap(); - if (symbols) { - for (const symbol of symbols) { - const entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - const id = escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start)); - return uniqueNames; + if (node.parent.kind === SyntaxKind.PropertyAssignment && + node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression && + (node.parent).name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent, typeChecker, compilerOptions.target, log); } - - function getStringLiteralCompletionEntries(sourceFile: SourceFile, position: number): CompletionInfo | undefined { - const node = findPrecedingToken(position, sourceFile); - if (!node || node.kind !== SyntaxKind.StringLiteral) { - return undefined; - } - - if (node.parent.kind === SyntaxKind.PropertyAssignment && - node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression && - (node.parent).name === node) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else if (node.parent.kind === SyntaxKind.ImportDeclaration || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isRequireCall(node.parent, false)) { - // Get all known external module names or complete a path to a module - // i.e. import * as ns from "/*completion position*/"; - // import x = require("/*completion position*/"); - // var y = require("/*completion position*/"); - return getStringLiteralCompletionEntriesFromModuleNames(node); - } - else { - const argumentInfo = SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); - } - - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } + else if (isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent, typeChecker, compilerOptions.target, log); } - - function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement): CompletionInfo | undefined { - const type = typeChecker.getContextualType((element.parent)); - const entries: CompletionEntry[] = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries }; - } - } + else if (node.parent.kind === SyntaxKind.ImportDeclaration || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isRequireCall(node.parent, false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return getStringLiteralCompletionEntriesFromModuleNames(node, compilerOptions, host, typeChecker); } - - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo): CompletionInfo | undefined { - const candidates: Signature[] = []; - const entries: CompletionEntry[] = []; - - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - - for (const candidate of candidates) { - addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries); + else { + const argumentInfo = SignatureHelp.getImmediatelyContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, typeChecker); } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromContextualType(node, typeChecker); + } + } + + function getStringLiteralCompletionEntriesFromPropertyAssignment(element: ObjectLiteralElement, typeChecker: TypeChecker, target: ScriptTarget, log: Log): CompletionInfo | undefined { + const type = typeChecker.getContextualType((element.parent)); + const entries: CompletionEntry[] = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/false, typeChecker, target, log); if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries }; + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries }; } + } + } - return undefined; + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo: SignatureHelp.ArgumentListInfo, typeChecker: TypeChecker): CompletionInfo | undefined { + const candidates: Signature[] = []; + const entries: CompletionEntry[] = []; + + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + + for (const candidate of candidates) { + addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker); } - function getStringLiteralCompletionEntriesFromElementAccess(node: ElementAccessExpression): CompletionInfo | undefined { - const type = typeChecker.getTypeAtLocation(node.expression); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries }; + } + + return undefined; + } + + function getStringLiteralCompletionEntriesFromElementAccess(node: ElementAccessExpression, typeChecker: TypeChecker, target: ScriptTarget, log: Log): CompletionInfo | undefined { + const type = typeChecker.getTypeAtLocation(node.expression); + const entries: CompletionEntry[] = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/false, typeChecker, target, log); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries }; + } + } + return undefined; + } + + function getStringLiteralCompletionEntriesFromContextualType(node: StringLiteral, typeChecker: TypeChecker): CompletionInfo | undefined { + const type = typeChecker.getContextualType(node); + if (type) { const entries: CompletionEntry[] = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/false); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries }; - } - } - return undefined; - } - - function getStringLiteralCompletionEntriesFromContextualType(node: StringLiteral): CompletionInfo | undefined { - const type = typeChecker.getContextualType(node); - if (type) { - const entries: CompletionEntry[] = []; - addStringLiteralCompletionsFromType(type, entries); - if (entries.length) { - return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; - } - } - return undefined; - } - - function addStringLiteralCompletionsFromType(type: Type, result: Push): void { - if (type && type.flags & TypeFlags.TypeParameter) { - type = typeChecker.getApparentType(type); - } - if (!type) { - return; - } - if (type.flags & TypeFlags.Union) { - for (const t of (type).types) { - addStringLiteralCompletionsFromType(t, result); - } - } - else if (type.flags & TypeFlags.StringLiteral) { - result.push({ - name: (type).text, - kindModifiers: ScriptElementKindModifier.none, - kind: ScriptElementKind.variableElement, - sortText: "0" - }); + addStringLiteralCompletionsFromType(type, entries, typeChecker); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; } } + return undefined; + } - function getStringLiteralCompletionEntriesFromModuleNames(node: StringLiteral): CompletionInfo { - const literalValue = normalizeSlashes(node.text); + function addStringLiteralCompletionsFromType(type: Type, result: Push, typeChecker: TypeChecker): void { + if (type && type.flags & TypeFlags.TypeParameter) { + type = typeChecker.getApparentType(type); + } + if (!type) { + return; + } + if (type.flags & TypeFlags.Union) { + for (const t of (type).types) { + addStringLiteralCompletionsFromType(t, result, typeChecker); + } + } + else if (type.flags & TypeFlags.StringLiteral) { + result.push({ + name: (type).text, + kindModifiers: ScriptElementKindModifier.none, + kind: ScriptElementKind.variableElement, + sortText: "0" + }); + } + } - const scriptPath = node.getSourceFile().path; - const scriptDirectory = getDirectoryPath(scriptPath); + function getStringLiteralCompletionEntriesFromModuleNames(node: StringLiteral, compilerOptions: CompilerOptions, host: LanguageServiceHost, typeChecker: TypeChecker): CompletionInfo { + const literalValue = normalizeSlashes(node.text); - const span = getDirectoryFragmentTextSpan((node).text, node.getStart() + 1); - let entries: CompletionEntry[]; - if (isPathRelativeToScript(literalValue) || isRootedDiskPath(literalValue)) { - if (compilerOptions.rootDirs) { - entries = getCompletionEntriesForDirectoryFragmentWithRootDirs( - compilerOptions.rootDirs, literalValue, scriptDirectory, getSupportedExtensions(compilerOptions), /*includeExtensions*/false, span, scriptPath); - } - else { - entries = getCompletionEntriesForDirectoryFragment( - literalValue, scriptDirectory, getSupportedExtensions(compilerOptions), /*includeExtensions*/false, span, scriptPath); - } + const scriptPath = node.getSourceFile().path; + const scriptDirectory = getDirectoryPath(scriptPath); + + const span = getDirectoryFragmentTextSpan((node).text, node.getStart() + 1); + let entries: CompletionEntry[]; + if (isPathRelativeToScript(literalValue) || isRootedDiskPath(literalValue)) { + const extensions = getSupportedExtensions(compilerOptions); + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs( + compilerOptions.rootDirs, literalValue, scriptDirectory, extensions, /*includeExtensions*/false, span, compilerOptions, host, scriptPath); } else { - // Check for node modules - entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + entries = getCompletionEntriesForDirectoryFragment( + literalValue, scriptDirectory, extensions, /*includeExtensions*/false, span, host, scriptPath); } - return { - isGlobalCompletion: false, - isMemberCompletion: false, - isNewIdentifierLocation: true, - entries - }; } + else { + // Check for node modules + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span, compilerOptions, host, typeChecker); + } + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries + }; + } + + /** + * Takes a script path and returns paths for all potential folders that could be merged with its + * containing folder via the "rootDirs" compiler option + */ + function getBaseDirectoriesFromRootDirs(rootDirs: string[], basePath: string, scriptPath: string, ignoreCase: boolean): string[] { + // Make all paths absolute/normalized if they are not already + rootDirs = map(rootDirs, rootDirectory => normalizePath(isRootedDiskPath(rootDirectory) ? rootDirectory : combinePaths(basePath, rootDirectory))); + + // Determine the path to the directory containing the script relative to the root directory it is contained within + let relativeDirectory: string; + for (const rootDirectory of rootDirs) { + if (containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; + } + } + + // Now find a path for each potential directory that is to be merged with the one containing the script + return deduplicate(map(rootDirs, rootDirectory => combinePaths(rootDirectory, relativeDirectory))); + } + + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs: string[], fragment: string, scriptPath: string, extensions: string[], includeExtensions: boolean, span: TextSpan, compilerOptions: CompilerOptions, host: LanguageServiceHost, exclude?: string): CompletionEntry[] { + const basePath = compilerOptions.project || host.getCurrentDirectory(); + const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + + const result: CompletionEntry[] = []; + + for (const baseDirectory of baseDirectories) { + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, host, exclude, result); + } + + return result; + } + + /** + * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + */ + function getCompletionEntriesForDirectoryFragment(fragment: string, scriptPath: string, extensions: string[], includeExtensions: boolean, span: TextSpan, host: LanguageServiceHost, exclude?: string, result: CompletionEntry[] = []): CompletionEntry[] { + if (fragment === undefined) { + fragment = ""; + } + + fragment = normalizeSlashes(fragment); /** - * Takes a script path and returns paths for all potential folders that could be merged with its - * containing folder via the "rootDirs" compiler option + * Remove the basename from the path. Note that we don't use the basename to filter completions; + * the client is responsible for refining completions. */ - function getBaseDirectoriesFromRootDirs(rootDirs: string[], basePath: string, scriptPath: string, ignoreCase: boolean): string[] { - // Make all paths absolute/normalized if they are not already - rootDirs = map(rootDirs, rootDirectory => normalizePath(isRootedDiskPath(rootDirectory) ? rootDirectory : combinePaths(basePath, rootDirectory))); + fragment = getDirectoryPath(fragment); - // Determine the path to the directory containing the script relative to the root directory it is contained within - let relativeDirectory: string; - for (const rootDirectory of rootDirs) { - if (containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } - - // Now find a path for each potential directory that is to be merged with the one containing the script - return deduplicate(map(rootDirs, rootDirectory => combinePaths(rootDirectory, relativeDirectory))); + if (fragment === "") { + fragment = "." + directorySeparator; } - function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs: string[], fragment: string, scriptPath: string, extensions: string[], includeExtensions: boolean, span: TextSpan, exclude?: string): CompletionEntry[] { - const basePath = compilerOptions.project || host.getCurrentDirectory(); - const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + fragment = ensureTrailingDirectorySeparator(fragment); - const result: CompletionEntry[] = []; + const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); + const baseDirectory = getDirectoryPath(absolutePath); + const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - for (const baseDirectory of baseDirectories) { - getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); - } + if (tryDirectoryExists(host, baseDirectory)) { + // Enumerate the available files if possible + const files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/undefined, /*include*/["./*"]); - return result; - } - - /** - * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. - */ - function getCompletionEntriesForDirectoryFragment(fragment: string, scriptPath: string, extensions: string[], includeExtensions: boolean, span: TextSpan, exclude?: string, result: CompletionEntry[] = []): CompletionEntry[] { - if (fragment === undefined) { - fragment = ""; - } - - fragment = normalizeSlashes(fragment); - - /** - * Remove the basename from the path. Note that we don't use the basename to filter completions; - * the client is responsible for refining completions. - */ - fragment = getDirectoryPath(fragment); - - if (fragment === "") { - fragment = "." + directorySeparator; - } - - fragment = ensureTrailingDirectorySeparator(fragment); - - const absolutePath = normalizeAndPreserveTrailingSlash(isRootedDiskPath(fragment) ? fragment : combinePaths(scriptPath, fragment)); - const baseDirectory = getDirectoryPath(absolutePath); - const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); - - if (tryDirectoryExists(host, baseDirectory)) { - // Enumerate the available files if possible - const files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/undefined, /*include*/["./*"]); - - if (files) { - /** - * Multiple file entries might map to the same truncated name once we remove extensions - * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: - * - * both foo.ts and foo.tsx become foo - */ - const foundFiles = createMap(); - for (let filePath of files) { - filePath = normalizePath(filePath); - if (exclude && comparePaths(filePath, exclude, scriptPath, ignoreCase) === Comparison.EqualTo) { - continue; - } - - const foundFileName = includeExtensions ? getBaseFileName(filePath) : removeFileExtension(getBaseFileName(filePath)); - - if (!foundFiles[foundFileName]) { - foundFiles[foundFileName] = true; - } + if (files) { + /** + * Multiple file entries might map to the same truncated name once we remove extensions + * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: + * + * both foo.ts and foo.tsx become foo + */ + const foundFiles = createMap(); + for (let filePath of files) { + filePath = normalizePath(filePath); + if (exclude && comparePaths(filePath, exclude, scriptPath, ignoreCase) === Comparison.EqualTo) { + continue; } - for (const foundFile in foundFiles) { - result.push(createCompletionEntryForModule(foundFile, ScriptElementKind.scriptElement, span)); + const foundFileName = includeExtensions ? getBaseFileName(filePath) : removeFileExtension(getBaseFileName(filePath)); + + if (!foundFiles[foundFileName]) { + foundFiles[foundFileName] = true; } } - // If possible, get folder completion as well - const directories = tryGetDirectories(host, baseDirectory); - - if (directories) { - for (const directory of directories) { - const directoryName = getBaseFileName(normalizePath(directory)); - - result.push(createCompletionEntryForModule(directoryName, ScriptElementKind.directory, span)); - } + for (const foundFile in foundFiles) { + result.push(createCompletionEntryForModule(foundFile, ScriptElementKind.scriptElement, span)); } } - return result; + // If possible, get folder completion as well + const directories = tryGetDirectories(host, baseDirectory); + + if (directories) { + for (const directory of directories) { + const directoryName = getBaseFileName(normalizePath(directory)); + + result.push(createCompletionEntryForModule(directoryName, ScriptElementKind.directory, span)); + } + } } - /** - * Check all of the declared modules and those in node modules. Possible sources of modules: - * Modules that are found by the type checker - * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) - * Modules from node_modules (i.e. those listed in package.json) - * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions - */ - function getCompletionEntriesForNonRelativeModules(fragment: string, scriptPath: string, span: TextSpan): CompletionEntry[] { - const { baseUrl, paths } = compilerOptions; + return result; + } - let result: CompletionEntry[]; + /** + * Check all of the declared modules and those in node modules. Possible sources of modules: + * Modules that are found by the type checker + * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) + * Modules from node_modules (i.e. those listed in package.json) + * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions + */ + function getCompletionEntriesForNonRelativeModules(fragment: string, scriptPath: string, span: TextSpan, compilerOptions: CompilerOptions, host: LanguageServiceHost, typeChecker: TypeChecker): CompletionEntry[] { + const { baseUrl, paths } = compilerOptions; - if (baseUrl) { - const fileExtensions = getSupportedExtensions(compilerOptions); - const projectDir = compilerOptions.project || host.getCurrentDirectory(); - const absolute = isRootedDiskPath(baseUrl) ? baseUrl : combinePaths(projectDir, baseUrl); - result = getCompletionEntriesForDirectoryFragment(fragment, normalizePath(absolute), fileExtensions, /*includeExtensions*/false, span); + let result: CompletionEntry[]; - if (paths) { - for (const path in paths) { - if (paths.hasOwnProperty(path)) { - if (path === "*") { - if (paths[path]) { - for (const pattern of paths[path]) { - for (const match of getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions)) { - result.push(createCompletionEntryForModule(match, ScriptElementKind.externalModuleName, span)); - } + if (baseUrl) { + const fileExtensions = getSupportedExtensions(compilerOptions); + const projectDir = compilerOptions.project || host.getCurrentDirectory(); + const absolute = isRootedDiskPath(baseUrl) ? baseUrl : combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, normalizePath(absolute), fileExtensions, /*includeExtensions*/false, span, host); + + if (paths) { + for (const path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (const pattern of paths[path]) { + for (const match of getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host)) { + result.push(createCompletionEntryForModule(match, ScriptElementKind.externalModuleName, span)); } } } - else if (startsWith(path, fragment)) { - const entry = paths[path] && paths[path].length === 1 && paths[path][0]; - if (entry) { - result.push(createCompletionEntryForModule(path, ScriptElementKind.externalModuleName, span)); - } + } + else if (startsWith(path, fragment)) { + const entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ScriptElementKind.externalModuleName, span)); } } } } } - else { - result = []; - } - - getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - - for (const moduleName of enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions)) { - result.push(createCompletionEntryForModule(moduleName, ScriptElementKind.externalModuleName, span)); - } - - return result; + } + else { + result = []; } - function getModulesForPathsPattern(fragment: string, baseUrl: string, pattern: string, fileExtensions: string[]): string[] { - if (host.readDirectory) { - const parsed = hasZeroOrOneAsteriskCharacter(pattern) ? tryParsePattern(pattern) : undefined; - if (parsed) { - // The prefix has two effective parts: the directory path and the base component after the filepath that is not a - // full directory component. For example: directory/path/of/prefix/base* - const normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); - const normalizedPrefixDirectory = getDirectoryPath(normalizedPrefix); - const normalizedPrefixBase = getBaseFileName(normalizedPrefix); + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); - const fragmentHasPath = fragment.indexOf(directorySeparator) !== -1; + for (const moduleName of enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host)) { + result.push(createCompletionEntryForModule(moduleName, ScriptElementKind.externalModuleName, span)); + } - // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call - const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory; + return result; + } - const normalizedSuffix = normalizePath(parsed.suffix); - const baseDirectory = combinePaths(baseUrl, expandedPrefixDirectory); - const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + function getModulesForPathsPattern(fragment: string, baseUrl: string, pattern: string, fileExtensions: string[], host: LanguageServiceHost): string[] { + if (host.readDirectory) { + const parsed = hasZeroOrOneAsteriskCharacter(pattern) ? tryParsePattern(pattern) : undefined; + if (parsed) { + // The prefix has two effective parts: the directory path and the base component after the filepath that is not a + // full directory component. For example: directory/path/of/prefix/base* + const normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + const normalizedPrefixDirectory = getDirectoryPath(normalizedPrefix); + const normalizedPrefixBase = getBaseFileName(normalizedPrefix); - // If we have a suffix, then we need to read the directory all the way down. We could create a glob - // that encodes the suffix, but we would have to escape the character "?" which readDirectory - // doesn't support. For now, this is safer but slower - const includeGlob = normalizedSuffix ? "**/*" : "./*"; + const fragmentHasPath = fragment.indexOf(directorySeparator) !== -1; - const matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); - if (matches) { - const result: string[] = []; + // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call + const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory; - // Trim away prefix and suffix - for (const match of matches) { - const normalizedMatch = normalizePath(match); - if (!endsWith(normalizedMatch, normalizedSuffix) || !startsWith(normalizedMatch, completePrefix)) { - continue; - } + const normalizedSuffix = normalizePath(parsed.suffix); + const baseDirectory = combinePaths(baseUrl, expandedPrefixDirectory); + const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; - const start = completePrefix.length; - const length = normalizedMatch.length - start - normalizedSuffix.length; + // If we have a suffix, then we need to read the directory all the way down. We could create a glob + // that encodes the suffix, but we would have to escape the character "?" which readDirectory + // doesn't support. For now, this is safer but slower + const includeGlob = normalizedSuffix ? "**/*" : "./*"; - result.push(removeFileExtension(normalizedMatch.substr(start, length))); + const matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + const result: string[] = []; + + // Trim away prefix and suffix + for (const match of matches) { + const normalizedMatch = normalizePath(match); + if (!endsWith(normalizedMatch, normalizedSuffix) || !startsWith(normalizedMatch, completePrefix)) { + continue; + } + + const start = completePrefix.length; + const length = normalizedMatch.length - start - normalizedSuffix.length; + + result.push(removeFileExtension(normalizedMatch.substr(start, length))); + } + return result; + } + } + } + + return undefined; + } + + function enumeratePotentialNonRelativeModules(fragment: string, scriptPath: string, options: CompilerOptions, typeChecker: TypeChecker, host: LanguageServiceHost): string[] { + // Check If this is a nested module + const isNestedModule = fragment.indexOf(directorySeparator) !== -1; + const moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(directorySeparator)) : undefined; + + // Get modules that the type checker picked up + const ambientModules = map(typeChecker.getAmbientModules(), sym => stripQuotes(sym.name)); + let nonRelativeModules = filter(ambientModules, moduleName => startsWith(moduleName, fragment)); + + // Nested modules of the form "module-name/sub" need to be adjusted to only return the string + // after the last '/' that appears in the fragment because that's where the replacement span + // starts + if (isNestedModule) { + const moduleNameWithSeperator = ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = map(nonRelativeModules, moduleName => { + if (startsWith(fragment, moduleNameWithSeperator)) { + return moduleName.substr(moduleNameWithSeperator.length); + } + return moduleName; + }); + } + + + if (!options.moduleResolution || options.moduleResolution === ModuleResolutionKind.NodeJs) { + for (const visibleModule of enumerateNodeModulesVisibleToScript(host, scriptPath)) { + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (startsWith(visibleModule.moduleName, moduleNameFragment)) { + const nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, supportedTypeScriptExtensions, /*exclude*/undefined, /*include*/["./*"]); + if (nestedFiles) { + for (let f of nestedFiles) { + f = normalizePath(f); + const nestedModule = removeFileExtension(getBaseFileName(f)); + nonRelativeModules.push(nestedModule); } - return result; } } } + } + return deduplicate(nonRelativeModules); + } + + function getTripleSlashReferenceCompletion(sourceFile: SourceFile, position: number, compilerOptions: CompilerOptions, host: LanguageServiceHost): CompletionInfo { + const token = getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + const commentRanges: CommentRange[] = getLeadingCommentRanges(sourceFile.text, token.pos); + + if (!commentRanges || !commentRanges.length) { return undefined; } - function enumeratePotentialNonRelativeModules(fragment: string, scriptPath: string, options: CompilerOptions): string[] { - // Check If this is a nested module - const isNestedModule = fragment.indexOf(directorySeparator) !== -1; - const moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(directorySeparator)) : undefined; + const range = forEach(commentRanges, commentRange => position >= commentRange.pos && position <= commentRange.end && commentRange); - // Get modules that the type checker picked up - const ambientModules = map(typeChecker.getAmbientModules(), sym => stripQuotes(sym.name)); - let nonRelativeModules = filter(ambientModules, moduleName => startsWith(moduleName, fragment)); - - // Nested modules of the form "module-name/sub" need to be adjusted to only return the string - // after the last '/' that appears in the fragment because that's where the replacement span - // starts - if (isNestedModule) { - const moduleNameWithSeperator = ensureTrailingDirectorySeparator(moduleNameFragment); - nonRelativeModules = map(nonRelativeModules, moduleName => { - if (startsWith(fragment, moduleNameWithSeperator)) { - return moduleName.substr(moduleNameWithSeperator.length); - } - return moduleName; - }); - } - - - if (!options.moduleResolution || options.moduleResolution === ModuleResolutionKind.NodeJs) { - for (const visibleModule of enumerateNodeModulesVisibleToScript(host, scriptPath)) { - if (!isNestedModule) { - nonRelativeModules.push(visibleModule.moduleName); - } - else if (startsWith(visibleModule.moduleName, moduleNameFragment)) { - const nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, supportedTypeScriptExtensions, /*exclude*/undefined, /*include*/["./*"]); - if (nestedFiles) { - for (let f of nestedFiles) { - f = normalizePath(f); - const nestedModule = removeFileExtension(getBaseFileName(f)); - nonRelativeModules.push(nestedModule); - } - } - } - } - } - - return deduplicate(nonRelativeModules); + if (!range) { + return undefined; } - function getTripleSlashReferenceCompletion(sourceFile: SourceFile, position: number): CompletionInfo { - const token = getTokenAtPosition(sourceFile, position); - if (!token) { - return undefined; + const completionInfo: CompletionInfo = { + /** + * We don't want the editor to offer any other completions, such as snippets, inside a comment. + */ + isGlobalCompletion: false, + isMemberCompletion: false, + /** + * The user may type in a path that doesn't yet exist, creating a "new identifier" + * with respect to the collection of identifiers the server is aware of. + */ + isNewIdentifierLocation: true, + + entries: [] + }; + + const text = sourceFile.text.substr(range.pos, position - range.pos); + + const match = tripleSlashDirectiveFragmentRegex.exec(text); + + if (match) { + const prefix = match[1]; + const kind = match[2]; + const toComplete = match[3]; + + const scriptPath = getDirectoryPath(sourceFile.path); + if (kind === "path") { + // Give completions for a relative path + const span: TextSpan = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getSupportedExtensions(compilerOptions), /*includeExtensions*/true, span, host, sourceFile.path); } - const commentRanges: CommentRange[] = getLeadingCommentRanges(sourceFile.text, token.pos); - - if (!commentRanges || !commentRanges.length) { - return undefined; + else { + // Give completions based on the typings available + const span: TextSpan = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span); } - - const range = forEach(commentRanges, commentRange => position >= commentRange.pos && position <= commentRange.end && commentRange); - - if (!range) { - return undefined; - } - - const completionInfo: CompletionInfo = { - /** - * We don't want the editor to offer any other completions, such as snippets, inside a comment. - */ - isGlobalCompletion: false, - isMemberCompletion: false, - /** - * The user may type in a path that doesn't yet exist, creating a "new identifier" - * with respect to the collection of identifiers the server is aware of. - */ - isNewIdentifierLocation: true, - - entries: [] - }; - - const text = sourceFile.text.substr(range.pos, position - range.pos); - - const match = tripleSlashDirectiveFragmentRegex.exec(text); - - if (match) { - const prefix = match[1]; - const kind = match[2]; - const toComplete = match[3]; - - const scriptPath = getDirectoryPath(sourceFile.path); - if (kind === "path") { - // Give completions for a relative path - const span: TextSpan = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); - completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, getSupportedExtensions(compilerOptions), /*includeExtensions*/true, span, sourceFile.path); - } - else { - // Give completions based on the typings available - const span: TextSpan = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; - completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span); - } - } - - return completionInfo; } - function getCompletionEntriesFromTypings(host: LanguageServiceHost, options: CompilerOptions, scriptPath: string, span: TextSpan, result: CompletionEntry[] = []): CompletionEntry[] { - // Check for typings specified in compiler options - if (options.types) { - for (const moduleName of options.types) { - result.push(createCompletionEntryForModule(moduleName, ScriptElementKind.externalModuleName, span)); - } - } - else if (host.getDirectories) { - let typeRoots: string[]; - try { - // Wrap in try catch because getEffectiveTypeRoots touches the filesystem - typeRoots = getEffectiveTypeRoots(options, host); - } - catch (e) {} + return completionInfo; + } - if (typeRoots) { - for (const root of typeRoots) { - getCompletionEntriesFromDirectories(host, root, span, result); - } - } + function getCompletionEntriesFromTypings(host: LanguageServiceHost, options: CompilerOptions, scriptPath: string, span: TextSpan, result: CompletionEntry[] = []): CompletionEntry[] { + // Check for typings specified in compiler options + if (options.types) { + for (const moduleName of options.types) { + result.push(createCompletionEntryForModule(moduleName, ScriptElementKind.externalModuleName, span)); } - - if (host.getDirectories) { - // Also get all @types typings installed in visible node_modules directories - for (const packageJson of findPackageJsons(scriptPath)) { - const typesDir = combinePaths(getDirectoryPath(packageJson), "node_modules/@types"); - getCompletionEntriesFromDirectories(host, typesDir, span, result); - } - } - - return result; } + else if (host.getDirectories) { + let typeRoots: string[]; + try { + // Wrap in try catch because getEffectiveTypeRoots touches the filesystem + typeRoots = getEffectiveTypeRoots(options, host); + } + catch (e) {} - function getCompletionEntriesFromDirectories(host: LanguageServiceHost, directory: string, span: TextSpan, result: CompletionEntry[]) { - if (host.getDirectories && tryDirectoryExists(host, directory)) { - const directories = tryGetDirectories(host, directory); - if (directories) { - for (let typeDirectory of directories) { - typeDirectory = normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(getBaseFileName(typeDirectory), ScriptElementKind.externalModuleName, span)); - } + if (typeRoots) { + for (const root of typeRoots) { + getCompletionEntriesFromDirectories(host, root, span, result); } } } - function findPackageJsons(currentDir: string): string[] { - const paths: string[] = []; - let currentConfigPath: string; - while (true) { - currentConfigPath = findConfigFile(currentDir, (f) => tryFileExists(host, f), "package.json"); - if (currentConfigPath) { - paths.push(currentConfigPath); + if (host.getDirectories) { + // Also get all @types typings installed in visible node_modules directories + for (const packageJson of findPackageJsons(scriptPath, host)) { + const typesDir = combinePaths(getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); + } + } - currentDir = getDirectoryPath(currentConfigPath); - const parent = getDirectoryPath(currentDir); - if (currentDir === parent) { - break; - } - currentDir = parent; + return result; + } + + function getCompletionEntriesFromDirectories(host: LanguageServiceHost, directory: string, span: TextSpan, result: Push) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + const directories = tryGetDirectories(host, directory); + if (directories) { + for (let typeDirectory of directories) { + typeDirectory = normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(getBaseFileName(typeDirectory), ScriptElementKind.externalModuleName, span)); } - else { + } + } + } + + function findPackageJsons(currentDir: string, host: LanguageServiceHost): string[] { + const paths: string[] = []; + let currentConfigPath: string; + while (true) { + currentConfigPath = findConfigFile(currentDir, (f) => tryFileExists(host, f), "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + + currentDir = getDirectoryPath(currentConfigPath); + const parent = getDirectoryPath(currentDir); + if (currentDir === parent) { break; } + currentDir = parent; + } + else { + break; } - - return paths; } + return paths; + } - function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string) { - const result: VisibleModuleInfo[] = []; + function enumerateNodeModulesVisibleToScript(host: LanguageServiceHost, scriptPath: string) { + const result: VisibleModuleInfo[] = []; - if (host.readFile && host.fileExists) { - for (const packageJson of findPackageJsons(scriptPath)) { - const contents = tryReadingPackageJson(packageJson); - if (!contents) { - return; - } - - const nodeModulesDir = combinePaths(getDirectoryPath(packageJson), "node_modules"); - const foundModuleNames: string[] = []; - - // Provide completions for all non @types dependencies - for (const key of nodeModulesDependencyKeys) { - addPotentialPackageNames(contents[key], foundModuleNames); - } - - for (const moduleName of foundModuleNames) { - const moduleDir = combinePaths(nodeModulesDir, moduleName); - result.push({ - moduleName, - moduleDir - }); - } + if (host.readFile && host.fileExists) { + for (const packageJson of findPackageJsons(scriptPath, host)) { + const contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; } - } - return result; + const nodeModulesDir = combinePaths(getDirectoryPath(packageJson), "node_modules"); + const foundModuleNames: string[] = []; - function tryReadingPackageJson(filePath: string) { - try { - const fileText = tryReadFile(host, filePath); - return fileText ? JSON.parse(fileText) : undefined; + // Provide completions for all non @types dependencies + for (const key of nodeModulesDependencyKeys) { + addPotentialPackageNames(contents[key], foundModuleNames); } - catch (e) { - return undefined; - } - } - function addPotentialPackageNames(dependencies: any, result: string[]) { - if (dependencies) { - for (const dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !startsWith(dep, "@types/")) { - result.push(dep); - } - } + for (const moduleName of foundModuleNames) { + const moduleDir = combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName, + moduleDir + }); } } } - function createCompletionEntryForModule(name: string, kind: string, replacementSpan: TextSpan): CompletionEntry { - return { name, kind, kindModifiers: ScriptElementKindModifier.none, sortText: name, replacementSpan }; - } + return result; - // Replace everything after the last directory seperator that appears - function getDirectoryFragmentTextSpan(text: string, textStart: number): TextSpan { - const index = text.lastIndexOf(directorySeparator); - const offset = index !== -1 ? index + 1 : 0; - return { start: textStart + offset, length: text.length - offset }; - } - - // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) - function isPathRelativeToScript(path: string) { - if (path && path.length >= 2 && path.charCodeAt(0) === CharacterCodes.dot) { - const slashIndex = path.length >= 3 && path.charCodeAt(1) === CharacterCodes.dot ? 2 : 1; - const slashCharCode = path.charCodeAt(slashIndex); - return slashCharCode === CharacterCodes.slash || slashCharCode === CharacterCodes.backslash; + function tryReadingPackageJson(filePath: string) { + try { + const fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; } - return false; } - function normalizeAndPreserveTrailingSlash(path: string) { - return hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalizePath(path)) : normalizePath(path); + function addPotentialPackageNames(dependencies: any, result: string[]) { + if (dependencies) { + for (const dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !startsWith(dep, "@types/")) { + result.push(dep); + } + } + } } } + function createCompletionEntryForModule(name: string, kind: string, replacementSpan: TextSpan): CompletionEntry { + return { name, kind, kindModifiers: ScriptElementKindModifier.none, sortText: name, replacementSpan }; + } + + // Replace everything after the last directory seperator that appears + function getDirectoryFragmentTextSpan(text: string, textStart: number): TextSpan { + const index = text.lastIndexOf(directorySeparator); + const offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + + // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) + function isPathRelativeToScript(path: string) { + if (path && path.length >= 2 && path.charCodeAt(0) === CharacterCodes.dot) { + const slashIndex = path.length >= 3 && path.charCodeAt(1) === CharacterCodes.dot ? 2 : 1; + const slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === CharacterCodes.slash || slashCharCode === CharacterCodes.backslash; + } + return false; + } + + function normalizeAndPreserveTrailingSlash(path: string) { + return hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalizePath(path)) : normalizePath(path); + } + export function getCompletionEntryDetails(typeChecker: TypeChecker, log: (message: string) => void, compilerOptions: CompilerOptions, sourceFile: SourceFile, position: number, entryName: string): CompletionEntryDetails { // Compute all the completion symbols again. const completionData = getCompletionData(typeChecker, log, sourceFile, position); From 9fbadfdc67809636a580cd939ea7f815b8214a91 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 17 Jan 2017 08:02:39 -0800 Subject: [PATCH 289/289] Move `"types": []` to tsconfig-base --- src/compiler/tsconfig.json | 3 +-- src/services/tsconfig.json | 3 +-- src/tsconfig-base.json | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 1ed009444b1..52bb92ee1f0 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "removeComments": true, "outFile": "../../built/local/tsc.js", - "declaration": true, - "types": [ ] + "declaration": true }, "files": [ "core.ts", diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 13686d232a1..b60e00292f5 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "removeComments": false, "outFile": "../../built/local/typescriptServices.js", - "declaration": true, - "types": [] + "declaration": true }, "files": [ "../compiler/core.ts", diff --git a/src/tsconfig-base.json b/src/tsconfig-base.json index b4c82dbeeee..2eb1851dc5c 100644 --- a/src/tsconfig-base.json +++ b/src/tsconfig-base.json @@ -9,6 +9,7 @@ "preserveConstEnums": true, "stripInternal": true, "sourceMap": true, - "target": "es5" + "target": "es5", + "types": [] } } \ No newline at end of file

= (func: HTML) => {}; + +declare var h: HTML; +h.div(h); \ No newline at end of file diff --git a/tests/cases/compiler/nestedFreshLiteral.ts b/tests/cases/compiler/nestedFreshLiteral.ts new file mode 100644 index 00000000000..bf3bf5df8d3 --- /dev/null +++ b/tests/cases/compiler/nestedFreshLiteral.ts @@ -0,0 +1,14 @@ +// @strictNullChecks: true +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} \ No newline at end of file diff --git a/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts new file mode 100644 index 00000000000..25b351d62a1 --- /dev/null +++ b/tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts @@ -0,0 +1,13 @@ +// @target: es5 +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; \ No newline at end of file diff --git a/tests/cases/compiler/objectFreeze.ts b/tests/cases/compiler/objectFreeze.ts new file mode 100644 index 00000000000..5e8539831b1 --- /dev/null +++ b/tests/cases/compiler/objectFreeze.ts @@ -0,0 +1,12 @@ +const f = Object.freeze(function foo(a: number, b: string) { return false; }); +f(1, "") === false; + +class C { constructor(a: number) { } } +const c = Object.freeze(C); +new c(1); + +const a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); + +const o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); diff --git a/tests/cases/compiler/restIntersection.ts b/tests/cases/compiler/restIntersection.ts new file mode 100644 index 00000000000..5fca2dafc36 --- /dev/null +++ b/tests/cases/compiler/restIntersection.ts @@ -0,0 +1,4 @@ +var intersection: { x: number, y: number } & { w: string, z: string }; + +var rest1: { y: number, w: string, z: string }; +var {x, ...rest1 } = intersection; diff --git a/tests/cases/compiler/restInvalidArgumentType.ts b/tests/cases/compiler/restInvalidArgumentType.ts new file mode 100644 index 00000000000..488f546e231 --- /dev/null +++ b/tests/cases/compiler/restInvalidArgumentType.ts @@ -0,0 +1,59 @@ +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + + var {...r4} = i; // Error, index access + var {...r5} = k; // Error, index + + var {...r6} = mapped_generic; // Error, generic mapped object type + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + var {...r9} = union_primitive; // Error, union with generic type parameter + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + + var {...r12} = num; // Error + var {...r13} = str; // Error + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + var {...r18} = literal_number; // Error + + var {...r19} = e; // Error, enum +} \ No newline at end of file diff --git a/tests/cases/compiler/restUnion.ts b/tests/cases/compiler/restUnion.ts new file mode 100644 index 00000000000..c838b37340f --- /dev/null +++ b/tests/cases/compiler/restUnion.ts @@ -0,0 +1,14 @@ +var union: { a: number, c: boolean } | { a: string, b: string }; + +var rest1: { c: boolean } | { b: string }; +var {a, ...rest1 } = union; + + +var undefinedUnion: { n: number } | undefined; +var rest2: {}; +var {n, ...rest2 } = undefinedUnion; + + +var nullUnion: { n: number } | null; +var rest3: {}; +var {n, ...rest3 } = nullUnion; diff --git a/tests/cases/compiler/restUnion2.ts b/tests/cases/compiler/restUnion2.ts new file mode 100644 index 00000000000..83d94e03a73 --- /dev/null +++ b/tests/cases/compiler/restUnion2.ts @@ -0,0 +1,19 @@ +// @strictNullChecks: true + +declare const undefinedUnion: { n: number } | undefined; +var rest2: { n: number }; +var {...rest2 } = undefinedUnion; + + +declare const nullUnion: { n: number } | null; +var rest3: { n: number }; +var {...rest3 } = nullUnion; + + +declare const nullAndUndefinedUnion: null | undefined; +var rest4: { }; +var {...rest4 } = nullAndUndefinedUnion; + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +var rest5: { n: number, s: string }; +var {...rest5 } = unionWithIntersection; \ No newline at end of file diff --git a/tests/cases/compiler/selfReferencingSpreadInLoop.ts b/tests/cases/compiler/selfReferencingSpreadInLoop.ts new file mode 100644 index 00000000000..0900e6cad63 --- /dev/null +++ b/tests/cases/compiler/selfReferencingSpreadInLoop.ts @@ -0,0 +1,5 @@ +// @noImplicitAny: true +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} diff --git a/tests/cases/compiler/spreadIntersection.ts b/tests/cases/compiler/spreadIntersection.ts new file mode 100644 index 00000000000..3b397dc40cc --- /dev/null +++ b/tests/cases/compiler/spreadIntersection.ts @@ -0,0 +1,7 @@ +var intersection: { a: number } & { b: string }; + +var o1: { a: number, b: string }; +var o1 = { ...intersection }; + +var o2: { a: number, b: string, c: boolean }; +var o2 = { ...intersection, c: false }; \ No newline at end of file diff --git a/tests/cases/compiler/spreadInvalidArgumentType.ts b/tests/cases/compiler/spreadInvalidArgumentType.ts new file mode 100644 index 00000000000..2ac6aa921f4 --- /dev/null +++ b/tests/cases/compiler/spreadInvalidArgumentType.ts @@ -0,0 +1,59 @@ +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + + var o4 = { ...i }; // Error, index access + var o5 = { ...k }; // Error, index + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + var o9 = { ...union_primitive }; // Error, union with generic type parameter + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + + var o12 = { ...num }; // Error + var o13 = { ...str }; // Error + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + var o18 = { ...literal_number }; // Error + + var o19 = { ...e }; // Error, enum +} \ No newline at end of file diff --git a/tests/cases/compiler/spreadUnion.ts b/tests/cases/compiler/spreadUnion.ts new file mode 100644 index 00000000000..ef8440122ed --- /dev/null +++ b/tests/cases/compiler/spreadUnion.ts @@ -0,0 +1,10 @@ +var union: { a: number } | { b: string }; + +var o3: { a: number } | { b: string }; +var o3 = { ...union }; + +var o4: { a: boolean } | { b: string , a: boolean}; +var o4 = { ...union, a: false }; + +var o5: { a: number } | { b: string } | { a: number, b: string }; +var o5 = { ...union, ...union }; \ No newline at end of file diff --git a/tests/cases/compiler/spreadUnion2.ts b/tests/cases/compiler/spreadUnion2.ts new file mode 100644 index 00000000000..25dba81c0df --- /dev/null +++ b/tests/cases/compiler/spreadUnion2.ts @@ -0,0 +1,25 @@ +// @strictNullChecks: true + +declare const undefinedUnion: { a: number } | undefined; +declare const nullUnion: { b: number } | null; +declare const nullAndUndefinedUnion: null | undefined; + +var o1: { a: number }; +var o1 = { ...undefinedUnion }; + +var o2: { b: number }; +var o2 = { ...nullUnion }; + +var o3: { a: number, b: number }; +var o3 = { ...undefinedUnion, ...nullUnion }; +var o3 = { ...nullUnion, ...undefinedUnion }; + +var o4: { a: number }; +var o4 = { ...undefinedUnion, ...undefinedUnion }; + +var o5: { b: number }; +var o5 = { ...nullUnion, ...nullUnion }; + +var o6: { }; +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +var o6 = { ...nullAndUndefinedUnion }; \ No newline at end of file diff --git a/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts b/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts new file mode 100644 index 00000000000..fc5e9794500 --- /dev/null +++ b/tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts @@ -0,0 +1,15 @@ +class Base { + protected constructor() { } + public instance1 = new Base(); // allowed +} + +class Subclass extends Base { + public instance1_1 = new Base(); // allowed + public instance1_2 = new Subclass(); // allowed +} + +class SubclassOfSubclass extends Subclass { + public instance2_1 = new Base(); // allowed + public instance2_2 = new Subclass(); // allowed + public instance2_3 = new SubclassOfSubclass(); // allowed +} diff --git a/tests/cases/compiler/systemModuleTrailingComments.ts b/tests/cases/compiler/systemModuleTrailingComments.ts new file mode 100644 index 00000000000..32c29617832 --- /dev/null +++ b/tests/cases/compiler/systemModuleTrailingComments.ts @@ -0,0 +1,4 @@ +// @module: system +export const test = "TEST"; + +//some comment \ No newline at end of file diff --git a/tests/cases/compiler/unionTypeWithLeadingOperator.ts b/tests/cases/compiler/unionTypeWithLeadingOperator.ts new file mode 100644 index 00000000000..9f6d272ce7c --- /dev/null +++ b/tests/cases/compiler/unionTypeWithLeadingOperator.ts @@ -0,0 +1,6 @@ +type A = | string; +type B = + | { type: "INCREMENT" } + | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"]; diff --git a/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts new file mode 100644 index 00000000000..8cbf75b662b --- /dev/null +++ b/tests/cases/compiler/untypedModuleImport_withAugmentation2.ts @@ -0,0 +1,14 @@ +// @noImplicitReferences: true +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +// @Filename: /node_modules/augmenter/index.d.ts +declare module "js" { + export const j: number; +} +export {}; + +// @Filename: /node_modules/js/index.js +This file is not processed. + +// @Filename: /a.ts +import { } from "augmenter"; diff --git a/tests/cases/compiler/unusedLocalsAndObjectSpread.ts b/tests/cases/compiler/unusedLocalsAndObjectSpread.ts new file mode 100644 index 00000000000..b042b412c8e --- /dev/null +++ b/tests/cases/compiler/unusedLocalsAndObjectSpread.ts @@ -0,0 +1,31 @@ +//@noUnusedLocals:true + +declare var console: { log(a: any): void }; + +function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); +} + +function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); +} + +function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + //console.log(bar); +} + +function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + //console.log(bar); +} diff --git a/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts b/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts new file mode 100644 index 00000000000..c5cd486e0f0 --- /dev/null +++ b/tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts @@ -0,0 +1,7 @@ +// @target: es2017 +// @strictNullChecks: true +interface A extends Promise {} +declare var a: A; +async function f() { + await a; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts new file mode 100644 index 00000000000..2c59b6f93cc --- /dev/null +++ b/tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts @@ -0,0 +1,8 @@ +// @target: es5 + +abstract class A { + abstract get a(); + abstract get aa() { return 1; } // error + abstract set b(x: string); + abstract set bb(x: string) {} // error +} diff --git a/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts b/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts new file mode 100644 index 00000000000..9d5d4c8c895 --- /dev/null +++ b/tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts @@ -0,0 +1,15 @@ +class B { + constructor(x?: string) {} + x(): string { return ""; } +} +class C1 extends B { + constructor() { + super.x(); + super(); + } +} +class C2 extends B { + constructor() { + super(super.x()); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts new file mode 100644 index 00000000000..b20a5a85dfb --- /dev/null +++ b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts @@ -0,0 +1,34 @@ +// @target:es5 +// @experimentaldecorators: true +declare function dec1(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; +declare function dec2(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec1 get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec2 set x(value: number) { } +} + +class C { + @dec1 set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec2 get x() { return 0; } +} + +class E { + @dec1 get x() { return 0; } + @dec2 set x(value: number) { } +} + +class F { + @dec1 set x(value: number) { } + @dec2 get x() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts new file mode 100644 index 00000000000..3caf4b406d2 --- /dev/null +++ b/tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts @@ -0,0 +1,32 @@ +// @target:es5 +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare function dec(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor; + +class A { + @dec get x() { return 0; } + set x(value: number) { } +} + +class B { + get x() { return 0; } + @dec set x(value: number) { } +} + +class C { + @dec set x(value: number) { } + get x() { return 0; } +} + +class D { + set x(value: number) { } + @dec get x() { return 0; } +} + +class E { + @dec get x() { return 0; } +} + +class F { + @dec set x(value: number) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts new file mode 100644 index 00000000000..55e3a1423fa --- /dev/null +++ b/tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts @@ -0,0 +1,18 @@ +// @target: es5 +// @module: commonjs +// @experimentaldecorators: true +// @emitdecoratormetadata: true +declare var dec: any; + +@dec +class A { +} + +@dec +class B { + constructor(x: number) {} +} + +@dec +class C extends A { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts new file mode 100644 index 00000000000..c01030c7fa9 --- /dev/null +++ b/tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts @@ -0,0 +1,31 @@ +// @declaration: true + +type T1 = { + x: T1["x"]; // Error +}; + +type T2 = { + x: T2[K]; // Error + y: number; +} + +declare let x2: T2<"x">; +let x2x = x2.x; + +interface T3> { + x: T["x"]; // Error +} + +interface T4> { + x: T4["x"]; // Error +} + +class C1 { + x: C1["x"]; // Error +} + +class C2 { + x: this["y"]; // Error + y: this["z"]; // Error + z: this["x"]; // Error +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndForIn.ts b/tests/cases/conformance/types/keyof/keyofAndForIn.ts new file mode 100644 index 00000000000..97b8587a243 --- /dev/null +++ b/tests/cases/conformance/types/keyof/keyofAndForIn.ts @@ -0,0 +1,36 @@ +// @declaration: true + +// Repro from #12513 + +function f1(obj: { [P in K]: T }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f2(obj: { [P in keyof T]: T[P] }, k: keyof T) { + const b = k in obj; + let k1: keyof T; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} + +function f3(obj: { [P in K]: T[P] }, k: K) { + const b = k in obj; + let k1: K; + for (k1 in obj) { + let x1 = obj[k1]; + } + for (let k2 in obj) { + let x2 = obj[k2]; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index b0451b8d55c..ea6a3c2358a 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -1,3 +1,4 @@ +// @strictNullChecks: true // @declaration: true class Shape { @@ -21,11 +22,12 @@ class Options { } type Dictionary = { [x: string]: T }; +type NumericallyIndexed = { [x: number]: T }; const enum E { A, B, C } -type K00 = keyof any; // string | number -type K01 = keyof string; // number | "toString" | "charAt" | ... +type K00 = keyof any; // string +type K01 = keyof string; // "toString" | "charAt" | ... type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ... type K03 = keyof boolean; // "valueOf" type K04 = keyof void; // never @@ -34,19 +36,20 @@ type K06 = keyof null; // never type K07 = keyof never; // never type K10 = keyof Shape; // "name" | "width" | "height" | "visible" -type K11 = keyof Shape[]; // number | "length" | "toString" | ... -type K12 = keyof Dictionary; // string | number +type K11 = keyof Shape[]; // "length" | "toString" | ... +type K12 = keyof Dictionary; // string type K13 = keyof {}; // never type K14 = keyof Object; // "constructor" | "toString" | ... type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ... -type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ... +type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ... type K17 = keyof (Shape | Item); // "name" type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price" +type K19 = keyof NumericallyIndexed // never type KeyOf = keyof T; type K20 = KeyOf; // "name" | "width" | "height" | "visible" -type K21 = KeyOf>; // string | number +type K21 = KeyOf>; // string type NAME = "name"; type WIDTH_OR_HEIGHT = "width" | "height"; @@ -217,6 +220,83 @@ function f60(source: T, target: T) { } } +function f70(func: (k1: keyof (T | U), k2: keyof (T & U)) => void) { + func<{ a: any, b: any }, { a: any, c: any }>('a', 'a'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'b'); + func<{ a: any, b: any }, { a: any, c: any }>('a', 'c'); +} + +function f71(func: (x: T, y: U) => Partial) { + let x = func({ a: 1, b: "hello" }, { c: true }); + x.a; // number | undefined + x.b; // string | undefined + x.c; // boolean | undefined +} + +function f72(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f73(func: (x: T, y: U, k: K) => (T & U)[K]) { + let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string + let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean +} + +function f74(func: (x: T, y: U, k: K) => (T | U)[K]) { + let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number + let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean +} + +function f80(obj: T) { + let a1 = obj.a; // { x: any } + let a2 = obj['a']; // { x: any } + let a3 = obj['a'] as T['a']; // T["a"] + let x1 = obj.a.x; // any + let x2 = obj['a']['x']; // any + let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"] +} + +function f81(obj: T) { + return obj['a']['x'] as T['a']['x']; +} + +function f82() { + let x1 = f81({ a: { x: "hello" } }); // string + let x2 = f81({ a: { x: 42 } }); // number +} + +function f83(obj: T, key: K) { + return obj[key]['x'] as T[K]['x']; +} + +function f84() { + let x1 = f83({ foo: { x: "hello" } }, "foo"); // string + let x2 = f83({ bar: { x: 42 } }, "bar"); // number +} + +class C1 { + x: number; + get(key: K) { + return this[key]; + } + set(key: K, value: this[K]) { + this[key] = value; + } + foo() { + let x1 = this.x; // number + let x2 = this["x"]; // number + let x3 = this.get("x"); // this["x"] + let x4 = getProperty(this, "x"); // this["x"] + this.x = 42; + this["x"] = 42; + this.set("x", 42); + setProperty(this, "x", 42); + } +} + // Repros from #12011 class Base { @@ -247,4 +327,107 @@ class OtherPerson { getParts() { return getProperty(this, "parts") } -} \ No newline at end of file +} + +// Modified repro from #12544 + +function path(obj: T, key1: K1): T[K1]; +function path(obj: T, key1: K1, key2: K2): T[K1][K2]; +function path(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3]; +function path(obj: any, ...keys: (string | number)[]): any; +function path(obj: any, ...keys: (string | number)[]): any { + let result = obj; + for (let k of keys) { + result = result[k]; + } + return result; +} + +type Thing = { + a: { x: number, y: string }, + b: boolean +}; + + +function f1(thing: Thing) { + let x1 = path(thing, 'a'); // { x: number, y: string } + let x2 = path(thing, 'a', 'y'); // string + let x3 = path(thing, 'b'); // boolean + let x4 = path(thing, ...['a', 'x']); // any +} + +// Repro from comment in #12114 + +const assignTo2 = (object: T, key1: K1, key2: K2) => + (value: T[K1][K2]) => object[key1][key2] = value; + +// Modified repro from #12573 + +declare function one(handler: (t: T) => void): T +var empty = one(() => {}) // inferred as {}, expected + +type Handlers = { [K in keyof T]: (t: T[K]) => void } +declare function on(handlerHash: Handlers): T +var hashOfEmpty1 = on({ test: () => {} }); // {} +var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean } + +// Repro from #12624 + +interface Options1 { + data?: Data + computed?: Computed; +} + +declare class Component1 { + constructor(options: Options1); + get(key: K): (Data & Computed)[K]; +} + +let c1 = new Component1({ + data: { + hello: "" + } +}); + +c1.get("hello"); + +// Repro from #12625 + +interface Options2 { + data?: Data + computed?: Computed; +} + +declare class Component2 { + constructor(options: Options2); + get(key: K): (Data & Computed)[K]; +} + +// Repro from #12641 + +interface R { + p: number; +} + +function f(p: K) { + let a: any; + a[p].add; // any +} + +// Repro from #12651 + +type MethodDescriptor = { + name: string; + args: any[]; + returnValue: any; +} + +declare function dispatchMethod(name: M['name'], args: M['args']): M['returnValue']; + +type SomeMethodDescriptor = { + name: "someMethod"; + args: [string, number]; + returnValue: string[]; +} + +let result = dispatchMethod("someMethod", ["hello", 35]); \ No newline at end of file diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts index bc2ddc31a19..cbbc9a52200 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts @@ -65,4 +65,15 @@ function f10(shape: Shape) { setProperty(shape, "name", "rectangle"); setProperty(shape, "size", 10); // Error setProperty(shape, cond ? "name" : "size", 10); // Error +} + +function f20(k1: keyof (T | U), k2: keyof (T & U), o1: T | U, o2: T & U) { + o1[k1]; + o1[k2]; // Error + o2[k1]; + o2[k2]; + o1 = o2; + o2 = o1; // Error + k1 = k2; // Error + k2 = k1; } \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts new file mode 100644 index 00000000000..14bb765a840 --- /dev/null +++ b/tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts @@ -0,0 +1,155 @@ +// @strictNullChecks: true +// @noimplicitany: true +// @declaration: true + +type Box = { + value: T; +} + +type Boxified = { + [P in keyof T]: Box; +} + +function box(x: T): Box { + return { value: x }; +} + +function unbox(x: Box): T { + return x.value; +} + +function boxify(obj: T): Boxified { + let result = {} as Boxified; + for (let k in obj) { + result[k] = box(obj[k]); + } + return result; +} + +function unboxify(obj: Boxified): T { + let result = {} as T; + for (let k in obj) { + result[k] = unbox(obj[k]); + } + return result; +} + +function assignBoxified(obj: Boxified, values: T) { + for (let k in values) { + obj[k].value = values[k]; + } +} + +function f1() { + let v = { + a: 42, + b: "hello", + c: true + }; + let b = boxify(v); + let x: number = b.a.value; +} + +function f2() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + let v = unboxify(b); + let x: number = v.a; +} + +function f3() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + assignBoxified(b, { c: false }); +} + +function f4() { + let b = { + a: box(42), + b: box("hello"), + c: box(true) + }; + b = boxify(unboxify(b)); + b = unboxify(boxify(b)); +} + +function makeRecord(obj: { [P in K]: T }) { + return obj; +} + +function f5(s: string) { + let b = makeRecord({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v.a; +} + +function makeDictionary(obj: { [x: string]: T }) { + return obj; +} + +function f6(s: string) { + let b = makeDictionary({ + a: box(42), + b: box("hello"), + c: box(true) + }); + let v = unboxify(b); + let x: string | number | boolean = v[s]; +} + +declare function validate(obj: { [P in keyof T]?: T[P] }): T; +declare function clone(obj: { readonly [P in keyof T]: T[P] }): T; +declare function validateAndClone(obj: { readonly [P in keyof T]?: T[P] }): T; + +type Foo = { + a?: number; + readonly b: string; +} + +function f10(foo: Foo) { + let x = validate(foo); // { a: number, readonly b: string } + let y = clone(foo); // { a?: number, b: string } + let z = validateAndClone(foo); // { a: number, b: string } +} + +// Repro from #12606 + +type Func = (...args: any[]) => T; +type Spec = { + [P in keyof T]: Func | Spec ; +}; + +/** + * Given a spec object recursively mapping properties to functions, creates a function + * producing an object of the same structure, by mapping each property to the result + * of calling its associated function with the supplied arguments. + */ +declare function applySpec(obj: Spec): (...args: any[]) => T; + +// Infers g1: (...args: any[]) => { sum: number, nested: { mul: string } } +var g1 = applySpec({ + sum: (a: any) => 3, + nested: { + mul: (b: any) => "n" + } +}); + +// Infers g2: (...args: any[]) => { foo: { bar: { baz: boolean } } } +var g2 = applySpec({ foo: { bar: { baz: (x: any) => true } } }); + +// Repro from #12633 + +const foo = (object: T, partial: Partial) => object; +let o = {a: 5, b: 7}; +foo(o, {b: 9}); +o = foo(o, {b: 9}); \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts index b318cde3aab..4be6b6b098d 100644 --- a/tests/cases/conformance/types/mapped/mappedTypeErrors.ts +++ b/tests/cases/conformance/types/mapped/mappedTypeErrors.ts @@ -67,4 +67,61 @@ function f11() { function f12() { var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]: T[P][] }; // Error -} \ No newline at end of file +} + +// Check that inferences to mapped types are secondary + +declare function objAndReadonly(primary: T, secondary: Readonly): T; +declare function objAndPartial(primary: T, secondary: Partial): T; + +function f20() { + let x1 = objAndReadonly({ x: 0, y: 0 }, { x: 1 }); // Error + let x2 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndReadonly({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +function f21() { + let x1 = objAndPartial({ x: 0, y: 0 }, { x: 1 }); + let x2 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1 }); + let x3 = objAndPartial({ x: 0, y: 0 }, { x: 1, y: 1, z: 1 }); // Error +} + +// Verify use of Pick for setState functions (#12793) + +interface Foo { + a: string; + b?: number; +} + +function setState(obj: T, props: Pick) { + for (let k in props) { + obj[k] = props[k]; + } +} + +let foo: Foo = { a: "hello", b: 42 }; +setState(foo, { a: "test", b: 43 }) +setState(foo, { a: "hi" }); +setState(foo, { b: undefined }); +setState(foo, { }); +setState(foo, foo); +setState(foo, { a: undefined }); // Error +setState(foo, { c: true }); // Error + +class C { + state: T; + setState(props: Pick) { + for (let k in props) { + this.state[k] = props[k]; + } + } +} + +let c = new C(); +c.setState({ a: "test", b: 43 }); +c.setState({ a: "hi" }); +c.setState({ b: undefined }); +c.setState({ }); +c.setState(foo); +c.setState({ a: undefined }); // Error +c.setState({ c: true }); // Error diff --git a/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts new file mode 100644 index 00000000000..1fe6872965c --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypeModifiers.ts @@ -0,0 +1,77 @@ +// @strictNullChecks: true + +type T = { a: number, b: string }; +type TP = { a?: number, b?: string }; +type TR = { readonly a: number, readonly b: string }; +type TPR = { readonly a?: number, readonly b?: string }; + +var v00: "a" | "b"; +var v00: keyof T; +var v00: keyof TP; +var v00: keyof TR; +var v00: keyof TPR; + +var v01: T; +var v01: { [P in keyof T]: T[P] }; +var v01: Pick; +var v01: Pick, keyof T>; + +var v02: TP; +var v02: { [P in keyof T]?: T[P] }; +var v02: Partial; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; + +var v03: TR; +var v03: { readonly [P in keyof T]: T[P] }; +var v03: Readonly; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; + +var v04: TPR; +var v04: { readonly [P in keyof T]?: T[P] }; +var v04: Partial; +var v04: Readonly; +var v04: Partial>; +var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } +var v04: Pick; + +type Boxified = { [P in keyof T]: { x: T[P] } }; + +type B = { a: { x: number }, b: { x: string } }; +type BP = { a?: { x: number }, b?: { x: string } }; +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; + +var b00: "a" | "b"; +var b00: keyof B; +var b00: keyof BP; +var b00: keyof BR; +var b00: keyof BPR; + +var b01: B; +var b01: { [P in keyof B]: B[P] }; +var b01: Pick; +var b01: Pick, keyof B>; + +var b02: BP; +var b02: { [P in keyof B]?: B[P] }; +var b02: Partial; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; + +var b03: BR; +var b03: { readonly [P in keyof B]: B[P] }; +var b03: Readonly; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; + +var b04: BPR; +var b04: { readonly [P in keyof B]?: B[P] }; +var b04: Partial
; +var b04: Readonly; +var b04: Partial>; +var b04: Readonly>; +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes1.ts b/tests/cases/conformance/types/mapped/mappedTypes1.ts index d090b731518..b74872c2bfd 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes1.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes1.ts @@ -34,7 +34,9 @@ type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; declare function f1(): { [P in keyof T1]: void }; declare function f2(): { [P in keyof T1]: void }; declare function f3(): { [P in keyof T1]: void }; +declare function f4(): { [P in keyof T1]: void }; let x1 = f1(); let x2 = f2(); -let x3 = f3(); \ No newline at end of file +let x3 = f3(); +let x4 = f4(); \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes2.ts b/tests/cases/conformance/types/mapped/mappedTypes2.ts index e72a0c0a892..60db4c1383b 100644 --- a/tests/cases/conformance/types/mapped/mappedTypes2.ts +++ b/tests/cases/conformance/types/mapped/mappedTypes2.ts @@ -31,25 +31,30 @@ declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} + interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } function f0(s1: Shape, s2: Shape) { @@ -70,7 +75,7 @@ function f2(shape: Shape) { } function f3(shape: Shape) { - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + const x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { @@ -81,11 +86,11 @@ function f4() { function f5(shape: Shape) { const p = proxify(shape); let name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape: DeepReadonly) { - let name = shape.name; // DeepReadonly - let length = name.length; // DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> + let name = shape.name; // string + let location = shape.location; // DeepReadonly + let x = location.x; // number } \ No newline at end of file diff --git a/tests/cases/conformance/types/mapped/mappedTypes4.ts b/tests/cases/conformance/types/mapped/mappedTypes4.ts new file mode 100644 index 00000000000..74b3e395f32 --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypes4.ts @@ -0,0 +1,62 @@ +// @strictNullChecks: true +// @declaration: true + +type Box = { +}; + +type Boxified = { + [P in keyof T]: Box; +}; + +function boxify(obj: T): Boxified { + if (typeof obj === "object") { + let result = {} as Boxified; + for (let k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} + +type A = { a: string }; +type B = { b: string }; +type C = { c: string }; + +function f1(x: A | B | C | undefined) { + return boxify(x); +} + +type T00 = Partial
; +type T01 = Readonly; +type T02 = Boxified +type T03 = Readonly; +type T04 = Boxified; +type T05 = Partial<"hello" | "world" | 42>; + +type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +} + +type T10 = BoxifiedWithSentinel; +type T11 = BoxifiedWithSentinel; +type T12 = BoxifiedWithSentinel; + +type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; + +type Foo = { + x: number; + y: { a: string, b: number }; + z: boolean; +}; + +type DeepReadonlyFoo = { + readonly x: number; + readonly y: { readonly a: string, readonly b: number }; + readonly z: boolean; +}; + +var x1: DeepReadonly; +var x1: DeepReadonlyFoo; \ No newline at end of file diff --git a/tests/cases/conformance/types/rest/objectRest.ts b/tests/cases/conformance/types/rest/objectRest.ts index 3f7be177c7b..2fba5d0b6dc 100644 --- a/tests/cases/conformance/types/rest/objectRest.ts +++ b/tests/cases/conformance/types/rest/objectRest.ts @@ -36,3 +36,5 @@ let computed = 'b'; let computed2 = 'a'; var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; diff --git a/tests/cases/conformance/types/rest/objectRestNegative.ts b/tests/cases/conformance/types/rest/objectRestNegative.ts index c224c8cd30e..4f4667fe65a 100644 --- a/tests/cases/conformance/types/rest/objectRestNegative.ts +++ b/tests/cases/conformance/types/rest/objectRestNegative.ts @@ -1,3 +1,4 @@ +// @noImplicitAny: true let o = { a: 1, b: 'no' }; var { ...mustBeLast, a } = o; @@ -15,3 +16,5 @@ function generic(t: T) { let rest: { b: string } ({a, ...rest.b + rest.b} = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; diff --git a/tests/cases/conformance/types/spread/objectSpreadNegative.ts b/tests/cases/conformance/types/spread/objectSpreadNegative.ts index 3cd819d0613..6d1e0dde429 100644 --- a/tests/cases/conformance/types/spread/objectSpreadNegative.ts +++ b/tests/cases/conformance/types/spread/objectSpreadNegative.ts @@ -29,9 +29,7 @@ spread = b; // error, missing 's' let duplicated = { b: 'bad', ...o, b: 'bad', ...o2, b: 'bad' } let duplicatedSpread = { ...o, ...o } -// null, undefined and primitives are not allowed -let spreadNull = { ...null }; -let spreadUndefind = { ...undefined }; +// primitives are not allowed let spreadNum = { ...12 }; let spreadSum = { ...1 + 1 }; spreadSum.toFixed(); // error, no methods from number diff --git a/tests/cases/fourslash/basicClassMembers.ts b/tests/cases/fourslash/basicClassMembers.ts index 1407bf89be3..9fad6731973 100644 --- a/tests/cases/fourslash/basicClassMembers.ts +++ b/tests/cases/fourslash/basicClassMembers.ts @@ -7,6 +7,6 @@ goTo.eof(); edit.insert('t.'); -verify.memberListContains('x'); -verify.memberListContains('y'); -verify.not.memberListContains('z'); +verify.completionListContains('x'); +verify.completionListContains('y'); +verify.not.completionListContains('z'); diff --git a/tests/cases/fourslash/commentBraceCompletionPosition.ts b/tests/cases/fourslash/commentBraceCompletionPosition.ts index b92c49d3a14..3730a3466c9 100644 --- a/tests/cases/fourslash/commentBraceCompletionPosition.ts +++ b/tests/cases/fourslash/commentBraceCompletionPosition.ts @@ -14,10 +14,10 @@ //// } goTo.marker('1'); -verify.not.isValidBraceCompletionAtPosition('('); +verify.isValidBraceCompletionAtPosition('('); goTo.marker('2'); -verify.not.isValidBraceCompletionAtPosition('('); +verify.isValidBraceCompletionAtPosition('('); goTo.marker('3'); -verify.not.isValidBraceCompletionAtPosition('('); \ No newline at end of file +verify.isValidBraceCompletionAtPosition('('); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index 6edb684caa6..1c34584a262 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -139,18 +139,18 @@ verify.quickInfos({ }); goTo.marker('4'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('5'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -158,18 +158,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add"); verify.quickInfoAt("6", "(property) c1.p3: number", "getter property 1\nsetter property 1"); goTo.marker('7'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('8'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -177,48 +177,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add"); verify.quickInfoAt("8q", "(method) c1.p2(b: number): number", "sum with property"); goTo.marker('9'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); verify.quickInfoAt("10", "(property) c1.p3: number", "getter property 1\nsetter property 1"); goTo.marker('11'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('12'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('13'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -232,18 +232,18 @@ verify.quickInfos({ }); goTo.marker('16'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('17'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -251,18 +251,18 @@ verify.completionListContains("b", "(parameter) b: number", "number to add"); verify.quickInfoAt("18", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); goTo.marker('19'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('20'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -270,48 +270,48 @@ verify.currentParameterHelpArgumentDocCommentIs("number to add"); verify.quickInfoAt("20q", "(method) c1.pp2(b: number): number", "sum with property"); goTo.marker('21'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); verify.quickInfoAt("22", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); goTo.marker('23'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('24'); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); -verify.memberListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); -verify.memberListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); -verify.memberListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); -verify.memberListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); -verify.memberListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("pp1", "(property) c1.pp1: number", "pp1 is property of c1"); +verify.completionListContains("pp2", "(method) c1.pp2(b: number): number", "sum with property"); +verify.completionListContains("pp3", "(property) c1.pp3: number", "getter property 2\nsetter property 2"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("nc_pp1", "(property) c1.nc_pp1: number", ""); +verify.completionListContains("nc_pp2", "(method) c1.nc_pp2(b: number): number", ""); +verify.completionListContains("nc_pp3", "(property) c1.nc_pp3: number", ""); goTo.marker('25'); verify.currentSignatureHelpDocCommentIs("sum with property"); @@ -329,12 +329,12 @@ goTo.marker('29'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('30'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('31'); verify.completionListContains("b", "(parameter) b: number", "number to add"); @@ -345,12 +345,12 @@ goTo.marker('33'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('34'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('35'); verify.currentSignatureHelpDocCommentIs("static sum with property"); @@ -359,12 +359,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1"); verify.quickInfoAt("35q", "(method) c1.s2(b: number): number", "static sum with property"); goTo.marker('36'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); verify.quickInfoAt("37", "(property) c1.s3: number", "static getter property\nsetter property 3"); @@ -372,23 +372,23 @@ goTo.marker('38'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('39'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('40'); verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('41'); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("static sum with property"); @@ -477,12 +477,12 @@ verify.quickInfos({ goTo.marker("67"); verify.quickInfoIs("(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); -verify.memberListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); -verify.memberListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); -verify.memberListContains("nc_p3", "(property) c1.nc_p3: number", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "p1 is property of c1"); +verify.completionListContains("p2", "(method) c1.p2(b: number): number", "sum with property"); +verify.completionListContains("p3", "(property) c1.p3: number", "getter property 1\nsetter property 1"); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(method) c1.nc_p2(b: number): number", ""); +verify.completionListContains("nc_p3", "(property) c1.nc_p3: number", ""); verify.quickInfos({ 68: "var i1_f: (b: number) => number", @@ -526,12 +526,12 @@ verify.completionListContains("c1", "class c1", "This is comment for c1"); goTo.marker('88'); verify.quickInfoIs("(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); -verify.memberListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); -verify.memberListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); -verify.memberListContains("nc_s1", "(property) c1.nc_s1: number", ""); -verify.memberListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); -verify.memberListContains("nc_s3", "(property) c1.nc_s3: number", ""); +verify.completionListContains("s1", "(property) c1.s1: number", "s1 is static property of c1"); +verify.completionListContains("s2", "(method) c1.s2(b: number): number", "static sum with property"); +verify.completionListContains("s3", "(property) c1.s3: number", "static getter property\nsetter property 3"); +verify.completionListContains("nc_s1", "(property) c1.nc_s1: number", ""); +verify.completionListContains("nc_s2", "(method) c1.nc_s2(b: number): number", ""); +verify.completionListContains("nc_s3", "(property) c1.nc_s3: number", ""); verify.quickInfos({ 89: "var i1_s_f: (b: number) => number", @@ -593,10 +593,10 @@ verify.completionListContains("i1_c", "var i1_c: typeof c1", ""); goTo.marker('110'); verify.quickInfoIs("(property) cProperties.p2: number", "setter only property"); -verify.memberListContains("p1", "(property) cProperties.p1: number", "getter only property"); -verify.memberListContains("p2", "(property) cProperties.p2: number", "setter only property"); -verify.memberListContains("nc_p1", "(property) cProperties.nc_p1: number", ""); -verify.memberListContains("nc_p2", "(property) cProperties.nc_p2: number", ""); +verify.completionListContains("p1", "(property) cProperties.p1: number", "getter only property"); +verify.completionListContains("p2", "(property) cProperties.p2: number", "setter only property"); +verify.completionListContains("nc_p1", "(property) cProperties.nc_p1: number", ""); +verify.completionListContains("nc_p2", "(property) cProperties.nc_p2: number", ""); verify.quickInfos({ 111: ["(property) cProperties.p1: number", "getter only property"], @@ -605,7 +605,7 @@ verify.quickInfos({ }); goTo.marker('114'); -verify.memberListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); +verify.completionListContains("a", "(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); verify.quickInfoIs("(property) cWithConstructorProperty.a: number", "this is first parameter a\nmore info about a"); goTo.marker('115'); diff --git a/tests/cases/fourslash/commentsEnums.ts b/tests/cases/fourslash/commentsEnums.ts index 048c99c6e0c..bf0bc087372 100644 --- a/tests/cases/fourslash/commentsEnums.ts +++ b/tests/cases/fourslash/commentsEnums.ts @@ -22,11 +22,11 @@ verify.completionListContains("Colors", "enum Colors", "Enum of colors"); verify.quickInfoIs("enum Colors", "Enum of colors"); goTo.marker('6'); -verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); -verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); goTo.marker('7'); -verify.memberListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); -verify.memberListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); +verify.completionListContains("Cornflower", "(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); +verify.completionListContains("FancyPink", "(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsExternalModules.ts b/tests/cases/fourslash/commentsExternalModules.ts index d9773716369..4f1a82bc0ce 100644 --- a/tests/cases/fourslash/commentsExternalModules.ts +++ b/tests/cases/fourslash/commentsExternalModules.ts @@ -46,9 +46,9 @@ goTo.marker('4'); verify.completionListContains("m1", "namespace m1", "Namespace comment"); goTo.marker('5'); -verify.memberListContains("b", "var m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace m1.m2"); +verify.completionListContains("b", "var m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace m1.m2"); goTo.marker('6'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -57,8 +57,8 @@ verify.quickInfoAt("6q", "function m1.fooExport(): number", "exported function") verify.quickInfoAt("7", "var myvar: m1.m2.c"); goTo.marker('8'); -verify.memberListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); -verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i"); +verify.completionListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); +verify.completionListContains("i", "var m1.m2.i: m1.m2.c", "i"); goTo.file("commentsExternalModules_file1.ts"); verify.quickInfoAt("9", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); @@ -67,12 +67,12 @@ goTo.marker('10'); verify.completionListContains("extMod", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration"); goTo.marker('11'); -verify.memberListContains("m1", "namespace extMod.m1"); +verify.completionListContains("m1", "namespace extMod.m1"); goTo.marker('12'); -verify.memberListContains("b", "var extMod.m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace extMod.m1.m2"); +verify.completionListContains("b", "var extMod.m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace extMod.m1.m2"); goTo.marker('13'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -81,5 +81,5 @@ verify.quickInfoAt("13q", "function extMod.m1.fooExport(): number", "exported fu verify.quickInfoAt("14", "var newVar: extMod.m1.m2.c"); goTo.marker('15'); -verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); -verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); +verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); +verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash/commentsImportDeclaration.ts b/tests/cases/fourslash/commentsImportDeclaration.ts index 76f2c64a51d..cda983a9e5a 100644 --- a/tests/cases/fourslash/commentsImportDeclaration.ts +++ b/tests/cases/fourslash/commentsImportDeclaration.ts @@ -30,12 +30,12 @@ verify.quickInfos({ }); goTo.marker('6'); -verify.memberListContains("m1", "namespace extMod.m1"); +verify.completionListContains("m1", "namespace extMod.m1"); goTo.marker('7'); -verify.memberListContains("b", "var extMod.m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace extMod.m1.m2"); +verify.completionListContains("b", "var extMod.m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function extMod.m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace extMod.m1.m2"); goTo.marker('8'); verify.currentSignatureHelpDocCommentIs("exported function"); @@ -45,5 +45,5 @@ verify.quickInfos({ }); goTo.marker('10'); -verify.memberListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); -verify.memberListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); +verify.completionListContains("c", "constructor extMod.m1.m2.c(): extMod.m1.m2.c", ""); +verify.completionListContains("i", "var extMod.m1.m2.i: extMod.m1.m2.c", "i"); diff --git a/tests/cases/fourslash/commentsInheritance.ts b/tests/cases/fourslash/commentsInheritance.ts index fd7aa12e805..6e3e92cfcff 100644 --- a/tests/cases/fourslash/commentsInheritance.ts +++ b/tests/cases/fourslash/commentsInheritance.ts @@ -221,18 +221,18 @@ ////} goTo.marker('1'); -verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); -verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); -verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i1.p1: number", ""); -verify.memberListContains("f1", "(method) i1.f1(): void", ""); -verify.memberListContains("l1", "(property) i1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i1.p1: number", ""); +verify.completionListContains("f1", "(method) i1.f1(): void", ""); +verify.completionListContains("l1", "(property) i1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); goTo.marker('2'); verify.currentSignatureHelpDocCommentIs("i1_f1"); goTo.marker('3'); @@ -263,18 +263,18 @@ verify.quickInfos({ }); goTo.marker('6'); -verify.memberListContains("i1_p1", "(property) c1.i1_p1: number", ""); -verify.memberListContains("i1_f1", "(method) c1.i1_f1(): void", ""); -verify.memberListContains("i1_l1", "(property) c1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) c1.p1: number", "c1_p1"); -verify.memberListContains("f1", "(method) c1.f1(): void", "c1_f1"); -verify.memberListContains("l1", "(property) c1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1"); -verify.memberListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1"); -verify.memberListContains("nc_l1", "(property) c1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) c1.i1_p1: number", ""); +verify.completionListContains("i1_f1", "(method) c1.i1_f1(): void", ""); +verify.completionListContains("i1_l1", "(property) c1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) c1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) c1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) c1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) c1.p1: number", "c1_p1"); +verify.completionListContains("f1", "(method) c1.f1(): void", "c1_f1"); +verify.completionListContains("l1", "(property) c1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) c1.nc_p1: number", "c1_nc_p1"); +verify.completionListContains("nc_f1", "(method) c1.nc_f1(): void", "c1_nc_f1"); +verify.completionListContains("nc_l1", "(property) c1.nc_l1: () => void", ""); goTo.marker('7'); verify.currentSignatureHelpDocCommentIs(""); goTo.marker('8'); @@ -305,18 +305,18 @@ verify.quickInfos({ }); goTo.marker('11'); -verify.memberListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); -verify.memberListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); -verify.memberListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); -verify.memberListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); -verify.memberListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); -verify.memberListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i1.p1: number", ""); -verify.memberListContains("f1", "(method) i1.f1(): void", ""); -verify.memberListContains("l1", "(property) i1.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i1.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i1.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); +verify.completionListContains("i1_p1", "(property) i1.i1_p1: number", "i1_p1"); +verify.completionListContains("i1_f1", "(method) i1.i1_f1(): void", "i1_f1"); +verify.completionListContains("i1_l1", "(property) i1.i1_l1: () => void", ""); +verify.completionListContains("i1_nc_p1", "(property) i1.i1_nc_p1: number", ""); +verify.completionListContains("i1_nc_f1", "(method) i1.i1_nc_f1(): void", ""); +verify.completionListContains("i1_nc_l1", "(property) i1.i1_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i1.p1: number", ""); +verify.completionListContains("f1", "(method) i1.f1(): void", ""); +verify.completionListContains("l1", "(property) i1.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i1.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i1.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i1.nc_l1: () => void", ""); goTo.marker('12'); verify.currentSignatureHelpDocCommentIs("i1_f1"); goTo.marker('13'); @@ -376,18 +376,18 @@ verify.quickInfos({ }); goTo.marker('19'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); -verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); -verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); -verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); -verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", ""); goTo.marker('20'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('21'); @@ -405,18 +405,18 @@ verify.quickInfos({ }); goTo.marker('24'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); -verify.memberListContains("p1", "(property) c3.p1: number", "c3 p1"); -verify.memberListContains("f1", "(method) c3.f1(): void", "c3 f1"); -verify.memberListContains("prop", "(property) c3.prop: number", "c3 prop"); -verify.memberListContains("nc_p1", "(property) c3.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c3.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c3.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number", ""); +verify.completionListContains("p1", "(property) c3.p1: number", "c3 p1"); +verify.completionListContains("f1", "(method) c3.f1(): void", "c3 f1"); +verify.completionListContains("prop", "(property) c3.prop: number", "c3 prop"); +verify.completionListContains("nc_p1", "(property) c3.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c3.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c3.nc_prop: number", ""); goTo.marker('25'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('26'); @@ -434,18 +434,18 @@ verify.quickInfos({ }); goTo.marker('29'); -verify.memberListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); -verify.memberListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); -verify.memberListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); -verify.memberListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); -verify.memberListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); -verify.memberListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number"); -verify.memberListContains("p1", "(property) c2.p1: number", "c2 p1"); -verify.memberListContains("f1", "(method) c2.f1(): void", "c2 f1"); -verify.memberListContains("prop", "(property) c2.prop: number", "c2 prop"); -verify.memberListContains("nc_p1", "(property) c2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) c2.nc_f1(): void", ""); -verify.memberListContains("nc_prop", "(property) c2.nc_prop: number", ""); +verify.completionListContains("c2_p1", "(property) c2.c2_p1: number", "c2 c2_p1"); +verify.completionListContains("c2_f1", "(method) c2.c2_f1(): void", "c2 c2_f1"); +verify.completionListContains("c2_prop", "(property) c2.c2_prop: number", "c2 c2_prop"); +verify.completionListContains("c2_nc_p1", "(property) c2.c2_nc_p1: number", ""); +verify.completionListContains("c2_nc_f1", "(method) c2.c2_nc_f1(): void", ""); +verify.completionListContains("c2_nc_prop", "(property) c2.c2_nc_prop: number"); +verify.completionListContains("p1", "(property) c2.p1: number", "c2 p1"); +verify.completionListContains("f1", "(method) c2.f1(): void", "c2 f1"); +verify.completionListContains("prop", "(property) c2.prop: number", "c2 prop"); +verify.completionListContains("nc_p1", "(property) c2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) c2.nc_f1(): void", ""); +verify.completionListContains("nc_prop", "(property) c2.nc_prop: number", ""); goTo.marker('30'); verify.currentSignatureHelpDocCommentIs("c2 c2_f1"); goTo.marker('31'); @@ -478,18 +478,18 @@ verify.completionListContains("c4", "class c4", ""); verify.completionListContains("c4_i", "var c4_i: c4", ""); goTo.marker('36'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); -verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); -verify.memberListContains("l1", "(property) i2.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.completionListContains("l1", "(property) i2.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); goTo.marker('37'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('38'); @@ -521,18 +521,18 @@ verify.quickInfos({ }); goTo.marker('41'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i3.p1: number", "i3 p1"); -verify.memberListContains("f1", "(method) i3.f1(): void", "i3 f1"); -verify.memberListContains("l1", "(property) i3.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i3.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i3.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i3.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i3.p1: number", "i3 p1"); +verify.completionListContains("f1", "(method) i3.f1(): void", "i3 f1"); +verify.completionListContains("l1", "(property) i3.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i3.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i3.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i3.nc_l1: () => void", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('43'); @@ -562,18 +562,18 @@ verify.quickInfos({ }); goTo.marker('46'); -verify.memberListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); -verify.memberListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); -verify.memberListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); -verify.memberListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); -verify.memberListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); -verify.memberListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); -verify.memberListContains("p1", "(property) i2.p1: number", "i2 p1"); -verify.memberListContains("f1", "(method) i2.f1(): void", "i2 f1"); -verify.memberListContains("l1", "(property) i2.l1: () => void", ""); -verify.memberListContains("nc_p1", "(property) i2.nc_p1: number", ""); -verify.memberListContains("nc_f1", "(method) i2.nc_f1(): void", ""); -verify.memberListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); +verify.completionListContains("i2_p1", "(property) i2.i2_p1: number", "i2_p1"); +verify.completionListContains("i2_f1", "(method) i2.i2_f1(): void", "i2_f1"); +verify.completionListContains("i2_l1", "(property) i2.i2_l1: () => void", ""); +verify.completionListContains("i2_nc_p1", "(property) i2.i2_nc_p1: number", ""); +verify.completionListContains("i2_nc_f1", "(method) i2.i2_nc_f1(): void", ""); +verify.completionListContains("i2_nc_l1", "(property) i2.i2_nc_l1: () => void", ""); +verify.completionListContains("p1", "(property) i2.p1: number", "i2 p1"); +verify.completionListContains("f1", "(method) i2.f1(): void", "i2 f1"); +verify.completionListContains("l1", "(property) i2.l1: () => void", ""); +verify.completionListContains("nc_p1", "(property) i2.nc_p1: number", ""); +verify.completionListContains("nc_f1", "(method) i2.nc_f1(): void", ""); +verify.completionListContains("nc_l1", "(property) i2.nc_l1: () => void", ""); goTo.marker('47'); verify.currentSignatureHelpDocCommentIs("i2_f1"); goTo.marker('48'); diff --git a/tests/cases/fourslash/commentsInterface.ts b/tests/cases/fourslash/commentsInterface.ts index 49928f0d086..472798fa8e1 100644 --- a/tests/cases/fourslash/commentsInterface.ts +++ b/tests/cases/fourslash/commentsInterface.ts @@ -80,12 +80,12 @@ verify.quickInfos({ goTo.marker('8'); verify.quickInfoIs("(property) i2.x: number", "this is x"); -verify.memberListContains("x", "(property) i2.x: number", "this is x"); -verify.memberListContains("foo", "(property) i2.foo: (b: number) => string", "this is foo"); -verify.memberListContains("nc_x", "(property) i2.nc_x: number", ""); -verify.memberListContains("nc_foo", "(property) i2.nc_foo: (b: number) => string", ""); -verify.memberListContains("fnfoo", "(method) i2.fnfoo(b: number): string", "this is fnfoo"); -verify.memberListContains("nc_fnfoo", "(method) i2.nc_fnfoo(b: number): string", ""); +verify.completionListContains("x", "(property) i2.x: number", "this is x"); +verify.completionListContains("foo", "(property) i2.foo: (b: number) => string", "this is foo"); +verify.completionListContains("nc_x", "(property) i2.nc_x: number", ""); +verify.completionListContains("nc_foo", "(property) i2.nc_foo: (b: number) => string", ""); +verify.completionListContains("fnfoo", "(method) i2.fnfoo(b: number): string", "this is fnfoo"); +verify.completionListContains("nc_fnfoo", "(method) i2.nc_fnfoo(b: number): string", ""); verify.quickInfos({ 9: "var i2_i_foo: (b: number) => string", @@ -199,12 +199,12 @@ verify.completionListContains("i3_i", "var i3_i: i3", ""); goTo.marker('41'); verify.quickInfoIs("(method) i3.f(a: number): string", "Function i3 f"); -verify.memberListContains("f", "(method) i3.f(a: number): string", "Function i3 f"); -verify.memberListContains("l", "(property) i3.l: (b: number) => string", ""); -verify.memberListContains("x", "(property) i3.x: number", "Comment i3 x"); -verify.memberListContains("nc_f", "(method) i3.nc_f(a: number): string", ""); -verify.memberListContains("nc_l", "(property) i3.nc_l: (b: number) => string", ""); -verify.memberListContains("nc_x", "(property) i3.nc_x: number", ""); +verify.completionListContains("f", "(method) i3.f(a: number): string", "Function i3 f"); +verify.completionListContains("l", "(property) i3.l: (b: number) => string", ""); +verify.completionListContains("x", "(property) i3.x: number", "Comment i3 x"); +verify.completionListContains("nc_f", "(method) i3.nc_f(a: number): string", ""); +verify.completionListContains("nc_l", "(property) i3.nc_l: (b: number) => string", ""); +verify.completionListContains("nc_x", "(property) i3.nc_x: number", ""); goTo.marker('42'); verify.currentSignatureHelpDocCommentIs("Function i3 f"); diff --git a/tests/cases/fourslash/commentsLinePreservation.ts b/tests/cases/fourslash/commentsLinePreservation.ts index 6d085f71f80..3f60bdbf43b 100644 --- a/tests/cases/fourslash/commentsLinePreservation.ts +++ b/tests/cases/fourslash/commentsLinePreservation.ts @@ -105,6 +105,14 @@ //// * second time information about the param again //// */ ////function /*l*/l(param1: string) { /*9*/param1 = "hello"; } +//// /** +//// * This is firstLine +//// This is second Line +//// [1]: third * line +//// @param param1 first Line text +//// second line text +//// */ +////function /*m*/m(param1: string) { /*10*/param1 = "hello"; } verify.quickInfos({ a: ["var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line"], @@ -136,5 +144,8 @@ verify.quickInfos({ 8: ["(parameter) param1: string", "hello "], l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"], - 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"] + 9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"], + + m: ["function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line"], + 10: ["(parameter) param1: string", "first Line text\nsecond line text"] }); diff --git a/tests/cases/fourslash/commentsModules.ts b/tests/cases/fourslash/commentsModules.ts index 5f9457d81f4..c0b8ccc5731 100644 --- a/tests/cases/fourslash/commentsModules.ts +++ b/tests/cases/fourslash/commentsModules.ts @@ -110,9 +110,9 @@ goTo.marker('4'); verify.completionListContains("m1", "namespace m1", "Namespace comment"); goTo.marker('5'); -verify.memberListContains("b", "var m1.b: number", "b's comment"); -verify.memberListContains("fooExport", "function m1.fooExport(): number", "exported function"); -verify.memberListContains("m2", "namespace m1.m2"); +verify.completionListContains("b", "var m1.b: number", "b's comment"); +verify.completionListContains("fooExport", "function m1.fooExport(): number", "exported function"); +verify.completionListContains("m2", "namespace m1.m2"); verify.quickInfoIs("function m1.fooExport(): number", "exported function"); goTo.marker('6'); @@ -122,55 +122,55 @@ verify.quickInfoAt("7", "var myvar: m1.m2.c"); goTo.marker('8'); verify.quickInfoIs("constructor m1.m2.c(): m1.m2.c"); -verify.memberListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); -verify.memberListContains("i", "var m1.m2.i: m1.m2.c", "i"); +verify.completionListContains("c", "constructor m1.m2.c(): m1.m2.c", ""); +verify.completionListContains("i", "var m1.m2.i: m1.m2.c", "i"); goTo.marker('9'); verify.completionListContains("m2", "namespace m2", "namespace comment of m2.m3"); verify.quickInfoIs("namespace m2", "namespace comment of m2.m3"); goTo.marker('10'); -verify.memberListContains("m3", "namespace m2.m3"); +verify.completionListContains("m3", "namespace m2.m3"); verify.quickInfoIs("namespace m2.m3", "namespace comment of m2.m3"); goTo.marker('11'); verify.quickInfoIs("constructor m2.m3.c(): m2.m3.c"); -verify.memberListContains("c", "constructor m2.m3.c(): m2.m3.c", ""); +verify.completionListContains("c", "constructor m2.m3.c(): m2.m3.c", ""); goTo.marker('12'); verify.completionListContains("m3", "namespace m3", "namespace comment of m3.m4.m5"); verify.quickInfoIs("namespace m3", "namespace comment of m3.m4.m5"); goTo.marker('13'); -verify.memberListContains("m4", "namespace m3.m4", "namespace comment of m3.m4.m5"); +verify.completionListContains("m4", "namespace m3.m4", "namespace comment of m3.m4.m5"); verify.quickInfoIs("namespace m3.m4", "namespace comment of m3.m4.m5"); goTo.marker('14'); -verify.memberListContains("m5", "namespace m3.m4.m5"); +verify.completionListContains("m5", "namespace m3.m4.m5"); verify.quickInfoIs("namespace m3.m4.m5", "namespace comment of m3.m4.m5"); goTo.marker('15'); verify.quickInfoIs("constructor m3.m4.m5.c(): m3.m4.m5.c"); -verify.memberListContains("c", "constructor m3.m4.m5.c(): m3.m4.m5.c", ""); +verify.completionListContains("c", "constructor m3.m4.m5.c(): m3.m4.m5.c", ""); goTo.marker('16'); verify.completionListContains("m4", "namespace m4", "namespace comment of m4.m5.m6"); verify.quickInfoIs("namespace m4", "namespace comment of m4.m5.m6"); goTo.marker('17'); -verify.memberListContains("m5", "namespace m4.m5", "namespace comment of m4.m5.m6"); +verify.completionListContains("m5", "namespace m4.m5", "namespace comment of m4.m5.m6"); verify.quickInfoIs("namespace m4.m5", "namespace comment of m4.m5.m6"); goTo.marker('18'); -verify.memberListContains("m6", "namespace m4.m5.m6"); +verify.completionListContains("m6", "namespace m4.m5.m6"); verify.quickInfoIs("namespace m4.m5.m6", "namespace comment of m4.m5.m6"); goTo.marker('19'); -verify.memberListContains("m7", "namespace m4.m5.m6.m7"); +verify.completionListContains("m7", "namespace m4.m5.m6.m7"); verify.quickInfoIs("namespace m4.m5.m6.m7"); goTo.marker('20'); -verify.memberListContains("c", "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", ""); +verify.completionListContains("c", "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", ""); verify.quickInfoIs("constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c"); goTo.marker('21'); @@ -178,19 +178,19 @@ verify.completionListContains("m5", "namespace m5"); verify.quickInfoIs("namespace m5", "namespace comment of m5.m6.m7"); goTo.marker('22'); -verify.memberListContains("m6", "namespace m5.m6"); +verify.completionListContains("m6", "namespace m5.m6"); verify.quickInfoIs("namespace m5.m6", "namespace comment of m5.m6.m7"); goTo.marker('23'); -verify.memberListContains("m7", "namespace m5.m6.m7"); +verify.completionListContains("m7", "namespace m5.m6.m7"); verify.quickInfoIs("namespace m5.m6.m7", "namespace comment of m5.m6.m7"); goTo.marker('24'); -verify.memberListContains("m8", "namespace m5.m6.m7.m8"); +verify.completionListContains("m8", "namespace m5.m6.m7.m8"); verify.quickInfoIs("namespace m5.m6.m7.m8", "namespace m8 comment"); goTo.marker('25'); -verify.memberListContains("c", "constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c", ""); +verify.completionListContains("c", "constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c", ""); verify.quickInfoIs("constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c"); goTo.marker('26'); @@ -198,15 +198,15 @@ verify.completionListContains("m6", "namespace m6"); verify.quickInfoIs("namespace m6"); goTo.marker('27'); -verify.memberListContains("m7", "namespace m6.m7"); +verify.completionListContains("m7", "namespace m6.m7"); verify.quickInfoIs("namespace m6.m7"); goTo.marker('28'); -verify.memberListContains("m8", "namespace m6.m7.m8"); +verify.completionListContains("m8", "namespace m6.m7.m8"); verify.quickInfoIs("namespace m6.m7.m8"); goTo.marker('29'); -verify.memberListContains("c", "constructor m6.m7.m8.c(): m6.m7.m8.c", ""); +verify.completionListContains("c", "constructor m6.m7.m8.c(): m6.m7.m8.c", ""); verify.quickInfoIs("constructor m6.m7.m8.c(): m6.m7.m8.c"); goTo.marker('30'); @@ -214,15 +214,15 @@ verify.completionListContains("m7", "namespace m7"); verify.quickInfoIs("namespace m7"); goTo.marker('31'); -verify.memberListContains("m8", "namespace m7.m8"); +verify.completionListContains("m8", "namespace m7.m8"); verify.quickInfoIs("namespace m7.m8"); goTo.marker('32'); -verify.memberListContains("m9", "namespace m7.m8.m9"); +verify.completionListContains("m9", "namespace m7.m8.m9"); verify.quickInfoIs("namespace m7.m8.m9", "namespace m9 comment"); goTo.marker('33'); -verify.memberListContains("c", "constructor m7.m8.m9.c(): m7.m8.m9.c", ""); +verify.completionListContains("c", "constructor m7.m8.m9.c(): m7.m8.m9.c", ""); verify.quickInfoIs("constructor m7.m8.m9.c(): m7.m8.m9.c"); goTo.marker('34'); diff --git a/tests/cases/fourslash/commentsOverloads.ts b/tests/cases/fourslash/commentsOverloads.ts index 5cc03aa842a..ec4a63349f9 100644 --- a/tests/cases/fourslash/commentsOverloads.ts +++ b/tests/cases/fourslash/commentsOverloads.ts @@ -326,10 +326,10 @@ goTo.marker('22q'); verify.quickInfoAt("22q", "var i1_i: i1(b: string) => number (+1 overload)", "this is signature 2"); goTo.marker('23'); -verify.memberListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1'); -verify.memberListContains('foo2', '(method) i1.foo2(a: number): number (+1 overload)', ''); -verify.memberListContains('foo3', '(method) i1.foo3(a: number): number (+1 overload)', ''); -verify.memberListContains('foo4', '(method) i1.foo4(a: number): number (+1 overload)', 'foo4 1'); +verify.completionListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1'); +verify.completionListContains('foo2', '(method) i1.foo2(a: number): number (+1 overload)', ''); +verify.completionListContains('foo3', '(method) i1.foo3(a: number): number (+1 overload)', ''); +verify.completionListContains('foo4', '(method) i1.foo4(a: number): number (+1 overload)', 'foo4 1'); goTo.marker('24'); verify.currentSignatureHelpDocCommentIs("foo 1"); @@ -432,11 +432,11 @@ verify.currentParameterHelpArgumentDocCommentIs(""); verify.quickInfoAt("43q", "var i4_i: i4(b: string) => number (+1 overload)"); goTo.marker('44'); -verify.memberListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', ''); -verify.memberListContains('prop2', '(method) c.prop2(a: number): number (+1 overload)', 'prop2 1'); -verify.memberListContains('prop3', '(method) c.prop3(a: number): number (+1 overload)', ''); -verify.memberListContains('prop4', '(method) c.prop4(a: number): number (+1 overload)', 'prop4 1'); -verify.memberListContains('prop5', '(method) c.prop5(a: number): number (+1 overload)', 'prop5 1'); +verify.completionListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', ''); +verify.completionListContains('prop2', '(method) c.prop2(a: number): number (+1 overload)', 'prop2 1'); +verify.completionListContains('prop3', '(method) c.prop3(a: number): number (+1 overload)', ''); +verify.completionListContains('prop4', '(method) c.prop4(a: number): number (+1 overload)', 'prop4 1'); +verify.completionListContains('prop5', '(method) c.prop5(a: number): number (+1 overload)', 'prop5 1'); goTo.marker('45'); verify.currentSignatureHelpDocCommentIs(""); diff --git a/tests/cases/fourslash/completionEntryForUnionProperty.ts b/tests/cases/fourslash/completionEntryForUnionProperty.ts index bc0f9405a1b..0ffc184693c 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty.ts @@ -15,6 +15,6 @@ ////x./**/ goTo.marker(); -verify.memberListContains("commonProperty", "(property) commonProperty: string | number"); -verify.memberListContains("commonFunction", "(method) commonFunction(): number"); -verify.memberListCount(2); \ No newline at end of file +verify.completionListContains("commonProperty", "(property) commonProperty: string | number"); +verify.completionListContains("commonFunction", "(method) commonFunction(): number"); +verify.completionListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionEntryForUnionProperty2.ts b/tests/cases/fourslash/completionEntryForUnionProperty2.ts index c2d7bc406a5..604052ff1b5 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty2.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty2.ts @@ -15,6 +15,6 @@ ////x.commonProperty./**/ goTo.marker(); -verify.memberListContains("toString", "(method) toString(): string"); -verify.memberListContains("valueOf", "(method) valueOf(): string | number"); -verify.memberListCount(2); \ No newline at end of file +verify.completionListContains("toString", "(method) toString(): string"); +verify.completionListContains("valueOf", "(method) valueOf(): string | number"); +verify.completionListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts index 7faebc1474b..15f5901113b 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment1.ts @@ -16,9 +16,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts index 4ba88e7dd2a..1d20b57e2a1 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment2.ts @@ -22,9 +22,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts index 238606520e3..764011d90c1 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment3.ts @@ -18,9 +18,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:browser"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts index 9855bb8c502..e785a1a7657 100644 --- a/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts +++ b/tests/cases/fourslash/completionForQuotedPropertyInPropertyAssignment4.ts @@ -16,9 +16,9 @@ goTo.marker('0'); verify.completionListContains("jspm"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(1); +verify.completionListCount(1); goTo.marker('1'); verify.completionListContains("jspm:dev"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(4); +verify.completionListCount(4); diff --git a/tests/cases/fourslash/completionForStringLiteral.ts b/tests/cases/fourslash/completionForStringLiteral.ts index cdbe1589f73..7a14f6b6519 100644 --- a/tests/cases/fourslash/completionForStringLiteral.ts +++ b/tests/cases/fourslash/completionForStringLiteral.ts @@ -8,8 +8,8 @@ goTo.marker('1'); verify.completionListContains("Option 1"); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("Option 2"); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral2.ts b/tests/cases/fourslash/completionForStringLiteral2.ts index 6f0768d6c6b..9b00208c729 100644 --- a/tests/cases/fourslash/completionForStringLiteral2.ts +++ b/tests/cases/fourslash/completionForStringLiteral2.ts @@ -12,9 +12,9 @@ goTo.marker('1'); verify.completionListContains("foo"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("some other name"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral3.ts b/tests/cases/fourslash/completionForStringLiteral3.ts index 8c1a7cab2ed..238ba74b4d8 100644 --- a/tests/cases/fourslash/completionForStringLiteral3.ts +++ b/tests/cases/fourslash/completionForStringLiteral3.ts @@ -12,9 +12,9 @@ goTo.marker('1'); verify.completionListContains("A"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); goTo.marker('2'); verify.completionListContains("A"); verify.completionListAllowsNewIdentifier(); -verify.memberListCount(3); +verify.completionListCount(3); diff --git a/tests/cases/fourslash/completionForStringLiteral4.ts b/tests/cases/fourslash/completionForStringLiteral4.ts index 11ae699eab8..5629926bd18 100644 --- a/tests/cases/fourslash/completionForStringLiteral4.ts +++ b/tests/cases/fourslash/completionForStringLiteral4.ts @@ -20,4 +20,4 @@ verify.quickInfoIs('function f(p1: "literal", p2: "literal", p3: "other1" | "oth goTo.marker('2'); verify.completionListContains("other1"); verify.completionListContains("other2"); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts index e5cc7a3d2b6..8ab9dbd0131 100644 --- a/tests/cases/fourslash/completionInJsDoc.ts +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -30,6 +30,7 @@ goTo.marker('1'); verify.completionListContains("constructor"); verify.completionListContains("param"); verify.completionListContains("type"); +verify.completionListContains("method"); goTo.marker('2'); verify.completionListContains("constructor"); diff --git a/tests/cases/fourslash/completionListAfterAnyType.ts b/tests/cases/fourslash/completionListAfterAnyType.ts index 7ab945e14cc..f7222675a0f 100644 --- a/tests/cases/fourslash/completionListAfterAnyType.ts +++ b/tests/cases/fourslash/completionListAfterAnyType.ts @@ -9,5 +9,5 @@ //// } goTo.marker(); -verify.memberListContains("charAt"); -verify.memberListCount(1); +verify.completionListContains("charAt"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/completionListAfterInvalidCharacter.ts b/tests/cases/fourslash/completionListAfterInvalidCharacter.ts index d5512e60bf7..ece28e5e3a0 100644 --- a/tests/cases/fourslash/completionListAfterInvalidCharacter.ts +++ b/tests/cases/fourslash/completionListAfterInvalidCharacter.ts @@ -8,4 +8,4 @@ ////testModule./**/ goTo.marker(); -verify.memberListContains("foo"); +verify.completionListContains("foo"); diff --git a/tests/cases/fourslash/completionListAfterObjectLiteral1.ts b/tests/cases/fourslash/completionListAfterObjectLiteral1.ts index f761aad2495..7296ce057b4 100644 --- a/tests/cases/fourslash/completionListAfterObjectLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterObjectLiteral1.ts @@ -3,5 +3,5 @@ ////var v = { x: 4, y: 3 }./**/ goTo.marker(); -verify.not.memberListContains('a'); -verify.memberListContains('x'); \ No newline at end of file +verify.not.completionListContains('a'); +verify.completionListContains('x'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts index ac8568d13f5..759a3f9c2a4 100644 --- a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts +++ b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral01.ts @@ -4,5 +4,5 @@ /////a/./**/ goTo.marker(); -verify.not.memberListContains('v'); -verify.memberListContains('compile'); \ No newline at end of file +verify.not.completionListContains('v'); +verify.completionListContains('compile'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts index 558b4d1e791..465c676c714 100644 --- a/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterRegularExpressionLiteral1.ts @@ -3,5 +3,5 @@ /////a/./**/ goTo.marker(); -verify.not.memberListContains('alert'); -verify.memberListContains('compile'); \ No newline at end of file +verify.not.completionListContains('alert'); +verify.completionListContains('compile'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAfterStringLiteral1.ts b/tests/cases/fourslash/completionListAfterStringLiteral1.ts index 1391b3ae80d..533b428cdf5 100644 --- a/tests/cases/fourslash/completionListAfterStringLiteral1.ts +++ b/tests/cases/fourslash/completionListAfterStringLiteral1.ts @@ -3,5 +3,5 @@ ////"a"./**/ goTo.marker(); -verify.not.memberListContains('alert'); -verify.memberListContains('charAt'); \ No newline at end of file +verify.not.completionListContains('alert'); +verify.completionListContains('charAt'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts index c3ee033bf54..d0517d87279 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedDot.ts @@ -15,4 +15,4 @@ goTo.marker(); verify.completionListIsEmpty(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts index f0287a0baea..a40c68e8b15 100644 --- a/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts +++ b/tests/cases/fourslash/completionListAndMemberListOnCommentedWhiteSpace.ts @@ -15,4 +15,4 @@ goTo.marker(); verify.completionListIsEmpty(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListAtEOF1.ts b/tests/cases/fourslash/completionListAtEOF1.ts index 1e903119462..3a7cfe95316 100644 --- a/tests/cases/fourslash/completionListAtEOF1.ts +++ b/tests/cases/fourslash/completionListAtEOF1.ts @@ -3,4 +3,4 @@ //// if(0 === ''. goTo.eof(); -verify.memberListContains("charAt"); +verify.completionListContains("charAt"); diff --git a/tests/cases/fourslash/completionListAtEOF2.ts b/tests/cases/fourslash/completionListAtEOF2.ts index d83d29ab599..8ba6a9d8e65 100644 --- a/tests/cases/fourslash/completionListAtEOF2.ts +++ b/tests/cases/fourslash/completionListAtEOF2.ts @@ -8,4 +8,4 @@ ////var p = = new .length: number", /*docComments*/ undefined, /*kind*/ "property"); -verify.memberListContains('toString', "(method) Array.toString(): string", /*docComments*/ undefined, /*kind*/ "method"); +verify.completionListContains('length', "(property) Array.length: number", /*docComments*/ undefined, /*kind*/ "property"); +verify.completionListContains('toString', "(method) Array.toString(): string", /*docComments*/ undefined, /*kind*/ "method"); diff --git a/tests/cases/fourslash/completionListOfSplitInterface.ts b/tests/cases/fourslash/completionListOfSplitInterface.ts index 61eae0da072..9bc635d8f8b 100644 --- a/tests/cases/fourslash/completionListOfSplitInterface.ts +++ b/tests/cases/fourslash/completionListOfSplitInterface.ts @@ -33,18 +33,18 @@ ////ci1./*2*/b; goTo.marker('1'); -verify.memberListCount(6); -verify.memberListContains("a"); -verify.memberListContains("b"); -verify.memberListContains("c"); -verify.memberListContains("i1"); -verify.memberListContains("i2"); -verify.memberListContains("i3"); +verify.completionListCount(6); +verify.completionListContains("a"); +verify.completionListContains("b"); +verify.completionListContains("c"); +verify.completionListContains("i1"); +verify.completionListContains("i2"); +verify.completionListContains("i3"); goTo.marker('2'); -verify.memberListCount(5); -verify.memberListContains("a"); -verify.memberListContains("b"); -verify.memberListContains("b1"); -verify.memberListContains("i11"); -verify.memberListContains("i12"); +verify.completionListCount(5); +verify.completionListContains("a"); +verify.completionListContains("b"); +verify.completionListContains("b1"); +verify.completionListContains("i11"); +verify.completionListContains("i12"); diff --git a/tests/cases/fourslash/completionListOnAliases.ts b/tests/cases/fourslash/completionListOnAliases.ts index 3d9026c3036..c15e5284c06 100644 --- a/tests/cases/fourslash/completionListOnAliases.ts +++ b/tests/cases/fourslash/completionListOnAliases.ts @@ -9,7 +9,7 @@ ////} goTo.marker("1"); -verify.memberListContains("x", "import x = M", undefined); +verify.completionListContains("x", "import x = M", undefined); goTo.marker("2"); -verify.memberListContains("value"); +verify.completionListContains("value"); diff --git a/tests/cases/fourslash/completionListOnAliases2.ts b/tests/cases/fourslash/completionListOnAliases2.ts index 6a74f3a525b..7ff50a1a2b5 100644 --- a/tests/cases/fourslash/completionListOnAliases2.ts +++ b/tests/cases/fourslash/completionListOnAliases2.ts @@ -35,40 +35,40 @@ // Module m goTo.marker("1"); -verify.memberListContains("I"); -verify.memberListContains("C"); -verify.memberListContains("E"); -verify.memberListContains("N"); -verify.memberListContains("V"); -verify.memberListContains("F"); -verify.memberListContains("A"); +verify.completionListContains("I"); +verify.completionListContains("C"); +verify.completionListContains("E"); +verify.completionListContains("N"); +verify.completionListContains("V"); +verify.completionListContains("F"); +verify.completionListContains("A"); // Class C goTo.marker("2"); -verify.memberListContains("property"); +verify.completionListContains("property"); // Enum E goTo.marker("3"); -verify.memberListContains("value"); +verify.completionListContains("value"); // Module N goTo.marker("4"); -verify.memberListContains("v"); +verify.completionListContains("v"); // var V goTo.marker("5"); -verify.memberListContains("toFixed"); +verify.completionListContains("toFixed"); // function F goTo.marker("6"); -verify.memberListContains("call"); +verify.completionListContains("call"); // alias a goTo.marker("7"); -verify.memberListContains("I"); -verify.memberListContains("C"); -verify.memberListContains("E"); -verify.memberListContains("N"); -verify.memberListContains("V"); -verify.memberListContains("F"); -verify.memberListContains("A"); +verify.completionListContains("I"); +verify.completionListContains("C"); +verify.completionListContains("E"); +verify.completionListContains("N"); +verify.completionListContains("V"); +verify.completionListContains("F"); +verify.completionListContains("A"); diff --git a/tests/cases/fourslash/completionListOnAliases3.ts b/tests/cases/fourslash/completionListOnAliases3.ts index 8c5194af968..3eab00e2ed9 100644 --- a/tests/cases/fourslash/completionListOnAliases3.ts +++ b/tests/cases/fourslash/completionListOnAliases3.ts @@ -10,4 +10,4 @@ // Q does not show up in member list of x goTo.marker("1"); -verify.memberListContains("Q"); +verify.completionListContains("Q"); diff --git a/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts b/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts index 9cab9589406..cec7bf87aec 100644 --- a/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts +++ b/tests/cases/fourslash/completionListOnFunctionCallWithOptionalArgument.ts @@ -4,4 +4,4 @@ //// Foo(function () { } )./**/; goTo.marker(); -verify.memberListContains('q'); +verify.completionListContains('q'); diff --git a/tests/cases/fourslash/completionListOnParam.ts b/tests/cases/fourslash/completionListOnParam.ts index 8b686535927..ad2bbcde1b8 100644 --- a/tests/cases/fourslash/completionListOnParam.ts +++ b/tests/cases/fourslash/completionListOnParam.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.memberListContains('Blah'); \ No newline at end of file +verify.completionListContains('Blah'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListOnParamOfGenericType1.ts b/tests/cases/fourslash/completionListOnParamOfGenericType1.ts index 1b0fdba8ff8..c55b48bf7e9 100644 --- a/tests/cases/fourslash/completionListOnParamOfGenericType1.ts +++ b/tests/cases/fourslash/completionListOnParamOfGenericType1.ts @@ -9,14 +9,14 @@ ////} goTo.marker('1'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); edit.insert('next.'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); edit.insert('prev.'); -verify.memberListContains('next'); -verify.memberListContains('prev'); -verify.memberListContains('pushEntry'); +verify.completionListContains('next'); +verify.completionListContains('prev'); +verify.completionListContains('pushEntry'); diff --git a/tests/cases/fourslash/completionListOnSuper.ts b/tests/cases/fourslash/completionListOnSuper.ts index 3ca997cf1bb..2b3c0ef75fa 100644 --- a/tests/cases/fourslash/completionListOnSuper.ts +++ b/tests/cases/fourslash/completionListOnSuper.ts @@ -17,6 +17,6 @@ ////} goTo.marker(); -verify.memberListContains('foo'); -verify.memberListContains('bar'); -verify.memberListCount(2); +verify.completionListContains('foo'); +verify.completionListContains('bar'); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/completionListOnVarBetweenModules.ts b/tests/cases/fourslash/completionListOnVarBetweenModules.ts index 6f907e5f75b..b0205e3428c 100644 --- a/tests/cases/fourslash/completionListOnVarBetweenModules.ts +++ b/tests/cases/fourslash/completionListOnVarBetweenModules.ts @@ -13,5 +13,5 @@ ////} goTo.marker(); -verify.memberListContains("C1"); -verify.memberListContains("C2"); +verify.completionListContains("C1"); +verify.completionListContains("C2"); diff --git a/tests/cases/fourslash/completionListPrimitives.ts b/tests/cases/fourslash/completionListPrimitives.ts index fd1d0670f2e..21a34659c4e 100644 --- a/tests/cases/fourslash/completionListPrimitives.ts +++ b/tests/cases/fourslash/completionListPrimitives.ts @@ -3,10 +3,10 @@ /////**/ goTo.marker(); -verify.memberListContains("any"); -verify.memberListContains("boolean"); -verify.memberListContains("null"); -verify.memberListContains("number"); -verify.memberListContains("string"); -verify.memberListContains("undefined"); -verify.memberListContains("void"); \ No newline at end of file +verify.completionListContains("any"); +verify.completionListContains("boolean"); +verify.completionListContains("null"); +verify.completionListContains("number"); +verify.completionListContains("string"); +verify.completionListContains("undefined"); +verify.completionListContains("void"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListPrivateMembers.ts b/tests/cases/fourslash/completionListPrivateMembers.ts index 772491a391e..e5e494d521d 100644 --- a/tests/cases/fourslash/completionListPrivateMembers.ts +++ b/tests/cases/fourslash/completionListPrivateMembers.ts @@ -13,5 +13,5 @@ goTo.marker(); -verify.memberListContains("y"); -verify.not.memberListContains("x"); +verify.completionListContains("y"); +verify.not.completionListContains("x"); diff --git a/tests/cases/fourslash/completionListPrivateMembers2.ts b/tests/cases/fourslash/completionListPrivateMembers2.ts index 1b19d042cbe..1a04df1d823 100644 --- a/tests/cases/fourslash/completionListPrivateMembers2.ts +++ b/tests/cases/fourslash/completionListPrivateMembers2.ts @@ -9,9 +9,9 @@ ////f./*2*/ goTo.marker("1"); -verify.memberListContains("y"); -verify.memberListContains("x"); +verify.completionListContains("y"); +verify.completionListContains("x"); goTo.marker("2"); -verify.not.memberListContains("x"); -verify.not.memberListContains("y"); \ No newline at end of file +verify.not.completionListContains("x"); +verify.not.completionListContains("y"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListPrivateMembers3.ts b/tests/cases/fourslash/completionListPrivateMembers3.ts index 69f7456d7b5..999ab8fa5e6 100644 --- a/tests/cases/fourslash/completionListPrivateMembers3.ts +++ b/tests/cases/fourslash/completionListPrivateMembers3.ts @@ -19,13 +19,13 @@ ////} goTo.marker("1"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); goTo.marker("2"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); goTo.marker("2"); -verify.memberListContains("p"); -verify.memberListCount(1); +verify.completionListContains("p"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/completionListProtectedMembers.ts b/tests/cases/fourslash/completionListProtectedMembers.ts index 4715a9fb714..20cb990405d 100644 --- a/tests/cases/fourslash/completionListProtectedMembers.ts +++ b/tests/cases/fourslash/completionListProtectedMembers.ts @@ -19,26 +19,26 @@ ////f./*5*/ goTo.marker("1"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.not.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.not.completionListContains("z"); goTo.marker("2"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.completionListContains("z"); goTo.marker("3"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.not.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.not.completionListContains("z"); goTo.marker("4"); -verify.memberListContains("y"); -verify.memberListContains("x"); -verify.memberListContains("z"); +verify.completionListContains("y"); +verify.completionListContains("x"); +verify.completionListContains("z"); goTo.marker("5"); -verify.not.memberListContains("x"); -verify.not.memberListContains("y"); -verify.not.memberListContains("z"); +verify.not.completionListContains("x"); +verify.not.completionListContains("y"); +verify.not.completionListContains("z"); diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers.ts b/tests/cases/fourslash/completionListStaticProtectedMembers.ts index d72859570aa..ae79387fbe7 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers.ts @@ -28,32 +28,32 @@ // Same class, everything is visible goTo.marker("1"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // Can not access protected properties overridden in subclass goTo.marker("3"); -verify.memberListContains('privateMethod'); -verify.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.completionListContains('privateMethod'); +verify.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts index 44cf9f73fd5..c6c64c5c6eb 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers2.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers2.ts @@ -29,42 +29,42 @@ // Same class, everything is visible goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); goTo.marker("3"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // only public and protected methods of the base class are accessible through super goTo.marker("4"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.not.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.not.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts index c955f23fa32..0cb916c181f 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers3.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers3.ts @@ -25,21 +25,21 @@ // Only public properties are visible outside the class goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.not.memberListContains('protectedOverriddenMethod'); -verify.not.memberListContains('protectedOverriddenProperty'); \ No newline at end of file +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.not.completionListContains('protectedOverriddenMethod'); +verify.not.completionListContains('protectedOverriddenProperty'); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts index 817d2c4829c..14c460d6873 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers4.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers4.ts @@ -28,22 +28,22 @@ // Sub class, everything but private is visible goTo.marker("1"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.memberListContains('protectedMethod'); -verify.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.completionListContains('protectedMethod'); +verify.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); // Can see protected methods elevated to public goTo.marker("2"); -verify.not.memberListContains('privateMethod'); -verify.not.memberListContains('privateProperty'); -verify.not.memberListContains('protectedMethod'); -verify.not.memberListContains('protectedProperty'); -verify.memberListContains('publicMethod'); -verify.memberListContains('publicProperty'); -verify.memberListContains('protectedOverriddenMethod'); -verify.memberListContains('protectedOverriddenProperty'); +verify.not.completionListContains('privateMethod'); +verify.not.completionListContains('privateProperty'); +verify.not.completionListContains('protectedMethod'); +verify.not.completionListContains('protectedProperty'); +verify.completionListContains('publicMethod'); +verify.completionListContains('publicProperty'); +verify.completionListContains('protectedOverriddenMethod'); +verify.completionListContains('protectedOverriddenProperty'); diff --git a/tests/cases/fourslash/completionListSuperMembers.ts b/tests/cases/fourslash/completionListSuperMembers.ts index 6c7ddd5c7b3..ae6195601a3 100644 --- a/tests/cases/fourslash/completionListSuperMembers.ts +++ b/tests/cases/fourslash/completionListSuperMembers.ts @@ -25,11 +25,11 @@ goTo.marker(); -verify.not.memberListContains("publicProperty"); -verify.memberListContains("publicInstanceMethod"); +verify.not.completionListContains("publicProperty"); +verify.completionListContains("publicInstanceMethod"); // No statics -verify.not.memberListContains("publicStaticProperty"); -verify.not.memberListContains("publicStaticMethod"); +verify.not.completionListContains("publicStaticProperty"); +verify.not.completionListContains("publicStaticMethod"); // No privates -verify.not.memberListContains("privateProperty"); -verify.not.memberListContains("privateInstanceMethod"); \ No newline at end of file +verify.not.completionListContains("privateProperty"); +verify.not.completionListContains("privateInstanceMethod"); \ No newline at end of file diff --git a/tests/cases/fourslash/exportEqualTypes.ts b/tests/cases/fourslash/exportEqualTypes.ts index 1b8593893dd..b03e21b5f99 100644 --- a/tests/cases/fourslash/exportEqualTypes.ts +++ b/tests/cases/fourslash/exportEqualTypes.ts @@ -20,5 +20,5 @@ verify.quickInfos({ 3: "var r2: string" }); goTo.marker('4'); -verify.memberListContains('foo'); +verify.completionListContains('foo'); verify.numberOfErrorsInCurrentFile(0); diff --git a/tests/cases/fourslash/extendArrayInterface.ts b/tests/cases/fourslash/extendArrayInterface.ts index 4402dc39b88..d2322b37df0 100644 --- a/tests/cases/fourslash/extendArrayInterface.ts +++ b/tests/cases/fourslash/extendArrayInterface.ts @@ -8,7 +8,7 @@ goTo.marker("1"); -verify.memberListContains("concat"); +verify.completionListContains("concat"); // foo doesn't exist, so both references should be in error verify.errorExistsBetweenMarkers("2", "3"); diff --git a/tests/cases/fourslash/externalModuleIntellisense.ts b/tests/cases/fourslash/externalModuleIntellisense.ts index 93c7143a9c6..8577e0686bf 100644 --- a/tests/cases/fourslash/externalModuleIntellisense.ts +++ b/tests/cases/fourslash/externalModuleIntellisense.ts @@ -23,4 +23,4 @@ goTo.eof(); edit.insert("x."); verify.completionListContains('enable'); verify.completionListContains('post'); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts b/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts index 257c6cf3455..a1d503a657a 100644 --- a/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts +++ b/tests/cases/fourslash/externalModuleRefernceResolutionOrderInImportDeclaration.ts @@ -16,5 +16,5 @@ goTo.marker('1'); edit.insert("file1."); -verify.memberListContains("bar"); -verify.not.memberListContains("foo"); \ No newline at end of file +verify.completionListContains("bar"); +verify.not.completionListContains("foo"); \ No newline at end of file diff --git a/tests/cases/fourslash/forwardReference.ts b/tests/cases/fourslash/forwardReference.ts index 3c2e2c6393c..355eda9113c 100644 --- a/tests/cases/fourslash/forwardReference.ts +++ b/tests/cases/fourslash/forwardReference.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.memberListContains('n'); +verify.completionListContains('n'); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 35c68b49fd8..745a746db11 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -121,13 +121,11 @@ declare namespace FourSlashInterface { private negative; not: verifyNegatable; constructor(negative?: boolean); - memberListContains(symbol: string, text?: string, documenation?: string, kind?: string): void; - memberListCount(expectedCount: number): void; + completionListCount(expectedCount: number): void; completionListContains(symbol: string, text?: string, documentation?: string, kind?: string, spanIndex?: number): void; completionListItemsCountIsGreaterThan(count: number): void; completionListIsEmpty(): void; completionListAllowsNewIdentifier(): void; - memberListIsEmpty(): void; signatureHelpPresent(): void; errorExistsBetweenMarkers(startMarker: string, endMarker: string): void; errorExistsAfterMarker(markerName?: string): void; @@ -279,7 +277,6 @@ declare namespace FourSlashInterface { printCurrentFileStateWithoutCaret(): void; printCurrentQuickInfo(): void; printCurrentSignatureHelp(): void; - printMemberListMembers(): void; printCompletionListMembers(): void; printBreakpointLocation(pos: number): void; printBreakpointAtCurrentLocation(): void; diff --git a/tests/cases/fourslash/functionTypes.ts b/tests/cases/fourslash/functionTypes.ts index 0baccba286e..813dfa8cdcb 100644 --- a/tests/cases/fourslash/functionTypes.ts +++ b/tests/cases/fourslash/functionTypes.ts @@ -23,7 +23,7 @@ verify.numberOfErrorsInCurrentFile(0); for (var i = 1; i <= 7; i++) { goTo.marker('' + i); - verify.memberListCount(8); + verify.completionListCount(8); verify.completionListContains('apply'); verify.completionListContains('arguments'); verify.completionListContains('bind'); diff --git a/tests/cases/fourslash/getJavaScriptCompletions20.ts b/tests/cases/fourslash/getJavaScriptCompletions20.ts index d254705bb91..3ca27fa288a 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions20.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions20.ts @@ -18,4 +18,4 @@ //// Person.getNa/**/ = 10; goTo.marker(); -verify.not.memberListContains('getNa'); +verify.not.completionListContains('getNa'); diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo8.ts b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts index 09ac27ce595..958dec3765d 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo8.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo8.ts @@ -21,9 +21,9 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); edit.backspace(); goTo.marker('2'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts index bcf263a4b8c..5e3eead3b6c 100644 --- a/tests/cases/fourslash/javaScriptModules13.ts +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -23,6 +23,6 @@ verify.completionListContains('y'); verify.not.completionListContains('invisible'); edit.insert('x.'); -verify.memberListContains('a', undefined, undefined, 'property'); +verify.completionListContains('a', undefined, undefined, 'property'); edit.insert('a.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules19.ts b/tests/cases/fourslash/javaScriptModules19.ts index 564cbea722f..56ee5a2a2e5 100644 --- a/tests/cases/fourslash/javaScriptModules19.ts +++ b/tests/cases/fourslash/javaScriptModules19.ts @@ -21,6 +21,6 @@ verify.completionListContains('y'); verify.not.completionListContains('invisible'); edit.insert('x.'); -verify.memberListContains('a', undefined, undefined, 'property'); +verify.completionListContains('a', undefined, undefined, 'property'); edit.insert('a.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptPrototype1.ts b/tests/cases/fourslash/javaScriptPrototype1.ts index c9c454cfb2c..8b2d6f3fb84 100644 --- a/tests/cases/fourslash/javaScriptPrototype1.ts +++ b/tests/cases/fourslash/javaScriptPrototype1.ts @@ -22,25 +22,25 @@ // Members of the class instance goTo.marker('1'); edit.insert('.'); -verify.memberListContains('foo', undefined, undefined, 'property'); -verify.memberListContains('bar', undefined, undefined, 'property'); +verify.completionListContains('foo', undefined, undefined, 'property'); +verify.completionListContains('bar', undefined, undefined, 'property'); edit.backspace(); // Members of a class method (1) goTo.marker('2'); edit.insert('.'); -verify.memberListContains('length', undefined, undefined, 'property'); +verify.completionListContains('length', undefined, undefined, 'property'); edit.backspace(); // Members of the invocation of a class method (1) goTo.marker('3'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); -verify.not.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); +verify.not.completionListContains('substr', undefined, undefined, 'method'); edit.backspace(); // Members of the invocation of a class method (2) goTo.marker('4'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); -verify.not.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); +verify.not.completionListContains('toFixed', undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/jsDocFunctionSignatures3.ts b/tests/cases/fourslash/jsDocFunctionSignatures3.ts index 3679035d31d..87efaec3308 100644 --- a/tests/cases/fourslash/jsDocFunctionSignatures3.ts +++ b/tests/cases/fourslash/jsDocFunctionSignatures3.ts @@ -23,10 +23,10 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('substr', undefined, undefined, 'method'); +verify.completionListContains('substr', undefined, undefined, 'method'); edit.backspace(); goTo.marker('2'); edit.insert('.'); -verify.memberListContains('toFixed', undefined, undefined, 'method'); +verify.completionListContains('toFixed', undefined, undefined, 'method'); edit.backspace(); diff --git a/tests/cases/fourslash/jsDocGenerics1.ts b/tests/cases/fourslash/jsDocGenerics1.ts index 61358e3f490..e5570937ba4 100644 --- a/tests/cases/fourslash/jsDocGenerics1.ts +++ b/tests/cases/fourslash/jsDocGenerics1.ts @@ -25,10 +25,10 @@ goTo.marker('1'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); goTo.marker('2'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); goTo.marker('3'); -verify.memberListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/jsdocNullableUnion.ts b/tests/cases/fourslash/jsdocNullableUnion.ts index 19dc9818d69..50b929b1912 100644 --- a/tests/cases/fourslash/jsdocNullableUnion.ts +++ b/tests/cases/fourslash/jsdocNullableUnion.ts @@ -14,10 +14,10 @@ ////} goTo.marker('1'); -verify.memberListContains("x"); +verify.completionListContains("x"); goTo.marker('2'); -verify.memberListContains("y"); +verify.completionListContains("y"); goTo.marker('3'); -verify.memberListContains("z"); +verify.completionListContains("z"); diff --git a/tests/cases/fourslash/lambdaThisMembers.ts b/tests/cases/fourslash/lambdaThisMembers.ts index 1e80a5a47df..1a5aa112a6c 100644 --- a/tests/cases/fourslash/lambdaThisMembers.ts +++ b/tests/cases/fourslash/lambdaThisMembers.ts @@ -12,5 +12,5 @@ goTo.marker(); verify.completionListContains("a"); verify.completionListContains("b"); -verify.memberListCount(2); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts index 56629a3b510..9bd59e1dc9f 100644 --- a/tests/cases/fourslash/memberCompletionFromFunctionCall.ts +++ b/tests/cases/fourslash/memberCompletionFromFunctionCall.ts @@ -8,5 +8,5 @@ goTo.marker(); edit.insert("."); -verify.not.memberListIsEmpty(); -verify.memberListContains("text"); \ No newline at end of file +verify.not.completionListIsEmpty(); +verify.completionListContains("text"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberCompletionInForEach1.ts b/tests/cases/fourslash/memberCompletionInForEach1.ts index 2af0393283f..b90da43c119 100644 --- a/tests/cases/fourslash/memberCompletionInForEach1.ts +++ b/tests/cases/fourslash/memberCompletionInForEach1.ts @@ -6,11 +6,11 @@ goTo.marker('1'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear goTo.marker('2'); edit.insert('.'); -verify.memberListContains('trim'); -verify.memberListCount(21); +verify.completionListContains('trim'); +verify.completionListCount(21); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts index 6092e1e280a..cc3fc92a31a 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts @@ -14,21 +14,21 @@ ////} goTo.marker("S"); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker("T"); -verify.memberListContains("x", "(property) IFoo.x: number"); -verify.memberListContains("y", "(property) IFoo.y: string"); -verify.memberListCount(2); +verify.completionListContains("x", "(property) IFoo.x: number"); +verify.completionListContains("y", "(property) IFoo.y: string"); +verify.completionListCount(2); goTo.marker("U"); -verify.memberListContains("toString", "(method) Object.toString(): string"); -verify.memberListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable +verify.completionListContains("toString", "(method) Object.toString(): string"); +verify.completionListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable goTo.marker("V"); -verify.memberListContains("x", "(property) IFoo.x: number"); -verify.memberListContains("y", "(property) IFoo.y: string"); -verify.memberListCount(2); +verify.completionListContains("x", "(property) IFoo.x: number"); +verify.completionListContains("y", "(property) IFoo.y: string"); +verify.completionListCount(2); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts index e7f6c5c6519..f77a8b0c612 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters2.ts @@ -17,5 +17,5 @@ goTo.marker(); -verify.memberListContains("foo"); -verify.memberListCount(1); +verify.completionListContains("foo"); +verify.completionListCount(1); diff --git a/tests/cases/fourslash/memberListAfterDoubleDot.ts b/tests/cases/fourslash/memberListAfterDoubleDot.ts index 21a1ad913ea..489e7c3b105 100644 --- a/tests/cases/fourslash/memberListAfterDoubleDot.ts +++ b/tests/cases/fourslash/memberListAfterDoubleDot.ts @@ -3,4 +3,4 @@ ////../**/ goTo.marker(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListAfterSingleDot.ts b/tests/cases/fourslash/memberListAfterSingleDot.ts index 62edf3b8c9e..ba0cdb1a1eb 100644 --- a/tests/cases/fourslash/memberListAfterSingleDot.ts +++ b/tests/cases/fourslash/memberListAfterSingleDot.ts @@ -3,4 +3,4 @@ ////./**/ goTo.marker(); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListErrorRecovery.ts b/tests/cases/fourslash/memberListErrorRecovery.ts index 74bd25464f6..ee1fdf9193c 100644 --- a/tests/cases/fourslash/memberListErrorRecovery.ts +++ b/tests/cases/fourslash/memberListErrorRecovery.ts @@ -6,5 +6,5 @@ /////*1*/var bar; goTo.marker(); -verify.memberListContains("fun"); +verify.completionListContains("fun"); verify.not.errorExistsAfterMarker("1"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInFunctionCall.ts b/tests/cases/fourslash/memberListInFunctionCall.ts index 3c8c8e9ceb1..82e05bc4a00 100644 --- a/tests/cases/fourslash/memberListInFunctionCall.ts +++ b/tests/cases/fourslash/memberListInFunctionCall.ts @@ -11,5 +11,5 @@ goTo.marker(); edit.insert('.'); -verify.memberListContains('charAt'); +verify.completionListContains('charAt'); diff --git a/tests/cases/fourslash/memberListInReopenedEnum.ts b/tests/cases/fourslash/memberListInReopenedEnum.ts index 5101cb46f89..a03ee39041c 100644 --- a/tests/cases/fourslash/memberListInReopenedEnum.ts +++ b/tests/cases/fourslash/memberListInReopenedEnum.ts @@ -12,7 +12,7 @@ goTo.marker('1'); -verify.memberListContains('A', '(enum member) E.A = 0'); -verify.memberListContains('B', '(enum member) E.B = 1'); -verify.memberListContains('C', '(enum member) E.C = 0'); -verify.memberListContains('D', '(enum member) E.D = 1'); \ No newline at end of file +verify.completionListContains('A', '(enum member) E.A = 0'); +verify.completionListContains('B', '(enum member) E.B = 1'); +verify.completionListContains('C', '(enum member) E.C = 0'); +verify.completionListContains('D', '(enum member) E.D = 1'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInWithBlock.ts b/tests/cases/fourslash/memberListInWithBlock.ts index a37c20dadfa..5253e924ff3 100644 --- a/tests/cases/fourslash/memberListInWithBlock.ts +++ b/tests/cases/fourslash/memberListInWithBlock.ts @@ -12,7 +12,7 @@ ////} goTo.marker('1'); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker('2'); // Only keywords should show in completion, no members or types diff --git a/tests/cases/fourslash/memberListInWithBlock2.ts b/tests/cases/fourslash/memberListInWithBlock2.ts index 72bccb6926c..534cd12a416 100644 --- a/tests/cases/fourslash/memberListInWithBlock2.ts +++ b/tests/cases/fourslash/memberListInWithBlock2.ts @@ -9,4 +9,4 @@ ////} goTo.marker('1'); -verify.memberListIsEmpty(); \ No newline at end of file +verify.completionListIsEmpty(); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListInWithBlock3.ts b/tests/cases/fourslash/memberListInWithBlock3.ts index a007b08cd02..b30ceed9897 100644 --- a/tests/cases/fourslash/memberListInWithBlock3.ts +++ b/tests/cases/fourslash/memberListInWithBlock3.ts @@ -4,4 +4,4 @@ ////with(x./*1*/ goTo.marker('1'); -verify.memberListContains("a"); +verify.completionListContains("a"); diff --git a/tests/cases/fourslash/memberListInsideObjectLiterals.ts b/tests/cases/fourslash/memberListInsideObjectLiterals.ts index 99d62cbc6e5..875fb2c7fc9 100644 --- a/tests/cases/fourslash/memberListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/memberListInsideObjectLiterals.ts @@ -26,16 +26,16 @@ // Literal member completion inside empty literal. goTo.marker("1"); -verify.memberListContains("x1", "(property) MyPoint.x1: number"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("x1", "(property) MyPoint.x1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion for 2nd member name. goTo.marker("2"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); // Literal member completion at existing member name location. goTo.marker("3"); -verify.memberListContains("y1", "(property) MyPoint.y1: number"); +verify.completionListContains("y1", "(property) MyPoint.y1: number"); goTo.marker("4"); -verify.memberListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file +verify.completionListContains("x1", "(property) MyPoint.x1: number"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfClass.ts b/tests/cases/fourslash/memberListOfClass.ts index 6c93a0536d9..3355109e4a7 100644 --- a/tests/cases/fourslash/memberListOfClass.ts +++ b/tests/cases/fourslash/memberListOfClass.ts @@ -10,6 +10,6 @@ ////f./**/ goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); -verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file +verify.completionListCount(2); +verify.completionListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.completionListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts index 42171ff2e8b..5caaf5d9c23 100644 --- a/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts +++ b/tests/cases/fourslash/memberListOfEnumFromExternalModule.ts @@ -10,4 +10,4 @@ goTo.file("memberListOfEnumFromExternalModule_file1.ts"); goTo.marker('1'); -verify.memberListContains("One"); \ No newline at end of file +verify.completionListContains("One"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfEnumInModule.ts b/tests/cases/fourslash/memberListOfEnumInModule.ts index f92c5d43ea8..0a3887e3304 100644 --- a/tests/cases/fourslash/memberListOfEnumInModule.ts +++ b/tests/cases/fourslash/memberListOfEnumInModule.ts @@ -9,5 +9,5 @@ ////} goTo.marker(); -verify.memberListContains("bar"); -verify.memberListContains("baz"); \ No newline at end of file +verify.completionListContains("bar"); +verify.completionListContains("baz"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfExportedClass.ts b/tests/cases/fourslash/memberListOfExportedClass.ts index f6632bfe7b0..3c9fe36358b 100644 --- a/tests/cases/fourslash/memberListOfExportedClass.ts +++ b/tests/cases/fourslash/memberListOfExportedClass.ts @@ -11,5 +11,5 @@ ////c./**/ // test on c. goTo.marker(); -verify.memberListCount(1); -verify.memberListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file +verify.completionListCount(1); +verify.completionListContains('pub', '(property) M.C.pub: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfModule.ts b/tests/cases/fourslash/memberListOfModule.ts index f09dfd67dbd..4724691c0a7 100644 --- a/tests/cases/fourslash/memberListOfModule.ts +++ b/tests/cases/fourslash/memberListOfModule.ts @@ -14,6 +14,6 @@ ////var x: Foo./**/ goTo.marker(); -verify.memberListCount(2); -verify.memberListContains('Bar'); -verify.memberListContains('Blah'); \ No newline at end of file +verify.completionListCount(2); +verify.completionListContains('Bar'); +verify.completionListContains('Blah'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOfVarInArrowExpression.ts b/tests/cases/fourslash/memberListOfVarInArrowExpression.ts index 03da06989ae..b1a91ae3cb2 100644 --- a/tests/cases/fourslash/memberListOfVarInArrowExpression.ts +++ b/tests/cases/fourslash/memberListOfVarInArrowExpression.ts @@ -15,4 +15,4 @@ goTo.marker('1'); verify.quickInfoIs("(property) a1: string"); -verify.memberListContains("a1", "(property) a1: string"); \ No newline at end of file +verify.completionListContains("a1", "(property) a1: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnContextualThis.ts b/tests/cases/fourslash/memberListOnContextualThis.ts index 7eeb67dc620..e17600cad98 100644 --- a/tests/cases/fourslash/memberListOnContextualThis.ts +++ b/tests/cases/fourslash/memberListOnContextualThis.ts @@ -8,5 +8,5 @@ goTo.marker('1'); verify.quickInfoIs("this: A"); goTo.marker('2'); -verify.memberListContains('a', '(property) A.a: string'); +verify.completionListContains('a', '(property) A.a: string'); diff --git a/tests/cases/fourslash/memberListOnExplicitThis.ts b/tests/cases/fourslash/memberListOnExplicitThis.ts index b776a7c0641..425eb17f8ba 100644 --- a/tests/cases/fourslash/memberListOnExplicitThis.ts +++ b/tests/cases/fourslash/memberListOnExplicitThis.ts @@ -13,17 +13,17 @@ ////function g(this: Restricted) {this./*4*/} goTo.marker('1'); -verify.memberListContains('f', '(method) C1.f(this: this): void'); -verify.memberListContains('g', '(method) C1.g(this: Restricted): void'); -verify.memberListContains('n', '(property) C1.n: number'); -verify.memberListContains('m', '(property) C1.m: number'); +verify.completionListContains('f', '(method) C1.f(this: this): void'); +verify.completionListContains('g', '(method) C1.g(this: Restricted): void'); +verify.completionListContains('n', '(property) C1.n: number'); +verify.completionListContains('m', '(property) C1.m: number'); goTo.marker('2'); -verify.memberListContains('n', '(property) Restricted.n: number'); +verify.completionListContains('n', '(property) Restricted.n: number'); goTo.marker('3'); -verify.memberListIsEmpty(); +verify.completionListIsEmpty(); goTo.marker('4'); -verify.memberListContains('n', '(property) Restricted.n: number'); +verify.completionListContains('n', '(property) Restricted.n: number'); diff --git a/tests/cases/fourslash/memberListOnFunctionParameter.ts b/tests/cases/fourslash/memberListOnFunctionParameter.ts index ee33cdc95e5..52daacb3573 100644 --- a/tests/cases/fourslash/memberListOnFunctionParameter.ts +++ b/tests/cases/fourslash/memberListOnFunctionParameter.ts @@ -6,8 +6,8 @@ ////} goTo.marker(); -verify.memberListContains("charAt"); -verify.memberListContains("charCodeAt"); -verify.memberListContains("length"); -verify.memberListContains("concat"); -verify.not.memberListContains("toFixed"); \ No newline at end of file +verify.completionListContains("charAt"); +verify.completionListContains("charCodeAt"); +verify.completionListContains("length"); +verify.completionListContains("concat"); +verify.not.completionListContains("toFixed"); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts index 341605e391c..c44835f6882 100644 --- a/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts +++ b/tests/cases/fourslash/memberListOnThisInClassWithPrivates.ts @@ -8,6 +8,6 @@ ////} goTo.marker(); -verify.memberListContains('privMeth', '(method) C1.privMeth(): void'); -verify.memberListContains('pubMeth', '(method) C1.pubMeth(): void'); -verify.memberListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file +verify.completionListContains('privMeth', '(method) C1.privMeth(): void'); +verify.completionListContains('pubMeth', '(method) C1.pubMeth(): void'); +verify.completionListContains('pubProp', '(property) C1.pubProp: number'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberlistOnDDot.ts b/tests/cases/fourslash/memberlistOnDDot.ts index 604bf531fc7..11efdd5d523 100644 --- a/tests/cases/fourslash/memberlistOnDDot.ts +++ b/tests/cases/fourslash/memberlistOnDDot.ts @@ -6,4 +6,4 @@ goTo.marker(); edit.insert('.'); edit.insert('.'); -//verify.not.memberListContains('charAt'); \ No newline at end of file +//verify.not.completionListContains('charAt'); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts index cfeaabfbb86..25e6cd4c68e 100644 --- a/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts +++ b/tests/cases/fourslash/quickInfoOnNarrowedTypeInModule.ts @@ -64,12 +64,12 @@ verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: strin goTo.marker('7'); verify.quickInfoIs('var m.exportedStrOrNum: string | number'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string | number"); goTo.marker('8'); verify.quickInfoIs('var m.exportedStrOrNum: number'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: number"); +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: number"); goTo.marker('9'); verify.quickInfoIs('var m.exportedStrOrNum: string'); -verify.memberListContains("exportedStrOrNum", "var m.exportedStrOrNum: string"); \ No newline at end of file +verify.completionListContains("exportedStrOrNum", "var m.exportedStrOrNum: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts index 3ae0533d340..e11af2beda4 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithAccessors.ts @@ -17,8 +17,8 @@ verify.quickInfos({ }); goTo.marker('3'); -verify.memberListContains("x", "(property) x: number", undefined); -verify.memberListContains("b", "(property) b: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); +verify.completionListContains("b", "(property) b: number", undefined); verify.quickInfoIs("(property) x: number"); verify.quickInfoAt("4", "var point: {\n b: number;\n x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts index 7beaf5548fb..f592b255ac0 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlyGetter.ts @@ -14,6 +14,6 @@ verify.quickInfos({ }); goTo.marker('3'); -verify.memberListContains("x", "(property) x: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); verify.quickInfoAt("4", "var point: {\n readonly x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts index 95a304329f2..d66626cc99d 100644 --- a/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts +++ b/tests/cases/fourslash/quickInfoOnObjectLiteralWithOnlySetter.ts @@ -12,8 +12,8 @@ verify.quickInfoAt("1", "function makePoint(x: number): {\n b: number;\n x: number;\n}"); goTo.marker('2'); -verify.memberListContains("x", "(property) x: number", undefined); -verify.memberListContains("b", "(property) b: number", undefined); +verify.completionListContains("x", "(property) x: number", undefined); +verify.completionListContains("b", "(property) b: number", undefined); verify.quickInfoIs("(property) x: number"); verify.quickInfoAt("3", "var point: {\n b: number;\n x: number;\n}"); diff --git a/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts b/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts new file mode 100644 index 00000000000..39453ba8cdc --- /dev/null +++ b/tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts @@ -0,0 +1,15 @@ +/// + +// @filename: a.tsx +////import * as React from 'react'; +////interface SomeInterface { +//// someBoolean: boolean, +//// someString: string; +////} +////interface SomeProps { +//// someProp: SomeInterface; +////} +////export const /*1*/SomeStatelessComponent = ({someProp: { someBoolean, someString}}: SomeProps) => (

+>P : P +>T : T +>func : HTML +>HTML : HTML + +declare var h: HTML; +>h : HTML +>HTML : HTML + +h.div(h); +>h.div(h) : {} +>h.div : Block +>h : HTML +>div : Block +>h : HTML + diff --git a/tests/baselines/reference/mappedTypeModifiers.js b/tests/baselines/reference/mappedTypeModifiers.js new file mode 100644 index 00000000000..6291fb9c42b --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.js @@ -0,0 +1,133 @@ +//// [mappedTypeModifiers.ts] + +type T = { a: number, b: string }; +type TP = { a?: number, b?: string }; +type TR = { readonly a: number, readonly b: string }; +type TPR = { readonly a?: number, readonly b?: string }; + +var v00: "a" | "b"; +var v00: keyof T; +var v00: keyof TP; +var v00: keyof TR; +var v00: keyof TPR; + +var v01: T; +var v01: { [P in keyof T]: T[P] }; +var v01: Pick; +var v01: Pick, keyof T>; + +var v02: TP; +var v02: { [P in keyof T]?: T[P] }; +var v02: Partial; +var v02: { [P in keyof TP]: TP[P] } +var v02: Pick; + +var v03: TR; +var v03: { readonly [P in keyof T]: T[P] }; +var v03: Readonly; +var v03: { [P in keyof TR]: TR[P] } +var v03: Pick; + +var v04: TPR; +var v04: { readonly [P in keyof T]?: T[P] }; +var v04: Partial; +var v04: Readonly; +var v04: Partial>; +var v04: Readonly>; +var v04: { [P in keyof TPR]: TPR[P] } +var v04: Pick; + +type Boxified = { [P in keyof T]: { x: T[P] } }; + +type B = { a: { x: number }, b: { x: string } }; +type BP = { a?: { x: number }, b?: { x: string } }; +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; + +var b00: "a" | "b"; +var b00: keyof B; +var b00: keyof BP; +var b00: keyof BR; +var b00: keyof BPR; + +var b01: B; +var b01: { [P in keyof B]: B[P] }; +var b01: Pick; +var b01: Pick, keyof B>; + +var b02: BP; +var b02: { [P in keyof B]?: B[P] }; +var b02: Partial; +var b02: { [P in keyof BP]: BP[P] } +var b02: Pick; + +var b03: BR; +var b03: { readonly [P in keyof B]: B[P] }; +var b03: Readonly; +var b03: { [P in keyof BR]: BR[P] } +var b03: Pick; + +var b04: BPR; +var b04: { readonly [P in keyof B]?: B[P] }; +var b04: Partial
; +var b04: Readonly; +var b04: Partial>; +var b04: Readonly>; +var b04: { [P in keyof BPR]: BPR[P] } +var b04: Pick; + +//// [mappedTypeModifiers.js] +var v00; +var v00; +var v00; +var v00; +var v00; +var v01; +var v01; +var v01; +var v01; +var v02; +var v02; +var v02; +var v02; +var v02; +var v03; +var v03; +var v03; +var v03; +var v03; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var v04; +var b00; +var b00; +var b00; +var b00; +var b00; +var b01; +var b01; +var b01; +var b01; +var b02; +var b02; +var b02; +var b02; +var b02; +var b03; +var b03; +var b03; +var b03; +var b03; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; +var b04; diff --git a/tests/baselines/reference/mappedTypeModifiers.symbols b/tests/baselines/reference/mappedTypeModifiers.symbols new file mode 100644 index 00000000000..5138055d08b --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.symbols @@ -0,0 +1,355 @@ +=== tests/cases/conformance/types/mapped/mappedTypeModifiers.ts === + +type T = { a: number, b: string }; +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 1, 10)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 1, 21)) + +type TP = { a?: number, b?: string }; +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 2, 11)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 2, 23)) + +type TR = { readonly a: number, readonly b: string }; +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 3, 11)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 3, 31)) + +type TPR = { readonly a?: number, readonly b?: string }; +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 4, 12)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 4, 33)) + +var v00: "a" | "b"; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) + +var v00: keyof T; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v00: keyof TP; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v00: keyof TR; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v00: keyof TPR; +>v00 : Symbol(v00, Decl(mappedTypeModifiers.ts, 6, 3), Decl(mappedTypeModifiers.ts, 7, 3), Decl(mappedTypeModifiers.ts, 8, 3), Decl(mappedTypeModifiers.ts, 9, 3), Decl(mappedTypeModifiers.ts, 10, 3)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) + +var v01: T; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v01: { [P in keyof T]: T[P] }; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 13, 12)) + +var v01: Pick; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v01: Pick, keyof T>; +>v01 : Symbol(v01, Decl(mappedTypeModifiers.ts, 12, 3), Decl(mappedTypeModifiers.ts, 13, 3), Decl(mappedTypeModifiers.ts, 14, 3), Decl(mappedTypeModifiers.ts, 15, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v02: TP; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v02: { [P in keyof T]?: T[P] }; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 18, 12)) + +var v02: Partial; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v02: { [P in keyof TP]: TP[P] } +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 20, 12)) + +var v02: Pick; +>v02 : Symbol(v02, Decl(mappedTypeModifiers.ts, 17, 3), Decl(mappedTypeModifiers.ts, 18, 3), Decl(mappedTypeModifiers.ts, 19, 3), Decl(mappedTypeModifiers.ts, 20, 3), Decl(mappedTypeModifiers.ts, 21, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v03: TR; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v03: { readonly [P in keyof T]: T[P] }; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 24, 21)) + +var v03: Readonly; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v03: { [P in keyof TR]: TR[P] } +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 26, 12)) + +var v03: Pick; +>v03 : Symbol(v03, Decl(mappedTypeModifiers.ts, 23, 3), Decl(mappedTypeModifiers.ts, 24, 3), Decl(mappedTypeModifiers.ts, 25, 3), Decl(mappedTypeModifiers.ts, 26, 3), Decl(mappedTypeModifiers.ts, 27, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v04: TPR; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) + +var v04: { readonly [P in keyof T]?: T[P] }; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 30, 21)) + +var v04: Partial; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>TR : Symbol(TR, Decl(mappedTypeModifiers.ts, 2, 37)) + +var v04: Readonly; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>TP : Symbol(TP, Decl(mappedTypeModifiers.ts, 1, 34)) + +var v04: Partial>; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v04: Readonly>; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 35, 12)) + +var v04: Pick; +>v04 : Symbol(v04, Decl(mappedTypeModifiers.ts, 29, 3), Decl(mappedTypeModifiers.ts, 30, 3), Decl(mappedTypeModifiers.ts, 31, 3), Decl(mappedTypeModifiers.ts, 32, 3), Decl(mappedTypeModifiers.ts, 33, 3), Decl(mappedTypeModifiers.ts, 34, 3), Decl(mappedTypeModifiers.ts, 35, 3), Decl(mappedTypeModifiers.ts, 36, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>TPR : Symbol(TPR, Decl(mappedTypeModifiers.ts, 3, 53)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 0, 0)) + +type Boxified = { [P in keyof T]: { x: T[P] } }; +>Boxified : Symbol(Boxified, Decl(mappedTypeModifiers.ts, 36, 28)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 38, 38)) +>T : Symbol(T, Decl(mappedTypeModifiers.ts, 38, 14)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 38, 22)) + +type B = { a: { x: number }, b: { x: string } }; +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 40, 10)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 15)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 40, 28)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 40, 33)) + +type BP = { a?: { x: number }, b?: { x: string } }; +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 41, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 17)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 41, 30)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 41, 36)) + +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 42, 11)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 25)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 42, 38)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 42, 52)) + +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>a : Symbol(a, Decl(mappedTypeModifiers.ts, 43, 12)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 27)) +>b : Symbol(b, Decl(mappedTypeModifiers.ts, 43, 40)) +>x : Symbol(x, Decl(mappedTypeModifiers.ts, 43, 55)) + +var b00: "a" | "b"; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) + +var b00: keyof B; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b00: keyof BP; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b00: keyof BR; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b00: keyof BPR; +>b00 : Symbol(b00, Decl(mappedTypeModifiers.ts, 45, 3), Decl(mappedTypeModifiers.ts, 46, 3), Decl(mappedTypeModifiers.ts, 47, 3), Decl(mappedTypeModifiers.ts, 48, 3), Decl(mappedTypeModifiers.ts, 49, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + +var b01: B; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b01: { [P in keyof B]: B[P] }; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 52, 12)) + +var b01: Pick; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b01: Pick, keyof B>; +>b01 : Symbol(b01, Decl(mappedTypeModifiers.ts, 51, 3), Decl(mappedTypeModifiers.ts, 52, 3), Decl(mappedTypeModifiers.ts, 53, 3), Decl(mappedTypeModifiers.ts, 54, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b02: BP; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b02: { [P in keyof B]?: B[P] }; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 57, 12)) + +var b02: Partial; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b02: { [P in keyof BP]: BP[P] } +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 59, 12)) + +var b02: Pick; +>b02 : Symbol(b02, Decl(mappedTypeModifiers.ts, 56, 3), Decl(mappedTypeModifiers.ts, 57, 3), Decl(mappedTypeModifiers.ts, 58, 3), Decl(mappedTypeModifiers.ts, 59, 3), Decl(mappedTypeModifiers.ts, 60, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b03: BR; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b03: { readonly [P in keyof B]: B[P] }; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 63, 21)) + +var b03: Readonly; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b03: { [P in keyof BR]: BR[P] } +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 65, 12)) + +var b03: Pick; +>b03 : Symbol(b03, Decl(mappedTypeModifiers.ts, 62, 3), Decl(mappedTypeModifiers.ts, 63, 3), Decl(mappedTypeModifiers.ts, 64, 3), Decl(mappedTypeModifiers.ts, 65, 3), Decl(mappedTypeModifiers.ts, 66, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b04: BPR; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + +var b04: { readonly [P in keyof B]?: B[P] }; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 69, 21)) + +var b04: Partial
; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>BR : Symbol(BR, Decl(mappedTypeModifiers.ts, 41, 51)) + +var b04: Readonly; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>BP : Symbol(BP, Decl(mappedTypeModifiers.ts, 40, 48)) + +var b04: Partial>; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b04: Readonly>; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>B : Symbol(B, Decl(mappedTypeModifiers.ts, 38, 51)) + +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>P : Symbol(P, Decl(mappedTypeModifiers.ts, 74, 12)) + +var b04: Pick; +>b04 : Symbol(b04, Decl(mappedTypeModifiers.ts, 68, 3), Decl(mappedTypeModifiers.ts, 69, 3), Decl(mappedTypeModifiers.ts, 70, 3), Decl(mappedTypeModifiers.ts, 71, 3), Decl(mappedTypeModifiers.ts, 72, 3), Decl(mappedTypeModifiers.ts, 73, 3), Decl(mappedTypeModifiers.ts, 74, 3), Decl(mappedTypeModifiers.ts, 75, 3)) +>Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) +>BPR : Symbol(BPR, Decl(mappedTypeModifiers.ts, 42, 67)) + diff --git a/tests/baselines/reference/mappedTypeModifiers.types b/tests/baselines/reference/mappedTypeModifiers.types new file mode 100644 index 00000000000..7a30e227bd6 --- /dev/null +++ b/tests/baselines/reference/mappedTypeModifiers.types @@ -0,0 +1,355 @@ +=== tests/cases/conformance/types/mapped/mappedTypeModifiers.ts === + +type T = { a: number, b: string }; +>T : T +>a : number +>b : string + +type TP = { a?: number, b?: string }; +>TP : TP +>a : number | undefined +>b : string | undefined + +type TR = { readonly a: number, readonly b: string }; +>TR : TR +>a : number +>b : string + +type TPR = { readonly a?: number, readonly b?: string }; +>TPR : TPR +>a : number | undefined +>b : string | undefined + +var v00: "a" | "b"; +>v00 : "a" | "b" + +var v00: keyof T; +>v00 : "a" | "b" +>T : T + +var v00: keyof TP; +>v00 : "a" | "b" +>TP : TP + +var v00: keyof TR; +>v00 : "a" | "b" +>TR : TR + +var v00: keyof TPR; +>v00 : "a" | "b" +>TPR : TPR + +var v01: T; +>v01 : T +>T : T + +var v01: { [P in keyof T]: T[P] }; +>v01 : T +>P : P +>T : T +>T : T +>P : P + +var v01: Pick; +>v01 : T +>Pick : Pick +>T : T +>T : T + +var v01: Pick, keyof T>; +>v01 : T +>Pick : Pick +>Pick : Pick +>T : T +>T : T +>T : T + +var v02: TP; +>v02 : TP +>TP : TP + +var v02: { [P in keyof T]?: T[P] }; +>v02 : TP +>P : P +>T : T +>T : T +>P : P + +var v02: Partial; +>v02 : TP +>Partial : Partial +>T : T + +var v02: { [P in keyof TP]: TP[P] } +>v02 : TP +>P : P +>TP : TP +>TP : TP +>P : P + +var v02: Pick; +>v02 : TP +>Pick : Pick +>TP : TP +>TP : TP + +var v03: TR; +>v03 : TR +>TR : TR + +var v03: { readonly [P in keyof T]: T[P] }; +>v03 : TR +>P : P +>T : T +>T : T +>P : P + +var v03: Readonly; +>v03 : TR +>Readonly : Readonly +>T : T + +var v03: { [P in keyof TR]: TR[P] } +>v03 : TR +>P : P +>TR : TR +>TR : TR +>P : P + +var v03: Pick; +>v03 : TR +>Pick : Pick +>TR : TR +>TR : TR + +var v04: TPR; +>v04 : TPR +>TPR : TPR + +var v04: { readonly [P in keyof T]?: T[P] }; +>v04 : TPR +>P : P +>T : T +>T : T +>P : P + +var v04: Partial; +>v04 : TPR +>Partial : Partial +>TR : TR + +var v04: Readonly; +>v04 : TPR +>Readonly : Readonly +>TP : TP + +var v04: Partial>; +>v04 : TPR +>Partial : Partial +>Readonly : Readonly +>T : T + +var v04: Readonly>; +>v04 : TPR +>Readonly : Readonly +>Partial : Partial +>T : T + +var v04: { [P in keyof TPR]: TPR[P] } +>v04 : TPR +>P : P +>TPR : TPR +>TPR : TPR +>P : P + +var v04: Pick; +>v04 : TPR +>Pick : Pick +>TPR : TPR +>T : T + +type Boxified = { [P in keyof T]: { x: T[P] } }; +>Boxified : Boxified +>T : T +>P : P +>T : T +>x : T[P] +>T : T +>P : P + +type B = { a: { x: number }, b: { x: string } }; +>B : B +>a : { x: number; } +>x : number +>b : { x: string; } +>x : string + +type BP = { a?: { x: number }, b?: { x: string } }; +>BP : BP +>a : { x: number; } | undefined +>x : number +>b : { x: string; } | undefined +>x : string + +type BR = { readonly a: { x: number }, readonly b: { x: string } }; +>BR : BR +>a : { x: number; } +>x : number +>b : { x: string; } +>x : string + +type BPR = { readonly a?: { x: number }, readonly b?: { x: string } }; +>BPR : BPR +>a : { x: number; } | undefined +>x : number +>b : { x: string; } | undefined +>x : string + +var b00: "a" | "b"; +>b00 : "a" | "b" + +var b00: keyof B; +>b00 : "a" | "b" +>B : B + +var b00: keyof BP; +>b00 : "a" | "b" +>BP : BP + +var b00: keyof BR; +>b00 : "a" | "b" +>BR : BR + +var b00: keyof BPR; +>b00 : "a" | "b" +>BPR : BPR + +var b01: B; +>b01 : B +>B : B + +var b01: { [P in keyof B]: B[P] }; +>b01 : B +>P : P +>B : B +>B : B +>P : P + +var b01: Pick; +>b01 : B +>Pick : Pick +>B : B +>B : B + +var b01: Pick, keyof B>; +>b01 : B +>Pick : Pick +>Pick : Pick +>B : B +>B : B +>B : B + +var b02: BP; +>b02 : BP +>BP : BP + +var b02: { [P in keyof B]?: B[P] }; +>b02 : BP +>P : P +>B : B +>B : B +>P : P + +var b02: Partial; +>b02 : BP +>Partial : Partial +>B : B + +var b02: { [P in keyof BP]: BP[P] } +>b02 : BP +>P : P +>BP : BP +>BP : BP +>P : P + +var b02: Pick; +>b02 : BP +>Pick : Pick +>BP : BP +>BP : BP + +var b03: BR; +>b03 : BR +>BR : BR + +var b03: { readonly [P in keyof B]: B[P] }; +>b03 : BR +>P : P +>B : B +>B : B +>P : P + +var b03: Readonly; +>b03 : BR +>Readonly : Readonly +>B : B + +var b03: { [P in keyof BR]: BR[P] } +>b03 : BR +>P : P +>BR : BR +>BR : BR +>P : P + +var b03: Pick; +>b03 : BR +>Pick : Pick +>BR : BR +>BR : BR + +var b04: BPR; +>b04 : BPR +>BPR : BPR + +var b04: { readonly [P in keyof B]?: B[P] }; +>b04 : BPR +>P : P +>B : B +>B : B +>P : P + +var b04: Partial
; +>b04 : BPR +>Partial : Partial +>BR : BR + +var b04: Readonly; +>b04 : BPR +>Readonly : Readonly +>BP : BP + +var b04: Partial>; +>b04 : BPR +>Partial : Partial +>Readonly : Readonly +>B : B + +var b04: Readonly>; +>b04 : BPR +>Readonly : Readonly +>Partial : Partial +>B : B + +var b04: { [P in keyof BPR]: BPR[P] } +>b04 : BPR +>P : P +>BPR : BPR +>BPR : BPR +>P : P + +var b04: Pick; +>b04 : BPR +>Pick : Pick +>BPR : BPR +>BPR : BPR + diff --git a/tests/baselines/reference/mappedTypes1.js b/tests/baselines/reference/mappedTypes1.js index a172b637d1c..1998ad5ab6b 100644 --- a/tests/baselines/reference/mappedTypes1.js +++ b/tests/baselines/reference/mappedTypes1.js @@ -33,15 +33,18 @@ type T47 = { [P in string | "a" | "b" | "0" | "1"]: void }; declare function f1(): { [P in keyof T1]: void }; declare function f2(): { [P in keyof T1]: void }; declare function f3(): { [P in keyof T1]: void }; +declare function f4(): { [P in keyof T1]: void }; let x1 = f1(); let x2 = f2(); -let x3 = f3(); +let x3 = f3(); +let x4 = f4(); //// [mappedTypes1.js] var x1 = f1(); var x2 = f2(); var x3 = f3(); +var x4 = f4(); //// [mappedTypes1.d.ts] @@ -128,31 +131,13 @@ declare function f2(): { declare function f3(): { [P in keyof T1]: void; }; -declare let x1: {}; -declare let x2: { - toString: void; - charAt: void; - charCodeAt: void; - concat: void; - indexOf: void; - lastIndexOf: void; - localeCompare: void; - match: void; - replace: void; - search: void; - slice: void; - split: void; - substring: void; - toLowerCase: void; - toLocaleLowerCase: void; - toUpperCase: void; - toLocaleUpperCase: void; - trim: void; - length: void; - substr: void; - valueOf: void; +declare function f4(): { + [P in keyof T1]: void; }; -declare let x3: { +declare let x1: {}; +declare let x2: string; +declare let x3: number; +declare let x4: { toString: void; valueOf: void; toFixed: void; diff --git a/tests/baselines/reference/mappedTypes1.symbols b/tests/baselines/reference/mappedTypes1.symbols index 88ced68aa0e..e8c09b25989 100644 --- a/tests/baselines/reference/mappedTypes1.symbols +++ b/tests/baselines/reference/mappedTypes1.symbols @@ -140,15 +140,26 @@ declare function f3(): { [P in keyof T1]: void }; >P : Symbol(P, Decl(mappedTypes1.ts, 33, 45)) >T1 : Symbol(T1, Decl(mappedTypes1.ts, 33, 20)) +declare function f4(): { [P in keyof T1]: void }; +>f4 : Symbol(f4, Decl(mappedTypes1.ts, 33, 68)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 34, 20)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>P : Symbol(P, Decl(mappedTypes1.ts, 34, 45)) +>T1 : Symbol(T1, Decl(mappedTypes1.ts, 34, 20)) + let x1 = f1(); ->x1 : Symbol(x1, Decl(mappedTypes1.ts, 35, 3)) +>x1 : Symbol(x1, Decl(mappedTypes1.ts, 36, 3)) >f1 : Symbol(f1, Decl(mappedTypes1.ts, 29, 59)) let x2 = f2(); ->x2 : Symbol(x2, Decl(mappedTypes1.ts, 36, 3)) +>x2 : Symbol(x2, Decl(mappedTypes1.ts, 37, 3)) >f2 : Symbol(f2, Decl(mappedTypes1.ts, 31, 53)) let x3 = f3(); ->x3 : Symbol(x3, Decl(mappedTypes1.ts, 37, 3)) +>x3 : Symbol(x3, Decl(mappedTypes1.ts, 38, 3)) >f3 : Symbol(f3, Decl(mappedTypes1.ts, 32, 68)) +let x4 = f4(); +>x4 : Symbol(x4, Decl(mappedTypes1.ts, 39, 3)) +>f4 : Symbol(f4, Decl(mappedTypes1.ts, 33, 68)) + diff --git a/tests/baselines/reference/mappedTypes1.types b/tests/baselines/reference/mappedTypes1.types index 6886810c394..35d13143bab 100644 --- a/tests/baselines/reference/mappedTypes1.types +++ b/tests/baselines/reference/mappedTypes1.types @@ -142,18 +142,30 @@ declare function f3(): { [P in keyof T1]: void }; >P : P >T1 : T1 +declare function f4(): { [P in keyof T1]: void }; +>f4 : () => { [P in keyof T1]: void; } +>T1 : T1 +>Number : Number +>P : P +>T1 : T1 + let x1 = f1(); >x1 : {} >f1() : {} >f1 : () => { [P in keyof T1]: void; } let x2 = f2(); ->x2 : { toString: void; charAt: void; charCodeAt: void; concat: void; indexOf: void; lastIndexOf: void; localeCompare: void; match: void; replace: void; search: void; slice: void; split: void; substring: void; toLowerCase: void; toLocaleLowerCase: void; toUpperCase: void; toLocaleUpperCase: void; trim: void; length: void; substr: void; valueOf: void; } ->f2() : { toString: void; charAt: void; charCodeAt: void; concat: void; indexOf: void; lastIndexOf: void; localeCompare: void; match: void; replace: void; search: void; slice: void; split: void; substring: void; toLowerCase: void; toLocaleLowerCase: void; toUpperCase: void; toLocaleUpperCase: void; trim: void; length: void; substr: void; valueOf: void; } +>x2 : string +>f2() : string >f2 : () => { [P in keyof T1]: void; } let x3 = f3(); ->x3 : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } ->f3() : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>x3 : number +>f3() : number >f3 : () => { [P in keyof T1]: void; } +let x4 = f4(); +>x4 : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>f4() : { toString: void; valueOf: void; toFixed: void; toExponential: void; toPrecision: void; toLocaleString: void; } +>f4 : () => { [P in keyof T1]: void; } + diff --git a/tests/baselines/reference/mappedTypes2.js b/tests/baselines/reference/mappedTypes2.js index 580cb36c741..84d052b6287 100644 --- a/tests/baselines/reference/mappedTypes2.js +++ b/tests/baselines/reference/mappedTypes2.js @@ -30,25 +30,30 @@ declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} + interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } function f0(s1: Shape, s2: Shape) { @@ -69,7 +74,7 @@ function f2(shape: Shape) { } function f3(shape: Shape) { - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + const x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { @@ -80,13 +85,13 @@ function f4() { function f5(shape: Shape) { const p = proxify(shape); let name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape: DeepReadonly) { - let name = shape.name; // DeepReadonly - let length = name.length; // DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> + let name = shape.name; // string + let location = shape.location; // DeepReadonly + let x = location.x; // number } //// [mappedTypes2.js] @@ -115,7 +120,7 @@ function f2(shape) { var partial = {}; } function f3(shape) { - var x = pick(shape, "name", "visible"); // { name: string, visible: boolean } + var x = pick(shape, "name", "location"); // { name: string, location: Point } } function f4() { var rec = { foo: "hello", bar: "world", baz: "bye" }; @@ -124,12 +129,12 @@ function f4() { function f5(shape) { var p = proxify(shape); var name = p.name.get(); - p.visible.set(false); + p.width.set(42); } function f6(shape) { - var name = shape.name; // DeepReadonly - var length = name.length; // DeepReadonly - var toString = length.toString; // DeepReadonly<(radix?: number) => string> + var name = shape.name; // string + var location = shape.location; // DeepReadonly + var x = location.x; // number } @@ -150,23 +155,27 @@ declare function freeze(obj: T): Readonly; declare function pick(obj: T, ...keys: K[]): Pick; declare function mapObject(obj: Record, f: (x: T) => U): Record; declare function proxify(obj: T): Proxify; +interface Point { + x: number; + y: number; +} interface Shape { name: string; width: number; height: number; - visible: boolean; + location: Point; } interface PartialShape { name?: string; width?: number; height?: number; - visible?: boolean; + location?: Point; } interface ReadonlyShape { readonly name: string; readonly width: number; readonly height: number; - readonly visible: boolean; + readonly location: Point; } declare function f0(s1: Shape, s2: Shape): void; declare function f1(shape: Shape): void; diff --git a/tests/baselines/reference/mappedTypes2.symbols b/tests/baselines/reference/mappedTypes2.symbols index 1b6fe299140..079a56243c5 100644 --- a/tests/baselines/reference/mappedTypes2.symbols +++ b/tests/baselines/reference/mappedTypes2.symbols @@ -151,190 +151,203 @@ declare function proxify(obj: T): Proxify; >Proxify : Symbol(Proxify, Decl(mappedTypes2.ts, 15, 1)) >T : Symbol(T, Decl(mappedTypes2.ts, 29, 25)) +interface Point { +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) + + x: number; +>x : Symbol(Point.x, Decl(mappedTypes2.ts, 31, 17)) + + y: number; +>y : Symbol(Point.y, Decl(mappedTypes2.ts, 32, 14)) +} + interface Shape { ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) name: string; ->name : Symbol(Shape.name, Decl(mappedTypes2.ts, 31, 17)) +>name : Symbol(Shape.name, Decl(mappedTypes2.ts, 36, 17)) width: number; ->width : Symbol(Shape.width, Decl(mappedTypes2.ts, 32, 17)) +>width : Symbol(Shape.width, Decl(mappedTypes2.ts, 37, 17)) height: number; ->height : Symbol(Shape.height, Decl(mappedTypes2.ts, 33, 18)) +>height : Symbol(Shape.height, Decl(mappedTypes2.ts, 38, 18)) - visible: boolean; ->visible : Symbol(Shape.visible, Decl(mappedTypes2.ts, 34, 19)) + location: Point; +>location : Symbol(Shape.location, Decl(mappedTypes2.ts, 39, 19)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } interface PartialShape { ->PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 36, 1)) +>PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 41, 1)) name?: string; ->name : Symbol(PartialShape.name, Decl(mappedTypes2.ts, 38, 24)) +>name : Symbol(PartialShape.name, Decl(mappedTypes2.ts, 43, 24)) width?: number; ->width : Symbol(PartialShape.width, Decl(mappedTypes2.ts, 39, 18)) +>width : Symbol(PartialShape.width, Decl(mappedTypes2.ts, 44, 18)) height?: number; ->height : Symbol(PartialShape.height, Decl(mappedTypes2.ts, 40, 19)) +>height : Symbol(PartialShape.height, Decl(mappedTypes2.ts, 45, 19)) - visible?: boolean; ->visible : Symbol(PartialShape.visible, Decl(mappedTypes2.ts, 41, 20)) + location?: Point; +>location : Symbol(PartialShape.location, Decl(mappedTypes2.ts, 46, 20)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } interface ReadonlyShape { ->ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 43, 1)) +>ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 48, 1)) readonly name: string; ->name : Symbol(ReadonlyShape.name, Decl(mappedTypes2.ts, 45, 25)) +>name : Symbol(ReadonlyShape.name, Decl(mappedTypes2.ts, 50, 25)) readonly width: number; ->width : Symbol(ReadonlyShape.width, Decl(mappedTypes2.ts, 46, 26)) +>width : Symbol(ReadonlyShape.width, Decl(mappedTypes2.ts, 51, 26)) readonly height: number; ->height : Symbol(ReadonlyShape.height, Decl(mappedTypes2.ts, 47, 27)) +>height : Symbol(ReadonlyShape.height, Decl(mappedTypes2.ts, 52, 27)) - readonly visible: boolean; ->visible : Symbol(ReadonlyShape.visible, Decl(mappedTypes2.ts, 48, 28)) + readonly location: Point; +>location : Symbol(ReadonlyShape.location, Decl(mappedTypes2.ts, 53, 28)) +>Point : Symbol(Point, Decl(mappedTypes2.ts, 29, 48)) } function f0(s1: Shape, s2: Shape) { ->f0 : Symbol(f0, Decl(mappedTypes2.ts, 50, 1)) ->s1 : Symbol(s1, Decl(mappedTypes2.ts, 52, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) ->s2 : Symbol(s2, Decl(mappedTypes2.ts, 52, 22)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f0 : Symbol(f0, Decl(mappedTypes2.ts, 55, 1)) +>s1 : Symbol(s1, Decl(mappedTypes2.ts, 57, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) +>s2 : Symbol(s2, Decl(mappedTypes2.ts, 57, 22)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) assign(s1, { name: "circle" }); >assign : Symbol(assign, Decl(mappedTypes2.ts, 23, 2)) ->s1 : Symbol(s1, Decl(mappedTypes2.ts, 52, 12)) ->name : Symbol(name, Decl(mappedTypes2.ts, 53, 16)) +>s1 : Symbol(s1, Decl(mappedTypes2.ts, 57, 12)) +>name : Symbol(name, Decl(mappedTypes2.ts, 58, 16)) assign(s2, { width: 10, height: 20 }); >assign : Symbol(assign, Decl(mappedTypes2.ts, 23, 2)) ->s2 : Symbol(s2, Decl(mappedTypes2.ts, 52, 22)) ->width : Symbol(width, Decl(mappedTypes2.ts, 54, 16)) ->height : Symbol(height, Decl(mappedTypes2.ts, 54, 27)) +>s2 : Symbol(s2, Decl(mappedTypes2.ts, 57, 22)) +>width : Symbol(width, Decl(mappedTypes2.ts, 59, 16)) +>height : Symbol(height, Decl(mappedTypes2.ts, 59, 27)) } function f1(shape: Shape) { ->f1 : Symbol(f1, Decl(mappedTypes2.ts, 55, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 57, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f1 : Symbol(f1, Decl(mappedTypes2.ts, 60, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 62, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var frozen: ReadonlyShape; ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) ->ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 43, 1)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) +>ReadonlyShape : Symbol(ReadonlyShape, Decl(mappedTypes2.ts, 48, 1)) var frozen: Readonly; ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) >Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var frozen = freeze(shape); ->frozen : Symbol(frozen, Decl(mappedTypes2.ts, 58, 7), Decl(mappedTypes2.ts, 59, 7), Decl(mappedTypes2.ts, 60, 7)) +>frozen : Symbol(frozen, Decl(mappedTypes2.ts, 63, 7), Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7)) >freeze : Symbol(freeze, Decl(mappedTypes2.ts, 25, 60)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 57, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 62, 12)) } function f2(shape: Shape) { ->f2 : Symbol(f2, Decl(mappedTypes2.ts, 61, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 63, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f2 : Symbol(f2, Decl(mappedTypes2.ts, 66, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 68, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var partial: PartialShape; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) ->PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 36, 1)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) +>PartialShape : Symbol(PartialShape, Decl(mappedTypes2.ts, 41, 1)) var partial: Partial; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) var partial: Partial = {}; ->partial : Symbol(partial, Decl(mappedTypes2.ts, 64, 7), Decl(mappedTypes2.ts, 65, 7), Decl(mappedTypes2.ts, 66, 7)) +>partial : Symbol(partial, Decl(mappedTypes2.ts, 69, 7), Decl(mappedTypes2.ts, 70, 7), Decl(mappedTypes2.ts, 71, 7)) >Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) } function f3(shape: Shape) { ->f3 : Symbol(f3, Decl(mappedTypes2.ts, 67, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 69, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f3 : Symbol(f3, Decl(mappedTypes2.ts, 72, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 74, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } ->x : Symbol(x, Decl(mappedTypes2.ts, 70, 9)) + const x = pick(shape, "name", "location"); // { name: string, location: Point } +>x : Symbol(x, Decl(mappedTypes2.ts, 75, 9)) >pick : Symbol(pick, Decl(mappedTypes2.ts, 26, 48)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 69, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 74, 12)) } function f4() { ->f4 : Symbol(f4, Decl(mappedTypes2.ts, 71, 1)) +>f4 : Symbol(f4, Decl(mappedTypes2.ts, 76, 1)) const rec = { foo: "hello", bar: "world", baz: "bye" }; ->rec : Symbol(rec, Decl(mappedTypes2.ts, 74, 9)) ->foo : Symbol(foo, Decl(mappedTypes2.ts, 74, 17)) ->bar : Symbol(bar, Decl(mappedTypes2.ts, 74, 31)) ->baz : Symbol(baz, Decl(mappedTypes2.ts, 74, 45)) +>rec : Symbol(rec, Decl(mappedTypes2.ts, 79, 9)) +>foo : Symbol(foo, Decl(mappedTypes2.ts, 79, 17)) +>bar : Symbol(bar, Decl(mappedTypes2.ts, 79, 31)) +>baz : Symbol(baz, Decl(mappedTypes2.ts, 79, 45)) const lengths = mapObject(rec, s => s.length); // { foo: number, bar: number, baz: number } ->lengths : Symbol(lengths, Decl(mappedTypes2.ts, 75, 9)) +>lengths : Symbol(lengths, Decl(mappedTypes2.ts, 80, 9)) >mapObject : Symbol(mapObject, Decl(mappedTypes2.ts, 27, 78)) ->rec : Symbol(rec, Decl(mappedTypes2.ts, 74, 9)) ->s : Symbol(s, Decl(mappedTypes2.ts, 75, 34)) +>rec : Symbol(rec, Decl(mappedTypes2.ts, 79, 9)) +>s : Symbol(s, Decl(mappedTypes2.ts, 80, 34)) >s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) ->s : Symbol(s, Decl(mappedTypes2.ts, 75, 34)) +>s : Symbol(s, Decl(mappedTypes2.ts, 80, 34)) >length : Symbol(String.length, Decl(lib.d.ts, --, --)) } function f5(shape: Shape) { ->f5 : Symbol(f5, Decl(mappedTypes2.ts, 76, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 78, 12)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>f5 : Symbol(f5, Decl(mappedTypes2.ts, 81, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 83, 12)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) const p = proxify(shape); ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) >proxify : Symbol(proxify, Decl(mappedTypes2.ts, 28, 100)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 78, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 83, 12)) let name = p.name.get(); ->name : Symbol(name, Decl(mappedTypes2.ts, 80, 7)) +>name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) >p.name.get : Symbol(get, Decl(mappedTypes2.ts, 12, 17)) >p.name : Symbol(name) ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) >name : Symbol(name) >get : Symbol(get, Decl(mappedTypes2.ts, 12, 17)) - p.visible.set(false); ->p.visible.set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) ->p.visible : Symbol(visible) ->p : Symbol(p, Decl(mappedTypes2.ts, 79, 9)) ->visible : Symbol(visible) + p.width.set(42); +>p.width.set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) +>p.width : Symbol(width) +>p : Symbol(p, Decl(mappedTypes2.ts, 84, 9)) +>width : Symbol(width) >set : Symbol(set, Decl(mappedTypes2.ts, 13, 13)) } function f6(shape: DeepReadonly) { ->f6 : Symbol(f6, Decl(mappedTypes2.ts, 82, 1)) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 84, 12)) +>f6 : Symbol(f6, Decl(mappedTypes2.ts, 87, 1)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) >DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes2.ts, 19, 1)) ->Shape : Symbol(Shape, Decl(mappedTypes2.ts, 29, 48)) +>Shape : Symbol(Shape, Decl(mappedTypes2.ts, 34, 1)) - let name = shape.name; // DeepReadonly ->name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) + let name = shape.name; // string +>name : Symbol(name, Decl(mappedTypes2.ts, 90, 7)) >shape.name : Symbol(name) ->shape : Symbol(shape, Decl(mappedTypes2.ts, 84, 12)) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) >name : Symbol(name) - let length = name.length; // DeepReadonly ->length : Symbol(length, Decl(mappedTypes2.ts, 86, 7)) ->name.length : Symbol(length) ->name : Symbol(name, Decl(mappedTypes2.ts, 85, 7)) ->length : Symbol(length) + let location = shape.location; // DeepReadonly +>location : Symbol(location, Decl(mappedTypes2.ts, 91, 7)) +>shape.location : Symbol(location) +>shape : Symbol(shape, Decl(mappedTypes2.ts, 89, 12)) +>location : Symbol(location) - let toString = length.toString; // DeepReadonly<(radix?: number) => string> ->toString : Symbol(toString, Decl(mappedTypes2.ts, 87, 7)) ->length.toString : Symbol(toString) ->length : Symbol(length, Decl(mappedTypes2.ts, 86, 7)) ->toString : Symbol(toString) + let x = location.x; // number +>x : Symbol(x, Decl(mappedTypes2.ts, 92, 7)) +>location.x : Symbol(x) +>location : Symbol(location, Decl(mappedTypes2.ts, 91, 7)) +>x : Symbol(x) } diff --git a/tests/baselines/reference/mappedTypes2.types b/tests/baselines/reference/mappedTypes2.types index 14ca77e4680..f082069f569 100644 --- a/tests/baselines/reference/mappedTypes2.types +++ b/tests/baselines/reference/mappedTypes2.types @@ -151,6 +151,16 @@ declare function proxify(obj: T): Proxify; >Proxify : Proxify >T : T +interface Point { +>Point : Point + + x: number; +>x : number + + y: number; +>y : number +} + interface Shape { >Shape : Shape @@ -163,8 +173,9 @@ interface Shape { height: number; >height : number - visible: boolean; ->visible : boolean + location: Point; +>location : Point +>Point : Point } interface PartialShape { @@ -179,8 +190,9 @@ interface PartialShape { height?: number; >height : number | undefined - visible?: boolean; ->visible : boolean | undefined + location?: Point; +>location : Point | undefined +>Point : Point } interface ReadonlyShape { @@ -195,8 +207,9 @@ interface ReadonlyShape { readonly height: number; >height : number - readonly visible: boolean; ->visible : boolean + readonly location: Point; +>location : Point +>Point : Point } function f0(s1: Shape, s2: Shape) { @@ -272,13 +285,13 @@ function f3(shape: Shape) { >shape : Shape >Shape : Shape - const x = pick(shape, "name", "visible"); // { name: string, visible: boolean } ->x : Pick ->pick(shape, "name", "visible") : Pick + const x = pick(shape, "name", "location"); // { name: string, location: Point } +>x : Pick +>pick(shape, "name", "location") : Pick >pick : (obj: T, ...keys: K[]) => Pick >shape : Shape >"name" : "name" ->"visible" : "visible" +>"location" : "location" } function f4() { @@ -326,14 +339,14 @@ function f5(shape: Shape) { >name : Proxy >get : () => string - p.visible.set(false); ->p.visible.set(false) : void ->p.visible.set : (value: boolean) => void ->p.visible : Proxy + p.width.set(42); +>p.width.set(42) : void +>p.width.set : (value: number) => void +>p.width : Proxy >p : Proxify ->visible : Proxy ->set : (value: boolean) => void ->false : false +>width : Proxy +>set : (value: number) => void +>42 : 42 } function f6(shape: DeepReadonly) { @@ -342,21 +355,21 @@ function f6(shape: DeepReadonly) { >DeepReadonly : DeepReadonly >Shape : Shape - let name = shape.name; // DeepReadonly ->name : DeepReadonly ->shape.name : DeepReadonly + let name = shape.name; // string +>name : string +>shape.name : string >shape : DeepReadonly ->name : DeepReadonly +>name : string - let length = name.length; // DeepReadonly ->length : DeepReadonly ->name.length : DeepReadonly ->name : DeepReadonly ->length : DeepReadonly + let location = shape.location; // DeepReadonly +>location : DeepReadonly +>shape.location : DeepReadonly +>shape : DeepReadonly +>location : DeepReadonly - let toString = length.toString; // DeepReadonly<(radix?: number) => string> ->toString : DeepReadonly<(radix?: number | undefined) => string> ->length.toString : DeepReadonly<(radix?: number | undefined) => string> ->length : DeepReadonly ->toString : DeepReadonly<(radix?: number | undefined) => string> + let x = location.x; // number +>x : number +>location.x : number +>location : DeepReadonly +>x : number } diff --git a/tests/baselines/reference/mappedTypes4.js b/tests/baselines/reference/mappedTypes4.js new file mode 100644 index 00000000000..bb003b1a1ec --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.js @@ -0,0 +1,129 @@ +//// [mappedTypes4.ts] + +type Box = { +}; + +type Boxified = { + [P in keyof T]: Box; +}; + +function boxify(obj: T): Boxified { + if (typeof obj === "object") { + let result = {} as Boxified; + for (let k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} + +type A = { a: string }; +type B = { b: string }; +type C = { c: string }; + +function f1(x: A | B | C | undefined) { + return boxify(x); +} + +type T00 = Partial
; +type T01 = Readonly; +type T02 = Boxified +type T03 = Readonly; +type T04 = Boxified; +type T05 = Partial<"hello" | "world" | 42>; + +type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +} + +type T10 = BoxifiedWithSentinel; +type T11 = BoxifiedWithSentinel; +type T12 = BoxifiedWithSentinel; + +type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; + +type Foo = { + x: number; + y: { a: string, b: number }; + z: boolean; +}; + +type DeepReadonlyFoo = { + readonly x: number; + readonly y: { readonly a: string, readonly b: number }; + readonly z: boolean; +}; + +var x1: DeepReadonly; +var x1: DeepReadonlyFoo; + +//// [mappedTypes4.js] +function boxify(obj) { + if (typeof obj === "object") { + var result = {}; + for (var k in obj) { + result[k] = { value: obj[k] }; + } + return result; + } + return obj; +} +function f1(x) { + return boxify(x); +} +var x1; +var x1; + + +//// [mappedTypes4.d.ts] +declare type Box = {}; +declare type Boxified = { + [P in keyof T]: Box; +}; +declare function boxify(obj: T): Boxified; +declare type A = { + a: string; +}; +declare type B = { + b: string; +}; +declare type C = { + c: string; +}; +declare function f1(x: A | B | C | undefined): Boxified | Boxified | Boxified | undefined; +declare type T00 = Partial; +declare type T01 = Readonly; +declare type T02 = Boxified; +declare type T03 = Readonly; +declare type T04 = Boxified; +declare type T05 = Partial<"hello" | "world" | 42>; +declare type BoxifiedWithSentinel = { + [P in keyof T]: Box | U; +}; +declare type T10 = BoxifiedWithSentinel; +declare type T11 = BoxifiedWithSentinel; +declare type T12 = BoxifiedWithSentinel; +declare type DeepReadonly = { + readonly [P in keyof T]: DeepReadonly; +}; +declare type Foo = { + x: number; + y: { + a: string; + b: number; + }; + z: boolean; +}; +declare type DeepReadonlyFoo = { + readonly x: number; + readonly y: { + readonly a: string; + readonly b: number; + }; + readonly z: boolean; +}; +declare var x1: DeepReadonly; +declare var x1: DeepReadonlyFoo; diff --git a/tests/baselines/reference/mappedTypes4.symbols b/tests/baselines/reference/mappedTypes4.symbols new file mode 100644 index 00000000000..b57adfe9954 --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.symbols @@ -0,0 +1,198 @@ +=== tests/cases/conformance/types/mapped/mappedTypes4.ts === + +type Box = { +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 1, 9)) + +}; + +type Boxified = { +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) + + [P in keyof T]: Box; +>P : Symbol(P, Decl(mappedTypes4.ts, 5, 5)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 4, 14)) +>P : Symbol(P, Decl(mappedTypes4.ts, 5, 5)) + +}; + +function boxify(obj: T): Boxified { +>boxify : Symbol(boxify, Decl(mappedTypes4.ts, 6, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) + + if (typeof obj === "object") { +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) + + let result = {} as Boxified; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>T : Symbol(T, Decl(mappedTypes4.ts, 8, 16)) + + for (let k in obj) { +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) + + result[k] = { value: obj[k] }; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) +>value : Symbol(value, Decl(mappedTypes4.ts, 12, 25)) +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +>k : Symbol(k, Decl(mappedTypes4.ts, 11, 16)) + } + return result; +>result : Symbol(result, Decl(mappedTypes4.ts, 10, 11)) + } + return obj; +>obj : Symbol(obj, Decl(mappedTypes4.ts, 8, 19)) +} + +type A = { a: string }; +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>a : Symbol(a, Decl(mappedTypes4.ts, 19, 10)) + +type B = { b: string }; +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>b : Symbol(b, Decl(mappedTypes4.ts, 20, 10)) + +type C = { c: string }; +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) +>c : Symbol(c, Decl(mappedTypes4.ts, 21, 10)) + +function f1(x: A | B | C | undefined) { +>f1 : Symbol(f1, Decl(mappedTypes4.ts, 21, 23)) +>x : Symbol(x, Decl(mappedTypes4.ts, 23, 12)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + + return boxify(x); +>boxify : Symbol(boxify, Decl(mappedTypes4.ts, 6, 2)) +>x : Symbol(x, Decl(mappedTypes4.ts, 23, 12)) +} + +type T00 = Partial; +>T00 : Symbol(T00, Decl(mappedTypes4.ts, 25, 1)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T01 = Readonly; +>T01 : Symbol(T01, Decl(mappedTypes4.ts, 27, 30)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T02 = Boxified +>T02 : Symbol(T02, Decl(mappedTypes4.ts, 28, 50)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T03 = Readonly; +>T03 : Symbol(T03, Decl(mappedTypes4.ts, 29, 41)) +>Readonly : Symbol(Readonly, Decl(lib.d.ts, --, --)) + +type T04 = Boxified; +>T04 : Symbol(T04, Decl(mappedTypes4.ts, 30, 73)) +>Boxified : Symbol(Boxified, Decl(mappedTypes4.ts, 2, 2)) + +type T05 = Partial<"hello" | "world" | 42>; +>T05 : Symbol(T05, Decl(mappedTypes4.ts, 31, 73)) +>Partial : Symbol(Partial, Decl(lib.d.ts, --, --)) + +type BoxifiedWithSentinel = { +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>U : Symbol(U, Decl(mappedTypes4.ts, 34, 28)) + + [P in keyof T]: Box | U; +>P : Symbol(P, Decl(mappedTypes4.ts, 35, 5)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>Box : Symbol(Box, Decl(mappedTypes4.ts, 0, 0)) +>T : Symbol(T, Decl(mappedTypes4.ts, 34, 26)) +>P : Symbol(P, Decl(mappedTypes4.ts, 35, 5)) +>U : Symbol(U, Decl(mappedTypes4.ts, 34, 28)) +} + +type T10 = BoxifiedWithSentinel; +>T10 : Symbol(T10, Decl(mappedTypes4.ts, 36, 1)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T11 = BoxifiedWithSentinel; +>T11 : Symbol(T11, Decl(mappedTypes4.ts, 38, 49)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) +>A : Symbol(A, Decl(mappedTypes4.ts, 17, 1)) +>B : Symbol(B, Decl(mappedTypes4.ts, 19, 23)) +>C : Symbol(C, Decl(mappedTypes4.ts, 20, 23)) + +type T12 = BoxifiedWithSentinel; +>T12 : Symbol(T12, Decl(mappedTypes4.ts, 39, 54)) +>BoxifiedWithSentinel : Symbol(BoxifiedWithSentinel, Decl(mappedTypes4.ts, 32, 43)) + +type DeepReadonly = { +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) + + readonly [P in keyof T]: DeepReadonly; +>P : Symbol(P, Decl(mappedTypes4.ts, 43, 14)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>T : Symbol(T, Decl(mappedTypes4.ts, 42, 18)) +>P : Symbol(P, Decl(mappedTypes4.ts, 43, 14)) + +}; + +type Foo = { +>Foo : Symbol(Foo, Decl(mappedTypes4.ts, 44, 2)) + + x: number; +>x : Symbol(x, Decl(mappedTypes4.ts, 46, 12)) + + y: { a: string, b: number }; +>y : Symbol(y, Decl(mappedTypes4.ts, 47, 14)) +>a : Symbol(a, Decl(mappedTypes4.ts, 48, 8)) +>b : Symbol(b, Decl(mappedTypes4.ts, 48, 19)) + + z: boolean; +>z : Symbol(z, Decl(mappedTypes4.ts, 48, 32)) + +}; + +type DeepReadonlyFoo = { +>DeepReadonlyFoo : Symbol(DeepReadonlyFoo, Decl(mappedTypes4.ts, 50, 2)) + + readonly x: number; +>x : Symbol(x, Decl(mappedTypes4.ts, 52, 24)) + + readonly y: { readonly a: string, readonly b: number }; +>y : Symbol(y, Decl(mappedTypes4.ts, 53, 23)) +>a : Symbol(a, Decl(mappedTypes4.ts, 54, 17)) +>b : Symbol(b, Decl(mappedTypes4.ts, 54, 37)) + + readonly z: boolean; +>z : Symbol(z, Decl(mappedTypes4.ts, 54, 59)) + +}; + +var x1: DeepReadonly; +>x1 : Symbol(x1, Decl(mappedTypes4.ts, 58, 3), Decl(mappedTypes4.ts, 59, 3)) +>DeepReadonly : Symbol(DeepReadonly, Decl(mappedTypes4.ts, 40, 51)) +>Foo : Symbol(Foo, Decl(mappedTypes4.ts, 44, 2)) + +var x1: DeepReadonlyFoo; +>x1 : Symbol(x1, Decl(mappedTypes4.ts, 58, 3), Decl(mappedTypes4.ts, 59, 3)) +>DeepReadonlyFoo : Symbol(DeepReadonlyFoo, Decl(mappedTypes4.ts, 50, 2)) + diff --git a/tests/baselines/reference/mappedTypes4.types b/tests/baselines/reference/mappedTypes4.types new file mode 100644 index 00000000000..cc492d82120 --- /dev/null +++ b/tests/baselines/reference/mappedTypes4.types @@ -0,0 +1,213 @@ +=== tests/cases/conformance/types/mapped/mappedTypes4.ts === + +type Box = { +>Box : Box +>T : T + +}; + +type Boxified = { +>Boxified : Boxified +>T : T + + [P in keyof T]: Box; +>P : P +>T : T +>Box : Box +>T : T +>P : P + +}; + +function boxify(obj: T): Boxified { +>boxify : (obj: T) => Boxified +>T : T +>obj : T +>T : T +>Boxified : Boxified +>T : T + + if (typeof obj === "object") { +>typeof obj === "object" : boolean +>typeof obj : string +>obj : T +>"object" : "object" + + let result = {} as Boxified; +>result : Boxified +>{} as Boxified : Boxified +>{} : {} +>Boxified : Boxified +>T : T + + for (let k in obj) { +>k : keyof T +>obj : T + + result[k] = { value: obj[k] }; +>result[k] = { value: obj[k] } : { value: T[keyof T]; } +>result[k] : Box +>result : Boxified +>k : keyof T +>{ value: obj[k] } : { value: T[keyof T]; } +>value : T[keyof T] +>obj[k] : T[keyof T] +>obj : T +>k : keyof T + } + return result; +>result : Boxified + } + return obj; +>obj : any +>obj : never +} + +type A = { a: string }; +>A : A +>a : string + +type B = { b: string }; +>B : B +>b : string + +type C = { c: string }; +>C : C +>c : string + +function f1(x: A | B | C | undefined) { +>f1 : (x: A | B | C | undefined) => Boxified | Boxified | Boxified | undefined +>x : A | B | C | undefined +>A : A +>B : B +>C : C + + return boxify(x); +>boxify(x) : Boxified | Boxified | Boxified | undefined +>boxify : (obj: T) => Boxified +>x : A | B | C | undefined +} + +type T00 = Partial; +>T00 : Partial | Partial | Partial +>Partial : Partial +>A : A +>B : B +>C : C + +type T01 = Readonly; +>T01 : Readonly | Readonly | Readonly | null | undefined +>Readonly : Readonly +>A : A +>B : B +>C : C +>null : null + +type T02 = Boxified +>T02 : string | Boxified | Boxified | Boxified +>Boxified : Boxified +>A : A +>B : B +>C : C + +type T03 = Readonly; +>T03 : string | number | boolean | void | null | undefined +>Readonly : Readonly +>null : null + +type T04 = Boxified; +>T04 : string | number | boolean | void | null | undefined +>Boxified : Boxified +>null : null + +type T05 = Partial<"hello" | "world" | 42>; +>T05 : "hello" | "world" | 42 +>Partial : Partial + +type BoxifiedWithSentinel = { +>BoxifiedWithSentinel : BoxifiedWithSentinel +>T : T +>U : U + + [P in keyof T]: Box | U; +>P : P +>T : T +>Box : Box +>T : T +>P : P +>U : U +} + +type T10 = BoxifiedWithSentinel; +>T10 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>BoxifiedWithSentinel : BoxifiedWithSentinel +>A : A +>B : B +>C : C +>null : null + +type T11 = BoxifiedWithSentinel; +>T11 : BoxifiedWithSentinel | BoxifiedWithSentinel | BoxifiedWithSentinel +>BoxifiedWithSentinel : BoxifiedWithSentinel +>A : A +>B : B +>C : C + +type T12 = BoxifiedWithSentinel; +>T12 : string +>BoxifiedWithSentinel : BoxifiedWithSentinel + +type DeepReadonly = { +>DeepReadonly : DeepReadonly +>T : T + + readonly [P in keyof T]: DeepReadonly; +>P : P +>T : T +>DeepReadonly : DeepReadonly +>T : T +>P : P + +}; + +type Foo = { +>Foo : Foo + + x: number; +>x : number + + y: { a: string, b: number }; +>y : { a: string; b: number; } +>a : string +>b : number + + z: boolean; +>z : boolean + +}; + +type DeepReadonlyFoo = { +>DeepReadonlyFoo : DeepReadonlyFoo + + readonly x: number; +>x : number + + readonly y: { readonly a: string, readonly b: number }; +>y : { readonly a: string; readonly b: number; } +>a : string +>b : number + + readonly z: boolean; +>z : boolean + +}; + +var x1: DeepReadonly; +>x1 : DeepReadonly +>DeepReadonly : DeepReadonly +>Foo : Foo + +var x1: DeepReadonlyFoo; +>x1 : DeepReadonly +>DeepReadonlyFoo : DeepReadonlyFoo + diff --git a/tests/baselines/reference/nestedFreshLiteral.errors.txt b/tests/baselines/reference/nestedFreshLiteral.errors.txt new file mode 100644 index 00000000000..6aff94ac0a6 --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.errors.txt @@ -0,0 +1,31 @@ +tests/cases/compiler/nestedFreshLiteral.ts(12,21): error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. + Types of property 'nested' are incompatible. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. + Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. + Types of property 'prop' are incompatible. + Type '{ colour: string; }' is not assignable to type 'CSSProps'. + Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + + +==== tests/cases/compiler/nestedFreshLiteral.ts (1 errors) ==== + interface CSSProps { + color?: string + } + interface NestedCSSProps { + nested?: NestedSelector + } + interface NestedSelector { + prop: CSSProps; + } + + let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } + ~~~~~~~~~~~~~ +!!! error TS2322: Type '{ nested: { prop: { colour: string; }; }; }' is not assignable to type 'NestedCSSProps'. +!!! error TS2322: Types of property 'nested' are incompatible. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector | undefined'. +!!! error TS2322: Type '{ prop: { colour: string; }; }' is not assignable to type 'NestedSelector'. +!!! error TS2322: Types of property 'prop' are incompatible. +!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'. +!!! error TS2322: Object literal may only specify known properties, and 'colour' does not exist in type 'CSSProps'. + } \ No newline at end of file diff --git a/tests/baselines/reference/nestedFreshLiteral.js b/tests/baselines/reference/nestedFreshLiteral.js new file mode 100644 index 00000000000..36d4743deae --- /dev/null +++ b/tests/baselines/reference/nestedFreshLiteral.js @@ -0,0 +1,19 @@ +//// [nestedFreshLiteral.ts] +interface CSSProps { + color?: string +} +interface NestedCSSProps { + nested?: NestedSelector +} +interface NestedSelector { + prop: CSSProps; +} + +let stylen: NestedCSSProps = { + nested: { prop: { colour: 'red' } } +} + +//// [nestedFreshLiteral.js] +var stylen = { + nested: { prop: { colour: 'red' } } +}; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js new file mode 100644 index 00000000000..8525352d415 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.js @@ -0,0 +1,31 @@ +//// [newLexicalEnvironmentForConvertedLoop.ts] +function baz(x: any) { + return [[x, x]]; +} + +function foo(set: any) { + for (const [value, i] of baz(set.values)) { + const bar: any = []; + (() => bar); + + set.values.push(...[]); + } +}; + +//// [newLexicalEnvironmentForConvertedLoop.js] +function baz(x) { + return [[x, x]]; +} +function foo(set) { + var _loop_1 = function (value, i) { + var bar = []; + (function () { return bar; }); + (_a = set.values).push.apply(_a, []); + var _a; + }; + for (var _i = 0, _a = baz(set.values); _i < _a.length; _i++) { + var _b = _a[_i], value = _b[0], i = _b[1]; + _loop_1(value, i); + } +} +; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols new file mode 100644 index 00000000000..19d657218d6 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.symbols @@ -0,0 +1,30 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) + + return [[x, x]]; +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +>x : Symbol(x, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 13)) +} + +function foo(set: any) { +>foo : Symbol(foo, Decl(newLexicalEnvironmentForConvertedLoop.ts, 2, 1)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + for (const [value, i] of baz(set.values)) { +>value : Symbol(value, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 14)) +>i : Symbol(i, Decl(newLexicalEnvironmentForConvertedLoop.ts, 5, 20)) +>baz : Symbol(baz, Decl(newLexicalEnvironmentForConvertedLoop.ts, 0, 0)) +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + + const bar: any = []; +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + (() => bar); +>bar : Symbol(bar, Decl(newLexicalEnvironmentForConvertedLoop.ts, 6, 9)) + + set.values.push(...[]); +>set : Symbol(set, Decl(newLexicalEnvironmentForConvertedLoop.ts, 4, 13)) + } +}; diff --git a/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types new file mode 100644 index 00000000000..dcc6f1375a3 --- /dev/null +++ b/tests/baselines/reference/newLexicalEnvironmentForConvertedLoop.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts === +function baz(x: any) { +>baz : (x: any) => any[][] +>x : any + + return [[x, x]]; +>[[x, x]] : any[][] +>[x, x] : any[] +>x : any +>x : any +} + +function foo(set: any) { +>foo : (set: any) => void +>set : any + + for (const [value, i] of baz(set.values)) { +>value : any +>i : any +>baz(set.values) : any[][] +>baz : (x: any) => any[][] +>set.values : any +>set : any +>values : any + + const bar: any = []; +>bar : any +>[] : undefined[] + + (() => bar); +>(() => bar) : () => any +>() => bar : () => any +>bar : any + + set.values.push(...[]); +>set.values.push(...[]) : any +>set.values.push : any +>set.values : any +>set : any +>values : any +>push : any +>...[] : undefined +>[] : undefined[] + } +}; diff --git a/tests/baselines/reference/objectFreeze.errors.txt b/tests/baselines/reference/objectFreeze.errors.txt new file mode 100644 index 00000000000..9c28c62f534 --- /dev/null +++ b/tests/baselines/reference/objectFreeze.errors.txt @@ -0,0 +1,22 @@ +tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'ReadonlyArray' only permits reading. +tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. + + +==== tests/cases/compiler/objectFreeze.ts (2 errors) ==== + const f = Object.freeze(function foo(a: number, b: string) { return false; }); + f(1, "") === false; + + class C { constructor(a: number) { } } + const c = Object.freeze(C); + new c(1); + + const a = Object.freeze([1, 2, 3]); + a[0] = a[2].toString(); + ~~~~ +!!! error TS2542: Index signature in type 'ReadonlyArray' only permits reading. + + const o = Object.freeze({ a: 1, b: "string" }); + o.b = o.a.toString(); + ~ +!!! error TS2540: Cannot assign to 'b' because it is a constant or a read-only property. + \ No newline at end of file diff --git a/tests/baselines/reference/objectFreeze.js b/tests/baselines/reference/objectFreeze.js new file mode 100644 index 00000000000..4c37631bb10 --- /dev/null +++ b/tests/baselines/reference/objectFreeze.js @@ -0,0 +1,29 @@ +//// [objectFreeze.ts] +const f = Object.freeze(function foo(a: number, b: string) { return false; }); +f(1, "") === false; + +class C { constructor(a: number) { } } +const c = Object.freeze(C); +new c(1); + +const a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); + +const o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); + + +//// [objectFreeze.js] +var f = Object.freeze(function foo(a, b) { return false; }); +f(1, "") === false; +var C = (function () { + function C(a) { + } + return C; +}()); +var c = Object.freeze(C); +new c(1); +var a = Object.freeze([1, 2, 3]); +a[0] = a[2].toString(); +var o = Object.freeze({ a: 1, b: "string" }); +o.b = o.a.toString(); diff --git a/tests/baselines/reference/objectRest.js b/tests/baselines/reference/objectRest.js index 85d8a6a573e..48a1bf8daf8 100644 --- a/tests/baselines/reference/objectRest.js +++ b/tests/baselines/reference/objectRest.js @@ -36,6 +36,8 @@ let computed = 'b'; let computed2 = 'a'; var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; ({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; //// [objectRest.js] @@ -43,7 +45,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; @@ -76,4 +78,8 @@ let computed = 'b'; let computed2 = 'a'; var _g = computed, stillNotGreat = o[_g], _h = computed2, soSo = o[_h], o = __rest(o, [typeof _g === "symbol" ? _g : _g + "", typeof _h === "symbol" ? _h : _h + ""]); (_j = computed, stillNotGreat = o[_j], _k = computed2, soSo = o[_k], o = __rest(o, [typeof _j === "symbol" ? _j : _j + "", typeof _k === "symbol" ? _k : _k + ""])); +var noContextualType = (_a) => { + var { aNumber = 12 } = _a, notEmptyObject = __rest(_a, ["aNumber"]); + return aNumber + notEmptyObject['anythingGoes']; +}; var _d, _f, _j, _k; diff --git a/tests/baselines/reference/objectRest.symbols b/tests/baselines/reference/objectRest.symbols index 325258aa8cd..46309392135 100644 --- a/tests/baselines/reference/objectRest.symbols +++ b/tests/baselines/reference/objectRest.symbols @@ -169,3 +169,10 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; >o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) >o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51)) +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; +>noContextualType : Symbol(noContextualType, Decl(objectRest.ts, 38, 3)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) +>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25)) +>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39)) + diff --git a/tests/baselines/reference/objectRest.types b/tests/baselines/reference/objectRest.types index 7d833543747..1dc05741713 100644 --- a/tests/baselines/reference/objectRest.types +++ b/tests/baselines/reference/objectRest.types @@ -195,3 +195,15 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o; >o : { a: number; b: string; } >o : { a: number; b: string; } +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes']; +>noContextualType : ({aNumber, ...notEmptyObject}: { [x: string]: any; aNumber?: number; }) => any +>({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject['anythingGoes'] : ({aNumber, ...notEmptyObject}: { [x: string]: any; aNumber?: number; }) => any +>aNumber : number +>12 : 12 +>notEmptyObject : { [x: string]: any; } +>aNumber + notEmptyObject['anythingGoes'] : any +>aNumber : number +>notEmptyObject['anythingGoes'] : any +>notEmptyObject : { [x: string]: any; } +>'anythingGoes' : "anythingGoes" + diff --git a/tests/baselines/reference/objectRestAssignment.js b/tests/baselines/reference/objectRestAssignment.js index 66ee00f6696..cbdff663c26 100644 --- a/tests/baselines/reference/objectRestAssignment.js +++ b/tests/baselines/reference/objectRestAssignment.js @@ -19,7 +19,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectRestForOf.js b/tests/baselines/reference/objectRestForOf.js index b4e33550cb0..fd81f77512e 100644 --- a/tests/baselines/reference/objectRestForOf.js +++ b/tests/baselines/reference/objectRestForOf.js @@ -27,7 +27,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectRestNegative.errors.txt b/tests/baselines/reference/objectRestNegative.errors.txt index 345e99723bd..6e65af4bdc1 100644 --- a/tests/baselines/reference/objectRestNegative.errors.txt +++ b/tests/baselines/reference/objectRestNegative.errors.txt @@ -3,11 +3,14 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(6,10): error TS2322: Ty Types of property 'a' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern +tests/cases/conformance/types/rest/objectRestNegative.ts(11,30): error TS7008: Member 'x' implicitly has an 'any' type. +tests/cases/conformance/types/rest/objectRestNegative.ts(11,33): error TS7008: Member 'y' implicitly has an 'any' type. tests/cases/conformance/types/rest/objectRestNegative.ts(12,17): error TS2700: Rest types may only be created from object types. tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: The target of an object rest assignment must be a variable or a property access. +tests/cases/conformance/types/rest/objectRestNegative.ts(19,90): error TS2339: Property 'anythingGoes' does not exist on type '{ [x: string]: any; }'. -==== tests/cases/conformance/types/rest/objectRestNegative.ts (5 errors) ==== +==== tests/cases/conformance/types/rest/objectRestNegative.ts (8 errors) ==== let o = { a: 1, b: 'no' }; var { ...mustBeLast, a } = o; ~~~~~~~~~~ @@ -27,6 +30,10 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th !!! error TS2462: A rest element must be last in a destructuring pattern } function generic(t: T) { + ~~ +!!! error TS7008: Member 'x' implicitly has an 'any' type. + ~ +!!! error TS7008: Member 'y' implicitly has an 'any' type. let { x, ...rest } = t; ~~~~ !!! error TS2700: Rest types may only be created from object types. @@ -37,4 +44,8 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th ({a, ...rest.b + rest.b} = o); ~~~~~~~~~~~~~~~ !!! error TS2701: The target of an object rest assignment must be a variable or a property access. + + var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; + ~~~~~~~~~~~~ +!!! error TS2339: Property 'anythingGoes' does not exist on type '{ [x: string]: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectRestNegative.js b/tests/baselines/reference/objectRestNegative.js index f8c5b72ada5..19559e865f2 100644 --- a/tests/baselines/reference/objectRestNegative.js +++ b/tests/baselines/reference/objectRestNegative.js @@ -16,6 +16,8 @@ function generic(t: T) { let rest: { b: string } ({a, ...rest.b + rest.b} = o); + +var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber + notEmptyObject.anythingGoes; //// [objectRestNegative.js] @@ -23,7 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; @@ -42,3 +44,7 @@ function generic(t) { } var rest; (a = o.a, o, rest.b + rest.b = __rest(o, ["a"])); +var noContextualType = function (_a) { + var _b = _a.aNumber, aNumber = _b === void 0 ? 12 : _b, notEmptyObject = __rest(_a, ["aNumber"]); + return aNumber + notEmptyObject.anythingGoes; +}; diff --git a/tests/baselines/reference/objectRestParameter.js b/tests/baselines/reference/objectRestParameter.js index 87419bd06e9..14e84eddfce 100644 --- a/tests/baselines/reference/objectRestParameter.js +++ b/tests/baselines/reference/objectRestParameter.js @@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (typeof Object.getOwnPropertySymbols === "function") + if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; diff --git a/tests/baselines/reference/objectSpread.symbols b/tests/baselines/reference/objectSpread.symbols index 0b2fce46b0d..35c10faa9c0 100644 --- a/tests/baselines/reference/objectSpread.symbols +++ b/tests/baselines/reference/objectSpread.symbols @@ -200,7 +200,6 @@ let cplus: { p: number, plus(): void } = { ...c, plus() { return this.p + 1; } } >plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) >c : Symbol(c, Decl(objectSpread.ts, 45, 3)) >plus : Symbol(plus, Decl(objectSpread.ts, 49, 48)) ->this : Symbol(__object, Decl(objectSpread.ts, 41, 15)) cplus.plus(); >cplus.plus : Symbol(plus, Decl(objectSpread.ts, 49, 23)) diff --git a/tests/baselines/reference/objectSpreadNegative.errors.txt b/tests/baselines/reference/objectSpreadNegative.errors.txt index dc6a356708f..17f07bc06a2 100644 --- a/tests/baselines/reference/objectSpreadNegative.errors.txt +++ b/tests/baselines/reference/objectSpreadNegative.errors.txt @@ -7,20 +7,18 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(25,1): error TS2322 Property 's' is missing in type '{ b: boolean; }'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,36): error TS2300: Duplicate identifier 'b'. tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,53): error TS2300: Duplicate identifier 'b'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(32,20): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(33,24): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(34,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(35,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,20): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(39,19): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(44,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(48,12): error TS2339: Property 'b' does not exist on type '{}'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(54,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,14): error TS2698: Spread types may only be created from object types. -tests/cases/conformance/types/spread/objectSpreadNegative.ts(61,14): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(32,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(33,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(35,20): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,19): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(42,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(46,12): error TS2339: Property 'b' does not exist on type '{}'. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(52,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(56,14): error TS2698: Spread types may only be created from object types. +tests/cases/conformance/types/spread/objectSpreadNegative.ts(59,14): error TS2698: Spread types may only be created from object types. -==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (17 errors) ==== +==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (15 errors) ==== let o = { a: 1, b: 'no' } /// private propagates @@ -66,13 +64,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(61,14): error TS269 !!! error TS2300: Duplicate identifier 'b'. let duplicatedSpread = { ...o, ...o } - // null, undefined and primitives are not allowed - let spreadNull = { ...null }; - ~~~~~~~ -!!! error TS2698: Spread types may only be created from object types. - let spreadUndefind = { ...undefined }; - ~~~~~~~~~~~~ -!!! error TS2698: Spread types may only be created from object types. + // primitives are not allowed let spreadNum = { ...12 }; ~~~~~ !!! error TS2698: Spread types may only be created from object types. diff --git a/tests/baselines/reference/objectSpreadNegative.js b/tests/baselines/reference/objectSpreadNegative.js index 6287f4559a7..dff84355370 100644 --- a/tests/baselines/reference/objectSpreadNegative.js +++ b/tests/baselines/reference/objectSpreadNegative.js @@ -29,9 +29,7 @@ spread = b; // error, missing 's' let duplicated = { b: 'bad', ...o, b: 'bad', ...o2, b: 'bad' } let duplicatedSpread = { ...o, ...o } -// null, undefined and primitives are not allowed -let spreadNull = { ...null }; -let spreadUndefind = { ...undefined }; +// primitives are not allowed let spreadNum = { ...12 }; let spreadSum = { ...1 + 1 }; spreadSum.toFixed(); // error, no methods from number @@ -108,9 +106,7 @@ spread = b; // error, missing 's' // literal repeats are not allowed, but spread repeats are fine var duplicated = __assign({ b: 'bad' }, o, { b: 'bad' }, o2, { b: 'bad' }); var duplicatedSpread = __assign({}, o, o); -// null, undefined and primitives are not allowed -var spreadNull = __assign({}, null); -var spreadUndefind = __assign({}, undefined); +// primitives are not allowed var spreadNum = __assign({}, 12); var spreadSum = __assign({}, 1 + 1); spreadSum.toFixed(); // error, no methods from number diff --git a/tests/baselines/reference/parserExportAssignment9.errors.txt b/tests/baselines/reference/parserExportAssignment9.errors.txt index 5d84ee9836c..818b60cfc98 100644 --- a/tests/baselines/reference/parserExportAssignment9.errors.txt +++ b/tests/baselines/reference/parserExportAssignment9.errors.txt @@ -1,16 +1,16 @@ -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1318: A default export can only be used in an ECMAScript-style module. -tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1318: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(2,3): error TS1319: A default export can only be used in an ECMAScript-style module. +tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts(6,3): error TS1319: A default export can only be used in an ECMAScript-style module. ==== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment9.ts (2 errors) ==== namespace Foo { export default foo; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1318: A default export can only be used in an ECMAScript-style module. +!!! error TS1319: A default export can only be used in an ECMAScript-style module. } module Bar { export default bar; ~~~~~~~~~~~~~~~~~~~ -!!! error TS1318: A default export can only be used in an ECMAScript-style module. +!!! error TS1319: A default export can only be used in an ECMAScript-style module. } \ No newline at end of file diff --git a/tests/baselines/reference/restIntersection.js b/tests/baselines/reference/restIntersection.js new file mode 100644 index 00000000000..d1f9aa3094c --- /dev/null +++ b/tests/baselines/reference/restIntersection.js @@ -0,0 +1,20 @@ +//// [restIntersection.ts] +var intersection: { x: number, y: number } & { w: string, z: string }; + +var rest1: { y: number, w: string, z: string }; +var {x, ...rest1 } = intersection; + + +//// [restIntersection.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var intersection; +var rest1; +var x = intersection.x, rest1 = __rest(intersection, ["x"]); diff --git a/tests/baselines/reference/restIntersection.symbols b/tests/baselines/reference/restIntersection.symbols new file mode 100644 index 00000000000..75f91d243e2 --- /dev/null +++ b/tests/baselines/reference/restIntersection.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/restIntersection.ts === +var intersection: { x: number, y: number } & { w: string, z: string }; +>intersection : Symbol(intersection, Decl(restIntersection.ts, 0, 3)) +>x : Symbol(x, Decl(restIntersection.ts, 0, 19)) +>y : Symbol(y, Decl(restIntersection.ts, 0, 30)) +>w : Symbol(w, Decl(restIntersection.ts, 0, 46)) +>z : Symbol(z, Decl(restIntersection.ts, 0, 57)) + +var rest1: { y: number, w: string, z: string }; +>rest1 : Symbol(rest1, Decl(restIntersection.ts, 2, 3), Decl(restIntersection.ts, 3, 7)) +>y : Symbol(y, Decl(restIntersection.ts, 2, 12)) +>w : Symbol(w, Decl(restIntersection.ts, 2, 23)) +>z : Symbol(z, Decl(restIntersection.ts, 2, 34)) + +var {x, ...rest1 } = intersection; +>x : Symbol(x, Decl(restIntersection.ts, 3, 5)) +>rest1 : Symbol(rest1, Decl(restIntersection.ts, 2, 3), Decl(restIntersection.ts, 3, 7)) +>intersection : Symbol(intersection, Decl(restIntersection.ts, 0, 3)) + diff --git a/tests/baselines/reference/restIntersection.types b/tests/baselines/reference/restIntersection.types new file mode 100644 index 00000000000..5779349ba29 --- /dev/null +++ b/tests/baselines/reference/restIntersection.types @@ -0,0 +1,19 @@ +=== tests/cases/compiler/restIntersection.ts === +var intersection: { x: number, y: number } & { w: string, z: string }; +>intersection : { x: number; y: number; } & { w: string; z: string; } +>x : number +>y : number +>w : string +>z : string + +var rest1: { y: number, w: string, z: string }; +>rest1 : { y: number; w: string; z: string; } +>y : number +>w : string +>z : string + +var {x, ...rest1 } = intersection; +>x : number +>rest1 : { y: number; w: string; z: string; } +>intersection : { x: number; y: number; } & { w: string; z: string; } + diff --git a/tests/baselines/reference/restInvalidArgumentType.errors.txt b/tests/baselines/reference/restInvalidArgumentType.errors.txt new file mode 100644 index 00000000000..fff2c7b3563 --- /dev/null +++ b/tests/baselines/reference/restInvalidArgumentType.errors.txt @@ -0,0 +1,104 @@ +tests/cases/compiler/restInvalidArgumentType.ts(31,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(33,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(35,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(36,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(38,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(41,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(42,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(44,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(45,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(47,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(48,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(55,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(56,13): error TS2700: Rest types may only be created from object types. +tests/cases/compiler/restInvalidArgumentType.ts(58,13): error TS2700: Rest types may only be created from object types. + + +==== tests/cases/compiler/restInvalidArgumentType.ts (14 errors) ==== + enum E { v1, v2 }; + + function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r4} = i; // Error, index access + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r5} = k; // Error, index + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r6} = mapped_generic; // Error, generic mapped object type + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + ~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r9} = union_primitive; // Error, union with generic type parameter + ~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r12} = num; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r13} = str; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + var {...r18} = literal_number; // Error + ~~~ +!!! error TS2700: Rest types may only be created from object types. + + var {...r19} = e; // Error, enum + ~~~ +!!! error TS2700: Rest types may only be created from object types. + } \ No newline at end of file diff --git a/tests/baselines/reference/restInvalidArgumentType.js b/tests/baselines/reference/restInvalidArgumentType.js new file mode 100644 index 00000000000..48e4e11e805 --- /dev/null +++ b/tests/baselines/reference/restInvalidArgumentType.js @@ -0,0 +1,115 @@ +//// [restInvalidArgumentType.ts] +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var {...r1} = p1; // Error, generic type paramterre + var {...r2} = p2; // OK + var {...r3} = t; // Error, generic type paramter + + var {...r4} = i; // Error, index access + var {...r5} = k; // Error, index + + var {...r6} = mapped_generic; // Error, generic mapped object type + var {...r7} = mapped; // OK, non-generic mapped type + + var {...r8} = union_generic; // Error, union with generic type parameter + var {...r9} = union_primitive; // Error, union with generic type parameter + + var {...r10} = intersection_generic; // Error, intersection with generic type parameter + var {...r11} = intersection_premitive; // Error, intersection with generic type parameter + + var {...r12} = num; // Error + var {...r13} = str; // Error + + var {...r14} = u; // OK + var {...r15} = n; // OK + + var {...r16} = a; // OK + + var {...r17} = literal_string; // Error + var {...r18} = literal_number; // Error + + var {...r19} = e; // Error, enum +} + +//// [restInvalidArgumentType.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var E; +(function (E) { + E[E["v1"] = 0] = "v1"; + E[E["v2"] = 1] = "v2"; +})(E || (E = {})); +; +function f(p1, p2) { + var t; + var i; + var k; + var mapped_generic; + var mapped; + var union_generic; + var union_primitive; + var intersection_generic; + var intersection_premitive; + var num; + var str; + var u; + var n; + var a; + var literal_string; + var literal_number; + var e; + var r1 = __rest(p1, []); // Error, generic type paramterre + var r2 = __rest(p2, []); // OK + var r3 = __rest(t, []); // Error, generic type paramter + var r4 = __rest(i, []); // Error, index access + var r5 = __rest(k, []); // Error, index + var r6 = __rest(mapped_generic, []); // Error, generic mapped object type + var r7 = __rest(mapped, []); // OK, non-generic mapped type + var r8 = __rest(union_generic, []); // Error, union with generic type parameter + var r9 = __rest(union_primitive, []); // Error, union with generic type parameter + var r10 = __rest(intersection_generic, []); // Error, intersection with generic type parameter + var r11 = __rest(intersection_premitive, []); // Error, intersection with generic type parameter + var r12 = __rest(num, []); // Error + var r13 = __rest(str, []); // Error + var r14 = __rest(u, []); // OK + var r15 = __rest(n, []); // OK + var r16 = __rest(a, []); // OK + var r17 = __rest(literal_string, []); // Error + var r18 = __rest(literal_number, []); // Error + var r19 = __rest(e, []); // Error, enum +} diff --git a/tests/baselines/reference/restUnion.js b/tests/baselines/reference/restUnion.js new file mode 100644 index 00000000000..09a6243d2a9 --- /dev/null +++ b/tests/baselines/reference/restUnion.js @@ -0,0 +1,36 @@ +//// [restUnion.ts] +var union: { a: number, c: boolean } | { a: string, b: string }; + +var rest1: { c: boolean } | { b: string }; +var {a, ...rest1 } = union; + + +var undefinedUnion: { n: number } | undefined; +var rest2: {}; +var {n, ...rest2 } = undefinedUnion; + + +var nullUnion: { n: number } | null; +var rest3: {}; +var {n, ...rest3 } = nullUnion; + + +//// [restUnion.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var union; +var rest1; +var a = union.a, rest1 = __rest(union, ["a"]); +var undefinedUnion; +var rest2; +var n = undefinedUnion.n, rest2 = __rest(undefinedUnion, ["n"]); +var nullUnion; +var rest3; +var n = nullUnion.n, rest3 = __rest(nullUnion, ["n"]); diff --git a/tests/baselines/reference/restUnion.symbols b/tests/baselines/reference/restUnion.symbols new file mode 100644 index 00000000000..660c85badb4 --- /dev/null +++ b/tests/baselines/reference/restUnion.symbols @@ -0,0 +1,44 @@ +=== tests/cases/compiler/restUnion.ts === +var union: { a: number, c: boolean } | { a: string, b: string }; +>union : Symbol(union, Decl(restUnion.ts, 0, 3)) +>a : Symbol(a, Decl(restUnion.ts, 0, 12)) +>c : Symbol(c, Decl(restUnion.ts, 0, 23)) +>a : Symbol(a, Decl(restUnion.ts, 0, 40)) +>b : Symbol(b, Decl(restUnion.ts, 0, 51)) + +var rest1: { c: boolean } | { b: string }; +>rest1 : Symbol(rest1, Decl(restUnion.ts, 2, 3), Decl(restUnion.ts, 3, 7)) +>c : Symbol(c, Decl(restUnion.ts, 2, 12)) +>b : Symbol(b, Decl(restUnion.ts, 2, 29)) + +var {a, ...rest1 } = union; +>a : Symbol(a, Decl(restUnion.ts, 3, 5)) +>rest1 : Symbol(rest1, Decl(restUnion.ts, 2, 3), Decl(restUnion.ts, 3, 7)) +>union : Symbol(union, Decl(restUnion.ts, 0, 3)) + + +var undefinedUnion: { n: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion.ts, 6, 3)) +>n : Symbol(n, Decl(restUnion.ts, 6, 21)) + +var rest2: {}; +>rest2 : Symbol(rest2, Decl(restUnion.ts, 7, 3), Decl(restUnion.ts, 8, 7)) + +var {n, ...rest2 } = undefinedUnion; +>n : Symbol(n, Decl(restUnion.ts, 8, 5), Decl(restUnion.ts, 13, 5)) +>rest2 : Symbol(rest2, Decl(restUnion.ts, 7, 3), Decl(restUnion.ts, 8, 7)) +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion.ts, 6, 3)) + + +var nullUnion: { n: number } | null; +>nullUnion : Symbol(nullUnion, Decl(restUnion.ts, 11, 3)) +>n : Symbol(n, Decl(restUnion.ts, 11, 16)) + +var rest3: {}; +>rest3 : Symbol(rest3, Decl(restUnion.ts, 12, 3), Decl(restUnion.ts, 13, 7)) + +var {n, ...rest3 } = nullUnion; +>n : Symbol(n, Decl(restUnion.ts, 8, 5), Decl(restUnion.ts, 13, 5)) +>rest3 : Symbol(rest3, Decl(restUnion.ts, 12, 3), Decl(restUnion.ts, 13, 7)) +>nullUnion : Symbol(nullUnion, Decl(restUnion.ts, 11, 3)) + diff --git a/tests/baselines/reference/restUnion.types b/tests/baselines/reference/restUnion.types new file mode 100644 index 00000000000..9837466684b --- /dev/null +++ b/tests/baselines/reference/restUnion.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/restUnion.ts === +var union: { a: number, c: boolean } | { a: string, b: string }; +>union : { a: number; c: boolean; } | { a: string; b: string; } +>a : number +>c : boolean +>a : string +>b : string + +var rest1: { c: boolean } | { b: string }; +>rest1 : { c: boolean; } | { b: string; } +>c : boolean +>b : string + +var {a, ...rest1 } = union; +>a : string | number +>rest1 : { c: boolean; } | { b: string; } +>union : { a: number; c: boolean; } | { a: string; b: string; } + + +var undefinedUnion: { n: number } | undefined; +>undefinedUnion : { n: number; } +>n : number + +var rest2: {}; +>rest2 : {} + +var {n, ...rest2 } = undefinedUnion; +>n : number +>rest2 : {} +>undefinedUnion : { n: number; } + + +var nullUnion: { n: number } | null; +>nullUnion : { n: number; } +>n : number +>null : null + +var rest3: {}; +>rest3 : {} + +var {n, ...rest3 } = nullUnion; +>n : number +>rest3 : {} +>nullUnion : { n: number; } + diff --git a/tests/baselines/reference/restUnion2.js b/tests/baselines/reference/restUnion2.js new file mode 100644 index 00000000000..44a0acfbcf8 --- /dev/null +++ b/tests/baselines/reference/restUnion2.js @@ -0,0 +1,38 @@ +//// [restUnion2.ts] + +declare const undefinedUnion: { n: number } | undefined; +var rest2: { n: number }; +var {...rest2 } = undefinedUnion; + + +declare const nullUnion: { n: number } | null; +var rest3: { n: number }; +var {...rest3 } = nullUnion; + + +declare const nullAndUndefinedUnion: null | undefined; +var rest4: { }; +var {...rest4 } = nullAndUndefinedUnion; + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +var rest5: { n: number, s: string }; +var {...rest5 } = unionWithIntersection; + +//// [restUnion2.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +var rest2; +var rest2 = __rest(undefinedUnion, []); +var rest3; +var rest3 = __rest(nullUnion, []); +var rest4; +var rest4 = __rest(nullAndUndefinedUnion, []); +var rest5; +var rest5 = __rest(unionWithIntersection, []); diff --git a/tests/baselines/reference/restUnion2.symbols b/tests/baselines/reference/restUnion2.symbols new file mode 100644 index 00000000000..20a113a23b4 --- /dev/null +++ b/tests/baselines/reference/restUnion2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/restUnion2.ts === + +declare const undefinedUnion: { n: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion2.ts, 1, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 1, 31)) + +var rest2: { n: number }; +>rest2 : Symbol(rest2, Decl(restUnion2.ts, 2, 3), Decl(restUnion2.ts, 3, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 2, 12)) + +var {...rest2 } = undefinedUnion; +>rest2 : Symbol(rest2, Decl(restUnion2.ts, 2, 3), Decl(restUnion2.ts, 3, 5)) +>undefinedUnion : Symbol(undefinedUnion, Decl(restUnion2.ts, 1, 13)) + + +declare const nullUnion: { n: number } | null; +>nullUnion : Symbol(nullUnion, Decl(restUnion2.ts, 6, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 6, 26)) + +var rest3: { n: number }; +>rest3 : Symbol(rest3, Decl(restUnion2.ts, 7, 3), Decl(restUnion2.ts, 8, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 7, 12)) + +var {...rest3 } = nullUnion; +>rest3 : Symbol(rest3, Decl(restUnion2.ts, 7, 3), Decl(restUnion2.ts, 8, 5)) +>nullUnion : Symbol(nullUnion, Decl(restUnion2.ts, 6, 13)) + + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(restUnion2.ts, 11, 13)) + +var rest4: { }; +>rest4 : Symbol(rest4, Decl(restUnion2.ts, 12, 3), Decl(restUnion2.ts, 13, 5)) + +var {...rest4 } = nullAndUndefinedUnion; +>rest4 : Symbol(rest4, Decl(restUnion2.ts, 12, 3), Decl(restUnion2.ts, 13, 5)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(restUnion2.ts, 11, 13)) + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +>unionWithIntersection : Symbol(unionWithIntersection, Decl(restUnion2.ts, 15, 13)) +>n : Symbol(n, Decl(restUnion2.ts, 15, 39)) +>s : Symbol(s, Decl(restUnion2.ts, 15, 55)) + +var rest5: { n: number, s: string }; +>rest5 : Symbol(rest5, Decl(restUnion2.ts, 16, 3), Decl(restUnion2.ts, 17, 5)) +>n : Symbol(n, Decl(restUnion2.ts, 16, 12)) +>s : Symbol(s, Decl(restUnion2.ts, 16, 23)) + +var {...rest5 } = unionWithIntersection; +>rest5 : Symbol(rest5, Decl(restUnion2.ts, 16, 3), Decl(restUnion2.ts, 17, 5)) +>unionWithIntersection : Symbol(unionWithIntersection, Decl(restUnion2.ts, 15, 13)) + diff --git a/tests/baselines/reference/restUnion2.types b/tests/baselines/reference/restUnion2.types new file mode 100644 index 00000000000..81b768777fd --- /dev/null +++ b/tests/baselines/reference/restUnion2.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/restUnion2.ts === + +declare const undefinedUnion: { n: number } | undefined; +>undefinedUnion : { n: number; } | undefined +>n : number + +var rest2: { n: number }; +>rest2 : { n: number; } +>n : number + +var {...rest2 } = undefinedUnion; +>rest2 : { n: number; } +>undefinedUnion : { n: number; } | undefined + + +declare const nullUnion: { n: number } | null; +>nullUnion : { n: number; } | null +>n : number +>null : null + +var rest3: { n: number }; +>rest3 : { n: number; } +>n : number + +var {...rest3 } = nullUnion; +>rest3 : { n: number; } +>nullUnion : { n: number; } | null + + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : null | undefined +>null : null + +var rest4: { }; +>rest4 : {} + +var {...rest4 } = nullAndUndefinedUnion; +>rest4 : {} +>nullAndUndefinedUnion : null | undefined + +declare const unionWithIntersection: ({ n: number } & { s: string }) & undefined | null; +>unionWithIntersection : ({ n: number; } & { s: string; } & undefined) | null +>n : number +>s : string +>null : null + +var rest5: { n: number, s: string }; +>rest5 : { n: number; s: string; } +>n : number +>s : string + +var {...rest5 } = unionWithIntersection; +>rest5 : { n: number; s: string; } +>unionWithIntersection : ({ n: number; } & { s: string; } & undefined) | null + diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt new file mode 100644 index 00000000000..599c9fbedb0 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.errors.txt @@ -0,0 +1,14 @@ +tests/cases/compiler/selfReferencingSpreadInLoop.ts(1,5): error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. +tests/cases/compiler/selfReferencingSpreadInLoop.ts(3,22): error TS7005: Variable 'additional' implicitly has an 'any[]' type. + + +==== tests/cases/compiler/selfReferencingSpreadInLoop.ts (2 errors) ==== + let additional = []; + ~~~~~~~~~~ +!!! error TS7034: Variable 'additional' implicitly has type 'any[]' in some locations where its type cannot be determined. + for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; + ~~~~~~~~~~ +!!! error TS7005: Variable 'additional' implicitly has an 'any[]' type. + } + \ No newline at end of file diff --git a/tests/baselines/reference/selfReferencingSpreadInLoop.js b/tests/baselines/reference/selfReferencingSpreadInLoop.js new file mode 100644 index 00000000000..1b8d5ace4f3 --- /dev/null +++ b/tests/baselines/reference/selfReferencingSpreadInLoop.js @@ -0,0 +1,13 @@ +//// [selfReferencingSpreadInLoop.ts] +let additional = []; +for (const subcomponent of [1, 2, 3]) { + additional = [...additional, subcomponent]; +} + + +//// [selfReferencingSpreadInLoop.js] +var additional = []; +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var subcomponent = _a[_i]; + additional = additional.concat([subcomponent]); +} diff --git a/tests/baselines/reference/spreadIntersection.js b/tests/baselines/reference/spreadIntersection.js new file mode 100644 index 00000000000..b3fa9f0c2fb --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.js @@ -0,0 +1,23 @@ +//// [spreadIntersection.ts] +var intersection: { a: number } & { b: string }; + +var o1: { a: number, b: string }; +var o1 = { ...intersection }; + +var o2: { a: number, b: string, c: boolean }; +var o2 = { ...intersection, c: false }; + +//// [spreadIntersection.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var intersection; +var o1; +var o1 = __assign({}, intersection); +var o2; +var o2 = __assign({}, intersection, { c: false }); diff --git a/tests/baselines/reference/spreadIntersection.symbols b/tests/baselines/reference/spreadIntersection.symbols new file mode 100644 index 00000000000..1f6b3c12de1 --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/spreadIntersection.ts === +var intersection: { a: number } & { b: string }; +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 0, 19)) +>b : Symbol(b, Decl(spreadIntersection.ts, 0, 35)) + +var o1: { a: number, b: string }; +>o1 : Symbol(o1, Decl(spreadIntersection.ts, 2, 3), Decl(spreadIntersection.ts, 3, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 2, 9)) +>b : Symbol(b, Decl(spreadIntersection.ts, 2, 20)) + +var o1 = { ...intersection }; +>o1 : Symbol(o1, Decl(spreadIntersection.ts, 2, 3), Decl(spreadIntersection.ts, 3, 3)) +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) + +var o2: { a: number, b: string, c: boolean }; +>o2 : Symbol(o2, Decl(spreadIntersection.ts, 5, 3), Decl(spreadIntersection.ts, 6, 3)) +>a : Symbol(a, Decl(spreadIntersection.ts, 5, 9)) +>b : Symbol(b, Decl(spreadIntersection.ts, 5, 20)) +>c : Symbol(c, Decl(spreadIntersection.ts, 5, 31)) + +var o2 = { ...intersection, c: false }; +>o2 : Symbol(o2, Decl(spreadIntersection.ts, 5, 3), Decl(spreadIntersection.ts, 6, 3)) +>intersection : Symbol(intersection, Decl(spreadIntersection.ts, 0, 3)) +>c : Symbol(c, Decl(spreadIntersection.ts, 6, 27)) + diff --git a/tests/baselines/reference/spreadIntersection.types b/tests/baselines/reference/spreadIntersection.types new file mode 100644 index 00000000000..c3c6b99adee --- /dev/null +++ b/tests/baselines/reference/spreadIntersection.types @@ -0,0 +1,29 @@ +=== tests/cases/compiler/spreadIntersection.ts === +var intersection: { a: number } & { b: string }; +>intersection : { a: number; } & { b: string; } +>a : number +>b : string + +var o1: { a: number, b: string }; +>o1 : { a: number; b: string; } +>a : number +>b : string + +var o1 = { ...intersection }; +>o1 : { a: number; b: string; } +>{ ...intersection } : { a: number; b: string; } +>intersection : { a: number; } & { b: string; } + +var o2: { a: number, b: string, c: boolean }; +>o2 : { a: number; b: string; c: boolean; } +>a : number +>b : string +>c : boolean + +var o2 = { ...intersection, c: false }; +>o2 : { a: number; b: string; c: boolean; } +>{ ...intersection, c: false } : { c: boolean; a: number; b: string; } +>intersection : { a: number; } & { b: string; } +>c : boolean +>false : false + diff --git a/tests/baselines/reference/spreadInvalidArgumentType.errors.txt b/tests/baselines/reference/spreadInvalidArgumentType.errors.txt new file mode 100644 index 00000000000..5088390f9ee --- /dev/null +++ b/tests/baselines/reference/spreadInvalidArgumentType.errors.txt @@ -0,0 +1,104 @@ +tests/cases/compiler/spreadInvalidArgumentType.ts(31,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(33,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(35,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(36,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(38,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(41,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(42,16): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(44,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(45,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(47,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(48,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(56,17): error TS2698: Spread types may only be created from object types. +tests/cases/compiler/spreadInvalidArgumentType.ts(58,17): error TS2698: Spread types may only be created from object types. + + +==== tests/cases/compiler/spreadInvalidArgumentType.ts (14 errors) ==== + enum E { v1, v2 }; + + function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + ~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o4 = { ...i }; // Error, index access + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o5 = { ...k }; // Error, index + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + ~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o9 = { ...union_primitive }; // Error, union with generic type parameter + ~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o12 = { ...num }; // Error + ~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o13 = { ...str }; // Error + ~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + var o18 = { ...literal_number }; // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: Spread types may only be created from object types. + + var o19 = { ...e }; // Error, enum + ~~~~ +!!! error TS2698: Spread types may only be created from object types. + } \ No newline at end of file diff --git a/tests/baselines/reference/spreadInvalidArgumentType.js b/tests/baselines/reference/spreadInvalidArgumentType.js new file mode 100644 index 00000000000..26f958f224d --- /dev/null +++ b/tests/baselines/reference/spreadInvalidArgumentType.js @@ -0,0 +1,114 @@ +//// [spreadInvalidArgumentType.ts] +enum E { v1, v2 }; + +function f(p1: T, p2: T[]) { + var t: T; + + var i: T["b"]; + var k: keyof T; + + var mapped_generic: {[P in keyof T]: T[P]}; + var mapped: {[P in "b"]: T[P]}; + + var union_generic: T | { a: number }; + var union_primitive: { a: number } | number; + + var intersection_generic: T & { a: number }; + var intersection_premitive: { a: number } | string; + + var num: number; + var str: number; + + var u: undefined; + var n: null; + + var a: any; + + var literal_string: "string"; + var literal_number: 42; + + var e: E; + + var o1 = { ...p1 }; // Error, generic type paramterre + var o2 = { ...p2 }; // OK + var o3 = { ...t }; // Error, generic type paramter + + var o4 = { ...i }; // Error, index access + var o5 = { ...k }; // Error, index + + var o6 = { ...mapped_generic }; // Error, generic mapped object type + var o7 = { ...mapped }; // OK, non-generic mapped type + + var o8 = { ...union_generic }; // Error, union with generic type parameter + var o9 = { ...union_primitive }; // Error, union with generic type parameter + + var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter + var o11 = { ...intersection_premitive }; // Error, intersection with generic type parameter + + var o12 = { ...num }; // Error + var o13 = { ...str }; // Error + + var o14 = { ...u }; // OK + var o15 = { ...n }; // OK + + var o16 = { ...a }; // OK + + var o17 = { ...literal_string }; // Error + var o18 = { ...literal_number }; // Error + + var o19 = { ...e }; // Error, enum +} + +//// [spreadInvalidArgumentType.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var E; +(function (E) { + E[E["v1"] = 0] = "v1"; + E[E["v2"] = 1] = "v2"; +})(E || (E = {})); +; +function f(p1, p2) { + var t; + var i; + var k; + var mapped_generic; + var mapped; + var union_generic; + var union_primitive; + var intersection_generic; + var intersection_premitive; + var num; + var str; + var u; + var n; + var a; + var literal_string; + var literal_number; + var e; + var o1 = __assign({}, p1); // Error, generic type paramterre + var o2 = __assign({}, p2); // OK + var o3 = __assign({}, t); // Error, generic type paramter + var o4 = __assign({}, i); // Error, index access + var o5 = __assign({}, k); // Error, index + var o6 = __assign({}, mapped_generic); // Error, generic mapped object type + var o7 = __assign({}, mapped); // OK, non-generic mapped type + var o8 = __assign({}, union_generic); // Error, union with generic type parameter + var o9 = __assign({}, union_primitive); // Error, union with generic type parameter + var o10 = __assign({}, intersection_generic); // Error, intersection with generic type parameter + var o11 = __assign({}, intersection_premitive); // Error, intersection with generic type parameter + var o12 = __assign({}, num); // Error + var o13 = __assign({}, str); // Error + var o14 = __assign({}, u); // OK + var o15 = __assign({}, n); // OK + var o16 = __assign({}, a); // OK + var o17 = __assign({}, literal_string); // Error + var o18 = __assign({}, literal_number); // Error + var o19 = __assign({}, e); // Error, enum +} diff --git a/tests/baselines/reference/spreadUnion.js b/tests/baselines/reference/spreadUnion.js new file mode 100644 index 00000000000..2691a3acdcc --- /dev/null +++ b/tests/baselines/reference/spreadUnion.js @@ -0,0 +1,28 @@ +//// [spreadUnion.ts] +var union: { a: number } | { b: string }; + +var o3: { a: number } | { b: string }; +var o3 = { ...union }; + +var o4: { a: boolean } | { b: string , a: boolean}; +var o4 = { ...union, a: false }; + +var o5: { a: number } | { b: string } | { a: number, b: string }; +var o5 = { ...union, ...union }; + +//// [spreadUnion.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var union; +var o3; +var o3 = __assign({}, union); +var o4; +var o4 = __assign({}, union, { a: false }); +var o5; +var o5 = __assign({}, union, union); diff --git a/tests/baselines/reference/spreadUnion.symbols b/tests/baselines/reference/spreadUnion.symbols new file mode 100644 index 00000000000..40a63d56d49 --- /dev/null +++ b/tests/baselines/reference/spreadUnion.symbols @@ -0,0 +1,38 @@ +=== tests/cases/compiler/spreadUnion.ts === +var union: { a: number } | { b: string }; +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 0, 12)) +>b : Symbol(b, Decl(spreadUnion.ts, 0, 28)) + +var o3: { a: number } | { b: string }; +>o3 : Symbol(o3, Decl(spreadUnion.ts, 2, 3), Decl(spreadUnion.ts, 3, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 2, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 2, 25)) + +var o3 = { ...union }; +>o3 : Symbol(o3, Decl(spreadUnion.ts, 2, 3), Decl(spreadUnion.ts, 3, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) + +var o4: { a: boolean } | { b: string , a: boolean}; +>o4 : Symbol(o4, Decl(spreadUnion.ts, 5, 3), Decl(spreadUnion.ts, 6, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 5, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 5, 26)) +>a : Symbol(a, Decl(spreadUnion.ts, 5, 38)) + +var o4 = { ...union, a: false }; +>o4 : Symbol(o4, Decl(spreadUnion.ts, 5, 3), Decl(spreadUnion.ts, 6, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 6, 21)) + +var o5: { a: number } | { b: string } | { a: number, b: string }; +>o5 : Symbol(o5, Decl(spreadUnion.ts, 8, 3), Decl(spreadUnion.ts, 9, 3)) +>a : Symbol(a, Decl(spreadUnion.ts, 8, 9)) +>b : Symbol(b, Decl(spreadUnion.ts, 8, 25)) +>a : Symbol(a, Decl(spreadUnion.ts, 8, 41)) +>b : Symbol(b, Decl(spreadUnion.ts, 8, 52)) + +var o5 = { ...union, ...union }; +>o5 : Symbol(o5, Decl(spreadUnion.ts, 8, 3), Decl(spreadUnion.ts, 9, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) +>union : Symbol(union, Decl(spreadUnion.ts, 0, 3)) + diff --git a/tests/baselines/reference/spreadUnion.types b/tests/baselines/reference/spreadUnion.types new file mode 100644 index 00000000000..9e5ac1cffd5 --- /dev/null +++ b/tests/baselines/reference/spreadUnion.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/spreadUnion.ts === +var union: { a: number } | { b: string }; +>union : { a: number; } | { b: string; } +>a : number +>b : string + +var o3: { a: number } | { b: string }; +>o3 : { a: number; } | { b: string; } +>a : number +>b : string + +var o3 = { ...union }; +>o3 : { a: number; } | { b: string; } +>{ ...union } : { a: number; } | { b: string; } +>union : { a: number; } | { b: string; } + +var o4: { a: boolean } | { b: string , a: boolean}; +>o4 : { a: boolean; } | { b: string; a: boolean; } +>a : boolean +>b : string +>a : boolean + +var o4 = { ...union, a: false }; +>o4 : { a: boolean; } | { b: string; a: boolean; } +>{ ...union, a: false } : { a: boolean; } | { a: boolean; b: string; } +>union : { a: number; } | { b: string; } +>a : boolean +>false : false + +var o5: { a: number } | { b: string } | { a: number, b: string }; +>o5 : { a: number; } | { b: string; } | { a: number; b: string; } +>a : number +>b : string +>a : number +>b : string + +var o5 = { ...union, ...union }; +>o5 : { a: number; } | { b: string; } | { a: number; b: string; } +>{ ...union, ...union } : { a: number; } | { b: string; a: number; } | { a: number; b: string; } | { b: string; } +>union : { a: number; } | { b: string; } +>union : { a: number; } | { b: string; } + diff --git a/tests/baselines/reference/spreadUnion2.js b/tests/baselines/reference/spreadUnion2.js new file mode 100644 index 00000000000..6c7527af9dd --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.js @@ -0,0 +1,49 @@ +//// [spreadUnion2.ts] + +declare const undefinedUnion: { a: number } | undefined; +declare const nullUnion: { b: number } | null; +declare const nullAndUndefinedUnion: null | undefined; + +var o1: { a: number }; +var o1 = { ...undefinedUnion }; + +var o2: { b: number }; +var o2 = { ...nullUnion }; + +var o3: { a: number, b: number }; +var o3 = { ...undefinedUnion, ...nullUnion }; +var o3 = { ...nullUnion, ...undefinedUnion }; + +var o4: { a: number }; +var o4 = { ...undefinedUnion, ...undefinedUnion }; + +var o5: { b: number }; +var o5 = { ...nullUnion, ...nullUnion }; + +var o6: { }; +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +var o6 = { ...nullAndUndefinedUnion }; + +//// [spreadUnion2.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; +var o1; +var o1 = __assign({}, undefinedUnion); +var o2; +var o2 = __assign({}, nullUnion); +var o3; +var o3 = __assign({}, undefinedUnion, nullUnion); +var o3 = __assign({}, nullUnion, undefinedUnion); +var o4; +var o4 = __assign({}, undefinedUnion, undefinedUnion); +var o5; +var o5 = __assign({}, nullUnion, nullUnion); +var o6; +var o6 = __assign({}, nullAndUndefinedUnion, nullAndUndefinedUnion); +var o6 = __assign({}, nullAndUndefinedUnion); diff --git a/tests/baselines/reference/spreadUnion2.symbols b/tests/baselines/reference/spreadUnion2.symbols new file mode 100644 index 00000000000..cc2c194f2a6 --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.symbols @@ -0,0 +1,74 @@ +=== tests/cases/compiler/spreadUnion2.ts === + +declare const undefinedUnion: { a: number } | undefined; +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>a : Symbol(a, Decl(spreadUnion2.ts, 1, 31)) + +declare const nullUnion: { b: number } | null; +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>b : Symbol(b, Decl(spreadUnion2.ts, 2, 26)) + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + +var o1: { a: number }; +>o1 : Symbol(o1, Decl(spreadUnion2.ts, 5, 3), Decl(spreadUnion2.ts, 6, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 5, 9)) + +var o1 = { ...undefinedUnion }; +>o1 : Symbol(o1, Decl(spreadUnion2.ts, 5, 3), Decl(spreadUnion2.ts, 6, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o2: { b: number }; +>o2 : Symbol(o2, Decl(spreadUnion2.ts, 8, 3), Decl(spreadUnion2.ts, 9, 3)) +>b : Symbol(b, Decl(spreadUnion2.ts, 8, 9)) + +var o2 = { ...nullUnion }; +>o2 : Symbol(o2, Decl(spreadUnion2.ts, 8, 3), Decl(spreadUnion2.ts, 9, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o3: { a: number, b: number }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 11, 9)) +>b : Symbol(b, Decl(spreadUnion2.ts, 11, 20)) + +var o3 = { ...undefinedUnion, ...nullUnion }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o3 = { ...nullUnion, ...undefinedUnion }; +>o3 : Symbol(o3, Decl(spreadUnion2.ts, 11, 3), Decl(spreadUnion2.ts, 12, 3), Decl(spreadUnion2.ts, 13, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o4: { a: number }; +>o4 : Symbol(o4, Decl(spreadUnion2.ts, 15, 3), Decl(spreadUnion2.ts, 16, 3)) +>a : Symbol(a, Decl(spreadUnion2.ts, 15, 9)) + +var o4 = { ...undefinedUnion, ...undefinedUnion }; +>o4 : Symbol(o4, Decl(spreadUnion2.ts, 15, 3), Decl(spreadUnion2.ts, 16, 3)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) +>undefinedUnion : Symbol(undefinedUnion, Decl(spreadUnion2.ts, 1, 13)) + +var o5: { b: number }; +>o5 : Symbol(o5, Decl(spreadUnion2.ts, 18, 3), Decl(spreadUnion2.ts, 19, 3)) +>b : Symbol(b, Decl(spreadUnion2.ts, 18, 9)) + +var o5 = { ...nullUnion, ...nullUnion }; +>o5 : Symbol(o5, Decl(spreadUnion2.ts, 18, 3), Decl(spreadUnion2.ts, 19, 3)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) +>nullUnion : Symbol(nullUnion, Decl(spreadUnion2.ts, 2, 13)) + +var o6: { }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) + +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + +var o6 = { ...nullAndUndefinedUnion }; +>o6 : Symbol(o6, Decl(spreadUnion2.ts, 21, 3), Decl(spreadUnion2.ts, 22, 3), Decl(spreadUnion2.ts, 23, 3)) +>nullAndUndefinedUnion : Symbol(nullAndUndefinedUnion, Decl(spreadUnion2.ts, 3, 13)) + diff --git a/tests/baselines/reference/spreadUnion2.types b/tests/baselines/reference/spreadUnion2.types new file mode 100644 index 00000000000..cf90381ca77 --- /dev/null +++ b/tests/baselines/reference/spreadUnion2.types @@ -0,0 +1,84 @@ +=== tests/cases/compiler/spreadUnion2.ts === + +declare const undefinedUnion: { a: number } | undefined; +>undefinedUnion : { a: number; } | undefined +>a : number + +declare const nullUnion: { b: number } | null; +>nullUnion : { b: number; } | null +>b : number +>null : null + +declare const nullAndUndefinedUnion: null | undefined; +>nullAndUndefinedUnion : null | undefined +>null : null + +var o1: { a: number }; +>o1 : { a: number; } +>a : number + +var o1 = { ...undefinedUnion }; +>o1 : { a: number; } +>{ ...undefinedUnion } : { a: number; } +>undefinedUnion : { a: number; } | undefined + +var o2: { b: number }; +>o2 : { b: number; } +>b : number + +var o2 = { ...nullUnion }; +>o2 : { b: number; } +>{ ...nullUnion } : { b: number; } +>nullUnion : { b: number; } | null + +var o3: { a: number, b: number }; +>o3 : { a: number; b: number; } +>a : number +>b : number + +var o3 = { ...undefinedUnion, ...nullUnion }; +>o3 : { a: number; b: number; } +>{ ...undefinedUnion, ...nullUnion } : { b: number; a: number; } +>undefinedUnion : { a: number; } | undefined +>nullUnion : { b: number; } | null + +var o3 = { ...nullUnion, ...undefinedUnion }; +>o3 : { a: number; b: number; } +>{ ...nullUnion, ...undefinedUnion } : { a: number; b: number; } +>nullUnion : { b: number; } | null +>undefinedUnion : { a: number; } | undefined + +var o4: { a: number }; +>o4 : { a: number; } +>a : number + +var o4 = { ...undefinedUnion, ...undefinedUnion }; +>o4 : { a: number; } +>{ ...undefinedUnion, ...undefinedUnion } : { a: number; } +>undefinedUnion : { a: number; } | undefined +>undefinedUnion : { a: number; } | undefined + +var o5: { b: number }; +>o5 : { b: number; } +>b : number + +var o5 = { ...nullUnion, ...nullUnion }; +>o5 : { b: number; } +>{ ...nullUnion, ...nullUnion } : { b: number; } +>nullUnion : { b: number; } | null +>nullUnion : { b: number; } | null + +var o6: { }; +>o6 : {} + +var o6 = { ...nullAndUndefinedUnion, ...nullAndUndefinedUnion }; +>o6 : {} +>{ ...nullAndUndefinedUnion, ...nullAndUndefinedUnion } : {} +>nullAndUndefinedUnion : null | undefined +>nullAndUndefinedUnion : null | undefined + +var o6 = { ...nullAndUndefinedUnion }; +>o6 : {} +>{ ...nullAndUndefinedUnion } : {} +>nullAndUndefinedUnion : null | undefined + diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt index 0dff64c9a31..fafffb563ea 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.errors.txt @@ -16,9 +16,9 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,9): error TS tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(21,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(23,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2693: 'public' only refers to a type, but is being used as a value here. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(25,20): error TS2702: 'public' only refers to a type, but is being used as a namespace here. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2693: 'public' only refers to a type, but is being used as a value here. +tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(26,21): error TS2702: 'public' only refers to a type, but is being used as a namespace here. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(27,17): error TS2304: Cannot find name 'package'. tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. @@ -88,12 +88,12 @@ tests/cases/compiler/strictModeReservedWordInClassDeclaration.ts(28,17): error T ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2693: 'public' only refers to a type, but is being used as a value here. +!!! error TS2702: 'public' only refers to a type, but is being used as a namespace here. class F1 implements public.private.implements { } ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS2693: 'public' only refers to a type, but is being used as a value here. +!!! error TS2702: 'public' only refers to a type, but is being used as a namespace here. class G extends package { } ~~~~~~~ !!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js new file mode 100644 index 00000000000..15d6fc70da5 --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.js @@ -0,0 +1,51 @@ +//// [subSubClassCanAccessProtectedConstructor.ts] +class Base { + protected constructor() { } + public instance1 = new Base(); // allowed +} + +class Subclass extends Base { + public instance1_1 = new Base(); // allowed + public instance1_2 = new Subclass(); // allowed +} + +class SubclassOfSubclass extends Subclass { + public instance2_1 = new Base(); // allowed + public instance2_2 = new Subclass(); // allowed + public instance2_3 = new SubclassOfSubclass(); // allowed +} + + +//// [subSubClassCanAccessProtectedConstructor.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Base = (function () { + function Base() { + this.instance1 = new Base(); // allowed + } + return Base; +}()); +var Subclass = (function (_super) { + __extends(Subclass, _super); + function Subclass() { + var _this = _super.apply(this, arguments) || this; + _this.instance1_1 = new Base(); // allowed + _this.instance1_2 = new Subclass(); // allowed + return _this; + } + return Subclass; +}(Base)); +var SubclassOfSubclass = (function (_super) { + __extends(SubclassOfSubclass, _super); + function SubclassOfSubclass() { + var _this = _super.apply(this, arguments) || this; + _this.instance2_1 = new Base(); // allowed + _this.instance2_2 = new Subclass(); // allowed + _this.instance2_3 = new SubclassOfSubclass(); // allowed + return _this; + } + return SubclassOfSubclass; +}(Subclass)); diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols new file mode 100644 index 00000000000..8a09e1d742f --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.symbols @@ -0,0 +1,40 @@ +=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts === +class Base { +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + protected constructor() { } + public instance1 = new Base(); // allowed +>instance1 : Symbol(Base.instance1, Decl(subSubClassCanAccessProtectedConstructor.ts, 1, 31)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) +} + +class Subclass extends Base { +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance1_1 = new Base(); // allowed +>instance1_1 : Symbol(Subclass.instance1_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 5, 29)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance1_2 = new Subclass(); // allowed +>instance1_2 : Symbol(Subclass.instance1_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 6, 36)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) +} + +class SubclassOfSubclass extends Subclass { +>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) + + public instance2_1 = new Base(); // allowed +>instance2_1 : Symbol(SubclassOfSubclass.instance2_1, Decl(subSubClassCanAccessProtectedConstructor.ts, 10, 43)) +>Base : Symbol(Base, Decl(subSubClassCanAccessProtectedConstructor.ts, 0, 0)) + + public instance2_2 = new Subclass(); // allowed +>instance2_2 : Symbol(SubclassOfSubclass.instance2_2, Decl(subSubClassCanAccessProtectedConstructor.ts, 11, 36)) +>Subclass : Symbol(Subclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 3, 1)) + + public instance2_3 = new SubclassOfSubclass(); // allowed +>instance2_3 : Symbol(SubclassOfSubclass.instance2_3, Decl(subSubClassCanAccessProtectedConstructor.ts, 12, 40)) +>SubclassOfSubclass : Symbol(SubclassOfSubclass, Decl(subSubClassCanAccessProtectedConstructor.ts, 8, 1)) +} + diff --git a/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types new file mode 100644 index 00000000000..253f6221c78 --- /dev/null +++ b/tests/baselines/reference/subSubClassCanAccessProtectedConstructor.types @@ -0,0 +1,46 @@ +=== tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts === +class Base { +>Base : Base + + protected constructor() { } + public instance1 = new Base(); // allowed +>instance1 : Base +>new Base() : Base +>Base : typeof Base +} + +class Subclass extends Base { +>Subclass : Subclass +>Base : Base + + public instance1_1 = new Base(); // allowed +>instance1_1 : Base +>new Base() : Base +>Base : typeof Base + + public instance1_2 = new Subclass(); // allowed +>instance1_2 : Subclass +>new Subclass() : Subclass +>Subclass : typeof Subclass +} + +class SubclassOfSubclass extends Subclass { +>SubclassOfSubclass : SubclassOfSubclass +>Subclass : Subclass + + public instance2_1 = new Base(); // allowed +>instance2_1 : Base +>new Base() : Base +>Base : typeof Base + + public instance2_2 = new Subclass(); // allowed +>instance2_2 : Subclass +>new Subclass() : Subclass +>Subclass : typeof Subclass + + public instance2_3 = new SubclassOfSubclass(); // allowed +>instance2_3 : SubclassOfSubclass +>new SubclassOfSubclass() : SubclassOfSubclass +>SubclassOfSubclass : typeof SubclassOfSubclass +} + diff --git a/tests/baselines/reference/superAccess2.errors.txt b/tests/baselines/reference/superAccess2.errors.txt index d8b39284f65..edcd4031c47 100644 --- a/tests/baselines/reference/superAccess2.errors.txt +++ b/tests/baselines/reference/superAccess2.errors.txt @@ -2,10 +2,13 @@ tests/cases/compiler/superAccess2.ts(7,15): error TS1034: 'super' must be follow tests/cases/compiler/superAccess2.ts(8,17): error TS2338: 'super' property access is permitted only in a constructor, member function, or member accessor of a derived class. tests/cases/compiler/superAccess2.ts(8,22): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,28): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,28): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,33): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,40): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,40): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,45): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(11,59): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superAccess2.ts(11,59): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superAccess2.ts(11,64): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(15,19): error TS1034: 'super' must be followed by an argument list or member access. tests/cases/compiler/superAccess2.ts(17,15): error TS2339: Property 'y' does not exist on type 'P'. @@ -13,7 +16,7 @@ tests/cases/compiler/superAccess2.ts(20,26): error TS1034: 'super' must be follo tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not exist on type 'typeof P'. -==== tests/cases/compiler/superAccess2.ts (13 errors) ==== +==== tests/cases/compiler/superAccess2.ts (16 errors) ==== class P { x() { } static y() { } @@ -33,14 +36,20 @@ tests/cases/compiler/superAccess2.ts(21,15): error TS2339: Property 'x' does not constructor(public z = super, zz = super, zzz = () => super) { ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. super(); diff --git a/tests/baselines/reference/superInConstructorParam1.errors.txt b/tests/baselines/reference/superInConstructorParam1.errors.txt index 96735c92547..4220fcb9b0e 100644 --- a/tests/baselines/reference/superInConstructorParam1.errors.txt +++ b/tests/baselines/reference/superInConstructorParam1.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superInConstructorParam1.ts(8,3): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS2336: 'super' cannot be referenced in constructor arguments. +tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. -==== tests/cases/compiler/superInConstructorParam1.ts (2 errors) ==== +==== tests/cases/compiler/superInConstructorParam1.ts (3 errors) ==== class B { public foo(): number { return 0; @@ -14,6 +15,8 @@ tests/cases/compiler/superInConstructorParam1.ts(8,19): error TS2336: 'super' ca ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ !!! error TS2336: 'super' cannot be referenced in constructor arguments. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. } ~~~ !!! error TS2377: Constructors for derived classes must contain a 'super' call. diff --git a/tests/baselines/reference/superNewCall1.errors.txt b/tests/baselines/reference/superNewCall1.errors.txt index 2b104e7d647..c8fd5c471fb 100644 --- a/tests/baselines/reference/superNewCall1.errors.txt +++ b/tests/baselines/reference/superNewCall1.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superNewCall1.ts(9,5): error TS2377: Constructors for derived classes must contain a 'super' call. tests/cases/compiler/superNewCall1.ts(10,9): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/superNewCall1.ts(10,13): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. -==== tests/cases/compiler/superNewCall1.ts (2 errors) ==== +==== tests/cases/compiler/superNewCall1.ts (3 errors) ==== class A { constructor(private map: (value: T1) => T2) { @@ -17,6 +18,8 @@ tests/cases/compiler/superNewCall1.ts(10,9): error TS2351: Cannot use 'new' with ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. } ~~~~~ !!! error TS2377: Constructors for derived classes must contain a 'super' call. From ec72ad64b65c427a1c23bfce5aaa91c27d8af0ee Mon Sep 17 00:00:00 2001 From: Yuichi Nukiyama Date: Wed, 14 Dec 2016 23:55:18 +0900 Subject: [PATCH 133/289] update --- ...rtyInConstructorBeforeSuperCall.errors.txt | 24 ++ ...perPropertyInConstructorBeforeSuperCall.js | 46 +++ .../superWithTypeArgument.errors.txt | 5 +- .../superWithTypeArgument2.errors.txt | 5 +- .../superWithTypeArgument3.errors.txt | 5 +- .../reference/systemModuleTrailingComments.js | 18 + .../systemModuleTrailingComments.symbols | 5 + .../systemModuleTrailingComments.types | 6 + .../reference/unionTypeWithLeadingOperator.js | 10 + .../unionTypeWithLeadingOperator.symbols | 16 + .../unionTypeWithLeadingOperator.types | 16 + ...dModuleImport_withAugmentation2.errors.txt | 19 + .../untypedModuleImport_withAugmentation2.js | 19 + .../unusedLocalsAndObjectSpread.errors.txt | 40 +++ .../reference/unusedLocalsAndObjectSpread.js | 67 ++++ .../useObjectValuesAndEntries1.types | 30 +- .../useObjectValuesAndEntries4.types | 8 +- .../reference/widenedTypes.errors.txt | 5 +- .../compiler/circularReferenceInImport.ts | 15 + .../declarationEmitIndexTypeNotFound.ts | 5 + ...orMetadataRestParameterWithImportedType.ts | 42 +++ .../compiler/decoratorWithUnderscoreMethod.ts | 18 + ...xhaustiveSwitchWithWideningLiteralTypes.ts | 18 + ...xplicitAnyAfterSpreadNoImplicitAnyError.ts | 3 + .../compiler/importHelpersDeclarations.ts | 9 + .../compiler/intersectionTypeNormalization.ts | 45 +++ .../intersectionTypeWithLeadingOperator.ts | 6 + .../compiler/invalidUseOfTypeAsNamespace.ts | 4 + .../jsxFactoryQualifiedNameWithEs5.ts | 17 + .../compiler/keyofIsLiteralContexualType.ts | 13 + .../mappedTypeInferenceCircularity.ts | 7 + tests/cases/compiler/nestedFreshLiteral.ts | 14 + .../newLexicalEnvironmentForConvertedLoop.ts | 13 + tests/cases/compiler/objectFreeze.ts | 12 + tests/cases/compiler/restIntersection.ts | 4 + .../cases/compiler/restInvalidArgumentType.ts | 59 ++++ tests/cases/compiler/restUnion.ts | 14 + tests/cases/compiler/restUnion2.ts | 19 + .../compiler/selfReferencingSpreadInLoop.ts | 5 + tests/cases/compiler/spreadIntersection.ts | 7 + .../compiler/spreadInvalidArgumentType.ts | 59 ++++ tests/cases/compiler/spreadUnion.ts | 10 + tests/cases/compiler/spreadUnion2.ts | 25 ++ ...ubSubClassCanAccessProtectedConstructor.ts | 15 + .../compiler/systemModuleTrailingComments.ts | 4 + .../compiler/unionTypeWithLeadingOperator.ts | 6 + .../untypedModuleImport_withAugmentation2.ts | 14 + .../compiler/unusedLocalsAndObjectSpread.ts | 31 ++ .../es2017/awaitInheritedPromise_es2017.ts | 7 + .../classAbstractAccessor.ts | 8 + ...perPropertyInConstructorBeforeSuperCall.ts | 15 + .../accessor/decoratorOnClassAccessor7.ts | 34 ++ .../accessor/decoratorOnClassAccessor8.ts | 32 ++ .../decoratorOnClassConstructor4.ts | 18 + .../keyof/circularIndexedAccessErrors.ts | 31 ++ .../conformance/types/keyof/keyofAndForIn.ts | 36 ++ .../types/keyof/keyofAndIndexedAccess.ts | 197 ++++++++++- .../keyof/keyofAndIndexedAccessErrors.ts | 11 + .../mapped/isomorphicMappedTypeInference.ts | 155 ++++++++ .../types/mapped/mappedTypeErrors.ts | 59 +++- .../types/mapped/mappedTypeModifiers.ts | 77 ++++ .../conformance/types/mapped/mappedTypes1.ts | 4 +- .../conformance/types/mapped/mappedTypes2.ts | 21 +- .../conformance/types/mapped/mappedTypes4.ts | 62 ++++ .../conformance/types/rest/objectRest.ts | 2 + .../types/rest/objectRestNegative.ts | 3 + .../types/spread/objectSpreadNegative.ts | 4 +- tests/cases/fourslash/basicClassMembers.ts | 6 +- .../commentBraceCompletionPosition.ts | 6 +- tests/cases/fourslash/commentsClassMembers.ts | 334 +++++++++--------- tests/cases/fourslash/commentsEnums.ts | 8 +- .../fourslash/commentsExternalModules.ts | 22 +- .../fourslash/commentsImportDeclaration.ts | 12 +- tests/cases/fourslash/commentsInheritance.ts | 216 +++++------ tests/cases/fourslash/commentsInterface.ts | 24 +- .../fourslash/commentsLinePreservation.ts | 13 +- tests/cases/fourslash/commentsModules.ts | 48 +-- tests/cases/fourslash/commentsOverloads.ts | 18 +- .../completionEntryForUnionProperty.ts | 6 +- .../completionEntryForUnionProperty2.ts | 6 +- ...nForQuotedPropertyInPropertyAssignment1.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment2.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment3.ts | 4 +- ...nForQuotedPropertyInPropertyAssignment4.ts | 4 +- .../fourslash/completionForStringLiteral.ts | 4 +- .../fourslash/completionForStringLiteral2.ts | 4 +- .../fourslash/completionForStringLiteral3.ts | 4 +- .../fourslash/completionForStringLiteral4.ts | 2 +- tests/cases/fourslash/completionInJsDoc.ts | 1 + .../fourslash/completionListAfterAnyType.ts | 4 +- .../completionListAfterInvalidCharacter.ts | 2 +- .../completionListAfterObjectLiteral1.ts | 4 +- ...tionListAfterRegularExpressionLiteral01.ts | 4 +- ...etionListAfterRegularExpressionLiteral1.ts | 4 +- .../completionListAfterStringLiteral1.ts | 4 +- ...mpletionListAndMemberListOnCommentedDot.ts | 2 +- ...nListAndMemberListOnCommentedWhiteSpace.ts | 2 +- tests/cases/fourslash/completionListAtEOF1.ts | 2 +- tests/cases/fourslash/completionListAtEOF2.ts | 2 +- .../fourslash/completionListAtNodeBoundry.ts | 2 +- .../fourslash/completionListBeforeKeyword.ts | 8 +- .../cases/fourslash/completionListCladule.ts | 16 +- .../fourslash/completionListClassMembers.ts | 52 +-- .../fourslash/completionListEnumMembers.ts | 14 +- .../fourslash/completionListEnumValues.ts | 14 +- .../fourslash/completionListErrorRecovery.ts | 2 +- ...berInAmbientModuleWithExportAssignment1.ts | 2 +- .../completionListForObjectSpread.ts | 22 +- .../cases/fourslash/completionListForRest.ts | 6 +- ...etionListForShorthandPropertyAssignment.ts | 4 +- ...tionListForShorthandPropertyAssignment2.ts | 4 +- .../completionListFunctionMembers.ts | 2 +- .../completionListGenericConstraints.ts | 34 +- .../completionListInClosedFunction01.ts | 8 +- .../completionListInClosedFunction02.ts | 16 +- .../completionListInClosedFunction03.ts | 16 +- .../completionListInClosedFunction04.ts | 16 +- .../completionListInClosedFunction05.ts | 18 +- .../completionListInClosedFunction06.ts | 2 +- .../completionListInClosedFunction07.ts | 20 +- ...tInClosedObjectTypeLiteralInSignature01.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature02.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature03.ts | 10 +- ...tInClosedObjectTypeLiteralInSignature04.ts | 10 +- .../fourslash/completionListInEmptyFile.ts | 2 +- .../completionListInExtendsClauseAtEOF.ts | 4 +- .../completionListInFunctionExpression.ts | 8 +- ...completionListInNamedFunctionExpression.ts | 6 +- .../completionListInObjectLiteral.ts | 4 +- ...ectLiteralThatIsParameterOfFunctionCall.ts | 6 +- .../cases/fourslash/completionListInScope.ts | 56 +-- ...mpletionListInTypeParameterOfTypeAlias3.ts | 12 +- .../completionListInTypedObjectLiterals2.ts | 4 +- .../completionListInTypedObjectLiterals3.ts | 4 +- .../completionListInTypedObjectLiterals4.ts | 6 +- ...dObjectLiteralsWithPartialPropertyNames.ts | 24 +- ...ObjectLiteralsWithPartialPropertyNames2.ts | 6 +- .../completionListInUnclosedFunction01.ts | 8 +- .../completionListInUnclosedFunction02.ts | 16 +- .../completionListInUnclosedFunction03.ts | 16 +- .../completionListInUnclosedFunction04.ts | 16 +- .../completionListInUnclosedFunction05.ts | 16 +- .../completionListInUnclosedFunction06.ts | 16 +- .../completionListInUnclosedFunction07.ts | 16 +- .../completionListInUnclosedFunction08.ts | 18 +- .../completionListInUnclosedFunction09.ts | 18 +- .../completionListInUnclosedFunction10.ts | 2 +- .../completionListInUnclosedFunction11.ts | 2 +- .../completionListInUnclosedFunction12.ts | 2 +- .../completionListInUnclosedFunction13.ts | 2 +- .../completionListInUnclosedFunction14.ts | 20 +- .../completionListInUnclosedFunction15.ts | 20 +- .../completionListInUnclosedFunction16.ts | 20 +- .../completionListInUnclosedFunction17.ts | 20 +- .../completionListInUnclosedFunction18.ts | 20 +- .../completionListInUnclosedFunction19.ts | 20 +- ...nUnclosedObjectTypeLiteralInSignature01.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature02.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature03.ts | 10 +- ...nUnclosedObjectTypeLiteralInSignature04.ts | 10 +- .../completionListInstanceProtectedMembers.ts | 48 +-- ...completionListInstanceProtectedMembers2.ts | 64 ++-- ...completionListInstanceProtectedMembers3.ts | 32 +- ...completionListInstanceProtectedMembers4.ts | 16 +- .../completionListInvalidMemberNames.ts | 2 +- .../completionListInvalidMemberNames2.ts | 6 +- .../cases/fourslash/completionListKeywords.ts | 86 ++--- .../fourslash/completionListModuleMembers.ts | 38 +- .../fourslash/completionListObjectMembers.ts | 4 +- .../fourslash/completionListOfGnericSymbol.ts | 4 +- .../completionListOfSplitInterface.ts | 26 +- .../fourslash/completionListOnAliases.ts | 4 +- .../fourslash/completionListOnAliases2.ts | 38 +- .../fourslash/completionListOnAliases3.ts | 2 +- ...nListOnFunctionCallWithOptionalArgument.ts | 2 +- .../cases/fourslash/completionListOnParam.ts | 2 +- .../completionListOnParamOfGenericType1.ts | 18 +- .../cases/fourslash/completionListOnSuper.ts | 6 +- .../completionListOnVarBetweenModules.ts | 4 +- .../fourslash/completionListPrimitives.ts | 14 +- .../fourslash/completionListPrivateMembers.ts | 4 +- .../completionListPrivateMembers2.ts | 8 +- .../completionListPrivateMembers3.ts | 12 +- .../completionListProtectedMembers.ts | 30 +- .../completionListStaticProtectedMembers.ts | 48 +-- .../completionListStaticProtectedMembers2.ts | 64 ++-- .../completionListStaticProtectedMembers3.ts | 32 +- .../completionListStaticProtectedMembers4.ts | 32 +- .../fourslash/completionListSuperMembers.ts | 12 +- tests/cases/fourslash/exportEqualTypes.ts | 2 +- tests/cases/fourslash/extendArrayInterface.ts | 2 +- .../fourslash/externalModuleIntellisense.ts | 2 +- ...ernceResolutionOrderInImportDeclaration.ts | 4 +- tests/cases/fourslash/forwardReference.ts | 2 +- tests/cases/fourslash/fourslash.ts | 5 +- tests/cases/fourslash/functionTypes.ts | 2 +- .../fourslash/getJavaScriptCompletions20.ts | 2 +- .../fourslash/getJavaScriptQuickInfo8.ts | 4 +- tests/cases/fourslash/javaScriptModules13.ts | 4 +- tests/cases/fourslash/javaScriptModules19.ts | 4 +- tests/cases/fourslash/javaScriptPrototype1.ts | 14 +- .../fourslash/jsDocFunctionSignatures3.ts | 4 +- tests/cases/fourslash/jsDocGenerics1.ts | 6 +- tests/cases/fourslash/jsdocNullableUnion.ts | 6 +- tests/cases/fourslash/lambdaThisMembers.ts | 2 +- .../memberCompletionFromFunctionCall.ts | 4 +- .../fourslash/memberCompletionInForEach1.ts | 8 +- .../memberCompletionOnTypeParameters.ts | 18 +- .../memberCompletionOnTypeParameters2.ts | 4 +- .../fourslash/memberListAfterDoubleDot.ts | 2 +- .../fourslash/memberListAfterSingleDot.ts | 2 +- .../fourslash/memberListErrorRecovery.ts | 2 +- .../fourslash/memberListInFunctionCall.ts | 2 +- .../fourslash/memberListInReopenedEnum.ts | 8 +- .../cases/fourslash/memberListInWithBlock.ts | 2 +- .../cases/fourslash/memberListInWithBlock2.ts | 2 +- .../cases/fourslash/memberListInWithBlock3.ts | 2 +- .../memberListInsideObjectLiterals.ts | 10 +- tests/cases/fourslash/memberListOfClass.ts | 6 +- .../memberListOfEnumFromExternalModule.ts | 2 +- .../fourslash/memberListOfEnumInModule.ts | 4 +- .../fourslash/memberListOfExportedClass.ts | 4 +- tests/cases/fourslash/memberListOfModule.ts | 6 +- .../memberListOfVarInArrowExpression.ts | 2 +- .../fourslash/memberListOnContextualThis.ts | 2 +- .../fourslash/memberListOnExplicitThis.ts | 14 +- .../memberListOnFunctionParameter.ts | 10 +- .../memberListOnThisInClassWithPrivates.ts | 6 +- tests/cases/fourslash/memberlistOnDDot.ts | 2 +- .../quickInfoOnNarrowedTypeInModule.ts | 6 +- .../quickInfoOnObjectLiteralWithAccessors.ts | 4 +- .../quickInfoOnObjectLiteralWithOnlyGetter.ts | 2 +- .../quickInfoOnObjectLiteralWithOnlySetter.ts | 4 +- ...WithNestedDestructuredParameterInLambda.ts | 15 + tests/cases/fourslash/server/completions01.ts | 8 +- .../cases/fourslash/server/jsdocTypedefTag.ts | 36 +- .../server/jsdocTypedefTagNamespace.ts | 10 +- tests/cases/fourslash/tsxCompletion10.ts | 2 +- .../fourslash/tsxCompletionOnClosingTag1.ts | 2 +- .../fourslash/tsxCompletionOnClosingTag2.ts | 4 +- .../tsxCompletionOnClosingTagWithoutJSX1.ts | 2 +- .../tsxCompletionOnClosingTagWithoutJSX2.ts | 4 +- .../tsxCompletionOnOpeningTagWithoutJSX1.ts | 2 +- .../unclosedStringLiteralErrorRecovery.ts | 2 +- tests/cases/fourslash/untypedModuleImport.ts | 1 - 245 files changed, 2848 insertions(+), 1284 deletions(-) create mode 100644 tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt create mode 100644 tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js create mode 100644 tests/baselines/reference/systemModuleTrailingComments.js create mode 100644 tests/baselines/reference/systemModuleTrailingComments.symbols create mode 100644 tests/baselines/reference/systemModuleTrailingComments.types create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.js create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.symbols create mode 100644 tests/baselines/reference/unionTypeWithLeadingOperator.types create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt create mode 100644 tests/baselines/reference/untypedModuleImport_withAugmentation2.js create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt create mode 100644 tests/baselines/reference/unusedLocalsAndObjectSpread.js create mode 100644 tests/cases/compiler/circularReferenceInImport.ts create mode 100644 tests/cases/compiler/declarationEmitIndexTypeNotFound.ts create mode 100644 tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts create mode 100644 tests/cases/compiler/decoratorWithUnderscoreMethod.ts create mode 100644 tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts create mode 100644 tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts create mode 100644 tests/cases/compiler/importHelpersDeclarations.ts create mode 100644 tests/cases/compiler/intersectionTypeWithLeadingOperator.ts create mode 100644 tests/cases/compiler/invalidUseOfTypeAsNamespace.ts create mode 100644 tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts create mode 100644 tests/cases/compiler/keyofIsLiteralContexualType.ts create mode 100644 tests/cases/compiler/mappedTypeInferenceCircularity.ts create mode 100644 tests/cases/compiler/nestedFreshLiteral.ts create mode 100644 tests/cases/compiler/newLexicalEnvironmentForConvertedLoop.ts create mode 100644 tests/cases/compiler/objectFreeze.ts create mode 100644 tests/cases/compiler/restIntersection.ts create mode 100644 tests/cases/compiler/restInvalidArgumentType.ts create mode 100644 tests/cases/compiler/restUnion.ts create mode 100644 tests/cases/compiler/restUnion2.ts create mode 100644 tests/cases/compiler/selfReferencingSpreadInLoop.ts create mode 100644 tests/cases/compiler/spreadIntersection.ts create mode 100644 tests/cases/compiler/spreadInvalidArgumentType.ts create mode 100644 tests/cases/compiler/spreadUnion.ts create mode 100644 tests/cases/compiler/spreadUnion2.ts create mode 100644 tests/cases/compiler/subSubClassCanAccessProtectedConstructor.ts create mode 100644 tests/cases/compiler/systemModuleTrailingComments.ts create mode 100644 tests/cases/compiler/unionTypeWithLeadingOperator.ts create mode 100644 tests/cases/compiler/untypedModuleImport_withAugmentation2.ts create mode 100644 tests/cases/compiler/unusedLocalsAndObjectSpread.ts create mode 100644 tests/cases/conformance/async/es2017/awaitInheritedPromise_es2017.ts create mode 100644 tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts create mode 100644 tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts create mode 100644 tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor7.ts create mode 100644 tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor8.ts create mode 100644 tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor4.ts create mode 100644 tests/cases/conformance/types/keyof/circularIndexedAccessErrors.ts create mode 100644 tests/cases/conformance/types/keyof/keyofAndForIn.ts create mode 100644 tests/cases/conformance/types/mapped/isomorphicMappedTypeInference.ts create mode 100644 tests/cases/conformance/types/mapped/mappedTypeModifiers.ts create mode 100644 tests/cases/conformance/types/mapped/mappedTypes4.ts create mode 100644 tests/cases/fourslash/quickInfoWithNestedDestructuredParameterInLambda.ts diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt new file mode 100644 index 00000000000..407e984c5d1 --- /dev/null +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. +tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts(13,15): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + + +==== tests/cases/conformance/classes/constructorDeclarations/superCalls/superPropertyInConstructorBeforeSuperCall.ts (2 errors) ==== + class B { + constructor(x?: string) {} + x(): string { return ""; } + } + class C1 extends B { + constructor() { + super.x(); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + super(); + } + } + class C2 extends B { + constructor() { + super(super.x()); + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js new file mode 100644 index 00000000000..15bc0c40f37 --- /dev/null +++ b/tests/baselines/reference/superPropertyInConstructorBeforeSuperCall.js @@ -0,0 +1,46 @@ +//// [superPropertyInConstructorBeforeSuperCall.ts] +class B { + constructor(x?: string) {} + x(): string { return ""; } +} +class C1 extends B { + constructor() { + super.x(); + super(); + } +} +class C2 extends B { + constructor() { + super(super.x()); + } +} + +//// [superPropertyInConstructorBeforeSuperCall.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var B = (function () { + function B(x) { + } + B.prototype.x = function () { return ""; }; + return B; +}()); +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + var _this; + _super.prototype.x.call(_this); + _this = _super.call(this) || this; + return _this; + } + return C1; +}(B)); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + return _super.call(this, _super.x.call(_this)) || this; + } + return C2; +}(B)); diff --git a/tests/baselines/reference/superWithTypeArgument.errors.txt b/tests/baselines/reference/superWithTypeArgument.errors.txt index d749cbd5157..5860cb466d9 100644 --- a/tests/baselines/reference/superWithTypeArgument.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument.ts(7,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument.ts (3 errors) ==== class C { } @@ -12,6 +13,8 @@ tests/cases/compiler/superWithTypeArgument.ts(7,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/superWithTypeArgument2.errors.txt b/tests/baselines/reference/superWithTypeArgument2.errors.txt index 766327c5c81..473e7f3b7ad 100644 --- a/tests/baselines/reference/superWithTypeArgument2.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument2.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument2.ts(6,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument2.ts(7,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument2.ts(7,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument2.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument2.ts (3 errors) ==== class C { foo: T; } @@ -12,6 +13,8 @@ tests/cases/compiler/superWithTypeArgument2.ts(7,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~~ super(x); ~~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/superWithTypeArgument3.errors.txt b/tests/baselines/reference/superWithTypeArgument3.errors.txt index 323b2958fcb..37e6681d770 100644 --- a/tests/baselines/reference/superWithTypeArgument3.errors.txt +++ b/tests/baselines/reference/superWithTypeArgument3.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/superWithTypeArgument3.ts(7,5): error TS2377: Constructors for derived classes must contain a 'super' call. +tests/cases/compiler/superWithTypeArgument3.ts(8,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. tests/cases/compiler/superWithTypeArgument3.ts(8,14): error TS1034: 'super' must be followed by an argument list or member access. -==== tests/cases/compiler/superWithTypeArgument3.ts (2 errors) ==== +==== tests/cases/compiler/superWithTypeArgument3.ts (3 errors) ==== class C { foo: T; bar(x: U) { } @@ -13,6 +14,8 @@ tests/cases/compiler/superWithTypeArgument3.ts(8,14): error TS1034: 'super' must ~~~~~~~~~~~~~~~ super(); ~~~~~~~~~~~~~~~~~~~ + ~~~~~ +!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class. ~ !!! error TS1034: 'super' must be followed by an argument list or member access. } diff --git a/tests/baselines/reference/systemModuleTrailingComments.js b/tests/baselines/reference/systemModuleTrailingComments.js new file mode 100644 index 00000000000..41b0bd299a0 --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.js @@ -0,0 +1,18 @@ +//// [systemModuleTrailingComments.ts] +export const test = "TEST"; + +//some comment + +//// [systemModuleTrailingComments.js] +System.register([], function (exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var test; + return { + setters: [], + execute: function () { + exports_1("test", test = "TEST"); + //some comment + } + }; +}); diff --git a/tests/baselines/reference/systemModuleTrailingComments.symbols b/tests/baselines/reference/systemModuleTrailingComments.symbols new file mode 100644 index 00000000000..4df59b45faa --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.symbols @@ -0,0 +1,5 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : Symbol(test, Decl(systemModuleTrailingComments.ts, 0, 12)) + +//some comment diff --git a/tests/baselines/reference/systemModuleTrailingComments.types b/tests/baselines/reference/systemModuleTrailingComments.types new file mode 100644 index 00000000000..235b46e6e8f --- /dev/null +++ b/tests/baselines/reference/systemModuleTrailingComments.types @@ -0,0 +1,6 @@ +=== tests/cases/compiler/systemModuleTrailingComments.ts === +export const test = "TEST"; +>test : "TEST" +>"TEST" : "TEST" + +//some comment diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.js b/tests/baselines/reference/unionTypeWithLeadingOperator.js new file mode 100644 index 00000000000..0fb366d538e --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.js @@ -0,0 +1,10 @@ +//// [unionTypeWithLeadingOperator.ts] +type A = | string; +type B = + | { type: "INCREMENT" } + | { type: "DECREMENT" }; + +type C = [| 0 | 1, | "foo" | "bar"]; + + +//// [unionTypeWithLeadingOperator.js] diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.symbols b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols new file mode 100644 index 00000000000..8c15d299c48 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/unionTypeWithLeadingOperator.ts === +type A = | string; +>A : Symbol(A, Decl(unionTypeWithLeadingOperator.ts, 0, 0)) + +type B = +>B : Symbol(B, Decl(unionTypeWithLeadingOperator.ts, 0, 18)) + + | { type: "INCREMENT" } +>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 2, 5)) + + | { type: "DECREMENT" }; +>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 3, 5)) + +type C = [| 0 | 1, | "foo" | "bar"]; +>C : Symbol(C, Decl(unionTypeWithLeadingOperator.ts, 3, 26)) + diff --git a/tests/baselines/reference/unionTypeWithLeadingOperator.types b/tests/baselines/reference/unionTypeWithLeadingOperator.types new file mode 100644 index 00000000000..2ca15fb54a2 --- /dev/null +++ b/tests/baselines/reference/unionTypeWithLeadingOperator.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/unionTypeWithLeadingOperator.ts === +type A = | string; +>A : string + +type B = +>B : B + + | { type: "INCREMENT" } +>type : "INCREMENT" + + | { type: "DECREMENT" }; +>type : "DECREMENT" + +type C = [| 0 | 1, | "foo" | "bar"]; +>C : [0 | 1, "foo" | "bar"] + diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt new file mode 100644 index 00000000000..628533b93d5 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.errors.txt @@ -0,0 +1,19 @@ +/node_modules/augmenter/index.d.ts(3,16): error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + + +==== /a.ts (0 errors) ==== + import { } from "augmenter"; + +==== /node_modules/augmenter/index.d.ts (1 errors) ==== + // This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + + declare module "js" { + ~~~~ +!!! error TS2665: Invalid module name in augmentation. Module 'js' resolves to an untyped module at '/node_modules/js/index.js', which cannot be augmented. + export const j: number; + } + export {}; + +==== /node_modules/js/index.js (0 errors) ==== + This file is not processed. + \ No newline at end of file diff --git a/tests/baselines/reference/untypedModuleImport_withAugmentation2.js b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js new file mode 100644 index 00000000000..f9fa7443224 --- /dev/null +++ b/tests/baselines/reference/untypedModuleImport_withAugmentation2.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/untypedModuleImport_withAugmentation2.ts] //// + +//// [index.d.ts] +// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`. + +declare module "js" { + export const j: number; +} +export {}; + +//// [index.js] +This file is not processed. + +//// [a.ts] +import { } from "augmenter"; + + +//// [a.js] +"use strict"; diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt new file mode 100644 index 00000000000..56f2ba927fb --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(21,18): error TS6133: 'bar' is declared but never used. +tests/cases/compiler/unusedLocalsAndObjectSpread.ts(28,21): error TS6133: 'bar' is declared but never used. + + +==== tests/cases/compiler/unusedLocalsAndObjectSpread.ts (2 errors) ==== + + declare var console: { log(a: any): void }; + + function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); + } + + function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); + } + + function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + ~~~ +!!! error TS6133: 'bar' is declared but never used. + //console.log(bar); + } + + function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + ~~~ +!!! error TS6133: 'bar' is declared but never used. + //console.log(bar); + } + \ No newline at end of file diff --git a/tests/baselines/reference/unusedLocalsAndObjectSpread.js b/tests/baselines/reference/unusedLocalsAndObjectSpread.js new file mode 100644 index 00000000000..2878f1b5c5c --- /dev/null +++ b/tests/baselines/reference/unusedLocalsAndObjectSpread.js @@ -0,0 +1,67 @@ +//// [unusedLocalsAndObjectSpread.ts] + +declare var console: { log(a: any): void }; + +function one() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; + console.log(bar); +} + +function two() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; + console.log(bar); +} + +function three() { + const foo = { a: 1, b: 2 }; + // 'a' is declared but never used + const {a, ...bar} = foo; // bar should be unused + //console.log(bar); +} + +function four() { + const foo = { a: 1, b: 2 }; + // '_' is declared but never used + const {a: _, ...bar} = foo; // bar should be unused + //console.log(bar); +} + + +//// [unusedLocalsAndObjectSpread.js] +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +}; +function one() { + var foo = { a: 1, b: 2 }; + // 'a' is declared but never used + var a = foo.a, bar = __rest(foo, ["a"]); + console.log(bar); +} +function two() { + var foo = { a: 1, b: 2 }; + // '_' is declared but never used + var _ = foo.a, bar = __rest(foo, ["a"]); + console.log(bar); +} +function three() { + var foo = { a: 1, b: 2 }; + // 'a' is declared but never used + var a = foo.a, bar = __rest(foo, ["a"]); // bar should be unused + //console.log(bar); +} +function four() { + var foo = { a: 1, b: 2 }; + // '_' is declared but never used + var _ = foo.a, bar = __rest(foo, ["a"]); // bar should be unused + //console.log(bar); +} diff --git a/tests/baselines/reference/useObjectValuesAndEntries1.types b/tests/baselines/reference/useObjectValuesAndEntries1.types index f04201450c0..d9ccc019f75 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries1.types +++ b/tests/baselines/reference/useObjectValuesAndEntries1.types @@ -22,38 +22,38 @@ for (var x of Object.values(o)) { } var entries = Object.entries(o); // <-- entries: ['a' | 'b', number][] ->entries : ["a" | "b", number][] ->Object.entries(o) : ["a" | "b", number][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >o : { a: number; b: number; } var entries1 = Object.entries(1); // <-- entries: [string, any][] >entries1 : [string, any][] >Object.entries(1) : [string, any][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >1 : 1 var entries2 = Object.entries({a: true, b: 2}) // ['a' | 'b', number | boolean][] ->entries2 : ["a" | "b", number | boolean][] ->Object.entries({a: true, b: 2}) : ["a" | "b", number | boolean][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries2 : [string, number | boolean][] +>Object.entries({a: true, b: 2}) : [string, number | boolean][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } ->{a: true, b: 2} : { a: true; b: number; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } +>{a: true, b: 2} : { a: true; b: 2; } >a : boolean >true : true >b : number >2 : 2 var entries3 = Object.entries({}) // [never, any][] ->entries3 : [never, any][] ->Object.entries({}) : [never, any][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries3 : [string, {}][] +>Object.entries({}) : [string, {}][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >{} : {} diff --git a/tests/baselines/reference/useObjectValuesAndEntries4.types b/tests/baselines/reference/useObjectValuesAndEntries4.types index d68193993e2..05af55d42cb 100644 --- a/tests/baselines/reference/useObjectValuesAndEntries4.types +++ b/tests/baselines/reference/useObjectValuesAndEntries4.types @@ -22,10 +22,10 @@ for (var x of Object.values(o)) { } var entries = Object.entries(o); ->entries : ["a" | "b", number][] ->Object.entries(o) : ["a" | "b", number][] ->Object.entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : [string, number][] +>Object.entries(o) : [string, number][] +>Object.entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: T): [keyof T, T[K]][]; (o: any): [string, any][]; } +>entries : { (o: { [s: string]: T; }): [string, T][]; (o: any): [string, any][]; } >o : { a: number; b: number; } diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index ea7c2b2f92a..5ea097acf2e 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,4 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(10,14): error TS2695: Left side of comma operator is unused and has no side effects. @@ -12,7 +11,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: Type 'number' is not assignable to type 'string'. -==== tests/cases/compiler/widenedTypes.ts (9 errors) ==== +==== tests/cases/compiler/widenedTypes.ts (8 errors) ==== null instanceof (() => { }); ~~~~ @@ -20,8 +19,6 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ x: number; y: ({}) instanceof null; // Ok because null is a subtype of function null in {}; - ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/cases/compiler/circularReferenceInImport.ts b/tests/cases/compiler/circularReferenceInImport.ts new file mode 100644 index 00000000000..869beeaa3a9 --- /dev/null +++ b/tests/cases/compiler/circularReferenceInImport.ts @@ -0,0 +1,15 @@ +// @declaration: true + +// @filename: db.d.ts +declare namespace Db { + export import Types = Db; +} + +export = Db; + +// @filename: app.ts +import * as Db from "./db" + +export function foo() { + return new Object() +} \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts b/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts new file mode 100644 index 00000000000..de3316cd56f --- /dev/null +++ b/tests/cases/compiler/declarationEmitIndexTypeNotFound.ts @@ -0,0 +1,5 @@ +// @declaration: true + +export interface Test { + [index: TypeNotFound]: any; +} diff --git a/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts new file mode 100644 index 00000000000..3bc22df8928 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataRestParameterWithImportedType.ts @@ -0,0 +1,42 @@ +// @experimentalDecorators: true +// @emitDecoratorMetadata: true +// @target: es5 + +// @filename: aux.ts +export class SomeClass { + field: string; +} + +// @filename: aux1.ts +export class SomeClass1 { + field: string; +} + +// @filename: aux2.ts +export class SomeClass2 { + field: string; +} +// @filename: main.ts +import { SomeClass } from './aux'; +import { SomeClass1 } from './aux1'; + +function annotation(): ClassDecorator { + return (target: any): void => { }; +} + +function annotation1(): MethodDecorator { + return (target: any): void => { }; +} + +@annotation() +export class ClassA { + array: SomeClass[]; + + constructor(...init: SomeClass[]) { + this.array = init; + } + + @annotation1() + foo(... args: SomeClass1[]) { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/decoratorWithUnderscoreMethod.ts b/tests/cases/compiler/decoratorWithUnderscoreMethod.ts new file mode 100644 index 00000000000..e6551c91284 --- /dev/null +++ b/tests/cases/compiler/decoratorWithUnderscoreMethod.ts @@ -0,0 +1,18 @@ +// @noemithelpers: true +// @experimentaldecorators: true + +declare var console : { log(arg: string): void }; +function dec(): Function { + return function (target: any, propKey: string, descr: PropertyDescriptor): void { + console.log(target[propKey]); + //logs undefined + //propKey has three underscores as prefix, but the method has only two underscores + }; +} + +class A { + @dec() + private __foo(bar: string): void { + // do something with bar + } +} \ No newline at end of file diff --git a/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts b/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts new file mode 100644 index 00000000000..14183a5de59 --- /dev/null +++ b/tests/cases/compiler/exhaustiveSwitchWithWideningLiteralTypes.ts @@ -0,0 +1,18 @@ +// @strictNullChecks: true + +// Repro from #12529 + +class A { + readonly kind = "A"; // (property) A.kind: "A" +} + +class B { + readonly kind = "B"; // (property) B.kind: "B" +} + +function f(value: A | B): number { + switch(value.kind) { + case "A": return 0; + case "B": return 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts new file mode 100644 index 00000000000..1c5ebac3d91 --- /dev/null +++ b/tests/cases/compiler/explicitAnyAfterSpreadNoImplicitAnyError.ts @@ -0,0 +1,3 @@ +// @noImplicitAny: true +({ a: [], ...(null as any) }); +let x: any; diff --git a/tests/cases/compiler/importHelpersDeclarations.ts b/tests/cases/compiler/importHelpersDeclarations.ts new file mode 100644 index 00000000000..7b958cda789 --- /dev/null +++ b/tests/cases/compiler/importHelpersDeclarations.ts @@ -0,0 +1,9 @@ +// @importHelpers: true +// @target: es5 +// @module: commonjs +// @moduleResolution: classic +// @filename: declaration.d.ts +export declare class D { +} +export declare class E extends D { +} \ No newline at end of file diff --git a/tests/cases/compiler/intersectionTypeNormalization.ts b/tests/cases/compiler/intersectionTypeNormalization.ts index f31c3d49014..3d07aeb1a23 100644 --- a/tests/cases/compiler/intersectionTypeNormalization.ts +++ b/tests/cases/compiler/intersectionTypeNormalization.ts @@ -57,4 +57,49 @@ function getValueAsString(value: IntersectionFail): string { return '' + value.num; } return value.str; +} + +// Repro from #12535 + +namespace enums { + export const enum A { + a1, + a2, + a3, + // ... elements omitted for the sake of clarity + a75, + a76, + a77, + } + export const enum B { + b1, + b2, + // ... elements omitted for the sake of clarity + b86, + b87, + } + export const enum C { + c1, + c2, + // ... elements omitted for the sake of clarity + c210, + c211, + } + export type Genre = A | B | C; +} + +type Foo = { + genreId: enums.Genre; +}; + +type Bar = { + genreId: enums.Genre; +}; + +type FooBar = Foo & Bar; + +function foo(so: any) { + const val = so as FooBar; + const isGenre = val.genreId; + return isGenre; } \ No newline at end of file diff --git a/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts new file mode 100644 index 00000000000..4138dee4261 --- /dev/null +++ b/tests/cases/compiler/intersectionTypeWithLeadingOperator.ts @@ -0,0 +1,6 @@ +type A = & string; +type B = + & { foo: string } + & { bar: number }; + +type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }]; diff --git a/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts b/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts new file mode 100644 index 00000000000..5391715cb3a --- /dev/null +++ b/tests/cases/compiler/invalidUseOfTypeAsNamespace.ts @@ -0,0 +1,4 @@ +interface OhNo { +} + +declare let y: OhNo.hello; diff --git a/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts b/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts new file mode 100644 index 00000000000..86fd9935a1f --- /dev/null +++ b/tests/cases/compiler/jsxFactoryQualifiedNameWithEs5.ts @@ -0,0 +1,17 @@ +//@module: commonjs +//@target: es5 +//@jsx: react +//@jsxFactory: skate.h +//@noEmit: false + +// @filename: index.tsx +import "./jsx"; + +var skate: any; +const React = { createElement: skate.h }; + +class Component { + renderCallback() { + return